How to partially select text of input in visual mode?

42 views Asked by At

For the Fish shell, to enable Vi keybindings I have the following configuration in my config.fish:

# Use Vi keybindings
function my_vi_bindings
  fish_vi_key_bindings
  bind yy fish_clipboard_copy
  bind Y fish_clipboard_copy
  bind p fish_clipboard_paste
  bind -M insert -m default kj backward-char force-repaint
  bind -M insert -m default jk backward-char force-repaint
#  bind -M normal -m default yy fish_clipboard_copy
  # bind -M visual -m default '"*y' 'commandline -s | xsel -p; commandline -f end-selection repaint-mode'
  bind -M visual -m default yy 'commandline -s | xsel -p; commandline -f end-selection repaint-mode'
  # bind -M p fish_clipboard_paste
end
set -g fish_key_bindings my_vi_bindings

This works like a charm. For example, when I press jk, then I will go to normal mode. I could press yy to copy the whole line of input.

But what if I would like to select a word/part of sentence/input only? In Vim usually you would press v, then moving around to select the part to cut/copy and then paste it. But in Fish I haven't found a way how to implement it in visual mode. Any hints would be appreciated.

0

There are 0 answers