Today I will introduce to you two very useful vim plug-ins, which can quickly move within the page and edit in pairs.
easymotion
We know that the vim editor can move up and down by pressing the keys h/j/k/l, use /keywords to search, use the keys w and e to move quickly between words, and use f{char} to Search within a line and more. However, none of these provide a way to quickly move within the entire page.
Today I will introduce a fast moving plug-in easymotion. With it, you can go wherever you want. The github address of the plug-in is: https://github.com/easymotion/vim-easymotion
Similarly, we use the vim-plug plug-in to install it. Then add a line of mapping to the configuration file
nmap ss (easymotion-s2)
Notice that what we need here is recursive mapping, not non-recursive map. After configuration, we can go to use it. The following demonstrates how to use it to complete the function of moving quickly on the page.
Now, we want to replace the double quotes in where on line 25 with single quotes, how to do it.
-
First move the cursor to any character in “”
-
Enter cs”'; cs (c means change), which means change the double quotes to single quotes
If you want to delete in pairs, delete the double quotes, and you should How to do it
-
Move the cursor to any character in “”
-
Enter ds”, d means delete
The double quotes have been deleted, but now you need to add double quotes, how should you do it
-
Move the cursor to i
-
Enter ysiw”
The above are recommended two very practical vim plug-ins – quick positioning, paired editing details, please pay attention to other related articles on 1024programmer.com for more!