You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Allow per-buffer toggling to override global
Fixes#98
* Respect global choice in current detection
* Refactor for readability/maintanability
Also addresses issues raised in #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
* Update docs to mirror refactor, fix#91 collisions
* Fix#92: Correctly re-init on colorscheme change
Bug was caused by snyIDattr() returning a string, empty when the
highlight group is undefined, rather than an int with -1 for undefined.
* Add mechanism for confirming whitespace stripping
Based on PR #69 by @advocateddrummer
Also make sure that EOF stripping of empty lines is only done when the
EOF is in the given range.
* Add option to only strip whitespace on modified lines
Diff-based technique to close#38
* Add option to disable stripping-on-save on large files
Using the number of lines in the file, based on PR #97 by @kurikomoe
Also fix docs.
* Adjust documentations
* Check if file exists instead of file name non-emtpy
Files that were created in vim printed errors on first save. E.g.:
:tabe new_file
:w
* Fix typo in doc/better-whitespace.txt
Co-Authored-By: Cimbali <me@cimba.li>
* Fix whitespace search to also match current line
Co-Authored-By: Cimbali <me@cimba.li>
* Correct missing sentence in doc
* Clarify ShouldStripWhitespace role, call diff less
Use &modified and &modifiable to skip diff and disable strippping
(by default) whitespace on save.
* Fix incorrect diff for last line of file
Appending "\n" to joined buffer lines allows to diff until EOF.
Co-Authored-By: Nate Peterson <ntpeters@mtu.edu>
* Make max lines more explicit and default to 1000
* Make a command to manually strip lines on changed lines
* Remove unused bangs from commands
Bangs are only used of `:w` for now
* Show errors to user, except E486: Pattern not found
That error is the only legitimate one, but is already ignored with the
e flag on :s, see :help s_e
* Add error for &noro, respect range for changed lines
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.
* Add a deprecation warning about in the doc
* Add error number so people can look the error up
The explanation says (emphasis mine):
You tried to execute a command that is neither an Ex command nor
*a user-defined command*.
0 commit comments