-
Notifications
You must be signed in to change notification settings - Fork 81
Fix various issues/PRs and update documentation #72
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch adds a option to enable matching of space characters that appear before or in-between tabs. Removing such characters can be as important as removing trailing white-space. This option is currently disabled by default.
Only match them, see discussion on ntpeters#58
Imports the changes from @matt1003, thus closes ntpeters#58
Import changes from ntpeters#69 and close ntpeters#70
Collaborator
Author
|
I merged all the other branches/PRs in here so it can be merged all together. Fix all issues/PRs except 1) asking confirmation before stripping 2) limit stripping to edited lines. |
Owner
|
This is awesome! Thanks for all the great work on this! 😄 |
This was referenced Feb 25, 2018
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This whole post explains the first commit of the PR (Cimbali/vim-better-whitespace@c0ad20c): Buffer-local stripping of whitespace
Setting whether we strip whitespace on save per buffer will solve some problems, both of clarity and blacklist.
Now both stripping and highlighting whitespace have different buffer variables controlling them, thus you can play globally with:
g:better_whitespace_enabledg:strip_whitespace_on_saveg:better_whitespace_filetypes_blacklist(only relevant if it was enabled globally)Enable/Disable/ToggleWhitespace(under the hoodb:better_whitespace_enabled)Enable/Disable/ToggleStripWhitespaceOnSave(under the hoodb:strip_whitespace_on_save)As far as I can tell this works well even in buffers where
FileTypeis never triggered (e.g. empty buffers, falling back to global defaults), and even if theDisableWhitespaceis called befoere theShouldSkipHighlightthat sets up the local variable (i.e. we don't overwrite specific settings with general defaults).This simplifies a lot the global enabling/disabling of global saving of stripping that was recommended in the doc:
becomes:
The documentation is updated as well, so this should fix #53 as well.
After this commit users should do
let g:strip_whitespace_on_save = 1to enable stripping globally instead of usingautocmd BufEnter * EnableStripWhitespaceOnSave, which then makes the blacklist work as expected (fixing #68).To have for example whitespace highlighting + stripping by default, and only highlighting (no stripping) in Markdown (as requested in #53), the vimrc would contain:
(or alternately leave it in the blacklist and call
EnableWhitespacefor markdown files)