Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stop formatting text if editor is not in normal mode
the autoformat function is called by vim when textwidth (if defined) is exceeded. during these calls, the Fallback part of the fuction ends up calling out to "normal! gww" which tends to reverse the last two characters. this is caused by how gww works, in relationship to how formatexpr is called during insert mode -- gww tries to bring the cursor back to where it was before, but the cursor position did not exist in the first place (since the last typed character was not inserted into the buffer yet before calling formatexpr) This change works around the issue by entirely disabling autoformatting when not in normal mode. It means that only using gq in normal mode will be able to reformat the text.
- Loading branch information