vim-better-whitespace icon indicating copy to clipboard operation
vim-better-whitespace copied to clipboard

Strip whitespace on save with highlighting disabled

Open itaranto opened this issue 4 years ago • 3 comments

I tried:

let g:better_whitespace_enabled=1
let g:strip_whitelines_at_eof=1
let g:strip_whitespace_on_save=1

and

let g:better_whitespace_enabled=1
let g:better_whitespace_filetypes_blacklist=['diff', 'gitcommit', 'unite', 'qf', 'help', 'markdown']
let g:strip_whitelines_at_eof=1
let g:strip_whitespace_on_save=1

and with both configurations I had the confirmation prompt in markdown files.

Is there something I'm doing wrong?

itaranto avatar Jun 26 '20 22:06 itaranto

This is the setting controlling the confirmation prompts, is that the one you’re looking for?

`g:strip_whitespace_confirm`                      (defaults to 1)
Set to 0 to deactivate asking for confirmation before whitespace is
stripped when you save the file.

If not please try to be more specific in what you’re trying to achieve and what is happening instead.

Cimbali avatar Jul 17 '20 00:07 Cimbali

I'm sorry I wasn't clear enough. This is't about the confirmation prompt.

My intended use case is to have the trim-on-save functionality but without the highlighting.

So, I attempted this:

let g:better_whitespace_enabled=0
let g:strip_whitelines_at_eof=1
let g:strip_whitespace_confirm=0
let g:strip_whitespace_on_save=1

But it still removes trailing whitespace from a markdown file, i.e a blacklisted file type.

So, I tried using let g:better_whitespace_enabled=1 and now the blacklist works properly. It seems that the better_whitespace_enabled controls the blacklist access, is that intended?

itaranto avatar Jul 18 '20 14:07 itaranto

I'm not sure stripping on save without enabling betterwhitespace is currently supported.

Cimbali avatar Jul 19 '20 17:07 Cimbali