Vim mode visual selection in word doesn't work #2847

Closed
opened 2014-10-08 21:24:51 +02:00 by marijnh · 3 comments
marijnh commented 2014-10-08 21:24:51 +02:00 (Migrated from gitlab.com)

One of the frequent things I do is type viw to visually select inside a word. Basically it's the same as placing your cursor at the front of a word and typing vw, which does work. But viw is nicer because, like ciw (which does work) it allows you to act on the whole word with your cursor anywhere in the word itself.

The main use case I have for this is pasting something over a current word. If I want to change the name of a variable or something I frequently type it once and then do yiw for yank in word, then move to the replacement, type viw and then p to replace the visually selected word with the yank buffer contents.

The reason this works well is because doing any sort of text deletion will modify the current yank contents. So if you yank something you want to paste somewhere else (like inside quotes or over a word) and you didn't yank it to a specific named buffer, you can't do another action that will modify that yank or you'll have a bad time trying to put it out. To get around this I like to do what I said and yank something, then visually select my put (paste) target, then put it right over it!

Here's a short screencast showing how this works in Vim http://quick.as/L6rI1G6

And for posterity, here's a much shorter, no sound, animated gif showing how I use this functionality.

vimyank

Thanks!

One of the frequent things I do is type `viw` to visually select inside a word. Basically it's the same as placing your cursor at the front of a word and typing `vw`, which does work. But `viw` is nicer because, like `ciw` (which does work) it allows you to act on the whole word with your cursor anywhere in the word itself. The main use case I have for this is pasting something over a current word. If I want to change the name of a variable or something I frequently type it once and then do `yiw` for yank in word, then move to the replacement, type `viw` and then `p` to replace the visually selected word with the yank buffer contents. The reason this works well is because doing any sort of text deletion will modify the current yank contents. So if you yank something you want to paste somewhere else (like inside quotes or over a word) and you didn't yank it to a specific named buffer, you can't do another action that will modify that yank or you'll have a bad time trying to put it out. To get around this I like to do what I said and yank something, then visually select my put (paste) target, then put it right over it! Here's a short screencast showing how this works in Vim http://quick.as/L6rI1G6 And for posterity, here's a much shorter, no sound, animated gif showing how I use this functionality. ![vimyank](https://cloud.githubusercontent.com/assets/4521/4565515/b5d2aacc-4f20-11e4-838f-81ad17b6a5b8.gif) Thanks!
marijnh commented 2014-10-09 04:26:04 +02:00 (Migrated from gitlab.com)

mentioned in merge request !10006

mentioned in merge request !10006
marijnh (Migrated from gitlab.com) closed this issue 2014-10-11 02:15:45 +02:00
marijnh commented 2014-10-11 02:17:45 +02:00 (Migrated from gitlab.com)

FYI, register 0 contains the contents of the previous yank command.

FYI, register 0 contains the contents of the previous yank command.
marijnh commented 2014-11-07 02:20:51 +01:00 (Migrated from gitlab.com)

mentioned in issue #33

mentioned in issue #33
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/codemirror5#2847
No description provided.