Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Kyle Moffett

On Jun 29, 2007, at 08:49:42, Dmitry Torokhov wrote:

On 6/29/07, Michael Tokarev <[EMAIL PROTECTED]> wrote:

highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

Works without any glitches here (not "laggy").  But I don't use  
syntax coloring - never tried if it works with coloring or not.




That only highlights whitespace at the end of the lines. You might  
want to use pattern below to also highlight "tab after space" in  
the middle of the line:


:highlight RedundantSpaces ctermbg=red guibg=red
:match RedundantSpaces /\s\+$\| \+\ze\t/


You missed the nice part about my vimrc patterns: :-D

Kyle Moffett wrote:
It always displays trailing whitespace and spaces-before tabs...  
except if your cursor is at the end of the whitespace.


They intentionally *don't* display whitespace at the end of the line  
to the left of your cursor.  I tried that one (that you quoted), but  
got annoyed by the fact that immediately after you typed any space or  
tab you had a little red blob to the left of the cursor.  So some of  
that "lagginess" is intentionaly (although not all of it, due to vim  
limitations).


Cheers,
Kyle Moffett
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Dmitry Torokhov

On 6/29/07, Michael Tokarev <[EMAIL PROTECTED]> wrote:

Kyle Moffett wrote:
> On Jun 28, 2007, at 03:20:24, Dave Young wrote:
>> And for vim trailing space, there's a tip in vim.org:
>> http://www.vim.org/tips/tip.php?tip_id=878
>
> I actually prefer this (in .vimrc):
>
> " Show trailing whitespace and spaces before tabs
> hi link localWhitespaceError Error
> au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
> au Syntax * syn match localWhitespaceError / \+\ze\t/ display
>
> It always displays trailing whitespace and spaces-before tabs... except
> if your cursor is at the end of the whitespace.  The updating is
> occasionally a bit laggy (EG: Put spaces on a line and then move the
> cursor off it without pressing ), but when you hit Ctrl-L, enter,
> or edit an adjacent line then it updates.

Stolen from an old message in LKML - I don't remember who's the author:

highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

Works without any glitches here (not "laggy").  But I don't use
syntax coloring - never tried if it works with coloring or not.



That only highlights whitespace at the end of the lines. You might
want to use pattern below to also highlight "tab after space" in the
middle of the line:

:highlight RedundantSpaces ctermbg=red guibg=red
:match RedundantSpaces /\s\+$\| \+\ze\t/

--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Michael Tokarev
Kyle Moffett wrote:
> On Jun 28, 2007, at 03:20:24, Dave Young wrote:
>> And for vim trailing space, there's a tip in vim.org:
>> http://www.vim.org/tips/tip.php?tip_id=878
> 
> I actually prefer this (in .vimrc):
> 
> " Show trailing whitespace and spaces before tabs
> hi link localWhitespaceError Error
> au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
> au Syntax * syn match localWhitespaceError / \+\ze\t/ display
> 
> It always displays trailing whitespace and spaces-before tabs... except
> if your cursor is at the end of the whitespace.  The updating is
> occasionally a bit laggy (EG: Put spaces on a line and then move the
> cursor off it without pressing ), but when you hit Ctrl-L, enter,
> or edit an adjacent line then it updates.

Stolen from an old message in LKML - I don't remember who's the author:

highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

Works without any glitches here (not "laggy").  But I don't use
syntax coloring - never tried if it works with coloring or not.

/mjt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Dave Young

On 6/29/07, Björn Steinbrink <[EMAIL PROTECTED]> wrote:

On 2007.06.29 01:42:22 -0700, Josh Triplett wrote:
> Jan Engelhardt wrote:
> > On Jun 29 2007 00:53, Josh Triplett wrote:
> >> And if you really want highlighting, you can always use grep --color. :)
> >
> > Been there, done that, have GREP_COLOR env variable defined!
>
> Same here.  Now I just need to convince git-grep to use it.

You need to convince grep. When piping its output to less, it won't
colorize unless forced. Always forcing color via GREP_OPTIONS might
break certain use-cases, and git-grep doesn't allow to pass options. So
for me, a bash alias it is:

alias gg='GREP_OPTIONS=--color=always git-grep'

You might need to set LESS=-R in addition to that, to stop less from
stripping the color codes.

Björn


I ussualy prefer the simple vim search command:
/\ *$
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Björn Steinbrink
On 2007.06.29 01:42:22 -0700, Josh Triplett wrote:
> Jan Engelhardt wrote:
> > On Jun 29 2007 00:53, Josh Triplett wrote:
> >> And if you really want highlighting, you can always use grep --color. :)
> > 
> > Been there, done that, have GREP_COLOR env variable defined!
> 
> Same here.  Now I just need to convince git-grep to use it.

You need to convince grep. When piping its output to less, it won't
colorize unless forced. Always forcing color via GREP_OPTIONS might
break certain use-cases, and git-grep doesn't allow to pass options. So
for me, a bash alias it is:

alias gg='GREP_OPTIONS=--color=always git-grep'

You might need to set LESS=-R in addition to that, to stop less from
stripping the color codes.

Björn
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Josh Triplett
Jan Engelhardt wrote:
> On Jun 29 2007 00:53, Josh Triplett wrote:
 I actually prefer this (in .vimrc):

 " Show trailing whitespace and spaces before tabs
 hi link localWhitespaceError Error
 au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
 au Syntax * syn match localWhitespaceError / \+\ze\t/ display
>>> I prefer this:
>>>
>>> find . -type f -print0 | xargs -0 grep -Pn '[\t ]+$'
>>>
>>> It is editor agnostic, and I do not have to look through all source files 
>>> for
>>> highlighted whitespace :-)
>> And if you really want highlighting, you can always use grep --color. :)
> 
> Been there, done that, have GREP_COLOR env variable defined!

Same here.  Now I just need to convince git-grep to use it.

- Josh Triplett

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Jan Engelhardt

On Jun 29 2007 00:53, Josh Triplett wrote:
>>> I actually prefer this (in .vimrc):
>>>
>>> " Show trailing whitespace and spaces before tabs
>>> hi link localWhitespaceError Error
>>> au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
>>> au Syntax * syn match localWhitespaceError / \+\ze\t/ display
>> 
>> I prefer this:
>> 
>> find . -type f -print0 | xargs -0 grep -Pn '[\t ]+$'
>> 
>> It is editor agnostic, and I do not have to look through all source files for
>> highlighted whitespace :-)
>
>And if you really want highlighting, you can always use grep --color. :)

Been there, done that, have GREP_COLOR env variable defined!


Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Josh Triplett
Jan Engelhardt wrote:
> On Jun 28 2007 23:11, Kyle Moffett wrote:
>> I actually prefer this (in .vimrc):
>>
>> " Show trailing whitespace and spaces before tabs
>> hi link localWhitespaceError Error
>> au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
>> au Syntax * syn match localWhitespaceError / \+\ze\t/ display
> 
> I prefer this:
> 
> find . -type f -print0 | xargs -0 grep -Pn '[\t ]+$'
> 
> It is editor agnostic, and I do not have to look through all source files for
> highlighted whitespace :-)

And if you really want highlighting, you can always use grep --color. :)

- Josh Triplett

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Jan Engelhardt

On Jun 28 2007 23:11, Kyle Moffett wrote:
> I actually prefer this (in .vimrc):
>
> " Show trailing whitespace and spaces before tabs
> hi link localWhitespaceError Error
> au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
> au Syntax * syn match localWhitespaceError / \+\ze\t/ display

I prefer this:

find . -type f -print0 | xargs -0 grep -Pn '[\t ]+$'

It is editor agnostic, and I do not have to look through all source files for
highlighted whitespace :-)

> The script mentioned there *is* good for removing said whitespace, though
>
> Cheers,
> Kyle Moffett
>

Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Jan Engelhardt

On Jun 28 2007 23:11, Kyle Moffett wrote:
 I actually prefer this (in .vimrc):

  Show trailing whitespace and spaces before tabs
 hi link localWhitespaceError Error
 au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
 au Syntax * syn match localWhitespaceError / \+\ze\t/ display

I prefer this:

find . -type f -print0 | xargs -0 grep -Pn '[\t ]+$'

It is editor agnostic, and I do not have to look through all source files for
highlighted whitespace :-)

 The script mentioned there *is* good for removing said whitespace, though

 Cheers,
 Kyle Moffett


Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Josh Triplett
Jan Engelhardt wrote:
 On Jun 28 2007 23:11, Kyle Moffett wrote:
 I actually prefer this (in .vimrc):

  Show trailing whitespace and spaces before tabs
 hi link localWhitespaceError Error
 au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
 au Syntax * syn match localWhitespaceError / \+\ze\t/ display
 
 I prefer this:
 
 find . -type f -print0 | xargs -0 grep -Pn '[\t ]+$'
 
 It is editor agnostic, and I do not have to look through all source files for
 highlighted whitespace :-)

And if you really want highlighting, you can always use grep --color. :)

- Josh Triplett

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Jan Engelhardt

On Jun 29 2007 00:53, Josh Triplett wrote:
 I actually prefer this (in .vimrc):

  Show trailing whitespace and spaces before tabs
 hi link localWhitespaceError Error
 au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
 au Syntax * syn match localWhitespaceError / \+\ze\t/ display
 
 I prefer this:
 
 find . -type f -print0 | xargs -0 grep -Pn '[\t ]+$'
 
 It is editor agnostic, and I do not have to look through all source files for
 highlighted whitespace :-)

And if you really want highlighting, you can always use grep --color. :)

Been there, done that, have GREP_COLOR env variable defined!


Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Josh Triplett
Jan Engelhardt wrote:
 On Jun 29 2007 00:53, Josh Triplett wrote:
 I actually prefer this (in .vimrc):

  Show trailing whitespace and spaces before tabs
 hi link localWhitespaceError Error
 au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
 au Syntax * syn match localWhitespaceError / \+\ze\t/ display
 I prefer this:

 find . -type f -print0 | xargs -0 grep -Pn '[\t ]+$'

 It is editor agnostic, and I do not have to look through all source files 
 for
 highlighted whitespace :-)
 And if you really want highlighting, you can always use grep --color. :)
 
 Been there, done that, have GREP_COLOR env variable defined!

Same here.  Now I just need to convince git-grep to use it.

- Josh Triplett

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Björn Steinbrink
On 2007.06.29 01:42:22 -0700, Josh Triplett wrote:
 Jan Engelhardt wrote:
  On Jun 29 2007 00:53, Josh Triplett wrote:
  And if you really want highlighting, you can always use grep --color. :)
  
  Been there, done that, have GREP_COLOR env variable defined!
 
 Same here.  Now I just need to convince git-grep to use it.

You need to convince grep. When piping its output to less, it won't
colorize unless forced. Always forcing color via GREP_OPTIONS might
break certain use-cases, and git-grep doesn't allow to pass options. So
for me, a bash alias it is:

alias gg='GREP_OPTIONS=--color=always git-grep'

You might need to set LESS=-R in addition to that, to stop less from
stripping the color codes.

Björn
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Dave Young

On 6/29/07, Björn Steinbrink [EMAIL PROTECTED] wrote:

On 2007.06.29 01:42:22 -0700, Josh Triplett wrote:
 Jan Engelhardt wrote:
  On Jun 29 2007 00:53, Josh Triplett wrote:
  And if you really want highlighting, you can always use grep --color. :)
 
  Been there, done that, have GREP_COLOR env variable defined!

 Same here.  Now I just need to convince git-grep to use it.

You need to convince grep. When piping its output to less, it won't
colorize unless forced. Always forcing color via GREP_OPTIONS might
break certain use-cases, and git-grep doesn't allow to pass options. So
for me, a bash alias it is:

alias gg='GREP_OPTIONS=--color=always git-grep'

You might need to set LESS=-R in addition to that, to stop less from
stripping the color codes.

Björn


I ussualy prefer the simple vim search command:
/\ *$
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Michael Tokarev
Kyle Moffett wrote:
 On Jun 28, 2007, at 03:20:24, Dave Young wrote:
 And for vim trailing space, there's a tip in vim.org:
 http://www.vim.org/tips/tip.php?tip_id=878
 
 I actually prefer this (in .vimrc):
 
  Show trailing whitespace and spaces before tabs
 hi link localWhitespaceError Error
 au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
 au Syntax * syn match localWhitespaceError / \+\ze\t/ display
 
 It always displays trailing whitespace and spaces-before tabs... except
 if your cursor is at the end of the whitespace.  The updating is
 occasionally a bit laggy (EG: Put spaces on a line and then move the
 cursor off it without pressing ENTER), but when you hit Ctrl-L, enter,
 or edit an adjacent line then it updates.

Stolen from an old message in LKML - I don't remember who's the author:

highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

Works without any glitches here (not laggy).  But I don't use
syntax coloring - never tried if it works with coloring or not.

/mjt
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Dmitry Torokhov

On 6/29/07, Michael Tokarev [EMAIL PROTECTED] wrote:

Kyle Moffett wrote:
 On Jun 28, 2007, at 03:20:24, Dave Young wrote:
 And for vim trailing space, there's a tip in vim.org:
 http://www.vim.org/tips/tip.php?tip_id=878

 I actually prefer this (in .vimrc):

  Show trailing whitespace and spaces before tabs
 hi link localWhitespaceError Error
 au Syntax * syn match localWhitespaceError /\(\zs\%#\|\s\)\+$/ display
 au Syntax * syn match localWhitespaceError / \+\ze\t/ display

 It always displays trailing whitespace and spaces-before tabs... except
 if your cursor is at the end of the whitespace.  The updating is
 occasionally a bit laggy (EG: Put spaces on a line and then move the
 cursor off it without pressing ENTER), but when you hit Ctrl-L, enter,
 or edit an adjacent line then it updates.

Stolen from an old message in LKML - I don't remember who's the author:

highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

Works without any glitches here (not laggy).  But I don't use
syntax coloring - never tried if it works with coloring or not.



That only highlights whitespace at the end of the lines. You might
want to use pattern below to also highlight tab after space in the
middle of the line:

:highlight RedundantSpaces ctermbg=red guibg=red
:match RedundantSpaces /\s\+$\| \+\ze\t/

--
Dmitry
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [OT] Vim highlighting for trailing spaces

2007-06-29 Thread Kyle Moffett

On Jun 29, 2007, at 08:49:42, Dmitry Torokhov wrote:

On 6/29/07, Michael Tokarev [EMAIL PROTECTED] wrote:

highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

Works without any glitches here (not laggy).  But I don't use  
syntax coloring - never tried if it works with coloring or not.




That only highlights whitespace at the end of the lines. You might  
want to use pattern below to also highlight tab after space in  
the middle of the line:


:highlight RedundantSpaces ctermbg=red guibg=red
:match RedundantSpaces /\s\+$\| \+\ze\t/


You missed the nice part about my vimrc patterns: :-D

Kyle Moffett wrote:
It always displays trailing whitespace and spaces-before tabs...  
except if your cursor is at the end of the whitespace.


They intentionally *don't* display whitespace at the end of the line  
to the left of your cursor.  I tried that one (that you quoted), but  
got annoyed by the fact that immediately after you typed any space or  
tab you had a little red blob to the left of the cursor.  So some of  
that lagginess is intentionaly (although not all of it, due to vim  
limitations).


Cheers,
Kyle Moffett
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/