1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-18 03:50:30 +01:00

Update of plugins: mark, ctrlp, taglisttoo and syntastic

This commit is contained in:
2012-04-01 19:42:57 +02:00
parent 1178b8be6d
commit f378edfbcb
17 changed files with 423 additions and 241 deletions

View File

@@ -14,6 +14,7 @@ fu! s:opts()
\ 'g:ctrlp_by_filename': ['s:byfname', 0],
\ 'g:ctrlp_clear_cache_on_exit': ['s:clrex', 1],
\ 'g:ctrlp_custom_ignore': ['s:usrign', ''],
\ 'g:ctrlp_default_input': ['s:deftxt', 0],
\ 'g:ctrlp_dont_split': ['s:nosplit', 'netrw'],
\ 'g:ctrlp_dotfiles': ['s:dotfiles', 1],
\ 'g:ctrlp_extensions': ['s:extensions', []],
@@ -58,7 +59,6 @@ fu! s:opts()
let s:glob = s:dotfiles ? '.*\|*' : '*'
let s:igntype = empty(s:usrign) ? -1 : type(s:usrign)
" Extensions
let g:ctrlp_builtins = 2
for each in s:extensions
exe 'ru autoload/ctrlp/'.each.'.vim'
endfo
@@ -173,6 +173,7 @@ let s:hlgrps = {
fu! s:Open()
cal s:log(1)
cal s:getenv()
cal s:execextvar('enter')
sil! exe 'noa keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP'
let [s:bufnr, s:prompt, s:winw] = [bufnr('%'), ['', '', ''], winwidth(0)]
abc <buffer>
@@ -204,7 +205,7 @@ fu! s:Close()
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
\ g:ctrlp_nolimit
cal ctrlp#recordhist()
cal s:extvar('exit')
cal s:execextvar('exit')
cal s:log(0)
ec
endf
@@ -228,7 +229,7 @@ fu! ctrlp#reset()
cal s:autocmds()
cal ctrlp#utils#opts()
cal ctrlp#mrufiles#opts()
cal s:extvar('opts')
cal s:execextvar('opts')
endf
" * Files {{{1
fu! ctrlp#files()
@@ -318,16 +319,15 @@ fu! ctrlp#buffers()
endf
" * MatchedItems() {{{1
fu! s:MatchIt(items, pat, limit, mfunc, ipt, exc)
let [newitems, id, itlen] = [[], 0, len(a:items)]
wh id < itlen
let item = a:items[id]
let [newitems, id] = [[], 0]
for item in a:items
let id += 1
try | if !( a:ipt && item == a:exc ) && call(a:mfunc, [item, a:pat]) >= 0
cal add(newitems, item)
en | cat | brea | endt
if a:limit > 0 && len(newitems) >= a:limit | brea | en
endw
let s:mdata = [s:dyncwd, s:itemtype, s:regexp, a:items[(id):]]
endfo
let s:mdata = [s:dyncwd, s:itemtype, s:regexp, s:sublist(a:items, id, -1)]
retu newitems
endf
@@ -387,21 +387,22 @@ fu! s:Render(lines, pat, ipt)
sil! exe '%d _ | res' s:height
" Print the new items
if empty(lines)
let s:matched = []
let [s:matched, s:lines] = [[], []]
cal setline(1, ' == NO ENTRIES ==')
setl noma nocul
cal s:unmarksigns()
if s:dohighlight() | cal clearmatches() | en
retu
en
if ( ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') )
\ || s:prompt != ['', '', ''] ) && s:matcher == {}
" Sorting
if s:dosort()
let s:compat = a:pat
cal sort(lines, 's:mixedsort')
unl s:compat
en
if s:mwreverse | cal reverse(lines) | en
let s:matched = copy(lines)
if s:mwreverse | cal reverse(lines) | en
let s:lines = copy(lines)
cal map(lines, 's:formatline(v:val, a:ipt)')
cal setline(1, lines)
setl noma cul
@@ -463,6 +464,17 @@ fu! s:BuildPrompt(upd, ...)
exe 'echoh' hibase '| echon "_" | echoh None'
en
endf
" - SetDefTxt() {{{1
fu! s:SetDefTxt()
if s:deftxt == '0' || s:pathmode == 1 | retu | en
let txt = s:deftxt
if !type(txt)
let txt = txt && !stridx(s:crfpath, s:dyncwd)
\ ? ctrlp#rmbasedir([s:crfpath])[0] : ''
let txt = txt != '' ? txt.s:lash(s:crfpath) : ''
en
let s:prompt[0] = txt
endf
" ** Prt Actions {{{1
" Editing {{{2
fu! s:PrtClear()
@@ -506,16 +518,20 @@ endf
fu! s:PrtInsert(type)
unl! s:hstgot
let s:act_add = 1
let s:prompt[0] .= a:type == 'w' ? s:crword
\ : a:type == 's' ? getreg('/')
\ : a:type == 'v' ? s:crvisual
\ : a:type == '+' ? substitute(getreg('+'), '\n', '\\n', 'g') : s:prompt[0]
cal s:BuildPrompt(1)
unl s:act_add
endf
fu! s:PrtExpandDir()
let prt = s:prompt
if prt[0] == '' | retu | en
unl! s:hstgot
let s:act_add = 1
let [base, seed] = s:headntail(prt[0])
let dirs = s:dircompl(base, seed)
if len(dirs) == 1
@@ -524,6 +540,7 @@ fu! s:PrtExpandDir()
let prt[0] .= s:findcommon(dirs, prt[0])
en
cal s:BuildPrompt(1)
unl s:act_add
endf
" Movement {{{2
fu! s:PrtCurLeft()
@@ -562,7 +579,7 @@ fu! s:PrtSelectMove(dir)
endf
fu! s:PrtSelectJump(char, ...)
let lines = copy(s:matched)
let lines = copy(s:lines)
if a:0
cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]')
en
@@ -804,7 +821,7 @@ fu! s:AcceptSelection(mode)
let str = join(s:prompt, '')
if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en
" Get the selected line
let line = !empty(s:matched) ? s:matched[line('.') - 1] : ''
let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
if a:mode != 'e' && s:itemtype < 3 && line == ''
\ && str !~ '\v^(\.\.|/|\\|\?)$'
cal s:CreateNewFile(a:mode) | retu
@@ -852,7 +869,7 @@ fu! s:MarkToOpen()
if s:bufnr <= 0 || s:opmul == '0' || ( s:itemtype > 2 && s:type() !~ 'rts' )
retu
en
let line = !empty(s:matched) ? s:matched[line('.') - 1] : ''
let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
if empty(line) | retu | en
let filpath = fnamemodify(line, ':p')
if exists('s:marked') && s:dictindex(s:marked, filpath) > 0
@@ -1260,8 +1277,8 @@ endf
fu! s:remarksigns()
if !s:dosigns() | retu | en
for ic in range(1, len(s:matched))
let key = s:dictindex(s:marked, fnamemodify(s:matched[ic - 1], ':p'))
for ic in range(1, len(s:lines))
let key = s:dictindex(s:marked, fnamemodify(s:lines[ic - 1], ':p'))
if key > 0
exe 'sign place' key 'line='.ic.' name=ctrlpmark buffer='.s:bufnr
en
@@ -1271,7 +1288,7 @@ endf
fu! s:dosigns()
retu exists('s:marked') && s:bufnr > 0 && s:opmul != '0' && has('signs')
endf
" Dictionaries {{{2
" Lists & Dictionaries {{{2
fu! s:dictindex(dict, expr)
for key in keys(a:dict)
if a:dict[key] == a:expr | retu key | en
@@ -1282,6 +1299,10 @@ endf
fu! s:vacantdict(dict)
retu filter(range(1, max(keys(a:dict))), '!has_key(a:dict, v:val)')
endf
fu! s:sublist(l, s, e)
retu v:version > 701 ? a:l[(a:s):(a:e)] : remove(copy(a:l), a:s, a:e)
endf
" Buffers {{{2
fu! s:buftab(bufnr, md)
for tabnr in range(1, tabpagenr('$'))
@@ -1374,66 +1395,17 @@ fu! s:argmaps(md, ...)
retu a:md
endf
" Misc {{{2
fu! s:dosort()
retu s:matcher == {} && ( ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') )
\ || s:prompt != ['', '', ''] ) && s:getextvar('sort')
endf
fu! s:narrowable()
retu exists('s:act_add') && exists('s:matched') && s:matched != []
\ && exists('s:mdata') && s:mdata[:2] == [s:dyncwd, s:itemtype, s:regexp]
\ && s:matcher == {}
endf
fu! s:matargs(mfunc, str)
let match_type = {
\ 'match': 'full-line',
\ 's:matchfname': 'filename-only',
\ 's:matchtabs': 'first-non-tab',
\ 's:matchtabe': 'until-last-tab',
\ }
retu [s:matcher['match'], a:str, match_type[a:mfunc]]
endf
fu! s:log(m)
if exists('g:ctrlp_log') && g:ctrlp_log | if a:m
let cadir = ctrlp#utils#cachedir()
sil! exe 'redi! >' cadir.s:lash(cadir).'ctrlp.log'
el
sil! redi END
en | en
endf
fu! s:strwidth(str)
retu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str)
endf
fu! s:getenv()
let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]]
let [s:crfile, s:crfpath] = [expand('%:p', 1), expand('%:p:h', 1)]
let [s:crword, s:crline] = [expand('<cword>'), getline('.')]
let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')]
let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()]
let s:currwin = s:mwbottom ? winnr() : winnr() + has('autocmd')
let s:wpmode = exists('b:ctrlp_working_path_mode')
\ ? b:ctrlp_working_path_mode : s:pathmode
if exists('g:ctrlp_extensions')
if index(g:ctrlp_extensions, 'undo') >= 0
let s:undos = s:getundo()
en
if index(g:ctrlp_extensions, 'tag') >= 0
let s:tagfiles = s:tagfiles()
en
en
endf
fu! s:lastvisual()
let cview = winsaveview()
let [ovreg, ovtype] = [getreg('v'), getregtype('v')]
let [oureg, outype] = [getreg('"'), getregtype('"')]
sil! norm! gv"vy
let selected = substitute(getreg('v'), '\n', '\\n', 'g')
cal setreg('v', ovreg, ovtype)
cal setreg('"', oureg, outype)
cal winrestview(cview)
retu selected
endf
fu! s:migemo(str)
let str = a:str
let dict = s:glbpath(&rtp, printf("dict/%s/migemo-dict", &enc), 1)
@@ -1450,6 +1422,73 @@ fu! s:migemo(str)
retu str
endf
fu! s:strwidth(str)
retu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str)
endf
fu! ctrlp#j2l(nr)
exe a:nr
sil! norm! zvzz
endf
fu! s:maxf(len)
retu s:maxfiles && a:len > s:maxfiles ? 1 : 0
endf
fu! s:regexfilter(str)
let str = a:str
for key in keys(s:fpats) | if match(str, key) >= 0
let str = substitute(str, s:fpats[key], '', 'g')
en | endfo
retu str
endf
fu! s:walker(m, p, d)
retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
endf
fu! s:matargs(mfunc, str)
let match_type = {
\ 'match': 'full-line',
\ 's:matchfname': 'filename-only',
\ 's:matchtabs': 'first-non-tab',
\ 's:matchtabe': 'until-last-tab',
\ }
retu [s:matcher['match'], a:str, match_type[a:mfunc]]
endf
" Entering & Exiting {{{2
fu! s:getenv()
let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]]
let [s:crfile, s:crfpath] = [expand('%:p', 1), expand('%:p:h', 1)]
let [s:crword, s:crline] = [expand('<cword>'), getline('.')]
let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')]
let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()]
let s:currwin = s:mwbottom ? winnr() : winnr() + has('autocmd')
let s:wpmode = exists('b:ctrlp_working_path_mode')
\ ? b:ctrlp_working_path_mode : s:pathmode
endf
fu! s:lastvisual()
let cview = winsaveview()
let [ovreg, ovtype] = [getreg('v'), getregtype('v')]
let [oureg, outype] = [getreg('"'), getregtype('"')]
sil! norm! gv"vy
let selected = substitute(getreg('v'), '\n', '\\n', 'g')
cal setreg('v', ovreg, ovtype)
cal setreg('"', oureg, outype)
cal winrestview(cview)
retu selected
endf
fu! s:log(m)
if exists('g:ctrlp_log') && g:ctrlp_log | if a:m
let cadir = ctrlp#utils#cachedir()
sil! exe 'redi! >' cadir.s:lash(cadir).'ctrlp.log'
el
sil! redi END
en | en
endf
fu! s:openfile(cmd, fid, tail, ...)
let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
@@ -1465,32 +1504,7 @@ fu! s:openfile(cmd, fid, tail, ...)
cal ctrlp#setlcdir()
en
endf
fu! s:writecache(read_cache, cache_file)
if !a:read_cache && ( ( g:ctrlp_newcache || !filereadable(a:cache_file) )
\ && s:caching || len(g:ctrlp_allfiles) > s:nocache_lim )
if len(g:ctrlp_allfiles) > s:nocache_lim | let s:caching = 1 | en
cal ctrlp#utils#writecache(g:ctrlp_allfiles)
en
endf
fu! ctrlp#j2l(nr)
exe a:nr
sil! norm! zvzz
endf
fu! s:regexfilter(str)
let str = a:str
for key in keys(s:fpats) | if match(str, key) >= 0
let str = substitute(str, s:fpats[key], '', 'g')
en | endfo
retu str
endf
fu! s:walker(m, p, d)
retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
endf
" Matchfuncs {{{2
fu! s:matchfname(item, pat)
retu match(split(a:item, s:lash)[-1], a:pat)
endf
@@ -1502,9 +1516,13 @@ endf
fu! s:matchtabe(item, pat)
retu match(split(a:item, '\t\+[^\t]\+$')[0], a:pat)
endf
fu! s:maxf(len)
retu s:maxfiles && a:len > s:maxfiles ? 1 : 0
" Cache {{{2
fu! s:writecache(read_cache, cache_file)
if !a:read_cache && ( ( g:ctrlp_newcache || !filereadable(a:cache_file) )
\ && s:caching || len(g:ctrlp_allfiles) > s:nocache_lim )
if len(g:ctrlp_allfiles) > s:nocache_lim | let s:caching = 1 | en
cal ctrlp#utils#writecache(g:ctrlp_allfiles)
en
endf
fu! s:insertcache(str)
@@ -1529,27 +1547,19 @@ fu! s:type(...)
\ ? g:ctrlp_ext_vars[s:itemtype - 3][a:0 ? 'type' : 'sname'] : s:itemtype
endf
fu! s:tagfiles()
retu filter(map(tagfiles(), 'fnamemodify(v:val, ":p")'), 'filereadable(v:val)')
endf
fu! s:extvar(key)
fu! s:execextvar(key)
if exists('g:ctrlp_ext_vars')
cal map(filter(copy(g:ctrlp_ext_vars),
\ 'has_key(v:val, a:key)'), 'eval(v:val[a:key])')
en
endf
fu! s:getundo()
if exists('*undotree')
\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )
retu [1, undotree()]
el
redi => result
sil! undol
redi END
retu [0, split(result, "\n")[1:]]
fu! s:getextvar(key)
if s:itemtype > 2
let vars = g:ctrlp_ext_vars[s:itemtype - 3]
retu has_key(vars, a:key) ? vars[a:key] : -1
en
retu -1
endf
fu! ctrlp#exit()
@@ -1567,11 +1577,7 @@ endf
" * Initialization {{{1
fu! ctrlp#setlines(type)
let s:itemtype = a:type
let types = [
\ 'ctrlp#files()',
\ 'ctrlp#buffers()',
\ 'ctrlp#mrufiles#list()',
\ ]
let types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()']
if exists('g:ctrlp_ext_vars')
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])')
en
@@ -1583,6 +1589,7 @@ fu! ctrlp#init(type, ...)
let [s:matches, s:init] = [1, 1]
cal s:Open()
cal s:SetWD(a:0 ? a:1 : '')
cal s:SetDefTxt()
cal s:MapKeys()
if has('syntax') && exists('g:syntax_on')
cal ctrlp#syntax()

View File

@@ -17,6 +17,7 @@ let s:changes_var = {
\ 'sname': 'chs',
\ 'exit': 'ctrlp#changes#exit()',
\ 'type': 'tabe',
\ 'sort': 0,
\ }
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)

View File

@@ -16,6 +16,7 @@ let s:var_qf = {
\ 'lname': 'quickfix',
\ 'sname': 'qfx',
\ 'type': 'line',
\ 'sort': 0,
\ }
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)

View File

@@ -11,10 +11,11 @@ en
let g:loaded_ctrlp_tag = 1
let s:tag_var = {
\ 'init': 'ctrlp#tag#init(s:tagfiles)',
\ 'init': 'ctrlp#tag#init()',
\ 'accept': 'ctrlp#tag#accept',
\ 'lname': 'tags',
\ 'sname': 'tag',
\ 'enter': 'ctrlp#tag#enter()',
\ 'type': 'tabs',
\ }
@@ -57,10 +58,10 @@ fu! s:filter(tags)
retu alltags
endf
" Public {{{1
fu! ctrlp#tag#init(tagfiles)
if empty(a:tagfiles) | retu [] | en
fu! ctrlp#tag#init()
if empty(s:tagfiles) | retu [] | en
let g:ctrlp_alltags = []
let tagfiles = sort(filter(a:tagfiles, 'count(a:tagfiles, v:val) == 1'))
let tagfiles = sort(filter(s:tagfiles, 'count(s:tagfiles, v:val) == 1'))
for each in tagfiles
let alltags = s:filter(ctrlp#utils#readfile(each))
cal extend(g:ctrlp_alltags, alltags)
@@ -101,6 +102,12 @@ endf
fu! ctrlp#tag#id()
retu s:id
endf
fu! ctrlp#tag#enter()
let tfs = tagfiles()
let s:tagfiles = tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'),
\ 'filereadable(v:val)') : []
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View File

@@ -11,12 +11,14 @@ en
let g:loaded_ctrlp_undo = 1
let s:undo_var = {
\ 'init': 'ctrlp#undo#init(s:undos)',
\ 'init': 'ctrlp#undo#init()',
\ 'accept': 'ctrlp#undo#accept',
\ 'lname': 'undo',
\ 'sname': 'udo',
\ 'enter': 'ctrlp#undo#enter()',
\ 'exit': 'ctrlp#undo#exit()',
\ 'type': 'line',
\ 'sort': 0,
\ }
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
@@ -27,6 +29,18 @@ let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
let s:text = map(['second', 'seconds', 'minutes', 'hours', 'days', 'weeks',
\ 'months', 'years'], '" ".v:val." ago"')
" Utilities {{{1
fu! s:getundo()
if exists('*undotree')
\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )
retu [1, undotree()]
el
redi => result
sil! undol
redi END
retu [0, split(result, "\n")[1:]]
en
endf
fu! s:flatten(tree, cur)
let flatdict = {}
for each in a:tree
@@ -104,16 +118,16 @@ fu! s:formatul(...)
retu parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
endf
" Public {{{1
fu! ctrlp#undo#init(undo)
let entries = a:undo[0] ? a:undo[1]['entries'] : a:undo[1]
fu! ctrlp#undo#init()
let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]
if empty(entries) | retu [] | en
if has('syntax') && exists('g:syntax_on')
cal s:syntax()
en
let g:ctrlp_nolimit = 1
if !exists('s:lines')
if a:undo[0]
let entries = s:dict2list(s:flatten(entries, a:undo[1]['seq_cur']))
if s:undos[0]
let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))
let s:lines = map(sort(entries, 's:compval'), 's:format(v:val)')
el
let s:lines = map(reverse(entries), 's:formatul(v:val)')
@@ -133,6 +147,10 @@ fu! ctrlp#undo#id()
retu s:id
endf
fu! ctrlp#undo#enter()
let s:undos = s:getundo()
endf
fu! ctrlp#undo#exit()
unl! s:lines
endf

View File

@@ -36,7 +36,7 @@ OPTIONS *ctrlp-options*
Below are the available options and their default values:~
*'g:ctrlp_map'*
Use this option to change the mapping to invoke |CtrlP| in |Normal| mode: >
Use this option to change the mapping to invoke CtrlP in |Normal| mode: >
let g:ctrlp_map = '<c-p>'
<
@@ -51,7 +51,8 @@ Use this to disable the plugin completely: >
<
*'g:ctrlp_by_filename'*
Set this to 1 to set searching by filename (not full path) as the default: >
Set this to 1 to set searching by filename (as opposed to full path) as the
default: >
let g:ctrlp_by_filename = 0
<
Can be toggled on/off by pressing <c-d> inside the prompt.
@@ -80,7 +81,7 @@ Set the maximum height of the match window: >
*'g:ctrlp_switch_buffer'*
When opening a file with <cr> or <c-t>, if the files already opened somewhere
|CtrlP| will try to jump to it instead of opening a new instance: >
CtrlP will try to jump to it instead of opening a new instance: >
let g:ctrlp_switch_buffer = 2
<
1 - only jump to the buffer if its opened in the current tab.
@@ -88,7 +89,7 @@ When opening a file with <cr> or <c-t>, if the files already opened somewhere
0 - disable this feature.
*'g:ctrlp_reuse_window'*
When opening a file with <cr>, |CtrlP| avoids opening it in windows created by
When opening a file with <cr>, CtrlP avoids opening it in windows created by
plugins, help and quickfix. Use this to setup some exceptions: >
let g:ctrlp_reuse_window = 'netrw'
<
@@ -99,7 +100,7 @@ Example: >
<
*'g:ctrlp_working_path_mode'*
When starting up, |CtrlP| sets its local working directory according to this
When starting up, CtrlP sets its local working directory according to this
variable: >
let g:ctrlp_working_path_mode = 2
<
@@ -111,19 +112,17 @@ Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a
per buffer basis.
*'g:ctrlp_root_markers'*
Use this to set your own root markers in addition to the default ones. Your
markers will take precedence: >
Use this to set your own root markers in addition to the default ones (.git/,
.hg/, .svn/, .bzr/, and _darcs/). Your markers will take precedence: >
let g:ctrlp_root_markers = ['']
<
These markers (builtins and yours) will serve as identifiers for the '/' and
'\' special inputs (|ctrlp-input-formats| (e)).
*'g:ctrlp_use_caching'*
Set this to 0 to disable per-session caching. When disabled, caching will still
be enabled for directories that have more than 4000 files: >
let g:ctrlp_use_caching = 1
<
Note: you can quickly purge the cache by pressing <F5> while inside |CtrlP|.
Note: you can quickly purge the cache by pressing <F5> while inside CtrlP.
*'g:ctrlp_clear_cache_on_exit'*
Set this to 0 to enable cross-session caching by not deleting the cache files
@@ -137,7 +136,7 @@ Set the directory to store the cache files: >
<
*'g:ctrlp_prompt_mappings'*
Use this to customize the mappings inside |CtrlP|s prompt to your liking. You
Use this to customize the mappings inside CtrlPs prompt to your liking. You
only need to keep the lines that youve changed the values (inside []): >
let g:ctrlp_prompt_mappings = {
\ 'PrtBS()': ['<bs>', '<c-]>'],
@@ -182,13 +181,12 @@ default <c-h> mapping: >
<
*'g:ctrlp_mruf_max'*
Specify the number of recently opened files you want |CtrlP| to remember: >
Specify the number of recently opened files you want CtrlP to remember: >
let g:ctrlp_mruf_max = 250
<
*'g:ctrlp_mruf_exclude'*
Files you dont want |CtrlP| to remember. Use |regexp| to specify the patterns:
>
Files you dont want CtrlP to remember. Use |regexp| to specify the patterns: >
let g:ctrlp_mruf_exclude = ''
<
Examples: >
@@ -197,7 +195,7 @@ Examples: >
<
*'g:ctrlp_mruf_include'*
And if you want |CtrlP| to only remember some files, specify them here: >
And if you want CtrlP to only remember some files, specify them here: >
let g:ctrlp_mruf_include = ''
<
Example: >
@@ -221,7 +219,7 @@ Set to 1 to sort the MRU file list to most-recently-entered-buffer order: >
<
*'g:ctrlp_dotfiles'*
Set this to 0 if you dont want |CtrlP| to scan for dotfiles and dotdirs: >
Set this to 0 if you dont want CtrlP to scan for dotfiles and dotdirs: >
let g:ctrlp_dotfiles = 1
<
You can use |'wildignore'| to exclude anything from the search.
@@ -239,7 +237,7 @@ tools on Windows). So be a little mindful of what you put in your |wildignore|.
*'g:ctrlp_custom_ignore'*
In addition to |'wildignore'|, use this for files and directories you want only
|CtrlP| to not show. Use |regexp| to specify the patterns: >
CtrlP to not show. Use |regexp| to specify the patterns: >
let g:ctrlp_custom_ignore = ''
<
Examples: >
@@ -250,6 +248,7 @@ Examples: >
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ }
<
Note: ignoring only works when |globpath()| is used to scan for files.
*'g:ctrlp_max_files'*
The maximum number of files to scan, set to 0 for no limit: >
@@ -302,7 +301,7 @@ If the fallback_command is empty or not defined, |globpath()| will then be used
when searching outside a repo.
*'g:ctrlp_max_history'*
The maximum number of input strings you want |CtrlP| to remember. The default
The maximum number of input strings you want CtrlP to remember. The default
value mirrors Vims global |'history'| option: >
let g:ctrlp_max_history = &history
<
@@ -368,6 +367,12 @@ after typings been stopped for a certain amount of time: >
If is 1, update after 250ms. If bigger than 1, the number will be used as the
delay time in milliseconds.
*'g:ctrlp_default_input'*
Set this to 1 to enable seeding the prompt with the current files relative
path: >
let g:ctrlp_default_input = 0
<
*'g:ctrlp_use_migemo'*
Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
works in |regexp| mode. To split the pattern, separate words with space: >
@@ -375,7 +380,7 @@ works in |regexp| mode. To split the pattern, separate words with space: >
<
*'g:ctrlp_status_func'*
Use this to customize the statuslines for the |CtrlP| window: >
Use this to customize the statuslines for the CtrlP window: >
let g:ctrlp_status_func = {}
<
Example: >
@@ -385,6 +390,7 @@ Example: >
\ }
<
Structure of the functions: >
" Main statusline
function! Function_Name_1(focus, byfname, regex, prev, item, next, marked)
" Arguments:
" |
@@ -406,6 +412,7 @@ Structure of the functions: >
return full_statusline
endfunction
" Progress statusline
function! Function_Name_2(str)
" a:str : Either the number of files scanned so far, or a string indicating
" the current directory is being scanned with a user_command.
@@ -416,7 +423,7 @@ Structure of the functions: >
See https://gist.github.com/1610859 for a working example.
*'g:ctrlp_match_func'*
Set an external fuzzy matching function for |CtrlP| to use: >
Set an external fuzzy matching function for CtrlP to use: >
let g:ctrlp_match_func = {}
<
Example: >
@@ -456,7 +463,7 @@ COMMANDS *ctrlp-commands*
*:CtrlP*
:CtrlP [starting-directory]
Open |CtrlP| in find file mode.
Open CtrlP in find file mode.
If no argument is given, the value of |g:ctrlp_working_path_mode| will be
used to determine the starting directory.
@@ -464,17 +471,17 @@ COMMANDS *ctrlp-commands*
*:CtrlPBuffer*
:CtrlPBuffer
Open |CtrlP| in find buffer mode.
Open CtrlP in find buffer mode.
*:CtrlPMRU*
:CtrlPMRU
Open |CtrlP| in find Most-Recently-Used file mode.
Open CtrlP in find Most-Recently-Used file mode.
*:CtrlPClearCache*
:CtrlPClearCache
Flush the cache for the current working directory. The same as pressing <F5>
inside |CtrlP|.
You can also enable/disable caching with the option |g:ctrlp_use_caching|.
inside CtrlP.
You can enable/disable caching with the |g:ctrlp_use_caching| option.
*:CtrlPClearAllCaches*
:CtrlPClearAllCaches
@@ -501,20 +508,20 @@ MAPPINGS *ctrlp-mappings*
*'ctrlp-<c-p>'*
<c-p>
Default |Normal| mode mapping to open the |CtrlP| prompt in find file mode.
Default |Normal| mode mapping to open the CtrlP prompt in find file mode.
Once inside the prompt:~
<c-d>
Toggle between full-path search and filename only search.
Note: in filename mode, the prompts base is '>d>' instead of '>>>'
<c-r> *'ctrlp-fullregexp'*
Toggle between the string mode and full |regexp| mode.
Note: in full |regexp| mode, the prompts base is 'r>>' instead of '>>>'
See also |input-formats| (guide) and |g:ctrlp_regexp_search| (option).
<c-d>
Toggle between full-path search and filename only search.
Note: in filename mode, the prompts base is '>d>' instead of '>>>'
<c-f>, 'forward'
<c-up>
Scroll to the 'next' search mode in the sequence.
@@ -575,9 +582,9 @@ Once inside the prompt:~
<c-v>
Open selected file in a 'vertical' split.
<c-x>,
<c-cr>,
<c-s>,
<c-x>
<c-s>
Open selected file in a 'horizontal' split.
<c-y>
@@ -591,26 +598,26 @@ Once inside the prompt:~
<c-z>
- Mark/unmark a file to be opened with <c-o>.
- Mark/unmark a file to create a new file in its directory using <c-y>.
- Or mark/unmark a file to create a new file in its directory using <c-y>.
<c-o>
Open files marked by <c-z>.
<F5>
- Refresh the match window and purge the cache for the current directory.
- Remove deleted files from MRU list.
- Or remove deleted files from the MRU list.
<F7>
- Wipe MRU list.
- Delete MRU entries marked by <c-z>.
- Wipe the MRU list.
- Or delete MRU entries marked by <c-z>.
<insert>
Insert the word under the cursor (in the active buffer) into the prompt.
Insert the word under the cursor (in the current buffer) into the prompt.
<esc>,
<c-c>,
<c-g>
Exit |CtrlP|.
Exit CtrlP.
Note: <c-c> can also be used to stop the scan if its taking too long.
Choose your own mappings with |g:ctrlp_prompt_mappings|.
@@ -629,11 +636,13 @@ INPUT FORMATS *ctrlp-input-formats*
Formats for inputting in the prompt:~
a) Simple string.
e.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c'
E.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c'
b) Vim |regexp|. If the input string contains '*' or '|', itll be treated as
a Vims |regexp| |pattern| without any modification.
e.g. 'abc\d*efg' will be read as 'abc\d*efg'.
E.g. 'abc\d*efg' will be read as 'abc\d*efg'.
See also |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option).
@@ -641,13 +650,17 @@ c) End the string with a colon ':' followed by a Vim command to execute that
command after opening the file. If you need to use ':' literally, escape it
with a backslash: '\:'. When opening multiple files, the command will be
executed on each opening file.
e.g. 'abc:45' will open the selected file and jump to line 45.
'abc:/my\:string' will open the selected file and jump to the first
instance of 'my:function'.
E.g. 'abc:45' will open the selected file and jump to line 45.
'abc:/any\:string' will open the selected file and jump to the first
instance of 'any:string'.
'abc:+setf\ myfiletype|50' will open the selected file and set its
filetype to 'myfiletype', then jump to line 50.
'abc:diffthis' will open the selected file and run |:diffthis| on the
first 4 files.
'abc:diffthis' will open the selected files and run |:diffthis| on the
first 4 files (if marked).
See also Vims |++opt| and |+cmd|.
@@ -662,11 +675,14 @@ e) Similarly, submit '/' or '\' to find and go to the projects root. If the
f) Type the name of a non-existent file and press <c-y> to create it. Mark a
file with <c-z> to create the new file in the same directory as the marked
file.
e.g. 'parentdir/newfile.txt' will create a directory named 'parentdir' as
E.g. 'parentdir/newfile.txt' will create a directory named 'parentdir' as
well as 'newfile.txt'.
If 'some/old/dirs/oldfile.txt' is marked with <c-z>, then 'parentdir'
and 'newfile.txt' will be created in 'some/old/dirs'. The final path
will then be 'some/old/dirs/parentdir/newfile.txt'.
Use '\' in place of '/' on Windows (if |'ssl'| is not set).
g) Submit ? to open this help file.
@@ -690,7 +706,8 @@ Available extensions:~
- Command: ':CtrlPTag'
- Search for a tag within a generated central tags file, and jump to the
definition. Use the Vims option |'tags'| to specify the names and the
locations of the tags file(s). Example: `set tags+=tags/help,doc/tags`
locations of the tags file(s).
E.g. set tags+=doc/tags
*:CtrlPBufTag*
*:CtrlPBufTagAll*
@@ -713,10 +730,10 @@ Available extensions:~
- Command: ':CtrlPDir [starting-directory]'
- Search for a directory and change the working directory to it.
- Mappings:
+ <cr> change the local working directory for |CtrlP| and keep it open.
+ <cr> change the local working directory for CtrlP and keep it open.
+ <c-t> change the global working directory (exit).
+ <c-v> change the local working directory for the current window (exit).
+ <c-x> change the global working directory to |CtrlP|s current local
+ <c-x> change the global working directory to CtrlPs current local
working directory (exit).
*:CtrlPRTS*
@@ -778,7 +795,7 @@ Examples: >
CUSTOMIZATION *ctrlp-customization*
Highlighting:~
* For the |CtrlP| buffer:
* For the CtrlP buffer:
CtrlPNoEntries : the message when no match is found (Error)
CtrlPMatch : the matched pattern (Identifier)
CtrlPLinePre : the line prefix '>' in the match window
@@ -878,7 +895,10 @@ Special thanks:~
===============================================================================
CHANGELOG *ctrlp-changelog*
+ New option: |g:ctrlp_match_func|, allow using a custom fuzzy matcher.
Before 2012/03/31~
+ New option: |g:ctrlp_default_input|, default input when entering CtrlP.
|g:ctrlp_match_func|, allow using a custom fuzzy matcher.
+ Rename:
*ClearCtrlPCache* -> |CtrlPClearCache|
*ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|

View File

@@ -8,7 +8,10 @@
if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
fini
en
let [g:loaded_ctrlp, g:ctrlp_lines, g:ctrlp_allfiles] = [1, [], []]
let g:loaded_ctrlp = 1
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
\ g:ctrlp_buftags, g:ctrlp_builtins] = [[], [], [], [], {}, 2]
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
@@ -36,47 +39,22 @@ en
cal ctrlp#mrufiles#init()
if !exists('g:ctrlp_extensions') | fini | en
com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
let s:ext = g:ctrlp_extensions
com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
if index(s:ext, 'tag') >= 0
let g:ctrlp_alltags = []
com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
en
com! -n=? -com=dir CtrlPDir cal ctrlp#init(ctrlp#dir#id(), <q-args>)
if index(s:ext, 'quickfix') >= 0
com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
en
com! -n=? -com=buffer CtrlPBufTag
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
if index(s:ext, 'dir') >= 0
let g:ctrlp_alldirs = []
com! -n=? -com=dir CtrlPDir cal ctrlp#init(ctrlp#dir#id(), <q-args>)
en
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
if index(s:ext, 'buffertag') >= 0
let g:ctrlp_buftags = {}
com! -n=? -com=buffer CtrlPBufTag
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
en
com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
if index(s:ext, 'rtscript') >= 0
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
en
com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
if index(s:ext, 'undo') >= 0
com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
en
if index(s:ext, 'line') >= 0
com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
en
if index(s:ext, 'changes') >= 0
com! -n=? -com=buffer CtrlPChange
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
en
unl s:ext
com! -n=? -com=buffer CtrlPChange
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))

View File

@@ -65,6 +65,41 @@ function! syntastic#c#GetIncludeDirs(filetype)
return join(map(s:Unique(include_dirs), '"-I" . v:val'), ' ')
endfunction
" read additional compiler flags from the given configuration file
" the file format and its parsing mechanism is inspired by clang_complete
function! syntastic#c#ReadConfig(file)
" search in the current file's directory upwards
let config = findfile(a:file, '.;')
if config == '' || !filereadable(config) | return '' | endif
" convert filename into absolute path
let filepath = substitute(fnamemodify(config, ':p:h'), '\', '/', 'g')
" try to read config file
try
let lines = map(readfile(config),
\ 'substitute(v:val, ''\'', ''/'', ''g'')')
catch /E484/
return ''
endtry
let parameters = []
for line in lines
let matches = matchlist(line, '^\s*-I\s*\(\S\+\)')
if matches != [] && matches[1] != ''
" this one looks like an absolute path
if match(matches[1], '^\%(/\|\a:\)') != -1
call add(parameters, '-I' . matches[1])
else
call add(parameters, '-I' . filepath . '/' . matches[1])
endif
else
call add(parameters, line)
endif
endfor
return join(parameters, ' ')
endfunction
" search the first 100 lines for include statements that are
" given in the handlers dictionary

View File

@@ -46,6 +46,13 @@
"
" let g:syntastic_c_compiler_options = ' -ansi'
"
" Additionally the setting 'g:syntastic_c_config_file' allows you to define a
" file that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_c_config':
"
" let g:syntastic_c_config_file = '.config'
"
" Using the global variable 'g:syntastic_c_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_c_include_dirs'
" setting are removed from the result set:
@@ -68,6 +75,10 @@ if !exists('g:syntastic_c_compiler_options')
let g:syntastic_c_compiler_options = '-std=gnu99'
endif
if !exists('g:syntastic_c_config_file')
let g:syntastic_c_config_file = '.syntastic_c_config'
endif
function! SyntaxCheckers_c_GetLocList()
let makeprg = 'gcc -fsyntax-only '
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
@@ -113,6 +124,9 @@ function! SyntaxCheckers_c_GetLocList()
let makeprg .= b:syntastic_c_cflags
endif
" add optional config file parameters
let makeprg .= syntastic#c#ReadConfig(g:syntastic_c_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })

View File

@@ -46,6 +46,13 @@
"
" let g:syntastic_cpp_compiler_options = ' -std=c++0x'
"
" Additionally the setting 'g:syntastic_cpp_config_file' allows you to define
" a file that contains additional compiler arguments like include directories
" or CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_cpp_config':
"
" let g:syntastic_cpp_config_file = '.config'
"
" Using the global variable 'g:syntastic_cpp_remove_include_errors' you can
" specify whether errors of files included via the
" g:syntastic_cpp_include_dirs' setting are removed from the result set:
@@ -64,6 +71,10 @@ endif
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_cpp_config_file')
let g:syntastic_cpp_config_file = '.syntastic_cpp_config'
endif
function! SyntaxCheckers_cpp_GetLocList()
let makeprg = 'g++ -fsyntax-only '
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
@@ -101,6 +112,9 @@ function! SyntaxCheckers_cpp_GetLocList()
let makeprg .= b:syntastic_cpp_cflags
endif
" add optional config file parameters
let makeprg .= syntastic#c#ReadConfig(g:syntastic_cpp_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })

View File

@@ -19,11 +19,16 @@ if !executable("ghc-mod")
finish
endif
if !exists('g:syntastic_haskell_checker_args')
let g:syntastic_haskell_checker_args = '--hlintOpt="--language=XmlSyntax"'
endif
function! SyntaxCheckers_haskell_GetLocList()
let ghcmod = 'ghc-mod ' . g:syntastic_haskell_checker_args
let makeprg =
\ "{ ".
\ "ghc-mod check ". shellescape(expand('%')) . "; " .
\ "ghc-mod lint " . shellescape(expand('%')) . ";" .
\ ghcmod . " check ". shellescape(expand('%')) . "; " .
\ ghcmod . " lint " . shellescape(expand('%')) . ";" .
\ " }"
let errorformat = '%-G\\s%#,%f:%l:%c:%trror: %m,%f:%l:%c:%tarning: %m,'.
\ '%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: %m,%f:%l:%c:%m,'.

View File

@@ -40,7 +40,7 @@ function! SyntaxCheckers_php_GetLocList()
let errors = []
let makeprg = "php -l -d error_reporting=E_PARSE -d display_errors=0 -d error_log='' ".shellescape(expand('%'))
let makeprg = "php -l -d error_reporting=E_ALL -d display_errors=0 -d error_log='' ".shellescape(expand('%'))
let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })

View File

@@ -26,6 +26,6 @@ endfunction
function! SyntaxCheckers_python_GetLocList()
let makeprg = 'flake8 '.g:syntastic_python_checker_args.' '.shellescape(expand('%'))
let errorformat = '%E%f:%l: could not compile,%-Z%p^,%W%f:%l:%c: %m,%W%f:%l: %m,%-G%.%#'
let errorformat = '%E%f:%l: could not compile,%-Z%p^,%E%f:%l:%c: %m,%E%f:%l: %m,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -141,8 +141,8 @@ function! s:ParseRegex(file, settings) " {{{
" Match Functions
call add(patterns, ['f', '\bfunction\s+([a-zA-Z0-9_.\$]+?)\s*\(', 1])
call add(patterns, ['f', '([a-zA-Z0-9_.\$]+?)\s*=\s*function\s*\(', 1])
call add(patterns, ['f', "\\[[\"']([A-Za-z0-9_]+)[\"']\\]\\s*=\\s*function\\s*\\(", 1])
call add(patterns, ['f', '([a-zA-Z0-9_.\$]+?)\s*=\s*\(?function\s*\(', 1])
call add(patterns, ['f', "\\[[\"']([A-Za-z0-9_]+)[\"']\\]\\s*=\\s*\\(?function\\s*\\(", 1])
" Match Members
call add(patterns, ['f', '\b([a-zA-Z0-9_.\$]+?)\s*:\s*function\s*\(', 1])

View File

@@ -218,16 +218,35 @@ CONFIGURATION *mark-configuration*
For a permanent configuration, put the following commands into your |vimrc|.
*mark-highlight-colors*
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
form (where N = 1..): >
highlight MarkWordN ctermbg=Cyan ctermfg=Black guibg=#8CCBEA guifg=Black
*mark-colors* *mark-highlight-colors*
This plugin defines 6 mark groups:
1: Cyan 2:Green 3:Yellow 4:Red 5:Magenta 6:Blue ~
Higher numbers always take precedence and are displayed above lower ones.
*g:mwDefaultHighlightingPalette*
Especially if you use GVIM, you can switch to a richer palette of up to 18
colors: >
let g:mwDefaultHighlightingPalette = 'extended'
<
If you like the additional colors, but don't need that many of them, restrict
their number via: >
let g:mwDefaultHighlightingNum = 9
<
*mark-colors-redefine*
If none of the default highlightings suits you, define your own colors in your
vimrc file (or anywhere before this plugin is sourced), in the following form
(where N = 1..): >
highlight MarkWordN ctermbg=Cyan ctermfg=Black guibg=#8CCBEA guifg=Black
You can also use this form to redefine only some of the default highlightings.
If you want to avoid losing the highlightings on |:colorscheme| commands, you
need to re-apply your highlights on the |ColorScheme| event, similar to how
this plugin does.
this plugin does. Or you define the palette not via :highlight commands, but
use the plugin's infrastructure: >
let g:mwDefaultHighlightingPalette = [
\ { 'ctermbg':'Cyan', 'ctermfg':'Black', 'guibg':'#8CCBEA', 'guifg':'Black' },
\ ...
\]
<
The search type highlighting (in the search message) can be changed via: >
highlight link SearchSpecialSearchType MoreMsg
<
@@ -299,6 +318,13 @@ http://vim.wikia.com/wiki/Highlight_multiple_words:
==============================================================================
HISTORY *mark-history*
2.6.3 27-Mar-2012
- ENH: Allow choosing of palette and limiting of default mark highlight groups
via g:mwDefaultHighlightingPalette and g:mwDefaultHighlightingNum.
- ENH: Offer an extended color palette in addition to the original 6-color one.
Enable this via :let g:mwDefaultHighlightingPalette = "extended" in your
vimrc.
2.6.2 26-Mar-2012
- ENH: When a [count] exceeding the number of available mark groups is given,
a summary of marks is given and the user is asked to select a mark group.

View File

@@ -13,8 +13,13 @@
" - Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher.
" - mark.vim autoload script.
"
" Version: 2.6.1
" Version: 2.6.3
" Changes:
" 27-Mar-2012, Ingo Karkat
" - ENH: Allow choosing of palette and limiting of default mark highlight groups
" via g:mwDefaultHighlightingPalette and g:mwDefaultHighlightingNum.
" - ENH: Offer an extended color palette in addition to the original 6-color one.
"
" 23-Mar-2012, Ingo Karkat
" - ENH: Add :Marks command that prints all mark highlight groups and their
" search patterns, plus information about the current search mark, next mark
@@ -174,6 +179,8 @@ if exists('g:loaded_mark') || (v:version == 701 && ! exists('*matchadd')) || (v:
finish
endif
let g:loaded_mark = 1
let s:save_cpo = &cpo
set cpo&vim
"- configuration --------------------------------------------------------------
if ! exists('g:mwHistAdd')
@@ -188,16 +195,63 @@ if ! exists('g:mwAutoSaveMarks')
let g:mwAutoSaveMarks = 1
endif
if ! exists('g:mwDefaultHighlightingNum')
let g:mwDefaultHighlightingNum = -1
endif
if ! exists('g:mwDefaultHighlightingPalette')
let g:mwDefaultHighlightingPalette = 'original'
endif
"- default highlightings ------------------------------------------------------
function! s:DefaultHighlightings()
" 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 MarkWord2 ctermbg=Green ctermfg=Black guibg=#A4E57E guifg=Black
highlight def MarkWord3 ctermbg=Yellow ctermfg=Black guibg=#FFDB72 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 MarkWord6 ctermbg=Blue ctermfg=Black guibg=#9999FF guifg=Black
let l:palette = []
if type(g:mwDefaultHighlightingPalette) == type([])
" There are custom color definitions, not a named built-in palette.
let l:palette = g:mwDefaultHighlightingPalette
elseif g:mwDefaultHighlightingPalette ==# 'original'
let l:palette = [
\ { 'ctermbg':'Cyan', 'ctermfg':'Black', 'guibg':'#8CCBEA', 'guifg':'Black' },
\ { 'ctermbg':'Green', 'ctermfg':'Black', 'guibg':'#A4E57E', 'guifg':'Black' },
\ { 'ctermbg':'Yellow', 'ctermfg':'Black', 'guibg':'#FFDB72', 'guifg':'Black' },
\ { 'ctermbg':'Red', 'ctermfg':'Black', 'guibg':'#FF7272', 'guifg':'Black' },
\ { 'ctermbg':'Magenta', 'ctermfg':'Black', 'guibg':'#FFB3FF', 'guifg':'Black' },
\ { 'ctermbg':'Blue', 'ctermfg':'Black', 'guibg':'#9999FF', 'guifg':'Black' },
\]
elseif g:mwDefaultHighlightingPalette ==# 'extended'
let l:palette = [
\ { 'ctermbg':'Blue', 'ctermfg':'Black', 'guibg':'#A1B7FF', 'guifg':'#001E80' },
\ { 'ctermbg':'Magenta', 'ctermfg':'Black', 'guibg':'#FFA1C6', 'guifg':'#80005D' },
\ { 'ctermbg':'Green', 'ctermfg':'Black', 'guibg':'#ACFFA1', 'guifg':'#0F8000' },
\ { 'ctermbg':'Yellow', 'ctermfg':'Black', 'guibg':'#FFE8A1', 'guifg':'#806000' },
\ { 'ctermbg':'DarkCyan', 'ctermfg':'Black', 'guibg':'#D2A1FF', 'guifg':'#420080' },
\ { 'ctermbg':'Cyan', 'ctermfg':'Black', 'guibg':'#A1FEFF', 'guifg':'#007F80' },
\ { 'ctermbg':'DarkBlue', 'ctermfg':'Black', 'guibg':'#A1DBFF', 'guifg':'#004E80' },
\ { 'ctermbg':'DarkMagenta','ctermfg':'Black', 'guibg':'#A29CCF', 'guifg':'#120080' },
\ { 'ctermbg':'DarkRed', 'ctermfg':'Black', 'guibg':'#F5A1FF', 'guifg':'#720080' },
\ { 'ctermbg':'Brown', 'ctermfg':'Black', 'guibg':'#FFC4A1', 'guifg':'#803000' },
\ { 'ctermbg':'DarkGreen', 'ctermfg':'Black', 'guibg':'#D0FFA1', 'guifg':'#3F8000' },
\ { 'ctermbg':'Red', 'ctermfg':'Black', 'guibg':'#F3FFA1', 'guifg':'#6F8000' },
\ { 'ctermbg':'White', 'ctermfg':'Gray', 'guibg':'#E3E3D2', 'guifg':'#999999' },
\ { 'ctermbg':'LightGray', 'ctermfg':'White', 'guibg':'#D3D3C3', 'guifg':'#666666' },
\ { 'ctermbg':'Gray', 'ctermfg':'Black', 'guibg':'#A3A396', 'guifg':'#222222' },
\ { 'ctermbg':'Black', 'ctermfg':'White', 'guibg':'#53534C', 'guifg':'#DDDDDD' },
\ { 'ctermbg':'Black', 'ctermfg':'Gray', 'guibg':'#131311', 'guifg':'#AAAAAA' },
\ { 'ctermbg':'Blue', 'ctermfg':'White', 'guibg':'#0000FF', 'guifg':'#F0F0FF' },
\ { 'ctermbg':'DarkRed', 'ctermfg':'White', 'guibg':'#FF0000', 'guifg':'#FFFFFF' },
\]
elseif ! empty(g:mwDefaultHighlightingPalette)
let v:warningmsg = 'Mark: Unknown value for g:mwDefaultHighlightingPalette: ' . g:mwDefaultHighlightingPalette
echohl WarningMsg
echomsg v:warningmsg
echohl None
return
endif
for i in range(1, (g:mwDefaultHighlightingNum == -1 ? len(l:palette) : g:mwDefaultHighlightingNum))
execute 'highlight def MarkWord' . i join(map(items(l:palette[i - 1]), 'join(v:val, "=")'))
endfor
endfunction
call s:DefaultHighlightings()
autocmd ColorScheme * call <SID>DefaultHighlightings()
@@ -305,4 +359,6 @@ if g:mwAutoLoadMarks
augroup END
endif
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: ts=4 sts=0 sw=4 noet