Existe um reverso de yank-last-arg / insert-last-argument?

6

yank-last-arg / insert-last-argument é provavelmente mais conhecido pelo seu atalho usual, Alt - . . É muito bom navegar pelo último argumento dos comandos anteriores, mas se você está navegando um pouco rápido demais, é fácil perder o argumento que você queria, e então parece que você não tem outra escolha senão começar tudo de novo. Isso atrasa a navegação, então espero que haja um comando para navegar por essa lista ao contrário .

Uma rápida olhada em bind -P não mostrou nenhum candidato óbvio para esse propósito.

    
por l0b0 30.04.2012 / 13:46

1 resposta

7

Se você digitar Alt - - 1 , então Alt - . a direção é invertida. Digitando-o novamente, retorne à direção usual.

Algumas explicações estão na man page do bash :

       yank-last-arg (M-., M-_)
              Insert  the last argument to the previous command (the last word
              of the previous history entry).  With a numeric argument, behave
              exactly  like  yank-nth-arg.   Successive calls to yank-last-arg
              move back through the history list, inserting the last word  (or
              the  word  specified  by the argument to the first call) of each
              line in turn.  Any numeric argument supplied to these successive
              calls  determines  the direction to move through the history.  A
              negative argument switches the  direction  through  the  history
              (back or forward).  The history expansion facilities are used to
              extract the last argument, as if the "!$" history expansion  had
              been specified.
    
por 30.04.2012 / 15:10