In vim, is there a plugin to use % to match the corresponding double quote (")?

前端 未结 5 1126
北海茫月
北海茫月 2020-12-24 11:08

The % key is one of the best features of vim: it lets you jump from { to }, [ to ], and so on.

Howeve

5条回答
  •  清歌不尽
    2020-12-24 11:38

    I'd like to expand on Greg's answer, and introduce the surround.vim plugin.

    Suppose that rather than editing the contents of your quotes, you want to modify the " characters themselves. Lets say you want to change from double-quotes to single-quotes.

    foo(bar, "baz quux")
                  ^
    

    The surround plugin allows you to change this to

    foo(bar, 'baz quux')
                  ^
    

    just by executing the following: cs"' (which reads: "change the surrounding double-quotes to single-quotes").

    You could also delete the quote marks simply by running: ds" (which reads: "delete the surrounding double-quotes).

    There is a good introduction to the surround plugin here.

提交回复
热议问题