Vim plugin for 'auto-closed' parenthesis?

时间秒杀一切 提交于 2019-12-18 03:34:47

问题


I've searched near and far, and not found a plugin that can simply auto-close a set of parenthesis like Textmate. For example:

Vim     : (*manually close parens* → )
Textmate: (*Auto closes parens*)

If you can describe a plugin for this, I will be very helpful. Thanks!


回答1:


Try delimitMate:

https://github.com/Raimondi/delimitMate

Some plugins listed here as well.. Plus instructions on setting it up yourself:

http://vim.wikia.com/wiki/Automatically_append_closing_characters




回答2:


I use AutoPairs. You can get it here:

https://github.com/jiangmiao/auto-pairs.git

If you read the docs, it has a lot of options which cover most eventualities.




回答3:


For those of us who want to go the plain vim way:

ino " ""<left>
ino ' ''<left>
ino ( ()<left>
ino [ []<left>
ino { {}<left>
ino {<CR> {<CR>}<ESC>O

This autocomplete in insert mode. Keep in the vimrc to avoid typing it everytime and when we don't want the mapping, we need to escape it using ctrl - v before typing the mapped char of ( { etc.




回答4:


I'm maintaining a plugin that simplifies insertion of balanced bracket-like characters, and that even supports surrounding of words/lines/selection.

https://github.com/LucHermitte/lh-brackets/#the-bracketing-subsystem

The default bindings for C & C++ are described in lh-cpp page.



来源:https://stackoverflow.com/questions/8958357/vim-plugin-for-auto-closed-parenthesis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!