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

Wishlist: auto_format modified lines only? #9

Closed
dnwe opened this issue Jul 3, 2014 · 2 comments
Closed

Wishlist: auto_format modified lines only? #9

dnwe opened this issue Jul 3, 2014 · 2 comments
Assignees

Comments

@dnwe
Copy link

dnwe commented Jul 3, 2014

Is it possible to provide g:clang_format#auto_format but which only reformats the lines that have been modified since the buffer was last saved?

@rhysd
Copy link
Owner

rhysd commented Jul 3, 2014

No, it's not possible.

Each chunk of modified lines requires executeing clang-format to format. It'll be a heavy work for Vim and it takes a lot, I think.
Though there is no feature to format modified lines automatically, I think it is better way to format per each modifying with remembering the line when you enter insert mode and invoking clang-format automatically when you leave insert mode. You can hook these points using InsertEnter and InsertLeave events.

@rhysd
Copy link
Owner

rhysd commented Jul 4, 2014

Hi, I added automatic formatting on InsertLeave as a trial at c83f840.

If g:clang_format#auto_format_on_insert_leave is 1, inserted lines are automatically on leaving insert mode. Please be careful because this feature has some side effects.

@rhysd rhysd self-assigned this Jul 4, 2014
@rhysd rhysd closed this as completed Jul 8, 2014
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

2 participants