我是 vim 新手。我按下了太多按钮来进行基本的文本换行:
string->"string"long string with many words->'long string with many words'a + b * c->(a + b) * c(elem0, elem1, elem2)-> [elem0, elem1, elem2] (可选)我正在手动完成所有这些操作:转到开始,插入模式,按键,正常模式(第二个字符相同)。
如何做得更快?例如:直观地选择文本,用您需要的内容智能换行。或者甚至没有视觉选择。
string->"string"
ciw"<C-r>""
Run Code Online (Sandbox Code Playgroud)long string with many words->'long string with many words'
veeeeec'<C-r>"'
Run Code Online (Sandbox Code Playgroud)a + b * c->(a + b) * c
vwwc(<C-r>")
Run Code Online (Sandbox Code Playgroud)(elem0, elem1, elem2)-> [elem0, elem1, elem2](可选)
"edibxs[<C-r>e]
Run Code Online (Sandbox Code Playgroud)
那个有点复杂:
"edib cut the content of those parentheses into
an arbitrary register, here I used "e
xs cut the closing parenthese then cut the opening one
and enter insert mode
[<C-r>e] insert the opening bracket, followed by the content of
register e, followed by the closing bracket
Run Code Online (Sandbox Code Playgroud)但是,是的,使用 Tim Pope 的 Surround。