The configuration file adds functions and key mappings as follows:
function! s:surround()
let word = expand("<cword>")
let wrap= input("wrap with: ")
let command = "s/".word."/".wrap.word.wrap."/"
execute command
endfunction
nmap cx :call <SID>surround()<CR>
In this way, place the cursor on the word in normal mode, and then use the shortcut key cx. It will prompt the characters to be filled on both sides. Just enter the characters and press Enter.
For details, please refer to: How to repeatedly add text on both si...
You can write a vim macro by yourself
In normal mode, the cursor is placed in the middle of the word
bi"<ESC>ea"<ESC>
Just record the above paragraph as a macro and use it.
The configuration file adds functions and key mappings as follows:
In this way, place the cursor on the word in normal mode, and then use the shortcut key cx. It will prompt the characters to be filled on both sides. Just enter the characters and press Enter.
For details, please refer to: How to repeatedly add text on both si...
You can write a vim macro by yourself
In normal mode, the cursor is placed in the middle of the word
bi"<ESC>ea"<ESC>
Just record the above paragraph as a macro and use it.
diwi"<C-r>0<Esc> #Cut the string and copy it into double quotes...