I just switch from Sublime text to MacVim. One useful shortcut I loved in sublime is cmd+D which adds the next occurrence of the current word to the selection. Is there any way I can get the equivalent in VIM?
Many thanks
I just switch from Sublime text to MacVim. One useful shortcut I loved in sublime is cmd+D which adds the next occurrence of the current word to the selection. Is there any way I can get the equivalent in VIM?
Many thanks
Not natively, but you can look if the vim-multiple-cursors has this feature.
Here is a related stackoverflow question: Multiple selections in VIM.
If you know that you want to select and modify all occurrences of the current word under the cursor, press *
to select it and in command-mode execute:
%s//replacement
Otherwise, if you don't want the replacement to happen in the whole file, select the word with *
, select a few lines in visual mode and in command-mode execute:
s//replacement