-
Notifications
You must be signed in to change notification settings - Fork 82
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
Refactor #100
Merged
Merged
Refactor #100
Conversation
This file contains 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
Also addresses issues raised in ntpeters#98. Reorder code, organise in sections. - Simplify utility functions: only keep InitVariable, remove its :exe - Whitespace patterns and highlighting mechanisms defined once - Prefs current_line_whitespace_disabled_* can be set only when loading the plugin (*), as this allows a lot of simplification. Clarify variables use/responsability. - Set buffer-local settings b:better_whitespace_enabled and b:strip_whitespace_on_save *only* when Enable/Disable/Toggle is called, or when the determination based on the filetype can be made. - Change SetupAutoCommands to be the only function to be called by: a) checking the buffer-local setting b) taking responsability for clearing the highlighting
Bug was caused by snyIDattr() returning a string, empty when the highlight group is undefined, rather than an int with -1 for undefined.
Based on PR ntpeters#69 by @advocateddrummer Also make sure that EOF stripping of empty lines is only done when the EOF is in the given range.
Diff-based technique to close ntpeters#38
Using the number of lines in the file, based on PR ntpeters#97 by @kurikomoe Also fix docs.
Files that were created in vim printed errors on first save. E.g.: :tabe new_file :w
ntpeters
requested changes
Jan 24, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ntpeters
reviewed
Jan 24, 2019
ntpeters
reviewed
Jan 24, 2019
ntpeters
reviewed
Jan 24, 2019
Co-Authored-By: Cimbali <[email protected]>
Co-Authored-By: Cimbali <[email protected]>
Use &modified and &modifiable to skip diff and disable strippping (by default) whitespace on save.
Appending "\n" to joined buffer lines allows to diff until EOF. Co-Authored-By: Nate Peterson <[email protected]>
ntpeters
reviewed
Jan 24, 2019
ntpeters
reviewed
Jan 24, 2019
ntpeters
reviewed
Jan 24, 2019
ntpeters
reviewed
Jan 24, 2019
ntpeters
reviewed
Jan 24, 2019
Bangs are only used of `:w` for now
That error is the only legitimate one, but is already ignored with the e flag on :s, see :help s_e
Make commands aware of &readonly and show proper errors. Also improve StripWhitespaceOnChangedLines to take into account the range it is passed. The range to defaults to % which means no different behaviour. With any other range, only perform the stripping on the intersection of the changed lines and that range.
The explanation says (emphasis mine): You tried to execute a command that is neither an Ex command nor *a user-defined command*.
ntpeters
approved these changes
Jan 25, 2019
This was referenced Jan 25, 2019
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.
Refactor of plugin to make it more readable, fixing bugs (#91 #92 #98) and adding long-standing feature requests (#38 #69 #97).