![]() Again, tthere is only one keymap active at a time. Only one of these two maps is active at a time.Įditing-mode vi does nothing more than set a default keymap when the shell starts, labelled vi-insert. When in editing-mode vi, the keymaps in use are vi/ vi-command/ vi-move and vi-insert (the starting keymap). "\C-d": delete-char # eof-maybe: ^D does nothing if there is text on the lineĪs we saw above, vi, vi-command and vi-move are one and the same keymap: diff <(bind -pm vi) <(bind -pm that's a total of just two distinct maps which are associated by default with editing-mode vi. Which I resolved as follows: set keymap emacs The first 3 of these four conflict with emacs bindings: "\C-d": delete-char The only additional bindings in vi-insert not in emacs-standard are: comm -23 vi-insert emacs-standard So for typing text, it's best to use the emacs-standard keymap over vi-insert as long as you can easily switch between emacs and vi-command. There are 28 commands in emacs-standard not in vi-insert comm -12 vi-insert emacs-standard |wc emacs-standard is basically a superset of vi-insert. You might argue that the second form is easier to read. Is functionally equivalent to: keymap emacs-meta So emacs/ emacs-standard is a behaviourally functional superset of both emacs-ctlx and emacs-meta This means that: keymap emacs ![]() There are NO commands mapped in emacs-meta and emacs-ctlx which don't also appear in emacs-standard: $ comm -13 <(sed -r 's/.*: (\S+)/\1/' emacs-standard|sort) <(sed -r 's/.*: (\S+)/\1/' emacs-ctlx|sort) If you the output of the second command into the files called emacs-standard, emacs-meta, emacs-ctlx, vi-command, and vi-insert for their corresponding keymaps, you can find out that: TL DR: They are different views on a single set of mappings applied to editing-mode emacs. What is the difference between the various emacs keymaps? There are many lines saying self-insert or do-lowercase-version which aren't very useful, so to remove them: INPUTRC=~/dev/null bash -c 'bind -pm emacs' | grep -vE '^#|: (do-lowercase-version|self-insert)$' | sort You can replace emacs with any other keymap name in the example above. To view the default keybindings for (example) emacs (the default), use: INPUTRC=~/dev/null bash -c 'bind -pm emacs' | grep -v '^# Differentiating the keymaps is probably best done by inspecting them. While not documented, vi/ vi-command and vi-move keymaps are also equivalent: diff <(bind -pm vi) <(bind -pm leaves us with: emacs, emacs-meta, emacs-ctlx, vi, and vi-insert as unique keymaps to explain. Vi is equivalent to vi-command emacs is equivalent to emacs-standard. ![]() What are the unique keymaps? Acceptable keymap names are emacs, emacs-standard, emacs-meta, emacs-ctlx, So what does editing-mode actually do? It just sets the active keymap upon shell startup to either emacs or vi-insert. ALL the emacs ones operate at the same time in editing-mode emacs (explained later). Note the difference between editing-mode and keymap: In editing-mode vi the two (yes there's only two, read on) keymaps are swapped in and out to emulate the different modes of the vi editor. By default, Readline starts up in Emacs editing mode, where the The editing-mode variable controls which default set of key bindings is The GNU Readline Library documentation says: editing-mode ![]() There are only two editing-modes: emacs (the default) and vi. What is the difference between an editing-mode and a keymap? Particularly useful is the concept of a hybrid emacs keymap for inserting text and while still easily getting to vi-command for making changes. If you want further info on the vi mode and maps, skip to the heading editing-mode vi (the last one).īut wait! There's a fair bit of background info that may be needed though: eg, the difference between an editing-mode and a keymap. If you want to change the insertion keymap (eg to add a Ctrl-A binding to go the beginning of the line while you're typing), you'll need to do this below a keymap vi-insert line. What keymap vi does is state that any bindings listed after that point apply to that keymap (which is exactly the same keymap as vi-command and vi-move). If you don't want to change/add bindings in the default keymaps, you don't need the line keymap vi.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |