How do I emulate Sublime text's auto complete behavior for curly braces {}
on vim? Basically, when a parenthesis is opened, it should auto close in the same line, and when <CR>
is pressed the cursor should go to the next line with a block indentation and }
should fall in line with the original indention of the line containing the {
. If my question is not clear, this is the default behavior of most code editors when dealing with {}
.
相关问题
- Emacs shell: save commit message
- How to change the first two uppercase characters o
- Insert text into current buffer from function
- Hot reload on save
- Substituting zero-width match in vim script
相关文章
- 如何让 vim 支持 .cshtml 文件的代码高亮
- Auto-save in VIM as you type
- How can I use gcc's -I command to add recursiv
- Vim: overloaded mapping for multiple modes
- How to use relative line numbering universally in
- How to copy the value of a vim option to a registe
- E185: Cannot find color scheme*
- How do I fix vim to properly indent folds containi
The Automatically append closing characters page on the Vim Tips Wiki has everything from simplistic mappings to complete plugin solutions. There seem to be issues with the latest Vim 7.4 version, though.
There exist many plugins with similar features as Ingo pointed out.
lh-brackets, that I'm maintaining, has the features you describe:
{
inserts{}
and moves the cursor in between (and also inserts a placeholder after the closing bracket<cr>
while within a pair of curly-brackets will insert another newline in-between (and indent correctly)