|
From: Keith M. <kei...@to...> - 2006-08-30 13:01:22
|
Earnie Boyd wrote, quoting me: >> >> bind '"\e[A":history-search-backward' >> bind '"\e[B":history-search-forward' >> >> to emulate the history search behaviour of the `4DOS' shell I used >> at one time with MS-DOS: type the first few characters of a command, >> then use <Cursor-Up> and <Cursor-Down> to find and replay matching >> commands in the history. > > I like to set my command mode vi style ``set -o vi'' and then use > ``<esc>/stringToSearch'' to enter search mode. I can then use ``n'' > to search forward and ``N'' to search reverse. You can even use the > <esc> key to enter a substitution command. I used to have `set -o vi' for Korn shell, on a Solaris box I administer, but with bash, I find the `emacs' style works better for me, (even though I much prefer `vi' to `emacs' as my working editor). I liked the 4DOS history search method, when I used that, and the two bindings above emulate it in `readline'; these are complementary to the preconfigured bindings for `<CTRL-R>' and `<CTRL-S>', which are analogues for the `vi' mode `<ESC>/SearchString', followed by `n' or 'N' mechanism, and which continue to work as configured. Readline is an exceptionally flexible beast, and the choice between its `vi' and `emacs' emulation modes is always going to come down to individual preference. The beauty is that we have that choice; experiment and choose whatever suits *you* best. Regards, Keith. |