1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 19:40:29 +01:00

Update for mark, sorcerer, vylight. Removed syntax for C files (which was the

base for pd_opl)
This commit is contained in:
2011-04-20 21:41:16 +02:00
parent f205f3b36d
commit 270fb29052
8 changed files with 239 additions and 495 deletions

View File

@@ -7,7 +7,7 @@ ScriptID SourceID Filename
311 7645 grep.vim 311 7645 grep.vim
3304 15211 gundo.vim 3304 15211 gundo.vim
2727 11120 jsbeautify.vim 2727 11120 jsbeautify.vim
2666 14741 Mark 2666 15477 Mark
2262 8944 occur.vim 2262 8944 occur.vim
910 14691 pydoc.vim 910 14691 pydoc.vim
#2421 9423 pysmell.vim #2421 9423 pysmell.vim
@@ -24,9 +24,15 @@ ScriptID SourceID Filename
1984 13961 :AutoInstall: FuzzyFinder 1984 13961 :AutoInstall: FuzzyFinder
3252 13948 :AutoInstall: L9 3252 13948 :AutoInstall: L9
### colors ### colors
1975 7471 lettuce.vim 2855 12456 github.vim
1143 11833 inkpot.vim
2555 15432 jellybeans.vim
2536 15197 lucius.vim 2536 15197 lucius.vim
3299 14475 sorcerer.vim
3309 14699 vydark
2589 14175 vylight
1165 3741 tolerable.vim 1165 3741 tolerable.vim
415 15463 zenburn
# compiler # compiler
891 10365 pylint.vim 891 10365 pylint.vim
# ftplugin # ftplugin
@@ -39,6 +45,7 @@ ScriptID SourceID Filename
# http://monkey.org/~caz/python.vim # http://monkey.org/~caz/python.vim
### syntax ### syntax
790 14268 python.vim 790 14268 python.vim
2651 10658 fitnesse.vim
### doc ### doc
3277 14056 py2stdlib 3277 14056 py2stdlib

View File

@@ -10,8 +10,44 @@
" Dependencies: " Dependencies:
" - SearchSpecial.vim autoload script (optional, for improved search messages). " - SearchSpecial.vim autoload script (optional, for improved search messages).
" "
" Version: 2.4.1 " Version: 2.4.4
" Changes: " Changes:
" 18-Apr-2011, Ingo Karkat
" - BUG: Include trailing newline character in check for current mark, so that a
" mark that matches the entire line (e.g. created by V<Leader>m) can be
" cleared via <Leader>n. Thanks to ping for reporting this.
" - Minor restructuring of mark#MarkCurrentWord().
" - FIX: On overlapping marks, mark#CurrentMark() returned the lowest, not the
" highest visible mark. So on overlapping marks, the one that was not visible
" at the cursor position was removed; very confusing! Use reverse iteration
" order.
" - FIX: To avoid an arbitrary ordering of highlightings when the highlighting
" group names roll over, and to avoid order inconsistencies across different
" windows and tabs, we assign a different priority based on the highlighting
" group.
" - Rename s:cycleMax to s:markNum; the previous name was too
" implementation-focused and off-by-one with regards to the actual value.
"
" 16-Apr-2011, Ingo Karkat
" - Move configuration variable g:mwHistAdd to plugin/mark.vim (as is customary)
" and make the remaining g:mw... variables script-local, as these contain
" internal housekeeping information that does not need to be accessible by the
" user.
"
" 15-Apr-2011, Ingo Karkat
" - Robustness: Move initialization of w:mwMatch from mark#UpdateMark() to
" s:MarkMatch(), where the variable is actually used. I had encountered cases
" where it w:mwMatch was undefined when invoked through mark#DoMark() ->
" s:MarkScope() -> s:MarkMatch(). This can be forced by :unlet w:mwMatch
" followed by :Mark foo.
" - Robustness: Checking for s:markNum == 0 in mark#DoMark(), trying to
" re-detect the mark highlightings and finally printing an error instead of
" choking. This can happen when somehow no mark highlightings are defined.
"
" 14-Jan-2011, Ingo Karkat
" - FIX: Capturing the visual selection could still clobber the blockwise yank
" mode of the unnamed register.
"
" 13-Jan-2011, Ingo Karkat " 13-Jan-2011, Ingo Karkat
" - FIX: Using a named register for capturing the visual selection on " - FIX: Using a named register for capturing the visual selection on
" {Visual}<Leader>m and {Visual}<Leader>r clobbered the unnamed register. Now " {Visual}<Leader>m and {Visual}<Leader>r clobbered the unnamed register. Now
@@ -71,14 +107,14 @@ endfunction
function! mark#MarkCurrentWord() function! mark#MarkCurrentWord()
let l:regexp = mark#CurrentMark()[0] let l:regexp = mark#CurrentMark()[0]
if empty(l:regexp) if empty(l:regexp)
let l:cword = expand("<cword>") let l:cword = expand('<cword>')
if ! empty(l:cword)
let l:regexp = s:EscapeText(l:cword)
" The star command only creates a \<whole word\> search pattern if the " The star command only creates a \<whole word\> search pattern if the
" <cword> actually only consists of keyword characters. " <cword> actually only consists of keyword characters.
if l:cword =~# '^\k\+$' if l:cword =~# '^\k\+$'
let l:regexp = '\<' . s:EscapeText(l:cword) . '\>' let l:regexp = '\<' . l:regexp . '\>'
elseif l:cword != '' endif
let l:regexp = s:EscapeText(l:cword)
endif endif
endif endif
@@ -90,10 +126,11 @@ endfunction
function! s:GetVisualSelection() function! s:GetVisualSelection()
let save_clipboard = &clipboard let save_clipboard = &clipboard
set clipboard= " Avoid clobbering the selection and clipboard registers. set clipboard= " Avoid clobbering the selection and clipboard registers.
let save_reg = @@ let save_reg = getreg('"')
let save_regmode = getregtype('"')
silent normal! gvy silent normal! gvy
let res = @@ let res = getreg('"')
let @@ = save_reg call setreg('"', save_reg, save_regmode)
let &clipboard = save_clipboard let &clipboard = save_clipboard
return res return res
endfunction endfunction
@@ -117,14 +154,18 @@ function! mark#MarkRegex( regexpPreset )
endfunction endfunction
function! s:Cycle( ... ) function! s:Cycle( ... )
let l:currentCycle = g:mwCycle let l:currentCycle = s:cycle
let l:newCycle = (a:0 ? a:1 : g:mwCycle) + 1 let l:newCycle = (a:0 ? a:1 : s:cycle) + 1
let g:mwCycle = (l:newCycle < g:mwCycleMax ? l:newCycle : 0) let s:cycle = (l:newCycle < s:markNum ? l:newCycle : 0)
return l:currentCycle return l:currentCycle
endfunction endfunction
" Set / clear matches in the current window. " Set match / clear matches in the current window.
function! s:MarkMatch( indices, expr ) function! s:MarkMatch( indices, expr )
if ! exists('w:mwMatch')
let w:mwMatch = repeat([0], s:markNum)
endif
for l:index in a:indices for l:index in a:indices
if w:mwMatch[l:index] > 0 if w:mwMatch[l:index] > 0
silent! call matchdelete(w:mwMatch[l:index]) silent! call matchdelete(w:mwMatch[l:index])
@@ -133,13 +174,21 @@ function! s:MarkMatch( indices, expr )
endfor endfor
if ! empty(a:expr) if ! empty(a:expr)
let l:index = a:indices[0] " Can only set one index for now.
" Info: matchadd() does not consider the 'magic' (it's always on),
" 'ignorecase' and 'smartcase' settings.
" Make the match according to the 'ignorecase' setting, like the star command. " Make the match according to the 'ignorecase' setting, like the star command.
" (But honor an explicit case-sensitive regexp via the /\C/ atom.) " (But honor an explicit case-sensitive regexp via the /\C/ atom.)
let l:expr = ((&ignorecase && a:expr !~# '\\\@<!\\C') ? '\c' . a:expr : a:expr) let l:expr = ((&ignorecase && a:expr !~# '\\\@<!\\C') ? '\c' . a:expr : a:expr)
" Info: matchadd() does not consider the 'magic' (it's always on), " To avoid an arbitrary ordering of highlightings, we assign a different
" 'ignorecase' and 'smartcase' settings. " priority based on the highlighting group, and ensure that the highest
let w:mwMatch[a:indices[0]] = matchadd('MarkWord' . (a:indices[0] + 1), l:expr, -10) " priority is -10, so that we do not override the 'hlsearch' of 0, and still
" allow other custom highlightings to sneak in between.
let l:priority = -10 - s:markNum + 1 + l:index
let w:mwMatch[l:index] = matchadd('MarkWord' . (l:index + 1), l:expr, l:priority)
endif endif
endfunction endfunction
" Set / clear matches in all windows. " Set / clear matches in all windows.
@@ -176,45 +225,58 @@ function! mark#DoMark(...) " DoMark(regexp)
if empty(regexp) if empty(regexp)
let i = 0 let i = 0
let indices = [] let indices = []
while i < g:mwCycleMax while i < s:markNum
if !empty(g:mwWord[i]) if !empty(s:pattern[i])
let g:mwWord[i] = '' let s:pattern[i] = ''
call add(indices, i) call add(indices, i)
endif endif
let i += 1 let i += 1
endwhile endwhile
let g:mwLastSearched = "" let s:lastSearch = ""
call s:MarkScope(l:indices, '') call s:MarkScope(l:indices, '')
return return
endif endif
" clear the mark if it has been marked " clear the mark if it has been marked
let i = 0 let i = 0
while i < g:mwCycleMax while i < s:markNum
if regexp == g:mwWord[i] if regexp == s:pattern[i]
if g:mwLastSearched == g:mwWord[i] if s:lastSearch == s:pattern[i]
let g:mwLastSearched = '' let s:lastSearch = ''
endif endif
let g:mwWord[i] = '' let s:pattern[i] = ''
call s:MarkScope([i], '') call s:MarkScope([i], '')
return return
endif endif
let i += 1 let i += 1
endwhile endwhile
" add to history if s:markNum <= 0
if stridx(g:mwHistAdd, "/") >= 0 " Uh, somehow no mark highlightings were defined. Try to detect them again.
call histadd("/", regexp) call s:InitMarkVariables()
if s:markNum <= 0
" Still no mark highlightings; complain.
let v:errmsg = 'No mark highlightings defined'
echohl ErrorMsg
echomsg v:errmsg
echohl None
return
endif endif
if stridx(g:mwHistAdd, "@") >= 0 endif
call histadd("@", regexp)
" add to history
if stridx(g:mwHistAdd, '/') >= 0
call histadd('/', regexp)
endif
if stridx(g:mwHistAdd, '@') >= 0
call histadd('@', regexp)
endif endif
" choose an unused mark group " choose an unused mark group
let i = 0 let i = 0
while i < g:mwCycleMax while i < s:markNum
if empty(g:mwWord[i]) if empty(s:pattern[i])
let g:mwWord[i] = regexp let s:pattern[i] = regexp
call s:Cycle(i) call s:Cycle(i)
call s:MarkScope([i], regexp) call s:MarkScope([i], regexp)
return return
@@ -224,43 +286,46 @@ function! mark#DoMark(...) " DoMark(regexp)
" choose a mark group by cycle " choose a mark group by cycle
let i = s:Cycle() let i = s:Cycle()
if g:mwLastSearched == g:mwWord[i] if s:lastSearch == s:pattern[i]
let g:mwLastSearched = '' let s:lastSearch = ''
endif endif
let g:mwWord[i] = regexp let s:pattern[i] = regexp
call s:MarkScope([i], regexp) call s:MarkScope([i], regexp)
endfunction endfunction
" Initialize mark colors in a (new) window. " Initialize mark colors in a (new) window.
function! mark#UpdateMark() function! mark#UpdateMark()
if ! exists('w:mwMatch')
let w:mwMatch = repeat([0], g:mwCycleMax)
endif
let i = 0 let i = 0
while i < g:mwCycleMax while i < s:markNum
if empty(g:mwWord[i]) if empty(s:pattern[i])
call s:MarkMatch([i], '') call s:MarkMatch([i], '')
else else
call s:MarkMatch([i], g:mwWord[i]) call s:MarkMatch([i], s:pattern[i])
endif endif
let i += 1 let i += 1
endwhile endwhile
endfunction endfunction
" Return [mark text, mark start position] of the mark under the cursor (or " Return [mark text, mark start position] of the mark under the cursor (or
" ['', []] if there is no mark); multi-lines marks not supported. " ['', []] if there is no mark).
" The mark can include the trailing newline character that concludes the line,
" but marks that span multiple lines are not supported.
function! mark#CurrentMark() function! mark#CurrentMark()
let line = getline(".") let line = getline('.') . "\n"
let i = 0
while i < g:mwCycleMax " Highlighting groups with higher numbers take precedence over lower numbers,
if !empty(g:mwWord[i]) " and therefore its marks appear "above" other marks. To retrieve the visible
" mark in case of overlapping marks, we need to check from highest to lowest
" highlighting group.
let i = s:markNum - 1
while i >= 0
if ! empty(s:pattern[i])
" Note: col() is 1-based, all other indexes zero-based! " Note: col() is 1-based, all other indexes zero-based!
let start = 0 let start = 0
while start >= 0 && start < strlen(line) && start < col(".") while start >= 0 && start < strlen(line) && start < col('.')
let b = match(line, g:mwWord[i], start) let b = match(line, s:pattern[i], start)
let e = matchend(line, g:mwWord[i], start) let e = matchend(line, s:pattern[i], start)
if b < col(".") && col(".") <= e if b < col('.') && col('.') <= e
return [g:mwWord[i], [line("."), (b + 1)]] return [s:pattern[i], [line('.'), (b + 1)]]
endif endif
if b == e if b == e
break break
@@ -268,7 +333,7 @@ function! mark#CurrentMark()
let start = e let start = e
endwhile endwhile
endif endif
let i += 1 let i -= 1
endwhile endwhile
return ['', []] return ['', []]
endfunction endfunction
@@ -277,15 +342,15 @@ endfunction
function! mark#SearchCurrentMark( isBackward ) function! mark#SearchCurrentMark( isBackward )
let [l:markText, l:markPosition] = mark#CurrentMark() let [l:markText, l:markPosition] = mark#CurrentMark()
if empty(l:markText) if empty(l:markText)
if empty(g:mwLastSearched) if empty(s:lastSearch)
call mark#SearchAnyMark(a:isBackward) call mark#SearchAnyMark(a:isBackward)
let g:mwLastSearched = mark#CurrentMark()[0] let s:lastSearch = mark#CurrentMark()[0]
else else
call s:Search(g:mwLastSearched, a:isBackward, [], 'same-mark') call s:Search(s:lastSearch, a:isBackward, [], 'same-mark')
endif endif
else else
call s:Search(l:markText, a:isBackward, l:markPosition, (l:markText ==# g:mwLastSearched ? 'same-mark' : 'new-mark')) call s:Search(l:markText, a:isBackward, l:markPosition, (l:markText ==# s:lastSearch ? 'same-mark' : 'new-mark'))
let g:mwLastSearched = l:markText let s:lastSearch = l:markText
endif endif
endfunction endfunction
@@ -436,7 +501,7 @@ endfunction
" Combine all marks into one regexp. " Combine all marks into one regexp.
function! s:AnyMark() function! s:AnyMark()
return join(filter(copy(g:mwWord), '! empty(v:val)'), '\|') return join(filter(copy(s:pattern), '! empty(v:val)'), '\|')
endfunction endfunction
" Search any mark. " Search any mark.
@@ -444,7 +509,7 @@ function! mark#SearchAnyMark( isBackward )
let l:markPosition = mark#CurrentMark()[1] let l:markPosition = mark#CurrentMark()[1]
let l:markText = s:AnyMark() let l:markText = s:AnyMark()
call s:Search(l:markText, a:isBackward, l:markPosition, 'any-mark') call s:Search(l:markText, a:isBackward, l:markPosition, 'any-mark')
let g:mwLastSearched = "" let s:lastSearch = ""
endfunction endfunction
" Search last searched mark. " Search last searched mark.
@@ -453,7 +518,7 @@ function! mark#SearchNext( isBackward )
if empty(l:markText) if empty(l:markText)
return 0 return 0
else else
if empty(g:mwLastSearched) if empty(s:lastSearch)
call mark#SearchAnyMark(a:isBackward) call mark#SearchAnyMark(a:isBackward)
else else
call mark#SearchCurrentMark(a:isBackward) call mark#SearchCurrentMark(a:isBackward)
@@ -472,25 +537,13 @@ augroup END
" Define global variables and initialize current scope. " Define global variables and initialize current scope.
function! s:InitMarkVariables() function! s:InitMarkVariables()
if !exists("g:mwHistAdd") let s:markNum = 0
let g:mwHistAdd = "/@" while hlexists('MarkWord' . (s:markNum + 1))
endif let s:markNum += 1
if !exists("g:mwCycleMax")
let i = 1
while hlexists("MarkWord" . i)
let i = i + 1
endwhile endwhile
let g:mwCycleMax = i - 1 let s:cycle = 0
endif let s:pattern = repeat([''], s:markNum)
if !exists("g:mwCycle") let s:lastSearch = ""
let g:mwCycle = 0
endif
if !exists("g:mwWord")
let g:mwWord = repeat([''], g:mwCycleMax)
endif
if !exists("g:mwLastSearched")
let g:mwLastSearched = ""
endif
endfunction endfunction
call s:InitMarkVariables() call s:InitMarkVariables()
call mark#UpdateScope() call mark#UpdateScope()

View File

@@ -24,7 +24,7 @@ hi DiffText guifg=#000000 guibg=#8ee5ee gui=NONE
hi Directory guifg=#1e90ff guibg=bg gui=NONE hi Directory guifg=#1e90ff guibg=bg gui=NONE
hi ErrorMsg guifg=#ff6a6a guibg=NONE gui=bold hi ErrorMsg guifg=#ff6a6a guibg=NONE gui=bold
hi FoldColumn guifg=#68838b guibg=#4B4B4B gui=bold hi FoldColumn guifg=#68838b guibg=#4B4B4B gui=bold
hi Folded guifg=#99aacc guibg=#40403c gui=NONE hi Folded guifg=#406060 guibg=#232c2c gui=NONE
hi IncSearch guifg=#ffffff guibg=#ff4500 gui=bold hi IncSearch guifg=#ffffff guibg=#ff4500 gui=bold
hi LineNr guifg=#686858 guibg=#000000 gui=NONE hi LineNr guifg=#686858 guibg=#000000 gui=NONE
hi MatchParen guifg=#fff000 guibg=#000000 gui=bold hi MatchParen guifg=#fff000 guibg=#000000 gui=bold

View File

@@ -2,8 +2,7 @@
" Vim colour file " Vim colour file
" "
" Maintainer: Vy-Shane Sin Fat <shane@node.mu> " Maintainer: Vy-Shane Sin Fat <shane@node.mu>
" Last Change: 20 November 2009 " Version: 1.3
" Version: 1.1
" "
" This colour file is meant for GUI use. " This colour file is meant for GUI use.
" "
@@ -16,24 +15,22 @@ endif
let g:colors_name="vylight" let g:colors_name="vylight"
hi Normal guifg=#1a1a1a guibg=white hi Normal guifg=#111111 guibg=white
hi Title guifg=black guibg=white hi Title guifg=black guibg=white
hi Cursor guibg=#111111 hi Cursor guibg=#FF7311
hi LineNr guifg=#aaaaaa guibg=#f8f8f8 hi LineNr guifg=#bebebe guibg=#f8f8f8
hi Visual guibg=#bbddff hi Visual guibg=#bbddff
hi NonText guifg=#cccccc guibg=#fafafa hi NonText guifg=#fafafa guibg=#fafafa
hi StatusLine guifg=#222222 guibg=#eeeeee gui=none hi StatusLine guifg=#222222 guibg=#eeeeee gui=none
hi StatusLineNC guifg=#666666 guibg=#eeeeee gui=none hi StatusLineNC guifg=#888888 guibg=#eeeeee gui=none
hi VertSplit guifg=#eeeeee guibg=#eeeeee gui=none hi VertSplit guifg=#eeeeee guibg=#eeeeee gui=none
hi ModeMsg guifg=#007050 guibg=#eeeeee gui=none hi ModeMsg guifg=black guibg=#bbddff gui=none
hi ErrorMsg guifg=#f03050 guibg=#eeeeee gui=none hi ErrorMsg guifg=black guibg=#ffbbbb gui=none
hi Error guifg=#bb3355 guibg=white gui=none hi Error guifg=#bb3355 guibg=white gui=none
" Vim 7.x specific " Vim 7.x specific
if version >= 700 if version >= 700
hi CursorLine guibg=#eeeeee gui=none
hi ColorColumn guibg=#efefef gui=none
hi MatchParen guibg=#ccffdd gui=none hi MatchParen guibg=#ccffdd gui=none
hi Pmenu guifg=#60656f guibg=#f0f5ff gui=none hi Pmenu guifg=#60656f guibg=#f0f5ff gui=none
hi PmenuSel guifg=white guibg=#3585ef gui=bold hi PmenuSel guifg=white guibg=#3585ef gui=bold
@@ -41,22 +38,23 @@ if version >= 700
hi PmenuThumb guifg=#e0e5ee guibg=#c0c5dd gui=bold hi PmenuThumb guifg=#e0e5ee guibg=#c0c5dd gui=bold
hi Search guibg=#fcfcaa gui=none hi Search guibg=#fcfcaa gui=none
hi IncSearch guibg=#ffff33 gui=bold hi IncSearch guibg=#ffff33 gui=bold
hi CursorLine guibg=#f1faff
hi ColorColumn guibg=#fafafa
endif endif
" Syntax highlighting " Syntax highlighting
hi Comment guifg=#668866 gui=none hi Comment guifg=#777777 gui=none
"hi Todo guifg=#225522 guibg=white gui=italic
hi Todo guifg=#446644 guibg=#ddeecc gui=italic hi Todo guifg=#446644 guibg=#ddeecc gui=italic
hi Operator guifg=#1a1a1a gui=none hi Operator guifg=#1a1a1a gui=none
hi Identifier guifg=#1a1a1a gui=none hi Identifier guifg=#1a1a1a gui=none
hi Statement guifg=#0050b0 gui=none hi Statement guifg=#1a1a1a gui=none
hi Type guifg=#0050b0 gui=none hi Type guifg=#0050b0 gui=none
hi Constant guifg=#204070 gui=none hi Constant guifg=#204070 gui=none
hi Conditional guifg=#006040 gui=none hi Conditional guifg=#006633 gui=none
hi Delimiter guifg=#1a1a1a gui=none hi Delimiter guifg=#1a1a1a gui=none
hi PreProc guifg=#007050 gui=none hi PreProc guifg=#006633 gui=none
hi Special guifg=#a05050 gui=none hi Special guifg=#006633 gui=none
hi Keyword guifg=#007050 gui=none hi Keyword guifg=#007050 gui=none
hi link Function Normal hi link Function Normal
@@ -68,7 +66,7 @@ hi link Float Number
hi link Repeat Conditional hi link Repeat Conditional
hi link Label Statement hi link Label Statement
hi link Exception Statement hi link Exception Statement
hi link Include PreProc hi link Include Normal
hi link Define PreProc hi link Define PreProc
hi link Macro PreProc hi link Macro PreProc
hi link PreCondit PreProc hi link PreCondit PreProc

View File

@@ -40,23 +40,35 @@ RELATED WORKS *
- http://vim.wikia.com/wiki/Highlight_multiple_words offers control over the - http://vim.wikia.com/wiki/Highlight_multiple_words offers control over the
color used by mapping the 1-9 keys on the numeric keypad, persistence, and color used by mapping the 1-9 keys on the numeric keypad, persistence, and
highlights only a single window. highlights only a single window.
- highlight.vim (vimscript #1599) highlights lines or patterns of interest in
different colors, using mappings that start with CTRL-H and work on cword.
============================================================================== ==============================================================================
USAGE *mark-usage* USAGE *mark-usage*
HIGHLIGHTING *mark-highlighting* HIGHLIGHTING *mark-highlighting*
*<Leader>m* *v_<Leader>m* *<Leader>m* *v_<Leader>m*
<Leader>m Mark or unmark the word under the cursor, similar to <Leader>m Mark the word under the cursor, similar to the |star|
the |star| command. command. The next free highlight group is used.
If already on a mark: Clear the mark, like
|<Leader>n|.
{Visual}<Leader>m Mark or unmark the visual selection. {Visual}<Leader>m Mark or unmark the visual selection.
*<Leader>r* *v_<Leader>r* *<Leader>r* *v_<Leader>r*
<Leader>r Manually input a regular expression to highlight. <Leader>r Manually input a regular expression to mark.
{Visual}<Leader>r (Based on the visual selection.) {Visual}<Leader>r (Based on the visual selection.)
In accordance with the built-in |star| command, In accordance with the built-in |star| command,
all these mappings use 'ignorecase', but not all these mappings use 'ignorecase', but not
'smartcase'. 'smartcase'.
*<Leader>n* *<Leader>n*
<Leader>n Clear the mark under the cursor / all marks. <Leader>n Clear the mark under the cursor.
If not on a mark: Clear all marks.
Note: Marks that span multiple lines are not detected,
so the use of <Leader>n on such a mark will
unintentionally remove all marks! Use
{Visual}<Leader>r or :Mark {pattern} to clear
multi-line marks.
*:Mark* *:Mark*
:Mark {pattern} Mark or unmark {pattern}. :Mark {pattern} Mark or unmark {pattern}.
For implementation reasons, {pattern} cannot use the For implementation reasons, {pattern} cannot use the
@@ -119,13 +131,14 @@ You may define your own colors or more than the default 6 highlightings in
your vimrc file (or anywhere before this plugin is sourced), in the following your vimrc file (or anywhere before this plugin is sourced), in the following
form (where N = 1..): > form (where N = 1..): >
highlight MarkWordN ctermbg=Cyan ctermfg=Black guibg=#8CCBEA guifg=Black highlight MarkWordN ctermbg=Cyan ctermfg=Black guibg=#8CCBEA guifg=Black
< Higher numbers always take precedence and are displayed above lower ones.
The search type highlighting (in the search message) can be changed via: > The search type highlighting (in the search message) can be changed via: >
highlight link SearchSpecialSearchType MoreMsg highlight link SearchSpecialSearchType MoreMsg
< < *g:mwHistAdd*
By default, any marked words are also added to the search (/) and input (@) By default, any marked words are also added to the search (/) and input (@)
history; if you don't want that, remove the corresponding symbols from: > history; if you don't want that, remove the corresponding symbols from: >
let g:mwHistAdd = "/@" let g:mwHistAdd = '/@'
< <
You can use different mappings by mapping to the <Plug>Mark... mappings before You can use different mappings by mapping to the <Plug>Mark... mappings before
this plugin is sourced. To remove the default overriding of * and #, use: > this plugin is sourced. To remove the default overriding of * and #, use: >
@@ -164,6 +177,32 @@ http://vim.wikia.com/wiki/Highlight_multiple_words:
============================================================================== ==============================================================================
HISTORY *mark-history* HISTORY *mark-history*
2.4.4 18-Apr-2011
- BUG: Include trailing newline character in check for current mark, so that a
mark that matches the entire line (e.g. created by V<Leader>m) can be
cleared via <Leader>n. Thanks to ping for reporting this.
- FIX: On overlapping marks, mark#CurrentMark() returned the lowest, not the
highest visible mark. So on overlapping marks, the one that was not visible
at the cursor position was removed; very confusing! Use reverse iteration
order.
- FIX: To avoid an arbitrary ordering of highlightings when the highlighting
group names roll over, and to avoid order inconsistencies across different
windows and tabs, we assign a different priority based on the highlighting
group.
2.4.3 16-Apr-2011
- Avoid losing the mark highlightings on :syn on or :colorscheme commands.
Thanks to Zhou YiChao for alerting me to this issue and suggesting a fix.
- Made the script more robust when somehow no highlightings have been defined
or when the window-local reckoning of match IDs got lost. I had very
occasionally encountered such script errors in the past.
- Made global housekeeping variables script-local, only g:mwHistAdd is used
for configuration.
2.4.2 14-Jan-2011 (unreleased)
- FIX: Capturing the visual selection could still clobber the blockwise yank
mode of the unnamed register.
2.4.1 13-Jan-2011 2.4.1 13-Jan-2011
- FIX: Using a named register for capturing the visual selection on - FIX: Using a named register for capturing the visual selection on
{Visual}<Leader>m and {Visual}<Leader>r clobbered the unnamed register. Now {Visual}<Leader>m and {Visual}<Leader>r clobbered the unnamed register. Now

View File

@@ -365,6 +365,7 @@ g:loremipsum_files loremipsum.txt /*g:loremipsum_files*
g:loremipsum_marker loremipsum.txt /*g:loremipsum_marker* g:loremipsum_marker loremipsum.txt /*g:loremipsum_marker*
g:loremipsum_paragraph_template loremipsum.txt /*g:loremipsum_paragraph_template* g:loremipsum_paragraph_template loremipsum.txt /*g:loremipsum_paragraph_template*
g:loremipsum_words loremipsum.txt /*g:loremipsum_words* g:loremipsum_words loremipsum.txt /*g:loremipsum_words*
g:mwHistAdd mark.txt /*g:mwHistAdd*
g:snippets_dir snipMate.txt /*g:snippets_dir* g:snippets_dir snipMate.txt /*g:snippets_dir*
g:snips_author snipMate.txt /*g:snips_author* g:snips_author snipMate.txt /*g:snips_author*
g:tagbar_autoclose tagbar.txt /*g:tagbar_autoclose* g:tagbar_autoclose tagbar.txt /*g:tagbar_autoclose*

View File

@@ -2,7 +2,7 @@
" Description: Highlight several words in different colors simultaneously. " Description: Highlight several words in different colors simultaneously.
" "
" Copyright: (C) 2005-2008 by Yuheng Xie " Copyright: (C) 2005-2008 by Yuheng Xie
" (C) 2008-2009 by Ingo Karkat " (C) 2008-2011 by Ingo Karkat
" The VIM LICENSE applies to this script; see ':help copyright'. " The VIM LICENSE applies to this script; see ':help copyright'.
" "
" Maintainer: Ingo Karkat <ingo@karkat.de> " Maintainer: Ingo Karkat <ingo@karkat.de>
@@ -13,8 +13,12 @@
" - Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher. " - Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher.
" - mark.vim autoload script. " - mark.vim autoload script.
" "
" Version: 2.3.2 " Version: 2.4.3
" Changes: " Changes:
" 15-Apr-2011, Ingo Karkat
" - Avoid losing the mark highlightings on :syn on or :colorscheme commands.
" Thanks to Zhou YiChao for alerting me to this issue and suggesting a fix.
"
" 17-Nov-2009, Ingo Karkat " 17-Nov-2009, Ingo Karkat
" - Replaced the (overly) generic mark#GetVisualSelectionEscaped() with " - Replaced the (overly) generic mark#GetVisualSelectionEscaped() with
" mark#GetVisualSelectionAsRegexp() and " mark#GetVisualSelectionAsRegexp() and
@@ -133,7 +137,14 @@ if exists('g:loaded_mark') || (v:version == 701 && ! exists('*matchadd')) || (v:
endif endif
let g:loaded_mark = 1 let g:loaded_mark = 1
"- configuration --------------------------------------------------------------
if !exists('g:mwHistAdd')
let g:mwHistAdd = '/@'
endif
"- default highlightings ------------------------------------------------------ "- default highlightings ------------------------------------------------------
function! s:DefaultHighlightings()
" You may define your own colors in your vimrc file, in the form as below: " You may define your own colors in your vimrc file, in the form as below:
highlight def MarkWord1 ctermbg=Cyan ctermfg=Black guibg=#8CCBEA guifg=Black highlight def MarkWord1 ctermbg=Cyan ctermfg=Black guibg=#8CCBEA guifg=Black
highlight def MarkWord2 ctermbg=Green ctermfg=Black guibg=#A4E57E guifg=Black highlight def MarkWord2 ctermbg=Green ctermfg=Black guibg=#A4E57E guifg=Black
@@ -141,6 +152,9 @@ highlight def MarkWord3 ctermbg=Yellow ctermfg=Black guibg=#FFDB72 guifg=
highlight def MarkWord4 ctermbg=Red ctermfg=Black guibg=#FF7272 guifg=Black highlight def MarkWord4 ctermbg=Red ctermfg=Black guibg=#FF7272 guifg=Black
highlight def MarkWord5 ctermbg=Magenta ctermfg=Black guibg=#FFB3FF guifg=Black highlight def MarkWord5 ctermbg=Magenta ctermfg=Black guibg=#FFB3FF guifg=Black
highlight def MarkWord6 ctermbg=Blue ctermfg=Black guibg=#9999FF guifg=Black highlight def MarkWord6 ctermbg=Blue ctermfg=Black guibg=#9999FF guifg=Black
endfunction
call s:DefaultHighlightings()
autocmd ColorScheme * call <SID>DefaultHighlightings()
" Default highlighting for the special search type. " Default highlighting for the special search type.
" You can override this by defining / linking the 'SearchSpecialSearchType' " You can override this by defining / linking the 'SearchSpecialSearchType'

View File

@@ -1,368 +0,0 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2008 Mar 19
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" A bunch of useful C keywords
syn keyword cStatement goto break return continue asm
syn keyword cLabel case default
syn keyword cConditional if else switch
syn keyword cRepeat while for do
syn keyword cTodo contained TODO FIXME XXX
" cCommentGroup allows adding matches for special things in comments
syn cluster cCommentGroup contains=cTodo
" String and Character constants
" Highlight special characters (those which have a backslash) differently
syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
if !exists("c_no_utf")
syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)"
endif
if exists("c_no_cformat")
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell
" cCppString: same as cString, but ends at end of line
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,@Spell
else
if !exists("c_no_c99") " ISO C99
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
else
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
endif
syn match cFormat display "%%" contained
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell
" cCppString: same as cString, but ends at end of line
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
endif
syn match cCharacter "L\='[^\\]'"
syn match cCharacter "L'[^']*'" contains=cSpecial
if exists("c_gnu")
syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'"
syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'"
else
syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'"
syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
endif
syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
syn match cSpecialCharacter display "'\\x\x\{1,2}'"
syn match cSpecialCharacter display "L'\\x\x\+'"
"when wanted, highlight trailing white space
if exists("c_space_errors")
if !exists("c_no_trail_space_error")
syn match cSpaceError display excludenl "\s\+$"
endif
if !exists("c_no_tab_space_error")
syn match cSpaceError display " \+\t"me=e-1
endif
endif
" This should be before cErrInParen to avoid problems with #define ({ xxx })
if exists("c_curly_error")
syntax match cCurlyError "}"
syntax region cBlock start="{" end="}" contains=ALLBUT,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell fold
else
syntax region cBlock start="{" end="}" transparent fold
endif
"catch errors caused by wrong parenthesis and brackets
" also accept <% for {, %> for }, <: for [ and :> for ] (C99)
" But avoid matching <::.
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
if exists("c_no_curly_error")
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
syn match cParenError display ")"
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
elseif exists("c_no_bracket_error")
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
syn match cParenError display ")"
syn match cErrInParen display contained "[{}]\|<%\|%>"
else
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
syn match cParenError display "[\])]"
syn match cErrInParen display contained "[\]{}]\|<%\|%>"
syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
" cCppBracket: same as cParen but ends at end-of-line; used in cDefine
syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
endif
"integer number, or floating point number without a dot and with "f".
syn case ignore
syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctalError,cOctal
" Same, but without octal error (for comments)
syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctal
syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
"hex number
syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
" Flag the first zero of an octal number as something special
syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
syn match cOctalZero display contained "\<0"
syn match cFloat display contained "\d\+f"
"floating point number, with dot, optional exponent
syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
"floating point number, starting with a dot, optional exponent
syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
"floating point number, without dot, with exponent
syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
if !exists("c_no_c99")
"hexadecimal floating point number, optional leading digits, with dot, with exponent
syn match cFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>"
"hexadecimal floating point number, with leading digits, optional dot, with exponent
syn match cFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>"
endif
" flag an octal number with wrong digits
syn match cOctalError display contained "0\o*[89]\d*"
syn case match
if exists("c_comment_strings")
" A comment can contain cString, cCharacter and cNumber.
" But a "*/" inside a cString in a cComment DOES end the comment! So we
" need to use a special type of cString: cCommentString, which also ends on
" "*/", and sees a "*" at the start of the line as comment again.
" Unfortunately this doesn't very well work for // type of comments :-(
syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)"
syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
if exists("c_no_comment_fold")
" Use "extend" here to have preprocessor lines not terminate halfway a
" comment.
syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
else
syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
endif
else
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell
if exists("c_no_comment_fold")
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend
else
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold extend
endif
endif
" keep a // comment separately, it terminates a preproc. conditional
syntax match cCommentError display "\*/"
syntax match cCommentStartError display "/\*"me=e-1 contained
syn keyword cOperator sizeof
if exists("c_gnu")
syn keyword cStatement __asm__
syn keyword cOperator typeof __real__ __imag__
endif
syn keyword cType int long short char void
syn keyword cType signed unsigned float double
if !exists("c_no_ansi") || exists("c_ansi_typedefs")
syn keyword cType size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t
syn keyword cType clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t
syn keyword cType mbstate_t wctrans_t wint_t wctype_t
endif
if !exists("c_no_c99") " ISO C99
syn keyword cType bool complex
syn keyword cType int8_t int16_t int32_t int64_t
syn keyword cType uint8_t uint16_t uint32_t uint64_t
syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t
syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t
syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t
syn keyword cType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
syn keyword cType intptr_t uintptr_t
syn keyword cType intmax_t uintmax_t
endif
if exists("c_gnu")
syn keyword cType __label__ __complex__ __volatile__
endif
syn keyword cStructure struct union enum typedef
syn keyword cStorageClass static register auto volatile extern const
if exists("c_gnu")
syn keyword cStorageClass inline __attribute__
endif
if !exists("c_no_c99")
syn keyword cStorageClass inline restrict
endif
if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
if exists("c_gnu")
syn keyword cConstant __GNUC__ __FUNCTION__ __PRETTY_FUNCTION__ __func__
endif
syn keyword cConstant __LINE__ __FILE__ __DATE__ __TIME__ __STDC__
syn keyword cConstant __STDC_VERSION__
syn keyword cConstant CHAR_BIT MB_LEN_MAX MB_CUR_MAX
syn keyword cConstant UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
syn keyword cConstant CHAR_MIN INT_MIN LONG_MIN SHRT_MIN
syn keyword cConstant CHAR_MAX INT_MAX LONG_MAX SHRT_MAX
syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN
syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX
if !exists("c_no_c99")
syn keyword cConstant __func__
syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX
syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN
syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX
syn keyword cConstant UINT8_MAX UINT16_MAX UINT32_MAX UINT64_MAX
syn keyword cConstant INT_LEAST8_MIN INT_LEAST16_MIN INT_LEAST32_MIN INT_LEAST64_MIN
syn keyword cConstant INT_LEAST8_MAX INT_LEAST16_MAX INT_LEAST32_MAX INT_LEAST64_MAX
syn keyword cConstant UINT_LEAST8_MAX UINT_LEAST16_MAX UINT_LEAST32_MAX UINT_LEAST64_MAX
syn keyword cConstant INT_FAST8_MIN INT_FAST16_MIN INT_FAST32_MIN INT_FAST64_MIN
syn keyword cConstant INT_FAST8_MAX INT_FAST16_MAX INT_FAST32_MAX INT_FAST64_MAX
syn keyword cConstant UINT_FAST8_MAX UINT_FAST16_MAX UINT_FAST32_MAX UINT_FAST64_MAX
syn keyword cConstant INTPTR_MIN INTPTR_MAX UINTPTR_MAX
syn keyword cConstant INTMAX_MIN INTMAX_MAX UINTMAX_MAX
syn keyword cConstant PTRDIFF_MIN PTRDIFF_MAX SIG_ATOMIC_MIN SIG_ATOMIC_MAX
syn keyword cConstant SIZE_MAX WCHAR_MIN WCHAR_MAX WINT_MIN WINT_MAX
endif
syn keyword cConstant FLT_RADIX FLT_ROUNDS
syn keyword cConstant FLT_DIG FLT_MANT_DIG FLT_EPSILON
syn keyword cConstant DBL_DIG DBL_MANT_DIG DBL_EPSILON
syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON
syn keyword cConstant FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP
syn keyword cConstant FLT_MIN_10_EXP FLT_MAX_10_EXP
syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP
syn keyword cConstant DBL_MIN_10_EXP DBL_MAX_10_EXP
syn keyword cConstant LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP
syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP
syn keyword cConstant HUGE_VAL CLOCKS_PER_SEC NULL
syn keyword cConstant LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY
syn keyword cConstant LC_NUMERIC LC_TIME
syn keyword cConstant SIG_DFL SIG_ERR SIG_IGN
syn keyword cConstant SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM
" Add POSIX signals as well...
syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP
syn keyword cConstant SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV
syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU
syn keyword cConstant SIGUSR1 SIGUSR2
syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF WEOF
syn keyword cConstant FOPEN_MAX FILENAME_MAX L_tmpnam
syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET
syn keyword cConstant TMP_MAX stderr stdin stdout
syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX
" Add POSIX errors as well
syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY
syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT
syn keyword cConstant EFBIG EILSEQ EINPROGRESS EINTR EINVAL EIO EISDIR
syn keyword cConstant EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENFILE ENODEV
syn keyword cConstant ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS
syn keyword cConstant ENOTDIR ENOTEMPTY ENOTSUP ENOTTY ENXIO EPERM
syn keyword cConstant EPIPE ERANGE EROFS ESPIPE ESRCH ETIMEDOUT EXDEV
" math.h
syn keyword cConstant M_E M_LOG2E M_LOG10E M_LN2 M_LN10 M_PI M_PI_2 M_PI_4
syn keyword cConstant M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2
endif
if !exists("c_no_c99") " ISO C99
syn keyword cConstant true false
endif
" Accept %: for # (C99)
syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
if !exists("c_no_if0")
if !exists("c_no_if0_fold")
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2 fold
else
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2
endif
syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip
syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip
endif
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match cIncluded display contained "<[^>]*>"
syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
"syn match cLineSkip "\\$"
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti
syn region cDefine start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 keepend contains=ALLBUT,@cPreProcGroup,@Spell
syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
" Highlight User Labels
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
syn cluster cLabelGroup contains=cUserLabel
syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup
syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup
syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
syn match cUserLabel display "\I\i*" contained
" Avoid recognizing most bitfields as labels
syn match cBitField display "^\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
syn match cBitField display ";\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
if exists("c_minlines")
let b:c_minlines = c_minlines
else
if !exists("c_no_if0")
let b:c_minlines = 50 " #if 0 constructs can be long
else
let b:c_minlines = 15 " mostly for () constructs
endif
endif
if exists("c_curly_error")
syn sync fromstart
else
exec "syn sync ccomment cComment minlines=" . b:c_minlines
endif
" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link cFormat cSpecial
hi def link cCppString cString
hi def link cCommentL cComment
hi def link cCommentStart cComment
hi def link cLabel Label
hi def link cUserLabel Label
hi def link cConditional Conditional
hi def link cRepeat Repeat
hi def link cCharacter Character
hi def link cSpecialCharacter cSpecial
hi def link cNumber Number
hi def link cOctal Number
hi def link cOctalZero PreProc " link this to Error if you want
hi def link cFloat Float
hi def link cOctalError cError
hi def link cParenError cError
hi def link cErrInParen cError
hi def link cErrInBracket cError
hi def link cCommentError cError
hi def link cCommentStartError cError
hi def link cSpaceError cError
hi def link cSpecialError cError
hi def link cCurlyError cError
hi def link cOperator Operator
hi def link cStructure Structure
hi def link cStorageClass StorageClass
hi def link cInclude Include
hi def link cPreProc PreProc
hi def link cDefine Macro
hi def link cIncluded cString
hi def link cError Error
hi def link cStatement Statement
hi def link cPreCondit PreCondit
hi def link cType Type
hi def link cConstant Constant
hi def link cCommentString cString
hi def link cComment2String cString
hi def link cCommentSkip cComment
hi def link cString String
hi def link cComment Comment
hi def link cSpecial SpecialChar
hi def link cTodo Todo
hi def link cCppSkip cCppOut
hi def link cCppOut2 cCppOut
hi def link cCppOut Comment
let b:current_syntax = "c"
" vim: ts=8