zsh keybinding: insert-last-word

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












In zsh, I have alt+. bound to insert-last-word



When I am listing through the last command parameters by repeatedly pressing alt+., sometimes I press one too many and I need to go one back.



What keybinding is used to go back?










share|improve this question



























    up vote
    3
    down vote

    favorite












    In zsh, I have alt+. bound to insert-last-word



    When I am listing through the last command parameters by repeatedly pressing alt+., sometimes I press one too many and I need to go one back.



    What keybinding is used to go back?










    share|improve this question

























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      In zsh, I have alt+. bound to insert-last-word



      When I am listing through the last command parameters by repeatedly pressing alt+., sometimes I press one too many and I need to go one back.



      What keybinding is used to go back?










      share|improve this question















      In zsh, I have alt+. bound to insert-last-word



      When I am listing through the last command parameters by repeatedly pressing alt+., sometimes I press one too many and I need to go one back.



      What keybinding is used to go back?







      zsh keyboard-shortcuts






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      Jeff Schaller

      35.8k952119




      35.8k952119










      asked yesterday









      Martin Vegter

      56233117231




      56233117231




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          You can just undo, bound to Ctrl+_ in emacs mode by default (note that insert-last-word is also bound to Alt+_).



          After undoing though, if you invoke insert-last-word again, you'll be back to the beginning, you can't just alternate pressing Ctrl+_ and Alt+_ to go back and forth in the history.



          For that, you'd need to define a separate widget that invokes the insert-last-word widget with 1 as argument (see info zsh insert-last-word for details).



          For instance, bound to Alt+,:



          insert-last-word-forward() zle insert-last-word 1
          zle -N insert-last-word-forward
          bindkey 'e,' insert-last-word-forward





          share|improve this answer






















          • the bind on the last line did not work. I had to change that to bindkey.
            – Martin Vegter
            yesterday










          • @Martin, sorry, my bad. Fixed now.
            – Stéphane Chazelas
            yesterday










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481713%2fzsh-keybinding-insert-last-word%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          You can just undo, bound to Ctrl+_ in emacs mode by default (note that insert-last-word is also bound to Alt+_).



          After undoing though, if you invoke insert-last-word again, you'll be back to the beginning, you can't just alternate pressing Ctrl+_ and Alt+_ to go back and forth in the history.



          For that, you'd need to define a separate widget that invokes the insert-last-word widget with 1 as argument (see info zsh insert-last-word for details).



          For instance, bound to Alt+,:



          insert-last-word-forward() zle insert-last-word 1
          zle -N insert-last-word-forward
          bindkey 'e,' insert-last-word-forward





          share|improve this answer






















          • the bind on the last line did not work. I had to change that to bindkey.
            – Martin Vegter
            yesterday










          • @Martin, sorry, my bad. Fixed now.
            – Stéphane Chazelas
            yesterday














          up vote
          2
          down vote



          accepted










          You can just undo, bound to Ctrl+_ in emacs mode by default (note that insert-last-word is also bound to Alt+_).



          After undoing though, if you invoke insert-last-word again, you'll be back to the beginning, you can't just alternate pressing Ctrl+_ and Alt+_ to go back and forth in the history.



          For that, you'd need to define a separate widget that invokes the insert-last-word widget with 1 as argument (see info zsh insert-last-word for details).



          For instance, bound to Alt+,:



          insert-last-word-forward() zle insert-last-word 1
          zle -N insert-last-word-forward
          bindkey 'e,' insert-last-word-forward





          share|improve this answer






















          • the bind on the last line did not work. I had to change that to bindkey.
            – Martin Vegter
            yesterday










          • @Martin, sorry, my bad. Fixed now.
            – Stéphane Chazelas
            yesterday












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          You can just undo, bound to Ctrl+_ in emacs mode by default (note that insert-last-word is also bound to Alt+_).



          After undoing though, if you invoke insert-last-word again, you'll be back to the beginning, you can't just alternate pressing Ctrl+_ and Alt+_ to go back and forth in the history.



          For that, you'd need to define a separate widget that invokes the insert-last-word widget with 1 as argument (see info zsh insert-last-word for details).



          For instance, bound to Alt+,:



          insert-last-word-forward() zle insert-last-word 1
          zle -N insert-last-word-forward
          bindkey 'e,' insert-last-word-forward





          share|improve this answer














          You can just undo, bound to Ctrl+_ in emacs mode by default (note that insert-last-word is also bound to Alt+_).



          After undoing though, if you invoke insert-last-word again, you'll be back to the beginning, you can't just alternate pressing Ctrl+_ and Alt+_ to go back and forth in the history.



          For that, you'd need to define a separate widget that invokes the insert-last-word widget with 1 as argument (see info zsh insert-last-word for details).



          For instance, bound to Alt+,:



          insert-last-word-forward() zle insert-last-word 1
          zle -N insert-last-word-forward
          bindkey 'e,' insert-last-word-forward






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          Stéphane Chazelas

          293k54547888




          293k54547888











          • the bind on the last line did not work. I had to change that to bindkey.
            – Martin Vegter
            yesterday










          • @Martin, sorry, my bad. Fixed now.
            – Stéphane Chazelas
            yesterday
















          • the bind on the last line did not work. I had to change that to bindkey.
            – Martin Vegter
            yesterday










          • @Martin, sorry, my bad. Fixed now.
            – Stéphane Chazelas
            yesterday















          the bind on the last line did not work. I had to change that to bindkey.
          – Martin Vegter
          yesterday




          the bind on the last line did not work. I had to change that to bindkey.
          – Martin Vegter
          yesterday












          @Martin, sorry, my bad. Fixed now.
          – Stéphane Chazelas
          yesterday




          @Martin, sorry, my bad. Fixed now.
          – Stéphane Chazelas
          yesterday

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481713%2fzsh-keybinding-insert-last-word%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown






          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?