For example, there is a word
I have already selected the word in V mode. Is there any shortcut key to add quotation marks around the word to make it become
The profile add function and key mappings are 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, the normal mode cursor is placed on the word, and then the shortcut key cx is used to prompt the characters filled on both sides. Enter the character Enter.
For details, please refer to:How to repeatedly add text on both si …