Visual selection in bash / cli

Is there a way to make bash use visual choices to replace text ?

Standard text input conventions do not work:

  • If you press Shift + left arrow, the character on the left should be visually selected
  • If you press Ctrl + left arrow, the cursor should go to the beginning of the previous word
  • If you press Shift + Ctrl + left arrow, the word on the left should be visually selected
  • If you visually select text and press any key, the text should be replaced by the text of the key you press

Vi mode (set -o vi) visual selection conventions do not work:

  • If you enter normal mode, press "v" to enter a visual selection, then press "h", he should visually select the character on the left.
  • If you enter normal mode, press "v" to enter a visual selection, then press "B", he should visually select the word on the left.
  • If you visually highlight the text and then press "R", it should erase the text and leave you a replacement entry
+5
source share
2 answers

this guy did this for zsh:

I made VI VISUAL Mode for! ZSH. VIM V visual mode emulation in a CMD line. http://ur1.ca/izng

This is amazing!

+9
source

ZSH, edit-command-line. .zshrc:

autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line

v , $EDITOR. Bash, v - .

+3

Source: https://habr.com/ru/post/1541846/


All Articles