my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
4.7 KiB

3 years ago
  1. # vi-mode plugin
  2. This plugin increase `vi-like` zsh functionality.
  3. To use it, add `vi-mode` to the plugins array in your zshrc file:
  4. ```zsh
  5. plugins=(... vi-mode)
  6. ```
  7. ## Settings
  8. - `VI_MODE_RESET_PROMPT_ON_MODE_CHANGE`: controls whether the prompt is redrawn when
  9. switching to a different input mode. If this is unset, the mode indicator will not
  10. be updated when changing to a different mode.
  11. Set it to `true` to enable it. For example:
  12. ```zsh
  13. VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true
  14. ```
  15. The default value is unset, unless `vi_mode_prompt_info` is used, in which case it'll
  16. automatically be set to `true`.
  17. - `VI_MODE_SET_CURSOR`: controls whether the cursor style is changed when switching
  18. to a different input mode. Set it to `true` to enable it (default: unset):
  19. ```zsh
  20. VI_MODE_SET_CURSOR=true
  21. ```
  22. - `MODE_INDICATOR`: controls the string displayed when the shell is in normal mode.
  23. See [Mode indicators](#mode-indicators) for details.
  24. - `INSERT_MODE_INDICATOR`: controls the string displayed when the shell is in insert mode.
  25. See [Mode indicators](#mode-indicators) for details.
  26. ## Mode indicators
  27. *Normal mode* is indicated with a red `<<<` mark at the right prompt, when it
  28. hasn't been defined by theme, *Insert mode* is not displayed by default.
  29. You can change these indicators by setting the `MODE_INDICATOR` (*Normal mode*) and
  30. `INSERT_MODE_INDICATORS` (*Insert mode*) variables.
  31. This settings support Prompt Expansion sequences. For example:
  32. ```zsh
  33. MODE_INDICATOR="%F{white}+%f"
  34. INSERT_MODE_INDICATOR="%F{yellow}+%f"
  35. ```
  36. You can also use the `vi_mode_prompt_info` function in your prompt, which will display
  37. this mode indicator.
  38. ## Key bindings
  39. Use `ESC` or `CTRL-[` to enter `Normal mode`.
  40. NOTE: some of these key bindings are set by zsh by default when using a vi-mode keymap.
  41. ### History
  42. - `ctrl-p` : Previous command in history
  43. - `ctrl-n` : Next command in history
  44. - `/` : Search backward in history
  45. - `n` : Repeat the last `/`
  46. ### Vim edition
  47. - `vv` : Edit current command line in Vim
  48. NOTE: this used to be bound to `v`. That is now the default (`visual-mode`).
  49. ### Movement
  50. - `$` : To the end of the line
  51. - `^` : To the first non-blank character of the line
  52. - `0` : To the first character of the line
  53. - `w` : [count] words forward
  54. - `W` : [count] WORDS forward
  55. - `e` : Forward to the end of word [count] inclusive
  56. - `E` : Forward to the end of WORD [count] inclusive
  57. - `b` : [count] words backward
  58. - `B` : [count] WORDS backward
  59. - `t{char}` : Till before [count]'th occurrence of {char} to the right
  60. - `T{char}` : Till before [count]'th occurrence of {char} to the left
  61. - `f{char}` : To [count]'th occurrence of {char} to the right
  62. - `F{char}` : To [count]'th occurrence of {char} to the left
  63. - `;` : Repeat latest f, t, F or T [count] times
  64. - `,` : Repeat latest f, t, F or T in opposite direction
  65. ### Insertion
  66. - `i` : Insert text before the cursor
  67. - `I` : Insert text before the first character in the line
  68. - `a` : Append text after the cursor
  69. - `A` : Append text at the end of the line
  70. - `o` : Insert new command line below the current one
  71. - `O` : Insert new command line above the current one
  72. ### Delete and Insert
  73. - `ctrl-h` : While in *Insert mode*: delete character before the cursor
  74. - `ctrl-w` : While in *Insert mode*: delete word before the cursor
  75. - `d{motion}` : Delete text that {motion} moves over
  76. - `dd` : Delete line
  77. - `D` : Delete characters under the cursor until the end of the line
  78. - `c{motion}` : Delete {motion} text and start insert
  79. - `cc` : Delete line and start insert
  80. - `C` : Delete to the end of the line and start insert
  81. - `r{char}` : Replace the character under the cursor with {char}
  82. - `R` : Enter replace mode: Each character replaces existing one
  83. - `x` : Delete `count` characters under and after the cursor
  84. - `X` : Delete `count` characters before the cursor
  85. ## Known issues
  86. ### Low `$KEYTIMEOUT`
  87. A low `$KEYTIMEOUT` value (< 15) means that key bindings that need multiple characters,
  88. like `vv`, will be very difficult to trigger. `$KEYTIMEOUT` controls the number of
  89. milliseconds that must pass before a key press is read and the appropriate key binding
  90. is triggered. For multi-character key bindings, the key presses need to happen before
  91. the timeout is reached, so on low timeouts the key press happens too slow, and therefore
  92. another key binding is triggered.
  93. We recommend either setting `$KEYTIMEOUT` to a higher value, or remapping the key bindings
  94. that you want to trigger to a keyboard sequence. For example:
  95. ```zsh
  96. bindkey -M vicmd 'V' edit-command-line # this remaps `vv` to `V` (but overrides `visual-mode`)
  97. ```