Lorsque j'avais appris que la variable $_ contenait le
dernier argument de la ligne de commande précédente, j'avais mis ceci
dans mon ~/.zshrc :
## inserer la chaine $_ (sans expansion) au niveau du curseur ## lorsqu'on appuie sur Ctl+F bindkey -s '^F' '$_'
C'était pas génial, mais ça me rendait des sacrés services.
Si j'avais relu attentivement l'excellente
documentation de zsh, j'aurai pu voir ceci dans le noeud History
Control :
insert-last-word (ESC-_ ESC-.) (unbound) (unbound)
Insert the last word from the previous history event at the cursor
position. If a positive numeric argument is given, insert that
word from the end of the previous history event. If the argument
is zero or negative insert that word from the left (zero inserts
the previous command word). Repeating this command replaces the
word just inserted with the last word from the history event prior
to the one just used; numeric arguments can be used in the same
way to pick a word from that event.
../..
Par défaut, il suffit juste de taper ESC-. ou
ESC-_. Magique non ?
On peut modifier les arguments d'insert-last-word pour
les adapter à nos besoins. À vous de jouer !