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

前端 未结 16 919
余生分开走
余生分开走 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:15

    If you use the vim plugin https://github.com/tpope/vim-surround (or use VSCode Vim plugin, which comes with vim-surround pre-installed), its pretty convinient!

    add

    ysiw' // surround in word `'`
    

    drop

    ds' // drop surround `'`
    

    change

    cs'" // change surround from `'` to `"`
    

    It even works for html tags!

    cst // change surround from current tag to ``
    

    check out the readme on github for better examples

提交回复
热议问题