⬆️ ⬇️

VIM plugins that you should know about, part 2: repeat.vim

I continue to translate articles Peteris Krumins. Original article



Here is the first part and its original .



Repeat.vim fixes a significant flaw in the plugin surround.vim, which I wrote about last week (I, lazy, ashamed - approx. Lane). The problem of surround.vim lies in the "." Command. (point). If you used the environment and would like to repeat it with the "." Command, you would not succeed. This plugin fixes the problem.

')

Essentially, wherever you set up surround.vim, you will need to repeat.vim.



But there is a nuance. The plugin does not allow repeating the "ys" commands. Fortunately, the "ys" commands can be replaced by the "cs" commands. For example, if you wanted to do "ysw" several times (put the word in quotes), type "csw" "and use". " to repeat. The only way to repeat commands using the visual mode is to write a macro.



Here is an example of using repeat.vim. Imagine that you typed a sentence and want to quote all the words:



 |foo bar baz quux muux woox (|   ) 




type csw " :



 |"foo" bar baz quux muux woox 




Now press W.



 "foo" |"bar" baz quux muux woox 




W moved the cursor to the next word, and the point repeated the environment command.



Repeat this 4 times and you will have the entire string in quotes:



 "foo" "bar" "baz" "quux" "muux" "woox" 




how to install repeat.vim?


1. Download repeat.vim to the ~ / .vim / plugin directory (Unix / Linux), or ~ \ vimfiles \ plugin (Windows).

2. Restart Vim or connect repeat.vim with ": so ~ / .vim / plugin / repeat.vim" in Unix or ": so ~ / vimfiles / plugin / repeat.vim" in Windows.



Enjoy!


Follow surround.vim and repeat.vim. Next time I will write about a much more significant plugin. :)

Source: https://habr.com/ru/post/116422/



All Articles