In all gui text editing, ctrl-arrow moves the cursor by word, and holding shift selects as the cursor moves. Thus ctrl-shift-left selects the previous word. Fish already has the former but I want to implement the latter.

I tried doing something like

bind \[d begin-selection backward-word      # \[d is ctrl-shift-left

But the problem is that it begins the selection on each keypress, instead of selecting additional words.

Additionally, I don't know how to copy the fish selection to the system-wide keyboard.

  • This is controlled by your terminal program, not fish. – glenn jackman Feb 14 at 21:49

What you're trying to do isn't possible with any version of fish that exists as I type this. The begin-selection function is meant to be bound to a key that only initiates selection mode. You can't also perform cursor movement in the same binding because, as you noticed, it starts a new selection with each keypress. That function is currently only used in the vi-mode command mode binding of v. After pressing whatever key you have bound to begin-selection you then need to press a different key that performs cursor movement to extend the selection. In theory this could be made to work the way you want. Feel free to open an issue.

To copy/paste implement you're preferred bindings. These are the default for emacs-mode and vi-mode key bindings:

bind \cx fish_clipboard_copy
bind \cv fish_clipboard_paste

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.