> On Fri 21-Jul-06 12:51pm -0600, Jason Weber wrote:
>
>>> Ah, that's an idea. Just "/ " to search for spaces (assumes
>>> highlighting's turned on), and they'll all be highlighted. He wants to
>>> turn off highlighting, just "/qqq" or something.
>
>> I prefer "/;;" to turn off highlighting. the keys are right next to each
>> other and never happen in any languages I use.
>
> I clear the last search pattern often enough that I use a
> mapping:
>
> map <leader>\ :let @/=""<bar>echo "Search pattern cleared"<cr>
>
> --
> Best regards,
> Bill
>
[Hmm, attachments are rejected. Trying again...]
Ah, very nice, 2 taps beats my four, or six for <shift>:noh<enter>.
For my previous mail, note that, as best I can tell, 'contained' is
broken by the use of 'contains=ALLBUT,...' in various other syntax files
like C and C++ (please tell me how I'm mistaken). I have a
clean_cpp.vim I use to switch to 'contains=TOP' instead.
Anyhow, for kicks I've extended my odd_space.vim to show spaces that
aren't tab aligned by 4. These are recent changes, so I haven't perused
a lot of source to see if it causes any odd corner cases.
-- Jason Weber
clean_cpp.vim:
" override ALLBUT to TOP to prevent exposing all 'contained'
syn clear cParen
syn clear cCppParen
syn region cParen transparent start='(' end=')'
contains=TOP,@cParenGroup,cCppParen,cCppString,@Spell
syn region cCppParen transparent start='(' skip='\\$'
excludenl end=')'
end='$' contained contains=TOP,@cParenGroup,cParen,cString,@Spell
syn clear cBracket
syn clear cCppBracket
syn region cBracket transparent start=/\[\|<::[EMAIL
PROTECTED]/ end=/]\|:>/
contains=TOP,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
syn region cCppBracket transparent start=/\[\|<::[EMAIL
PROTECTED]/ skip=/\\$/ end=/$/
end=/]\|:>/ contained excludenl
contains=TOP,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
syn clear cDefine
syn clear cMulti
syn clear cPreProc
syn region cDefine
start=/^\s*\(%:\|#\)\s*\(define\|undef\)\>/
skip=/\\$/ end=+//+me=s-1 end=/$/ contains=TOP,@cPreProcGroup,@Spell
syn region cMulti transparent start=/?/ skip=/::/ end=/:/
contains=TOP,@cMultiGroup,@Spell
syn
region cPreProc
start=/^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)/
skip=/\\$/ end=/$/ keepend contains=TOP,@cPreProcGroup,@Spell
odd_space.vim:
syn match newtab "[\t]\+$" containedin=ALL
syn match spacereturn "[ ]$" contained
syn match freespace "[ ]\+$" containedin=ALL
contains=spacereturn
syn match spacetab "[ ]\t"me=e-1 containedin=ALL
syn match tabspace "\t[ ]\+"lc=1 containedin=ALL
syn match tabtab "[ -'*-Z^-z|~]\t\t\t*[
-'*-.0-Z^-z|~]"lc=1,me=e-1
containedin=ALLBUT,cComment,loudmatch
syn match onespace "[ ]" contained
syn match twospace "[ ][ ]"he=e-1 contained
nextgroup=offspace,twospace,onespace
syn match midspace "[^ ][ ]\{2,}[^ ]"lc=1,me=e-1
contains=offspace
syn match offspace "[ ]\+\%>01v[^ ]\%<06v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>05v[^ ]\%<10v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>09v[^ ]\%<14v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>13v[^ ]\%<18v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>17v[^ ]\%<22v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>21v[^ ]\%<26v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>25v[^ ]\%<30v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>29v[^ ]\%<34v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>33v[^ ]\%<38v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>37v[^ ]\%<42v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>41v[^ ]\%<46v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>45v[^ ]\%<50v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>49v[^ ]\%<54v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>53v[^ ]\%<58v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>57v[^ ]\%<62v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>61v[^ ]\%<66v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>65v[^ ]\%<70v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>69v[^ ]\%<74v"me=e-1,hs=e-1
contained
contains=twospace
syn match offspace "[ ]\+\%>73v[^ ]\%<78v"me=e-1,hs=e-1
contained
contains=twospace
syn match leadspace "[ ][ ]"lc=1 contained
syn match pairspace "[ ][ ]"hs=s+1 contained
nextgroup=pairspace,leadspace
syn match quadspace "[ ][ ][ ][ ]"hs=s+1 contained
nextgroup=quadspace,pairspace,leadspace
syn match pairstart "^[ ][ ]"hs=s+1
nextgroup=quadspace,pairspace,leadspace
syn match quadstart "^[ ][ ][ ][ ]"hs=s+1
nextgroup=quadspace,pairspace,leadspace
syn match newsentence "\<\l\{2,}["]\=\.["]\=[ ][
]["]\=\u\l\+\>"
contains=sentencespace
syn match sentencespace "[ ][ ]" contained
hi spacetab ctermfg=Red guifg=#BB0000
gui=underline cterm=underline
hi link tabspace spacetab
hi link spacereturn spacetab
hi newtab ctermfg=Blue guifg=#8888FF
gui=underline cterm=underline
hi tabtab ctermfg=Blue guifg=#444488
gui=underline cterm=underline
hi
sentencespace ctermfg=DarkGreen guifg=#004400 gui=underline
cterm=underline
hi pairspace ctermfg=Yellow guifg=#FFFF00 gui=underline
cterm=underline
hi link pairstart pairspace
hi link leadspace pairspace
if &expandtab == 0
hi quadspace ctermfg=Magenta guifg=#440044 gui=underline
cterm=underline
hi link twospace spacetab
hi midspace ctermfg=DarkRed guifg=#660000
gui=underline cterm=underline
else
hi link quadspace Normal
hi twospace ctermfg=DarkRed guifg=#770000
gui=underline cterm=underline
hi midspace ctermfg=Black guifg=#330000
gui=underline cterm=underline
endif
hi link quadstart quadspace
hi link onespace twospace
hi link freespace midspace
hi link offspace leadspace