Problems with indentation of curly braces in vim
仅有的幸福
仅有的幸福 2017-05-16 16:39:40
0
2
669

Now assume that you write an if statement. After typing the left brace and pressing Enter, it looks like this (auto-completion is set)

if(a < b) {
}

The effect I want is after pressing Enter
if(a < b) {
I//The cursor is here
}

How should you set up vimrc like this?
Thanks!

仅有的幸福
仅有的幸福

reply all(2)
伊谢尔伦

The vim command is too complicated, we recommend SUB

滿天的星座

This can be accomplished with abbreviations:

:iabbrev {i {}<esc>i<cr>O

  1. {i Feel free to change
  2. O will be indented according to the current indent setting
  3. If you are not satisfied with the current effect, you can adjust it according to the document
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template