Sunday, July 20, 2008

Command-Line Tricks

I got diverted by a presentation by Simon Myers this morning and have spent time messing around with the shell.

I've used these before, and particularly like shell-expand-line for editing my path.

Put this into ~/.inputrc and arrange to re-read it (say, by starting a new shell).
$if Bash
Control-x: shell-expand-line
Now you get this behavior from the shell (which is giving you command-line editing throug readline(3) ).
# now type control-x
$ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/jsh/bin/bash_functions:/home/jsh/bin:/usr/local/libexec/git-core:
# and the path is there, ready for editing
I can get a lot of his tricks to work, but I can't bind "yank-last-arg" in vi mode. Works fine in emacs mode (Meta-.), but I'm a vi guy. I'm doing something wrong, but I don't know what.

No comments: