Add double quotes to surrounding a word/text

发布时间 2023-12-02 15:27:21作者: DaqianLU

In VIM for VScode, how to add a pair of double or single quotes to surround an existing word/text/numebr?

I've been writing R codes with VScode for many years (Thanks to the awesome R plugin for VScode!). Sometimes, I'll create a set of character vectors by hand, for example, char <-  c ( "Lucas" ,  "Deniel" ,  "Patrick" ),  I'll type "text, repeatedly, which is apparently low-efficiency and disappointing if I have a super long character vector to create. So, how could we resolve this problem with less laborious and high efficiency? Here's my solution with the vim-surround feature of VIM for Vscode:

The magic is: ysiw", this could be interpreted for "you surround the inner word with double quotes". If your cursor is on the 123 when you type this command, it will change 123 to "123".