Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hotkey for C-style block (curly braces) #268

Open
dnezamaev opened this issue Dec 23, 2017 · 0 comments
Open

Add hotkey for C-style block (curly braces) #268

dnezamaev opened this issue Dec 23, 2017 · 0 comments

Comments

@dnezamaev
Copy link

Assume I have text with cursor as | (after $):
while ( letter != '$|')
now I want to finish while statement and open C-block without typing <S-TAB><S-TAB><CR> or leaving insert mode to get this

while ( letter != '$')
{
  |
}

Now I have simple map in my vimrc to do this
inoremap {{ <C-o>o{<CR>}<C-o>O

Works fine, but it always adds new line before open curly brace, so when I want just add C-block on current line this mapping inserts unwanted empty line before C-block.

What I suggest: add to plugin smart C-block expansion that checks if there is some text before cursor or no. And using this information add new line before open brace or no. Also will be nice to have setting to choose style between:

while ( 1 ) {

}

or

while ( 1 ) 
{

}

By the way, thank you for plugin, it is really cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant