Skip to content

Commit

Permalink
Make max lines more explicit and default to 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
Cimbali committed Jan 24, 2019
1 parent a552fbd commit 6e407aa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,11 @@ Whitespace highlighting is enabled by default, with a highlight color of red.
a maximum number of lines (e.g. 1000) by adding the following to your `~/.vimrc`:
```vim
let g:strip_disabled_on_large_files = 1000
let g:strip_max_file_size = 1000
```
This overrides `let g:strip_whitespace_on_save` but not `:EnableStripWhitespaceOnSave`.
Set to `0` to deactivate.
* By default, you will be asked for confirmation before whitespace is
stripped when you save the file. This can be disabled by adding the
Expand Down
2 changes: 1 addition & 1 deletion doc/better-whitespace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ When stripping whitespace on save, only perform the stripping on the lines
that have been modified.
Uses `diff`, which should be available on all platforms (see |E810|).

`g:strip_disabled_on_large_files` (defaults to 0)
`g:strip_max_file_size` (defaults to 1000)
Skip stripping whitespace on files that have more lines than the value in this
variable. 0 means disabled, thus strip for any file size. This can be manually
overriden with |better-whitespace-:EnableStripWhitespaceOnSave| and related commands.
Expand Down
4 changes: 2 additions & 2 deletions plugin/better-whitespace.vim
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ call s:InitVariable('better_whitespace_skip_empty_lines', 0)
call s:InitVariable('strip_only_modified_lines', 0)

" Skip stripping whitespace on files that have more lines than this variable
call s:InitVariable('strip_disabled_on_large_files', 0)
call s:InitVariable('strip_max_file_size', 1000)

" Disable verbosity by default
call s:InitVariable('better_whitespace_verbosity', 0)
Expand Down Expand Up @@ -113,7 +113,7 @@ function! s:ShouldStripWhitespaceOnSave()
" Guess from local whitespace enabled-ness and global whitespace setting
if !exists('b:strip_whitespace_on_save') && exists('b:better_whitespace_enabled')
let b:strip_whitespace_on_save = b:better_whitespace_enabled && g:strip_whitespace_on_save && &modifiable &&
\ (g:strip_disabled_on_large_files == 0 || g:strip_disabled_on_large_files >= line('$'))
\ (g:strip_max_file_size == 0 || g:strip_max_file_size >= line('$'))
endif
return get(b:, 'strip_whitespace_on_save', g:strip_whitespace_on_save)
endfunction
Expand Down

0 comments on commit 6e407aa

Please sign in to comment.