Heim > Fragen und Antworten > Hauptteil
Zum Beispiel gibt es ein Wort
dcustmsg
Ich habe das Wort im V-Modus ausgewählt. Gibt es eine Tastenkombination, um auf beiden Seiten des Wortes Anführungszeichen hinzuzufügen, um es zu erstellen
"dcustmsg"
黄舟2017-05-16 16:44:14
配置文件添加函数和键映射如下:
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>
这样normal模式光标放在单词上,然后使用快捷键cx,会提示两边填充的字符,输入字符回车即可。
详细内容请参考:How to repeatedly add text on both si...