Hot tip for vim users: highlight spaces at end of lines

Chris Sherlock chris.sherlock79 at gmail.com
Thu Dec 31 07:20:03 PST 2015


Oh! Nice :-) I'll be doing that - I'm a serial offender, but I only ever
annoy myself!

Chris

On Friday, January 1, 2016, Ashod Nakashian <ashnakash at gmail.com> wrote:

> On Wed, Dec 30, 2015 at 8:38 PM, Chris Sherlock <
> chris.sherlock79 at gmail.com
> <javascript:_e(%7B%7D,'cvml','chris.sherlock79 at gmail.com');>> wrote:
>
>> Hi all,
>>
>> Quick tip I’d like to share - every now and then I accidentally add a
>> space on the end of lines of code.
>>
>> You can highlight this occurring in vim by adding the following to your
>> .vimrc file:
>>
>> highlight ExtraWhitespace ctermbg=red guibg=red
>> match ExtraWhitespace /\s\+$/
>>
>> Probably most vi/vim users know this, but to remove newlines, you can use
>> the following:
>>
>> :%s/ \+$//g
>>
>>
> You could also run that :substitute on :w and never have to worry about
> trailing whitespace ever again :)
>
> autocmd BufWritePre * :%s/\s\+$//e
>
>
> Change the asterisk to any pattern matching filenames to apply this to
> certain filetypes only. (Also note the use of \s to match any whitespace
> character.)
>
> More here: http://vim.wikia.com/wiki/Remove_unwanted_spaces
>
> Happy Vimming!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20160101/a4322056/attachment.html>


More information about the LibreOffice mailing list