My own personal ~/.inputrc, with comments on every line, can be used as an example of customizing your own shell. In your ~/.inputrc, a line with set keymap vi-command means that mappings below that line apply to command mode a line with set keymap vi-insert means that mappings below that line apply to insert mode. When customizing your Vi-style kemappings, be mindful of which editing mode your keymap applies to. It is recommended that you run the command once with insert mode active, and once when command mode is active.Ī reference to adjusting the options and mappings of the readline library most shells use for text editing can be found in the readline man page, or in the GNU bash man page. Important: the displayed keybindings will change depending on whether you're in insert or command mode when you execute the command. In bash, to see a list of the keymappings currently active, use the command bind -p | grep -v '^#\|self-insert\|^$'. You may want to keep a cheat sheet of default keymappings handy, since they do differ from Vi/Vim occasionally. By default, you're in insert mode press Esc to enter command mode. Restart your terminal and you'll have Vi keybindings. To enable Vi-mode, edit (or create) the file ~/.inputrc or /etc/inputrc and add the following lines: Not only will the keybindings match what you're used to, but you'll also have modal editing, just like Vi. It's possible to tell your shell to use Vi shortcuts instead. Many Unix shells (bash, zsh, etc.) come with keyboard shortcuts enabled: C-a jumps to the start of the line, C-e jumps to the end, and so on. Tip 1220 Printable Monobook Previous Next
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |