3 ms·
I almost never use any of the "shortcuts" explained. And I wonder if it would be worth learning them. They look much more cumbersome than the alternatives, I us
by aoloe 10y ago
I almost never use any of the "shortcuts" explained. And I wonder if it would be worth learning them.
They look much more cumbersome than the alternatives, I use in my everyday work.
I have to admit, that -- at some time in the past -- I've even tried to activate vim mode. As a heavy vim user i thought it would make sense.
At the end I'm stuck with the Emacs-inspired (is it really Emacs?) shortcuts.
They seem to be the ones that make most sense in the short living, very interactive, shell command line:
- Arrows for going up/down one or two commands,
- ctrl-r for interactive searching in the history,
- ctrl-a for going back to the beginning of the row,
- ctrl-e to the end,
- del & and backscape for deleting a bunch of chars,
- in some case ctrl-w for deleting words backwards (mostly for deleting the url in the latest wget command),
- and, of course, tab completion.
When I'm in need for more complex interactions:
- I start vim and
- work with a mix of !! commands (shell that outputs the result in the current vim buffer),
- vim manipulations (vertical selections, ctrl-x-f, qq short living macros), A and I with a . repeat),
- join everything in a row and yank it and, finally,
- a :!ctrl-r" to run it.
When the interaction is even more complex, than it's time for a shell script.
Last resort being a Python script.
Now, why would I take the time to write `rm my-file{-01,-02,old}` and risk getting a typo into it, instead of relying on the tab-autocomplete?
- lolive 10y agoYou definitely should read the comments about "history-search-backward" and "history-search-forward". There are a real nice addition to your list.
- aoloe 10y agoyes, that looks like a useful command... does not work here on a mac, but i can think of using it! thanks for mentioning.
- lolive 10y agothe usual configuration of a .inputrc is given for a PC keyboard. the safest method for you is to edit your ~/.inputrc with vi(m). go to insert mode, type " type Ctrl-v type PgUp (->a strange string is displayed), type the following string ": history-search-backward Do the same on another line for PgDn (replace backward with forward). Save. Relaunch a Bash session. And that's it.
- wtetzner 10y ago> Now, why would I take the time to write `rm my-file{-01,-02,old}` and risk getting a typo into it, instead of relying on the tab-autocomplete? If you write `rm my-file{-01,-02,old}` and then press tab, it will expand it for you before you run it.
- Jtsummers 10y agoC-x C-e to edit the command line with EDITOR=vim in your .bashrc (or whereever you keep your configurations). When it quits it'll run the command for you. You don't need to join the lines. It's like a temporary shell script. $ C-x C-e # in vim ipushd dir do stuff popd <esc>:wq Everything gets run.