4 ms·
Just enable vim mode (`set -o vi`) and call it a day.
by kitclen 4y ago
Just enable vim mode (`set -o vi`) and call it a day.
- djaouen 4y agoCan I still use macros with 'q<register>'?
- tsm 4y agoBased on 30 seconds of experimentation, no.
- bippingchip 4y agoYou can edit the current prompt in a full vim by pressing ‘v’. On :wq the content of the file will be run as the command. In that case you can use the macros with q (and any fancy vim plugin you might like)
- bippingchip 4y agoYes! I never got the hang of the read line short cuts. Only one I remember and regularly use is reverse history search: ctrl-R. The downside is that while vim mode works nicely on bash, other commands like gdb etc that also use read line aren’t as easy to get into vim mode, if they support it at all…
- gen220 4y agoime, most programs using readline parse ~/.inputrc. set editing-mode vi set keymap vi-command That does the trick for me in python shell, psql, etc. First thing I do on any fresh unix box is setting above, and echo "set -o vi" >> ~/.bash_profile.
- tristan957 4y agoFor programs which use libedit, you can also setup vi mode. bind -v
- gen220 4y agoGood one! That covers sqlite3, it was my last straggler. :)
- cassepipe 4y agoCan't remember why but I am pretty the second line is not needed
- cassepipe 4y agogdb also uses readline... And readline is configured with ~/.inputrc Here is my config from a happy gdb vim mode user : set editing-mode vi # If set to ‘on’, Readline performs filename matching and completion in a case-insensitive fashion. The default value is ‘off’. set completion-ignore-case on # If set to ‘on’, Readline displays possible completions using different colors to indicate their file type. The color definitions are taken from the set colored-stats on # Perform partial (common) completion on the first Tab press, only start # cycling full results on the second Tab press (from bash version 5) set menu-complete-display-prefix on ### MAPPINGS ### # Allow to refresh the screen "\C-l":clear-screen # If there are multiple matches for completion, Tab should cycle through them TAB:menu-complete
- BaculumMeumEst 4y agovi bindings aren't worth running into weird problems imo. it took me less than a minute to hit an incompatibility with fzf. https://github.com/junegunn/fzf/issues/1238 https://github.com/junegunn/fzf/issues/1238
- Sakos 4y agoThis is it for me. I'd use vi bindings everywhere if I could and it didn't end up breaking other things.
- distantsounds 4y agoshhh, don't tell them there's a superior text editor out there, it's fun watching emacs users consistently do things the hard way
- soheilpro 4y agoAnd add search support, if you're using zsh: https://github.com/soheilpro/zsh-vi-search https://github.com/soheilpro/zsh-vi-search
- chasil 4y agoEvery vi mode that I have ever used in any shell allows search with ESC-/ as the vi editor itself allows.
- chasil 4y agoThis is actually encouraged by POSIX. set -o vi: "Allow shell command line editing using the built-in vi editor. Enabling vi mode shall disable any other command line editing mode provided as an implementation extension." No other mode, specifically emacs mode, is included in the POSIX standard. Take from this what you will. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...
- deleted 4y ago[deleted]
- ataylor284_ 4y agoNot surprising. Back in the heyday of POSIX standardization, the Emacs camp and the POSIX camp were both very opinionated and not entirely aligned. One example is the standard disk block size used in command line utilities such as du and df. RMS made GNU use 1kb instead of the POSIX standard 512 byte size, but this could be overriden by setting the environment variable POSIX_ME_HARDER.