2

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.

1
  • This is controlled by your terminal program, not fish. Commented Feb 14, 2018 at 21:49

2 Answers 2

0

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
0

Kurtis has explained well how fish doesn't support this well today. There is an open bug about adding this feature.

You may also be interested in daleeidd/natural-selection, which manages to implement a good amount of shift-select with what's currently available in fish. You may be able to tweak this to support what you want.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .