by _TwoFinger · 3y ago · 0 comments
Everything but the last argument:
% git add -p dir1
% !!- dir2
git add -p dir2
Everything but the command: % textadept a b c
% vim !*
vim a b c
Substitute a string (once): % echo helo world
% ^lo^llo
echo hello world
First and last arguments: % diff path/a/file path/b/file
% diff !$ !^
diff path/b/file path/a/file
A cool detail is that even a long quoted string containing spaces is considered a single argument, and it all works fine.Also, the bangs can be anywhere on the command line, even inside other kinds of expansion; history expansion has highest priority of all.
Edit: the above is csh-style history expansion, available in bash as well.
No comments yet.