What Vim command(s) can be used to quote/unquote words?

前端 未结 16 896
余生分开走
余生分开走 2020-12-12 08:36

How can I quickly quote/unquote words and change quoting (e.g. from \' to \") in Vim? I know about the surround.vim plugin, but I would like to use

16条回答
  •  眼角桃花
    2020-12-12 09:17

    To wrap in single quotes (for example) ciw'"' works, but repeat won't work. Try:

    ciw'"'
    

    This puts the contents of the default register "literally". Now you can press . on any word to wrap it in quotes. To learn more see :h[elp] i_ctrl-r and more about text objects at :h text-objects

    Source: http://vimcasts.org/episodes/pasting-from-insert-mode/

提交回复
热议问题