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

cc and indentation not working #1534

Closed
madsystem opened this issue Jan 6, 2015 · 4 comments
Closed

cc and indentation not working #1534

madsystem opened this issue Jan 6, 2015 · 4 comments
Milestone

Comments

@madsystem
Copy link

Unfortunately cc does not start at the propper indentation level if the line was empty for example an new line added with o (and then switched directly to normal mode). Here is an gif explaining it a little better.

http://giphy.com/gifs/yoJC2EkaGPvMzsHK36

Im using pure visual studio indentation/tab settings. Changing them to my gvim settings did not help. Any tips, workarounds? Tested languages are c# and c++.

Btw thanks for this really great plugin :)

Cheers, Kris

@Kantis
Copy link
Contributor

Kantis commented Jan 9, 2015

Use :set autoindent to make cc automatically indent correctly

@jaredpar
Copy link
Collaborator

jaredpar commented Jan 9, 2015

@Kantis unfortunately it's not that simple in this case. The gVim indent behavior works the way it does because it relies on indentexpr for this scenario (typically it is set to GetVimIndent).

VsVim doesn't have support for indentexpr hence this scenario won't work even with autoindent.

To get this to work both indentexpr would need to be supported and some logical implementation of GetVimIndent would be needed for C based languages.

@friedroman
Copy link

I'd also really appreciate this. I also noticed o sometimes (rarely though) fails to autoindent. Not when going to normal mode on an empty line, which is expected. Could not spot a pattern so far for a clean repro.
Thanks for the great extension, Jared. It is appreciated.

@Zantier
Copy link

Zantier commented Jun 8, 2017

As a workaround, I put this as a line in my %userprofile%\_vsvimrc

nnoremap cc ddO

It won't cover other key combinations involving c, but hopefully that helps.

@jaredpar jaredpar added this to the 2.6.0 milestone Aug 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants