vimium-c icon indicating copy to clipboard operation
vimium-c copied to clipboard

How to yank text inside or around one character?

Open kandicst opened this issue 3 years ago • 3 comments

In vim, you can use yi{char} or ya{char} to yank text inside or around char from left and right side in the same line.

Is this possible in vimium-c, and if not where can I find more information on how to achieve this using custom key mappings?

kandicst avatar Apr 16 '22 10:04 kandicst

Sorry I don't know yi{char}. I can not press y i { c h a r } on my VIM for MSYS2, so I'm not sure what you want.

If you mean to copy text between { and }, then you may try the trick in https://github.com/gdh1995/vimium-c/discussions/600 .

If you mean to find text, extend the selection range and then copy, I'm afraid you have to:

  1. enter VisualMode
  2. press / to enter a sub-find mode, type your query text
  3. use Ctrl+J/K to iter over matches, and press Enter to exit from the sub-find mode
  4. use keys like h/j/k/l/w/b/o to modify the selection range
  5. press Enter or yy to copy.

gdh1995 avatar Apr 16 '22 10:04 gdh1995

This motion is what I am refering to. I am mostly interested in selecting text between a pair of quotes when cursor is anywhere inside the two quotes.

kandicst avatar Apr 16 '22 11:04 kandicst

Updated: in v1.99.0 as and aw should work well on Firefox.

Um, there was aw to select a current word, but v1.98.0 breaks this feature. I need time to fix it. When it's fixed, you may use as to select a "sentence" (will al for a line help?), and then y to copy it with a substitution rule to extract a "..." part in the line.

Currently there's no such feature to set selection boundaries to a given character. I know little about other VIM-like web-extensions so I'm sorry I can't help here.

It's more difficult to detect "whether words are in a same line" in a browser than doing in VIM. So I'm not sure whether I'll add this feature into Vimium C.

gdh1995 avatar Apr 18 '22 02:04 gdh1995

Hello, now in v1.99.96 aw and as in caret mode should also select a word, to make copying easier.

However it's too difficult to implement "yanking text in a character" in JS code effectively, so I want to give up this feature request.

gdh1995 avatar Dec 25 '22 19:12 gdh1995