mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 19:40:29 +01:00
Update of Mark, syntastic, taglisttoo and ctrlp plugins
This commit is contained in:
@@ -7,7 +7,7 @@ ScriptID SourceID Filename
|
|||||||
3304 17406 gundo.vim
|
3304 17406 gundo.vim
|
||||||
2727 11120 jsbeautify.vim
|
2727 11120 jsbeautify.vim
|
||||||
2289 8922 loremipsum
|
2289 8922 loremipsum
|
||||||
2666 17554 Mark
|
2666 17661 Mark
|
||||||
1218 14455 nerdcommenter
|
1218 14455 nerdcommenter
|
||||||
2262 8944 occur.vim
|
2262 8944 occur.vim
|
||||||
2136 8206 repeat.vim
|
2136 8206 repeat.vim
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
" File: autoload/ctrlp.vim
|
" File: autoload/ctrlp.vim
|
||||||
" Description: Fuzzy file, buffer, mru and tag finder.
|
" Description: Fuzzy file, buffer, mru and tag finder.
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
" Author: Kien Nguyen <github.com/kien>
|
||||||
" Version: 1.7.2
|
" Version: 1.7.4
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
" Static variables {{{1
|
" * Static variables {{{1
|
||||||
fu! s:opts()
|
fu! s:opts()
|
||||||
" Options
|
" Options
|
||||||
let hst = exists('+hi') ? &hi : 20
|
let hst = exists('+hi') ? &hi : 20
|
||||||
@@ -21,6 +21,7 @@ fu! s:opts()
|
|||||||
\ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'CtrlPMatch']],
|
\ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'CtrlPMatch']],
|
||||||
\ 'g:ctrlp_jump_to_buffer': ['s:jmptobuf', 2],
|
\ 'g:ctrlp_jump_to_buffer': ['s:jmptobuf', 2],
|
||||||
\ 'g:ctrlp_lazy_update': ['s:lazy', 0],
|
\ 'g:ctrlp_lazy_update': ['s:lazy', 0],
|
||||||
|
\ 'g:ctrlp_match_func': ['s:matcher', {}],
|
||||||
\ 'g:ctrlp_match_window_bottom': ['s:mwbottom', 1],
|
\ 'g:ctrlp_match_window_bottom': ['s:mwbottom', 1],
|
||||||
\ 'g:ctrlp_match_window_reversed': ['s:mwreverse', 1],
|
\ 'g:ctrlp_match_window_reversed': ['s:mwreverse', 1],
|
||||||
\ 'g:ctrlp_max_depth': ['s:maxdepth', 40],
|
\ 'g:ctrlp_max_depth': ['s:maxdepth', 40],
|
||||||
@@ -203,7 +204,7 @@ fu! s:Close()
|
|||||||
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
|
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
|
||||||
\ g:ctrlp_nolimit
|
\ g:ctrlp_nolimit
|
||||||
cal ctrlp#recordhist()
|
cal ctrlp#recordhist()
|
||||||
cal s:onexit()
|
cal s:extvar('exit')
|
||||||
cal s:log(0)
|
cal s:log(0)
|
||||||
ec
|
ec
|
||||||
endf
|
endf
|
||||||
@@ -224,8 +225,10 @@ endf
|
|||||||
|
|
||||||
fu! ctrlp#reset()
|
fu! ctrlp#reset()
|
||||||
cal s:opts()
|
cal s:opts()
|
||||||
|
cal s:autocmds()
|
||||||
cal ctrlp#utils#opts()
|
cal ctrlp#utils#opts()
|
||||||
cal ctrlp#mrufiles#opts()
|
cal ctrlp#mrufiles#opts()
|
||||||
|
cal s:extvar('opts')
|
||||||
endf
|
endf
|
||||||
" * Files {{{1
|
" * Files {{{1
|
||||||
fu! ctrlp#files()
|
fu! ctrlp#files()
|
||||||
@@ -307,25 +310,28 @@ fu! s:lsCmd()
|
|||||||
retu cmd['types'][key][1]
|
retu cmd['types'][key][1]
|
||||||
en
|
en
|
||||||
endf
|
endf
|
||||||
" Buffers {{{1
|
" - Buffers {{{1
|
||||||
fu! ctrlp#buffers()
|
fu! ctrlp#buffers()
|
||||||
retu map(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))'
|
retu map(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))'
|
||||||
\ .' && getbufvar(v:val, "&bl") && strlen(bufname(v:val))'),
|
\ .' && getbufvar(v:val, "&bl") && strlen(bufname(v:val))'),
|
||||||
\ 'fnamemodify(bufname(v:val), ":.")')
|
\ 'fnamemodify(bufname(v:val), ":.")')
|
||||||
endf
|
endf
|
||||||
" * MatchedItems() {{{1
|
" * MatchedItems() {{{1
|
||||||
fu! s:MatchIt(items, pat, limit, mfunc, ipt)
|
fu! s:MatchIt(items, pat, limit, mfunc, ipt, exc)
|
||||||
let [newitems, crfile] = [[], exists('s:crfilerel') ? s:crfilerel : '']
|
let [newitems, id, itlen] = [[], 0, len(a:items)]
|
||||||
for item in a:items
|
wh id < itlen
|
||||||
try | if !( a:ipt && item == crfile ) && call(a:mfunc, [item, a:pat]) >= 0
|
let item = a:items[id]
|
||||||
|
let id += 1
|
||||||
|
try | if !( a:ipt && item == a:exc ) && call(a:mfunc, [item, a:pat]) >= 0
|
||||||
cal add(newitems, item)
|
cal add(newitems, item)
|
||||||
en | cat | brea | endt
|
en | cat | brea | endt
|
||||||
if a:limit > 0 && len(newitems) >= a:limit | brea | en
|
if a:limit > 0 && len(newitems) >= a:limit | brea | en
|
||||||
endfo
|
endw
|
||||||
|
let s:mdata = [s:dyncwd, s:itemtype, s:regexp, a:items[(id):]]
|
||||||
retu newitems
|
retu newitems
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:MatchedItems(items, pat, limit, ipt)
|
fu! s:MatchedItems(items, str, pat, limit, ipt)
|
||||||
let [type, mfunc] = [s:type(1), 'match']
|
let [type, mfunc] = [s:type(1), 'match']
|
||||||
if s:byfname && a:ipt
|
if s:byfname && a:ipt
|
||||||
let mfunc = 's:matchfname'
|
let mfunc = 's:matchfname'
|
||||||
@@ -333,11 +339,20 @@ fu! s:MatchedItems(items, pat, limit, ipt)
|
|||||||
let types = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' }
|
let types = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' }
|
||||||
if has_key(types, type) | let mfunc = types[type] | en
|
if has_key(types, type) | let mfunc = types[type] | en
|
||||||
en
|
en
|
||||||
let newitems = s:MatchIt(a:items, a:pat, a:limit, mfunc, a:ipt)
|
let exc = exists('s:crfilerel') ? s:crfilerel : ''
|
||||||
|
let matfunc = 's:MatchIt'
|
||||||
|
let items = s:narrowable() ? s:matched + s:mdata[3] : a:items
|
||||||
|
let argms = [items, a:pat, a:limit, mfunc, a:ipt, exc]
|
||||||
|
if s:matcher != {} && has_key(s:matcher, 'match')
|
||||||
|
let [matfunc, argms[1], argms[3]] = s:matargs(mfunc, a:str)
|
||||||
|
let argms += [s:regexp]
|
||||||
|
en
|
||||||
|
let newitems = call(matfunc, argms)
|
||||||
let s:matches = len(newitems)
|
let s:matches = len(newitems)
|
||||||
retu newitems
|
retu newitems
|
||||||
endf
|
endf
|
||||||
fu! s:SplitPattern(str) "{{{1
|
|
||||||
|
fu! s:SplitPattern(str)
|
||||||
let str = a:str
|
let str = a:str
|
||||||
if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo')
|
if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo')
|
||||||
let str = s:migemo(str)
|
let str = s:migemo(str)
|
||||||
@@ -379,9 +394,8 @@ fu! s:Render(lines, pat, ipt)
|
|||||||
if s:dohighlight() | cal clearmatches() | en
|
if s:dohighlight() | cal clearmatches() | en
|
||||||
retu
|
retu
|
||||||
en
|
en
|
||||||
" Sort if not MRU
|
if ( ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') )
|
||||||
if ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') )
|
\ || s:prompt != ['', '', ''] ) && s:matcher == {}
|
||||||
\ || s:prompt != ['', '', '']
|
|
||||||
let s:compat = a:pat
|
let s:compat = a:pat
|
||||||
cal sort(lines, 's:mixedsort')
|
cal sort(lines, 's:mixedsort')
|
||||||
unl s:compat
|
unl s:compat
|
||||||
@@ -412,7 +426,7 @@ fu! s:Update(str)
|
|||||||
if str == oldstr && !empty(str) && !exists('s:force') | retu | en
|
if str == oldstr && !empty(str) && !exists('s:force') | retu | en
|
||||||
let [pat, ipt] = [s:SplitPattern(str), s:ispathitem()]
|
let [pat, ipt] = [s:SplitPattern(str), s:ispathitem()]
|
||||||
let lines = exists('g:ctrlp_nolimit') && empty(str) ? copy(g:ctrlp_lines)
|
let lines = exists('g:ctrlp_nolimit') && empty(str) ? copy(g:ctrlp_lines)
|
||||||
\ : s:MatchedItems(g:ctrlp_lines, pat, s:winh, ipt)
|
\ : s:MatchedItems(g:ctrlp_lines, str, pat, s:winh, ipt)
|
||||||
cal s:Render(lines, pat, ipt)
|
cal s:Render(lines, pat, ipt)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
@@ -459,8 +473,10 @@ endf
|
|||||||
|
|
||||||
fu! s:PrtAdd(char)
|
fu! s:PrtAdd(char)
|
||||||
unl! s:hstgot
|
unl! s:hstgot
|
||||||
|
let s:act_add = 1
|
||||||
let s:prompt[0] .= a:char
|
let s:prompt[0] .= a:char
|
||||||
cal s:BuildPrompt(1)
|
cal s:BuildPrompt(1)
|
||||||
|
unl s:act_add
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:PrtBS()
|
fu! s:PrtBS()
|
||||||
@@ -577,7 +593,7 @@ fu! s:PrtClearCache()
|
|||||||
cal ctrlp#clr(s:statypes[s:itemtype][1])
|
cal ctrlp#clr(s:statypes[s:itemtype][1])
|
||||||
en
|
en
|
||||||
if s:itemtype == 2
|
if s:itemtype == 2
|
||||||
let g:ctrlp_lines = ctrlp#mrufiles#list(-1, 1)
|
let g:ctrlp_lines = ctrlp#mrufiles#refresh()
|
||||||
el
|
el
|
||||||
cal ctrlp#setlines(s:itemtype)
|
cal ctrlp#setlines(s:itemtype)
|
||||||
en
|
en
|
||||||
@@ -588,13 +604,13 @@ endf
|
|||||||
|
|
||||||
fu! s:PrtDeleteMRU()
|
fu! s:PrtDeleteMRU()
|
||||||
if s:itemtype != 2 | retu | en
|
if s:itemtype != 2 | retu | en
|
||||||
let [s:force, ags] = [1, [-1, 2]]
|
let [s:force, tbrem] = [1, []]
|
||||||
if exists('s:marked')
|
if exists('s:marked')
|
||||||
let ags = [-1, 2, values(s:marked)]
|
let tbrem = values(s:marked)
|
||||||
cal s:unmarksigns()
|
cal s:unmarksigns()
|
||||||
unl s:marked
|
unl s:marked
|
||||||
en
|
en
|
||||||
let g:ctrlp_lines = call('ctrlp#mrufiles#list', ags)
|
let g:ctrlp_lines = ctrlp#mrufiles#remove(tbrem)
|
||||||
cal s:BuildPrompt(1)
|
cal s:BuildPrompt(1)
|
||||||
unl s:force
|
unl s:force
|
||||||
endf
|
endf
|
||||||
@@ -684,7 +700,7 @@ endf
|
|||||||
|
|
||||||
fu! s:ToggleType(dir)
|
fu! s:ToggleType(dir)
|
||||||
let ext = exists('g:ctrlp_ext_vars') ? len(g:ctrlp_ext_vars) : 0
|
let ext = exists('g:ctrlp_ext_vars') ? len(g:ctrlp_ext_vars) : 0
|
||||||
let s:itemtype = s:walker(g:ctrlp_builtins + ext, s:itemtype, a:dir)
|
let s:itemtype = s:walker(2 + ext, s:itemtype, a:dir)
|
||||||
if s:byfname && !s:ispathitem() | let s:byfname = 0 | en
|
if s:byfname && !s:ispathitem() | let s:byfname = 0 | en
|
||||||
unl! g:ctrlp_nolimit
|
unl! g:ctrlp_nolimit
|
||||||
if has('syntax') && exists('g:syntax_on')
|
if has('syntax') && exists('g:syntax_on')
|
||||||
@@ -699,8 +715,10 @@ fu! s:PrtSwitcher()
|
|||||||
cal s:BuildPrompt(1, s:Focus())
|
cal s:BuildPrompt(1, s:Focus())
|
||||||
unl s:force
|
unl s:force
|
||||||
endf
|
endf
|
||||||
fu! s:SetWD(...) "{{{1
|
" - SetWD() {{{1
|
||||||
let [pathmode, s:crfilerel] = [s:wpmode, fnamemodify(s:crfile, ':.')]
|
fu! s:SetWD(...)
|
||||||
|
let pathmode = s:wpmode
|
||||||
|
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
|
||||||
if a:0 && strlen(a:1) | if type(a:1)
|
if a:0 && strlen(a:1) | if type(a:1)
|
||||||
cal ctrlp#setdir(a:1) | retu
|
cal ctrlp#setdir(a:1) | retu
|
||||||
el
|
el
|
||||||
@@ -717,7 +735,7 @@ fu! s:SetWD(...) "{{{1
|
|||||||
cal extend(markers, s:rmarkers, 0)
|
cal extend(markers, s:rmarkers, 0)
|
||||||
en
|
en
|
||||||
for marker in markers
|
for marker in markers
|
||||||
cal s:findroot(getcwd(), marker, 0, 0)
|
cal s:findroot(s:dyncwd, marker, 0, 0)
|
||||||
if exists('s:foundroot') | brea | en
|
if exists('s:foundroot') | brea | en
|
||||||
endfo
|
endfo
|
||||||
unl! s:foundroot
|
unl! s:foundroot
|
||||||
@@ -742,7 +760,7 @@ fu! ctrlp#acceptfile(mode, line, ...)
|
|||||||
if j2l | cal ctrlp#j2l(j2l) | en
|
if j2l | cal ctrlp#j2l(j2l) | en
|
||||||
el
|
el
|
||||||
" Determine the command to use
|
" Determine the command to use
|
||||||
let useb = bufnr > 0 && empty(tail)
|
let useb = bufnr > 0 && getbufvar(bufnr, '&bl') && empty(tail)
|
||||||
let cmd =
|
let cmd =
|
||||||
\ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) :
|
\ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) :
|
||||||
\ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) :
|
\ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) :
|
||||||
@@ -794,10 +812,11 @@ fu! s:AcceptSelection(mode)
|
|||||||
if empty(line) | retu | en
|
if empty(line) | retu | en
|
||||||
" Do something with it
|
" Do something with it
|
||||||
let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile'
|
let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile'
|
||||||
\ : g:ctrlp_ext_vars[s:itemtype - ( g:ctrlp_builtins + 1 )]['accept']
|
\ : g:ctrlp_ext_vars[s:itemtype - 3]['accept']
|
||||||
cal call(actfunc, [a:mode, line])
|
cal call(actfunc, [a:mode, line])
|
||||||
endf
|
endf
|
||||||
fu! s:CreateNewFile(...) "{{{1
|
" - CreateNewFile() {{{1
|
||||||
|
fu! s:CreateNewFile(...)
|
||||||
let [md, str] = ['', join(s:prompt, '')]
|
let [md, str] = ['', join(s:prompt, '')]
|
||||||
if empty(str) | retu | en
|
if empty(str) | retu | en
|
||||||
if s:argmap && !a:0
|
if s:argmap && !a:0
|
||||||
@@ -830,8 +849,7 @@ fu! s:CreateNewFile(...) "{{{1
|
|||||||
endf
|
endf
|
||||||
" * OpenMulti() {{{1
|
" * OpenMulti() {{{1
|
||||||
fu! s:MarkToOpen()
|
fu! s:MarkToOpen()
|
||||||
if s:bufnr <= 0 || s:opmul == '0'
|
if s:bufnr <= 0 || s:opmul == '0' || ( s:itemtype > 2 && s:type() !~ 'rts' )
|
||||||
\ || ( s:itemtype > g:ctrlp_builtins && s:type() !~ 'rts' )
|
|
||||||
retu
|
retu
|
||||||
en
|
en
|
||||||
let line = !empty(s:matched) ? s:matched[line('.') - 1] : ''
|
let line = !empty(s:matched) ? s:matched[line('.') - 1] : ''
|
||||||
@@ -875,7 +893,8 @@ fu! s:OpenMulti()
|
|||||||
" Move the cursor to a reusable window
|
" Move the cursor to a reusable window
|
||||||
let [tail, fnesc] = [s:tail(), exists('*fnameescape') && v:version > 701]
|
let [tail, fnesc] = [s:tail(), exists('*fnameescape') && v:version > 701]
|
||||||
let [emptytail, nwpt] = [empty(tail), exists('g:ctrlp_open_multiple_files')]
|
let [emptytail, nwpt] = [empty(tail), exists('g:ctrlp_open_multiple_files')]
|
||||||
let useb = bufnr('^'.mkd[0].'$') > 0 && emptytail
|
let bufnr = bufnr('^'.mkd[0].'$')
|
||||||
|
let useb = bufnr > 0 && getbufvar(bufnr, '&bl') && emptytail
|
||||||
let fst = call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e'])
|
let fst = call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e'])
|
||||||
" Check if it's a replaceable buffer
|
" Check if it's a replaceable buffer
|
||||||
let repabl = ( empty(bufname('%')) && empty(&l:ft) ) || s:nosplit()
|
let repabl = ( empty(bufname('%')) && empty(&l:ft) ) || s:nosplit()
|
||||||
@@ -886,7 +905,7 @@ fu! s:OpenMulti()
|
|||||||
" Open the files
|
" Open the files
|
||||||
for va in mkd
|
for va in mkd
|
||||||
let bufnr = bufnr('^'.va.'$')
|
let bufnr = bufnr('^'.va.'$')
|
||||||
let useb = bufnr > 0 && emptytail
|
let useb = bufnr > 0 && getbufvar(bufnr, '&bl') && emptytail
|
||||||
let snd = md != '' && has_key(cmds, md) ?
|
let snd = md != '' && has_key(cmds, md) ?
|
||||||
\ ( useb ? cmds[md][0] : cmds[md][1] ) : ( useb ? 'vert sb' : 'vne' )
|
\ ( useb ? cmds[md][0] : cmds[md][1] ) : ( useb ? 'vert sb' : 'vne' )
|
||||||
let cmd = ic == 1 && ( ucr == 'r' || repabl ) ? fst : snd
|
let cmd = ic == 1 && ( ucr == 'r' || repabl ) ? fst : snd
|
||||||
@@ -925,6 +944,15 @@ fu! s:comptime(s1, s2)
|
|||||||
retu time1 == time2 ? 0 : time1 < time2 ? 1 : -1
|
retu time1 == time2 ? 0 : time1 < time2 ? 1 : -1
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
fu! s:compmre(...)
|
||||||
|
" By last entered time (buffer only)
|
||||||
|
if !exists('s:mrbs')
|
||||||
|
let s:mrbs = ctrlp#mrufiles#bufs()
|
||||||
|
en
|
||||||
|
let cwd = getcwd()
|
||||||
|
retu index(s:mrbs, cwd.s:lash().a:1) - index(s:mrbs, cwd.s:lash().a:2)
|
||||||
|
endf
|
||||||
|
|
||||||
fu! s:comparent(s1, s2)
|
fu! s:comparent(s1, s2)
|
||||||
" By same parent dir
|
" By same parent dir
|
||||||
let cwd = getcwd()
|
let cwd = getcwd()
|
||||||
@@ -968,8 +996,11 @@ fu! s:mixedsort(s1, s2)
|
|||||||
if s:itemtype < 3 && s:height < 51
|
if s:itemtype < 3 && s:height < 51
|
||||||
let [par, cfn] = [s:comparent(a:s1, a:s2), s:compfnlen(a:s1, a:s2)]
|
let [par, cfn] = [s:comparent(a:s1, a:s2), s:compfnlen(a:s1, a:s2)]
|
||||||
if s:height < 21
|
if s:height < 21
|
||||||
let ctm = s:comptime(a:s1, a:s2)
|
let [muls, ctm] = s:itemtype == 1
|
||||||
retu 12 * cml + 6 * par + 3 * cfn + 2 * ctm + cln
|
\ ? [[6, 3, 2, 12], s:compmre(a:s1, a:s2)]
|
||||||
|
\ : [[12, 6, 3, 2], s:comptime(a:s1, a:s2)]
|
||||||
|
unl! s:mrbs
|
||||||
|
retu muls[0] * cml + muls[1] * par + muls[2] * cfn + muls[3] * ctm + cln
|
||||||
en
|
en
|
||||||
retu 6 * cml + 3 * par + 2 * cfn + cln
|
retu 6 * cml + 3 * par + 2 * cfn + cln
|
||||||
en
|
en
|
||||||
@@ -1001,7 +1032,7 @@ fu! ctrlp#statusline()
|
|||||||
let byfname = s:byfname ? 'file' : 'path'
|
let byfname = s:byfname ? 'file' : 'path'
|
||||||
let marked = s:opmul != '0' ?
|
let marked = s:opmul != '0' ?
|
||||||
\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : ''
|
\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : ''
|
||||||
if has_key(s:status, 'main')
|
if s:status != {} && has_key(s:status, 'main')
|
||||||
let args = [focus, byfname, s:regexp, prv, item, nxt, marked]
|
let args = [focus, byfname, s:regexp, prv, item, nxt, marked]
|
||||||
let &l:stl = call(s:status['main'], args)
|
let &l:stl = call(s:status['main'], args)
|
||||||
el
|
el
|
||||||
@@ -1022,7 +1053,8 @@ endf
|
|||||||
|
|
||||||
fu! ctrlp#progress(enum)
|
fu! ctrlp#progress(enum)
|
||||||
if has('macunix') || has('mac') | sl 1m | en
|
if has('macunix') || has('mac') | sl 1m | en
|
||||||
let &l:stl = has_key(s:status, 'prog') ? call(s:status['prog'], [a:enum])
|
let &l:stl = s:status != {} && has_key(s:status, 'prog')
|
||||||
|
\ ? call(s:status['prog'], [a:enum])
|
||||||
\ : '%#CtrlPStats# '.a:enum.' %* %=%<%#CtrlPMode2# '.getcwd().' %*'
|
\ : '%#CtrlPStats# '.a:enum.' %* %=%<%#CtrlPMode2# '.getcwd().' %*'
|
||||||
redraws
|
redraws
|
||||||
endf
|
endf
|
||||||
@@ -1065,9 +1097,8 @@ fu! s:lash(...)
|
|||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:ispathitem()
|
fu! s:ispathitem()
|
||||||
let ext = s:itemtype - ( g:ctrlp_builtins + 1 )
|
retu s:itemtype < 3 ||
|
||||||
retu s:itemtype < 3
|
\ ( s:itemtype > 2 && g:ctrlp_ext_vars[s:itemtype - 3]['type'] == 'path' )
|
||||||
\ || ( s:itemtype > 2 && g:ctrlp_ext_vars[ext]['type'] == 'path' )
|
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! ctrlp#dirnfile(entries)
|
fu! ctrlp#dirnfile(entries)
|
||||||
@@ -1156,7 +1187,7 @@ endf
|
|||||||
fu! ctrlp#setdir(path, ...)
|
fu! ctrlp#setdir(path, ...)
|
||||||
let cmd = a:0 ? a:1 : 'lc!'
|
let cmd = a:0 ? a:1 : 'lc!'
|
||||||
sil! exe cmd ctrlp#fnesc(a:path)
|
sil! exe cmd ctrlp#fnesc(a:path)
|
||||||
let s:crfilerel = fnamemodify(s:crfile, ':.')
|
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! ctrlp#setlcdir()
|
fu! ctrlp#setlcdir()
|
||||||
@@ -1180,6 +1211,7 @@ fu! ctrlp#syntax()
|
|||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:highlight(pat, grp, ipt)
|
fu! s:highlight(pat, grp, ipt)
|
||||||
|
if s:matcher != {} | retu | en
|
||||||
cal clearmatches()
|
cal clearmatches()
|
||||||
if !empty(a:pat) && a:ipt
|
if !empty(a:pat) && a:ipt
|
||||||
let pat = s:regexp ? substitute(a:pat, '\\\@<!\^', '^> \\zs', 'g') : a:pat
|
let pat = s:regexp ? substitute(a:pat, '\\\@<!\^', '^> \\zs', 'g') : a:pat
|
||||||
@@ -1342,6 +1374,22 @@ fu! s:argmaps(md, ...)
|
|||||||
retu a:md
|
retu a:md
|
||||||
endf
|
endf
|
||||||
" Misc {{{2
|
" Misc {{{2
|
||||||
|
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)
|
fu! s:log(m)
|
||||||
if exists('g:ctrlp_log') && g:ctrlp_log | if a:m
|
if exists('g:ctrlp_log') && g:ctrlp_log | if a:m
|
||||||
let cadir = ctrlp#utils#cachedir()
|
let cadir = ctrlp#utils#cachedir()
|
||||||
@@ -1365,9 +1413,8 @@ fu! s:getenv()
|
|||||||
let s:wpmode = exists('b:ctrlp_working_path_mode')
|
let s:wpmode = exists('b:ctrlp_working_path_mode')
|
||||||
\ ? b:ctrlp_working_path_mode : s:pathmode
|
\ ? b:ctrlp_working_path_mode : s:pathmode
|
||||||
if exists('g:ctrlp_extensions')
|
if exists('g:ctrlp_extensions')
|
||||||
if index(g:ctrlp_extensions, 'undo') >= 0 && exists('*undotree')
|
if index(g:ctrlp_extensions, 'undo') >= 0
|
||||||
\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )
|
let s:undos = s:getundo()
|
||||||
let s:undotree = undotree()
|
|
||||||
en
|
en
|
||||||
if index(g:ctrlp_extensions, 'tag') >= 0
|
if index(g:ctrlp_extensions, 'tag') >= 0
|
||||||
let s:tagfiles = s:tagfiles()
|
let s:tagfiles = s:tagfiles()
|
||||||
@@ -1440,8 +1487,8 @@ fu! s:regexfilter(str)
|
|||||||
retu str
|
retu str
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:walker(max, pos, dir)
|
fu! s:walker(m, p, d)
|
||||||
retu a:dir > 0 ? a:pos < a:max ? a:pos + 1 : 0 : a:pos > 0 ? a:pos - 1 : a:max
|
retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:matchfname(item, pat)
|
fu! s:matchfname(item, pat)
|
||||||
@@ -1478,18 +1525,30 @@ fu! s:insertcache(str)
|
|||||||
endf
|
endf
|
||||||
" Extensions {{{2
|
" Extensions {{{2
|
||||||
fu! s:type(...)
|
fu! s:type(...)
|
||||||
let ext = s:itemtype - ( g:ctrlp_builtins + 1 )
|
retu s:itemtype > 2
|
||||||
retu s:itemtype > 2 ? g:ctrlp_ext_vars[ext][a:0 ? 'type' : 'sname'] : s:itemtype
|
\ ? g:ctrlp_ext_vars[s:itemtype - 3][a:0 ? 'type' : 'sname'] : s:itemtype
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:tagfiles()
|
fu! s:tagfiles()
|
||||||
retu filter(map(tagfiles(), 'fnamemodify(v:val, ":p")'), 'filereadable(v:val)')
|
retu filter(map(tagfiles(), 'fnamemodify(v:val, ":p")'), 'filereadable(v:val)')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:onexit()
|
fu! s:extvar(key)
|
||||||
if exists('g:ctrlp_ext_vars')
|
if exists('g:ctrlp_ext_vars')
|
||||||
cal map(filter(copy(g:ctrlp_ext_vars),
|
cal map(filter(copy(g:ctrlp_ext_vars),
|
||||||
\ 'has_key(v:val, "exit")'), 'eval(v:val["exit"])')
|
\ '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:]]
|
||||||
en
|
en
|
||||||
endf
|
endf
|
||||||
|
|
||||||
@@ -1500,6 +1559,10 @@ endf
|
|||||||
fu! ctrlp#prtclear()
|
fu! ctrlp#prtclear()
|
||||||
cal s:PrtClear()
|
cal s:PrtClear()
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
fu! ctrlp#switchtype(id)
|
||||||
|
cal s:ToggleType(a:id - s:itemtype)
|
||||||
|
endf
|
||||||
"}}}1
|
"}}}1
|
||||||
" * Initialization {{{1
|
" * Initialization {{{1
|
||||||
fu! ctrlp#setlines(type)
|
fu! ctrlp#setlines(type)
|
||||||
@@ -1507,7 +1570,7 @@ fu! ctrlp#setlines(type)
|
|||||||
let types = [
|
let types = [
|
||||||
\ 'ctrlp#files()',
|
\ 'ctrlp#files()',
|
||||||
\ 'ctrlp#buffers()',
|
\ 'ctrlp#buffers()',
|
||||||
\ 'ctrlp#mrufiles#list(-1)',
|
\ 'ctrlp#mrufiles#list()',
|
||||||
\ ]
|
\ ]
|
||||||
if exists('g:ctrlp_ext_vars')
|
if exists('g:ctrlp_ext_vars')
|
||||||
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])')
|
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])')
|
||||||
@@ -1527,16 +1590,27 @@ fu! ctrlp#init(type, ...)
|
|||||||
cal ctrlp#setlines(a:type)
|
cal ctrlp#setlines(a:type)
|
||||||
cal s:BuildPrompt(1)
|
cal s:BuildPrompt(1)
|
||||||
endf
|
endf
|
||||||
if has('autocmd') "{{{1
|
" - Autocmds {{{1
|
||||||
|
fu! s:autocmds()
|
||||||
|
if !has('autocmd') | retu | en
|
||||||
aug CtrlPAug
|
aug CtrlPAug
|
||||||
au!
|
au!
|
||||||
au BufEnter ControlP cal s:checkbuf()
|
au BufEnter ControlP cal s:checkbuf()
|
||||||
au BufLeave ControlP cal s:Close()
|
au BufLeave ControlP cal s:Close()
|
||||||
au VimLeavePre * cal s:leavepre()
|
au VimLeavePre * cal s:leavepre()
|
||||||
if s:lazy
|
|
||||||
au CursorHold ControlP cal s:ForceUpdate()
|
|
||||||
en
|
|
||||||
aug END
|
aug END
|
||||||
en "}}}
|
if exists('#CtrlPLazy')
|
||||||
|
au! CtrlPLazy
|
||||||
|
en
|
||||||
|
if s:lazy
|
||||||
|
aug CtrlPLazy
|
||||||
|
au!
|
||||||
|
au CursorHold ControlP cal s:ForceUpdate()
|
||||||
|
aug END
|
||||||
|
en
|
||||||
|
endf
|
||||||
|
|
||||||
|
cal s:autocmds()
|
||||||
|
"}}}
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ let s:buftag_var = {
|
|||||||
\ 'sname': 'bft',
|
\ 'sname': 'bft',
|
||||||
\ 'exit': 'ctrlp#buffertag#exit()',
|
\ 'exit': 'ctrlp#buffertag#exit()',
|
||||||
\ 'type': 'tabs',
|
\ 'type': 'tabs',
|
||||||
|
\ 'opts': 'ctrlp#buffertag#opts()',
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||||
@@ -27,7 +28,7 @@ let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
|||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||||
|
|
||||||
fu! s:opts()
|
fu! ctrlp#buffertag#opts()
|
||||||
let opts = {
|
let opts = {
|
||||||
\ 'g:ctrlp_buftag_systemenc': ['s:enc', &enc],
|
\ 'g:ctrlp_buftag_systemenc': ['s:enc', &enc],
|
||||||
\ 'g:ctrlp_buftag_ctags_bin': ['s:bin', ''],
|
\ 'g:ctrlp_buftag_ctags_bin': ['s:bin', ''],
|
||||||
@@ -37,7 +38,7 @@ fu! s:opts()
|
|||||||
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
||||||
endfo
|
endfo
|
||||||
endf
|
endf
|
||||||
cal s:opts()
|
cal ctrlp#buffertag#opts()
|
||||||
|
|
||||||
fu! s:bins()
|
fu! s:bins()
|
||||||
let bins = [
|
let bins = [
|
||||||
@@ -196,6 +197,21 @@ fu! s:parseline(line)
|
|||||||
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
|
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
|
||||||
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
|
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
fu! s:syntax()
|
||||||
|
if !hlexists('CtrlPTagKind')
|
||||||
|
hi link CtrlPTagKind Title
|
||||||
|
en
|
||||||
|
if !hlexists('CtrlPBufName')
|
||||||
|
hi link CtrlPBufName Directory
|
||||||
|
en
|
||||||
|
if !hlexists('CtrlPTabExtra')
|
||||||
|
hi link CtrlPTabExtra Comment
|
||||||
|
en
|
||||||
|
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
||||||
|
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
||||||
|
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
||||||
|
endf
|
||||||
" Public {{{1
|
" Public {{{1
|
||||||
fu! ctrlp#buffertag#init(fname)
|
fu! ctrlp#buffertag#init(fname)
|
||||||
let bufs = exists('s:btmode') && s:btmode
|
let bufs = exists('s:btmode') && s:btmode
|
||||||
@@ -203,14 +219,12 @@ fu! ctrlp#buffertag#init(fname)
|
|||||||
\ : [exists('s:bufname') ? s:bufname : a:fname]
|
\ : [exists('s:bufname') ? s:bufname : a:fname]
|
||||||
let lines = []
|
let lines = []
|
||||||
for each in bufs
|
for each in bufs
|
||||||
let tftype = get(split(getbufvar(each, '&ft'), '\.'), 0, '')
|
let bname = fnamemodify(each, ':p')
|
||||||
cal extend(lines, s:process(each, tftype))
|
let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '')
|
||||||
|
cal extend(lines, s:process(bname, tftype))
|
||||||
endfo
|
endfo
|
||||||
if has('syntax') && exists('g:syntax_on')
|
if has('syntax') && exists('g:syntax_on')
|
||||||
if !hlexists('CtrlPTabExtra')
|
cal s:syntax()
|
||||||
hi link CtrlPTabExtra Comment
|
|
||||||
en
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
|
||||||
en
|
en
|
||||||
retu lines
|
retu lines
|
||||||
endf
|
endf
|
||||||
|
|||||||
@@ -1,20 +1,9 @@
|
|||||||
" =============================================================================
|
" =============================================================================
|
||||||
" File: autoload/ctrlp/changes.vim
|
" File: autoload/ctrlp/changes.vim
|
||||||
" Description: Change list extension - Jump to a recent change in any buffer
|
" Description: Change list extension
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
" Author: Kien Nguyen <github.com/kien>
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
" User Configuration {{{1
|
|
||||||
" Enable:
|
|
||||||
" let g:ctrlp_extensions += ['changes']
|
|
||||||
" Create Some Commands:
|
|
||||||
" " Single buffer
|
|
||||||
" com! -n=? -com=buffer CtrlPChange
|
|
||||||
" \ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
|
||||||
" " All listed buffers
|
|
||||||
" com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" Init {{{1
|
" Init {{{1
|
||||||
if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes
|
if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes
|
||||||
fini
|
fini
|
||||||
@@ -54,6 +43,17 @@ fu! s:process(clines, ...)
|
|||||||
endfo
|
endfo
|
||||||
retu reverse(filter(clines, 'count(clines, v:val) == 1'))
|
retu reverse(filter(clines, 'count(clines, v:val) == 1'))
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
fu! s:syntax()
|
||||||
|
if !hlexists('CtrlPBufName')
|
||||||
|
hi link CtrlPBufName Directory
|
||||||
|
en
|
||||||
|
if !hlexists('CtrlPTabExtra')
|
||||||
|
hi link CtrlPTabExtra Comment
|
||||||
|
en
|
||||||
|
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||||
|
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||||
|
endf
|
||||||
" Public {{{1
|
" Public {{{1
|
||||||
fu! ctrlp#changes#init(original_bufnr, fname)
|
fu! ctrlp#changes#init(original_bufnr, fname)
|
||||||
let fname = exists('s:bufname') ? s:bufname : a:fname
|
let fname = exists('s:bufname') ? s:bufname : a:fname
|
||||||
@@ -62,7 +62,8 @@ fu! ctrlp#changes#init(original_bufnr, fname)
|
|||||||
let [swb, &swb] = [&swb, '']
|
let [swb, &swb] = [&swb, '']
|
||||||
let lines = []
|
let lines = []
|
||||||
for each in bufs
|
for each in bufs
|
||||||
let [bufnr, fnamet] = [bufnr('^'.each.'$'), fnamemodify(each, ':t')]
|
let [bname, fnamet] = [fnamemodify(each, ':p'), fnamemodify(each, ':t')]
|
||||||
|
let bufnr = bufnr('^'.bname.'$')
|
||||||
if bufnr > 0
|
if bufnr > 0
|
||||||
cal extend(lines, s:process(s:changelist(bufnr), bufnr, fnamet))
|
cal extend(lines, s:process(s:changelist(bufnr), bufnr, fnamet))
|
||||||
en
|
en
|
||||||
@@ -72,10 +73,7 @@ fu! ctrlp#changes#init(original_bufnr, fname)
|
|||||||
let g:ctrlp_nolimit = 1
|
let g:ctrlp_nolimit = 1
|
||||||
if has('syntax') && exists('g:syntax_on')
|
if has('syntax') && exists('g:syntax_on')
|
||||||
cal ctrlp#syntax()
|
cal ctrlp#syntax()
|
||||||
if !hlexists('CtrlPTabExtra')
|
cal s:syntax()
|
||||||
hi link CtrlPTabExtra Comment
|
|
||||||
en
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
|
||||||
en
|
en
|
||||||
retu lines
|
retu lines
|
||||||
endf
|
endf
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
" =============================================================================
|
" =============================================================================
|
||||||
" File: autoload/ctrlp/line.vim
|
" File: autoload/ctrlp/line.vim
|
||||||
" Description: Line extension - Find a line in any buffer
|
" Description: Line extension
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
" Author: Kien Nguyen <github.com/kien>
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
" User Configuration {{{1
|
|
||||||
" Enable:
|
|
||||||
" let g:ctrlp_extensions += ['line']
|
|
||||||
" Create A Command:
|
|
||||||
" com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" Init {{{1
|
" Init {{{1
|
||||||
if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
||||||
fini
|
fini
|
||||||
@@ -29,13 +22,25 @@ let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
|||||||
\ ? add(g:ctrlp_ext_vars, s:line_var) : [s:line_var]
|
\ ? add(g:ctrlp_ext_vars, s:line_var) : [s:line_var]
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||||
|
" Utilities {{{1
|
||||||
|
fu! s:syntax()
|
||||||
|
if !hlexists('CtrlPBufName')
|
||||||
|
hi link CtrlPBufName Directory
|
||||||
|
en
|
||||||
|
if !hlexists('CtrlPTabExtra')
|
||||||
|
hi link CtrlPTabExtra Comment
|
||||||
|
en
|
||||||
|
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||||
|
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||||
|
endf
|
||||||
" Public {{{1
|
" Public {{{1
|
||||||
fu! ctrlp#line#init()
|
fu! ctrlp#line#init()
|
||||||
let [bufs, lines] = [filter(ctrlp#buffers(), 'filereadable(v:val)'), []]
|
let [bufs, lines] = [filter(ctrlp#buffers(), 'filereadable(v:val)'), []]
|
||||||
for each in bufs
|
for each in bufs
|
||||||
let [fnamet, from_file] = [fnamemodify(each, ':t'), readfile(each)]
|
let [fnamet, from_file] = [fnamemodify(each, ':t'), readfile(each)]
|
||||||
|
let bname = fnamemodify(each, ':p')
|
||||||
cal map(from_file, 'tr(v:val, '' '', '' '')')
|
cal map(from_file, 'tr(v:val, '' '', '' '')')
|
||||||
let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.each.'$')]
|
let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.bname.'$')]
|
||||||
wh id <= len_ff
|
wh id <= len_ff
|
||||||
let from_file[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|'
|
let from_file[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|'
|
||||||
let id += 1
|
let id += 1
|
||||||
@@ -44,10 +49,7 @@ fu! ctrlp#line#init()
|
|||||||
cal extend(lines, from_file)
|
cal extend(lines, from_file)
|
||||||
endfo
|
endfo
|
||||||
if has('syntax') && exists('g:syntax_on')
|
if has('syntax') && exists('g:syntax_on')
|
||||||
if !hlexists('CtrlPTabExtra')
|
cal s:syntax()
|
||||||
hi link CtrlPTabExtra Comment
|
|
||||||
en
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
|
||||||
en
|
en
|
||||||
retu lines
|
retu lines
|
||||||
endf
|
endf
|
||||||
|
|||||||
@@ -17,76 +17,108 @@ fu! ctrlp#mrufiles#opts()
|
|||||||
for [ke, va] in items(opts)
|
for [ke, va] in items(opts)
|
||||||
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
||||||
endfo
|
endfo
|
||||||
let s:csen = s:csen ? '#' : '?'
|
let [s:csen, s:mrbs] = [s:csen ? '#' : '?', []]
|
||||||
|
if exists('s:locked')
|
||||||
|
cal ctrlp#mrufiles#init()
|
||||||
|
en
|
||||||
endf
|
endf
|
||||||
cal ctrlp#mrufiles#opts()
|
cal ctrlp#mrufiles#opts()
|
||||||
fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1
|
" Utilities {{{1
|
||||||
if s:locked | retu | en
|
fu! s:excl(fn)
|
||||||
let bufnr = a:bufnr + 0
|
retu !empty(s:ex) && a:fn =~# s:ex
|
||||||
if bufnr > 0
|
endf
|
||||||
let fn = fnamemodify(bufname(bufnr), ':p')
|
|
||||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
fu! s:readcache()
|
||||||
if empty(fn) || !empty(&bt) || ( !empty(s:in) && fn !~# s:in )
|
|
||||||
\ || ( !empty(s:ex) && fn =~# s:ex ) || !filereadable(fn)
|
|
||||||
retu
|
|
||||||
en
|
|
||||||
en
|
|
||||||
if !exists('s:cadir') || !exists('s:cafile')
|
if !exists('s:cadir') || !exists('s:cafile')
|
||||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
||||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
||||||
en
|
en
|
||||||
if a:0 && a:1 == 2
|
retu ctrlp#utils#readfile(s:cafile)
|
||||||
let mrufs = []
|
endf
|
||||||
if a:0 == 2
|
|
||||||
let mrufs = ctrlp#utils#readfile(s:cafile)
|
fu! s:reformat(mrufs)
|
||||||
cal filter(mrufs, 'index(a:2, v:val) < 0')
|
if s:re
|
||||||
en
|
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
|
||||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
cal filter(a:mrufs, '!stridx(v:val, cwd)')
|
||||||
retu map(mrufs, 'fnamemodify(v:val, '':.'')')
|
|
||||||
en
|
en
|
||||||
" Get the list
|
retu map(a:mrufs, 'fnamemodify(v:val, '':.'')')
|
||||||
let mrufs = ctrlp#utils#readfile(s:cafile)
|
endf
|
||||||
" Remove non-existent files
|
|
||||||
if a:0 && a:1 == 1
|
fu! s:record(bufnr, ...)
|
||||||
cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
|
if s:locked | retu | en
|
||||||
if exists('+ssl')
|
let bufnr = a:bufnr + 0
|
||||||
cal map(mrufs, 'tr(v:val, ''/'', ''\'')')
|
if bufnr <= 0 | retu | en
|
||||||
cal filter(mrufs, 'count(mrufs, v:val) == 1')
|
let fn = fnamemodify(bufname(bufnr), ':p')
|
||||||
en
|
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
||||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
cal filter(s:mrbs, 'v:val !='.s:csen.' fn')
|
||||||
|
cal insert(s:mrbs, fn)
|
||||||
|
if empty(fn) || !empty(&bt) || ( !empty(s:in) && fn !~# s:in )
|
||||||
|
\ || ( !empty(s:ex) && fn =~# s:ex ) || !filereadable(fn)
|
||||||
|
\ || ( a:0 && a:1 == 1 )
|
||||||
|
retu
|
||||||
en
|
en
|
||||||
" Return the list with the active buffer removed
|
let mrufs = s:readcache()
|
||||||
if bufnr == -1
|
|
||||||
if s:re
|
|
||||||
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
|
|
||||||
cal filter(mrufs, '!stridx(v:val, cwd)')
|
|
||||||
en
|
|
||||||
retu map(mrufs, 'fnamemodify(v:val, '':.'')')
|
|
||||||
en
|
|
||||||
" Remove old entry
|
|
||||||
cal filter(mrufs, 'v:val !='.s:csen.' fn')
|
cal filter(mrufs, 'v:val !='.s:csen.' fn')
|
||||||
" Insert new one
|
|
||||||
cal insert(mrufs, fn)
|
cal insert(mrufs, fn)
|
||||||
" Remove oldest entry or entries
|
|
||||||
if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en
|
if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en
|
||||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||||
endf "}}}
|
endf
|
||||||
fu! s:excl(fn) "{{{
|
" Public {{{1
|
||||||
retu !empty(s:ex) && a:fn =~# s:ex
|
fu! ctrlp#mrufiles#refresh()
|
||||||
endf "}}}
|
let mrufs = s:readcache()
|
||||||
fu! ctrlp#mrufiles#init() "{{{1
|
cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
|
||||||
|
if exists('+ssl')
|
||||||
|
cal map(mrufs, 'tr(v:val, ''/'', ''\'')')
|
||||||
|
cal filter(mrufs, 'count(mrufs, v:val) == 1')
|
||||||
|
en
|
||||||
|
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||||
|
retu s:reformat(mrufs)
|
||||||
|
endf
|
||||||
|
|
||||||
|
fu! ctrlp#mrufiles#remove(files)
|
||||||
|
let mrufs = []
|
||||||
|
if a:files != []
|
||||||
|
let mrufs = s:readcache()
|
||||||
|
cal filter(mrufs, 'index(a:files, v:val) < 0')
|
||||||
|
en
|
||||||
|
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||||
|
retu map(mrufs, 'fnamemodify(v:val, '':.'')')
|
||||||
|
endf
|
||||||
|
|
||||||
|
fu! ctrlp#mrufiles#list(...)
|
||||||
|
if a:0 | cal s:record(a:1) | retu | en
|
||||||
|
retu s:reformat(s:readcache())
|
||||||
|
endf
|
||||||
|
|
||||||
|
fu! ctrlp#mrufiles#bufs()
|
||||||
|
retu s:mrbs
|
||||||
|
endf
|
||||||
|
|
||||||
|
fu! ctrlp#mrufiles#init()
|
||||||
|
if !has('autocmd') | retu | en
|
||||||
let s:locked = 0
|
let s:locked = 0
|
||||||
aug CtrlPMRUF
|
aug CtrlPMRUF
|
||||||
au!
|
au!
|
||||||
au BufReadPost,BufNewFile,BufWritePost *
|
au BufReadPost,BufNewFile,BufWritePost * cal s:record(expand('<abuf>', 1))
|
||||||
\ cal ctrlp#mrufiles#list(expand('<abuf>', 1))
|
|
||||||
if s:mre
|
|
||||||
au BufEnter,BufUnload *
|
|
||||||
\ cal ctrlp#mrufiles#list(expand('<abuf>', 1))
|
|
||||||
en
|
|
||||||
au QuickFixCmdPre *vimgrep* let s:locked = 1
|
au QuickFixCmdPre *vimgrep* let s:locked = 1
|
||||||
au QuickFixCmdPost *vimgrep* let s:locked = 0
|
au QuickFixCmdPost *vimgrep* let s:locked = 0
|
||||||
aug END
|
aug END
|
||||||
|
aug CtrlPMREB
|
||||||
|
au!
|
||||||
|
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1), 1)
|
||||||
|
aug END
|
||||||
|
if exists('#CtrlPMREF')
|
||||||
|
au! CtrlPMREF
|
||||||
|
en
|
||||||
|
if s:mre
|
||||||
|
aug CtrlPMREF
|
||||||
|
au!
|
||||||
|
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1))
|
||||||
|
aug END
|
||||||
|
if exists('#CtrlPMREB')
|
||||||
|
au! CtrlPMREB
|
||||||
|
en
|
||||||
|
en
|
||||||
endf
|
endf
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,21 @@
|
|||||||
" =============================================================================
|
" =============================================================================
|
||||||
" File: autoload/ctrlp/undo.vim
|
" File: autoload/ctrlp/undo.vim
|
||||||
" Description: Undo extension - Browse undo history (requires Vim 7.3.005+)
|
" Description: Undo extension
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
" Author: Kien Nguyen <github.com/kien>
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
" User Configuration {{{1
|
|
||||||
" Enable:
|
|
||||||
" let g:ctrlp_extensions += ['undo']
|
|
||||||
" Create A Command:
|
|
||||||
" com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" Init {{{1
|
" Init {{{1
|
||||||
if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
||||||
\ || !( v:version > 703 || ( v:version == 703 && has('patch005') ) )
|
|
||||||
fini
|
fini
|
||||||
en
|
en
|
||||||
let g:loaded_ctrlp_undo = 1
|
let g:loaded_ctrlp_undo = 1
|
||||||
|
|
||||||
let s:undo_var = {
|
let s:undo_var = {
|
||||||
\ 'init': 'ctrlp#undo#init(s:undotree)',
|
\ 'init': 'ctrlp#undo#init(s:undos)',
|
||||||
\ 'accept': 'ctrlp#undo#accept',
|
\ 'accept': 'ctrlp#undo#accept',
|
||||||
\ 'lname': 'undo',
|
\ 'lname': 'undo',
|
||||||
\ 'sname': 'udo',
|
\ 'sname': 'udo',
|
||||||
|
\ 'exit': 'ctrlp#undo#exit()',
|
||||||
\ 'type': 'line',
|
\ 'type': 'line',
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
@@ -30,36 +23,31 @@ let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
|||||||
\ ? add(g:ctrlp_ext_vars, s:undo_var) : [s:undo_var]
|
\ ? add(g:ctrlp_ext_vars, s:undo_var) : [s:undo_var]
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
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
|
" Utilities {{{1
|
||||||
fu! s:flatten(tree)
|
fu! s:flatten(tree, cur)
|
||||||
let flatdict = {}
|
let flatdict = {}
|
||||||
for each in a:tree
|
for each in a:tree
|
||||||
cal extend(flatdict, { each['seq'] : each['time'] })
|
let saved = has_key(each, 'save') ? 'saved' : ''
|
||||||
|
let current = each['seq'] == a:cur ? 'current' : ''
|
||||||
|
cal extend(flatdict, { each['seq'] : [each['time'], saved, current] })
|
||||||
if has_key(each, 'alt')
|
if has_key(each, 'alt')
|
||||||
cal extend(flatdict, s:flatten(each['alt']))
|
cal extend(flatdict, s:flatten(each['alt'], a:cur))
|
||||||
en
|
en
|
||||||
endfo
|
endfo
|
||||||
retu flatdict
|
retu flatdict
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:humantime(nr)
|
fu! s:elapsed(nr)
|
||||||
let elapsed = localtime() - a:nr
|
let [text, time] = [s:text, localtime() - a:nr]
|
||||||
let mins = elapsed / 60
|
let mins = time / 60
|
||||||
let hrs = elapsed / 3600
|
let hrs = time / 3600
|
||||||
let days = elapsed / 86400
|
let days = time / 86400
|
||||||
let wks = elapsed / 604800
|
let wks = time / 604800
|
||||||
let mons = elapsed / 2592000
|
let mons = time / 2592000
|
||||||
let yrs = elapsed / 31536000
|
let yrs = time / 31536000
|
||||||
let text = [
|
|
||||||
\ ' second ago',
|
|
||||||
\ ' seconds ago',
|
|
||||||
\ ' minutes ago',
|
|
||||||
\ ' hours ago',
|
|
||||||
\ ' days ago',
|
|
||||||
\ ' weeks ago',
|
|
||||||
\ ' months ago',
|
|
||||||
\ ' years ago',
|
|
||||||
\ ]
|
|
||||||
if yrs > 1
|
if yrs > 1
|
||||||
retu yrs.text[7]
|
retu yrs.text[7]
|
||||||
elsei mons > 1
|
elsei mons > 1
|
||||||
@@ -72,42 +60,66 @@ fu! s:humantime(nr)
|
|||||||
retu hrs.text[3]
|
retu hrs.text[3]
|
||||||
elsei mins > 1
|
elsei mins > 1
|
||||||
retu mins.text[2]
|
retu mins.text[2]
|
||||||
elsei elapsed == 1
|
elsei time == 1
|
||||||
retu elapsed.text[0]
|
retu time.text[0]
|
||||||
elsei elapsed < 120
|
elsei time < 120
|
||||||
retu elapsed.text[1]
|
retu time.text[1]
|
||||||
en
|
en
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:syntax()
|
fu! s:syntax()
|
||||||
for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String'})
|
for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String',
|
||||||
|
\ 'Sv': 'Comment', 'Po': 'Title'})
|
||||||
if !hlexists('CtrlPUndo'.ke)
|
if !hlexists('CtrlPUndo'.ke)
|
||||||
exe 'hi link CtrlPUndo'.ke va
|
exe 'hi link CtrlPUndo'.ke va
|
||||||
en
|
en
|
||||||
endfo
|
endfo
|
||||||
sy match CtrlPUndoT '\d\+ \zs[^ ]\+\ze'
|
sy match CtrlPUndoT '\v\d+ \zs[^ ]+\ze|\d+:\d+:\d+'
|
||||||
sy match CtrlPUndoBr '\[\|\]'
|
sy match CtrlPUndoBr '\[\|\]'
|
||||||
sy match CtrlPUndoNr '\[\d\+\]$' contains=CtrlPUndoBr
|
sy match CtrlPUndoNr '\[\d\+\]' contains=CtrlPUndoBr
|
||||||
|
sy match CtrlPUndoSv 'saved'
|
||||||
|
sy match CtrlPUndoPo 'current'
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:dict2list(dict)
|
fu! s:dict2list(dict)
|
||||||
let dict = map(a:dict, 's:humantime(v:val)')
|
for ke in keys(a:dict)
|
||||||
retu map(keys(dict), 'eval(''[v:val, dict[v:val]]'')')
|
let a:dict[ke][0] = s:elapsed(a:dict[ke][0])
|
||||||
|
endfo
|
||||||
|
retu map(keys(a:dict), 'eval(''[v:val, a:dict[v:val]]'')')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:compval(...)
|
fu! s:compval(...)
|
||||||
retu a:2[0] - a:1[0]
|
retu a:2[0] - a:1[0]
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
fu! s:format(...)
|
||||||
|
let saved = !empty(a:1[1][1]) ? ' '.a:1[1][1] : ''
|
||||||
|
let current = !empty(a:1[1][2]) ? ' '.a:1[1][2] : ''
|
||||||
|
retu a:1[1][0].' ['.a:1[0].']'.saved.current
|
||||||
|
endf
|
||||||
|
|
||||||
|
fu! s:formatul(...)
|
||||||
|
let parts = matchlist(a:1,
|
||||||
|
\ '\v^\s+(\d+)\s+\d+\s+([^ ]+\s?[^ ]+|\d+\s\w+\s\w+)(\s*\d*)$')
|
||||||
|
retu parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
|
||||||
|
endf
|
||||||
" Public {{{1
|
" Public {{{1
|
||||||
fu! ctrlp#undo#init(undo)
|
fu! ctrlp#undo#init(undo)
|
||||||
let entries = a:undo['entries']
|
let entries = a:undo[0] ? a:undo[1]['entries'] : a:undo[1]
|
||||||
if empty(entries) | retu [] | en
|
if empty(entries) | retu [] | en
|
||||||
if has('syntax') && exists('g:syntax_on')
|
if has('syntax') && exists('g:syntax_on')
|
||||||
cal s:syntax()
|
cal s:syntax()
|
||||||
en
|
en
|
||||||
let g:ctrlp_nolimit = 1
|
let g:ctrlp_nolimit = 1
|
||||||
let entries = sort(s:dict2list(s:flatten(entries)), 's:compval')
|
if !exists('s:lines')
|
||||||
retu map(entries, 'v:val[1]." [".v:val[0]."]"')
|
if a:undo[0]
|
||||||
|
let entries = s:dict2list(s:flatten(entries, a:undo[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)')
|
||||||
|
en
|
||||||
|
en
|
||||||
|
retu s:lines
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! ctrlp#undo#accept(mode, str)
|
fu! ctrlp#undo#accept(mode, str)
|
||||||
@@ -120,6 +132,10 @@ endf
|
|||||||
fu! ctrlp#undo#id()
|
fu! ctrlp#undo#id()
|
||||||
retu s:id
|
retu s:id
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
fu! ctrlp#undo#exit()
|
||||||
|
unl! s:lines
|
||||||
|
endf
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.2
|
*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.4
|
||||||
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
|
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
|
||||||
===============================================================================
|
===============================================================================
|
||||||
# #
|
# #
|
||||||
@@ -175,12 +175,10 @@ only need to keep the lines that you’ve changed the values (inside []): >
|
|||||||
\ }
|
\ }
|
||||||
<
|
<
|
||||||
Note: In some terminals, it’s not possible to remap <c-h> without also changing
|
Note: In some terminals, it’s not possible to remap <c-h> without also changing
|
||||||
<bs> (|key-codes|). So if pressing <bs> moves the cursor to the left instead of
|
<bs> (|keycodes|). So if pressing <bs> moves the cursor to the left instead of
|
||||||
deleting a char for you, add this to your |vimrc| to disable the default <c-h>
|
deleting a char for you, add this to your |.vimrc| to disable the plugin’s
|
||||||
mapping: >
|
default <c-h> mapping: >
|
||||||
let g:ctrlp_prompt_mappings = {
|
let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
|
||||||
\ 'PrtCurLeft()': ['<left>', '<c-^>']
|
|
||||||
\ }
|
|
||||||
<
|
<
|
||||||
|
|
||||||
*'g:ctrlp_mruf_max'*
|
*'g:ctrlp_mruf_max'*
|
||||||
@@ -386,8 +384,73 @@ Example: >
|
|||||||
\ 'prog': 'Function_Name_2',
|
\ 'prog': 'Function_Name_2',
|
||||||
\ }
|
\ }
|
||||||
<
|
<
|
||||||
|
Structure of the functions: >
|
||||||
|
function! Function_Name_1(focus, byfname, regex, prev, item, next, marked)
|
||||||
|
" Arguments:
|
||||||
|
" |
|
||||||
|
" +- a:focus : The focus of the prompt: "prt" or "win".
|
||||||
|
" |
|
||||||
|
" +- a:byfname : In filename mode or in full path mode: "file" or "path".
|
||||||
|
" |
|
||||||
|
" +- a:regex : In regex mode: 1 or 0.
|
||||||
|
" |
|
||||||
|
" +- a:prev : The previous search mode.
|
||||||
|
" |
|
||||||
|
" +- a:item : The current search mode.
|
||||||
|
" |
|
||||||
|
" +- a:next : The next search mode.
|
||||||
|
" |
|
||||||
|
" +- a:marked : The number of marked files, or a comma separated list of
|
||||||
|
" the filenames.
|
||||||
|
|
||||||
|
return full_statusline
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
return full_statusline
|
||||||
|
endfunction
|
||||||
|
<
|
||||||
See https://gist.github.com/1610859 for a working example.
|
See https://gist.github.com/1610859 for a working example.
|
||||||
|
|
||||||
|
*'g:ctrlp_match_func'*
|
||||||
|
Set an external fuzzy matching function for |CtrlP| to use: >
|
||||||
|
let g:ctrlp_match_func = {}
|
||||||
|
<
|
||||||
|
Example: >
|
||||||
|
let g:ctrlp_match_func = { 'match': 'Function_Name' }
|
||||||
|
<
|
||||||
|
Structure of the function: >
|
||||||
|
function! Function_Name(items, str, limit, mmode, ispath, crfile, regex)
|
||||||
|
" Arguments:
|
||||||
|
" |
|
||||||
|
" +- a:items : The full list of items to search in.
|
||||||
|
" |
|
||||||
|
" +- a:str : The string entered by the user.
|
||||||
|
" |
|
||||||
|
" +- a:limit : The max height of the match window. Can be used to limit
|
||||||
|
" | the number of items to return.
|
||||||
|
" |
|
||||||
|
" +- a:mmode : The match mode. Can be one of these strings:
|
||||||
|
" | + "full-line": match the entire line.
|
||||||
|
" | + "filename-only": match only the filename.
|
||||||
|
" | + "first-non-tab": match until the first tab char.
|
||||||
|
" | + "until-last-tab": match until the last tab char.
|
||||||
|
" |
|
||||||
|
" +- a:ispath : Is 1 when searching in file, buffer, mru, dir, and rtscript
|
||||||
|
" | modes. Is 0 otherwise.
|
||||||
|
" |
|
||||||
|
" +- a:crfile : The file in the current window. Should be excluded from the
|
||||||
|
" | results when a:ispath == 1.
|
||||||
|
" |
|
||||||
|
" +- a:regex : In regex mode: 1 or 0.
|
||||||
|
|
||||||
|
return list_of_matched_items
|
||||||
|
endfunction
|
||||||
|
<
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
COMMANDS *ctrlp-commands*
|
COMMANDS *ctrlp-commands*
|
||||||
|
|
||||||
@@ -613,7 +676,8 @@ EXTENSIONS *g:ctrlp-extensions*
|
|||||||
|
|
||||||
Extensions are optional. To enable an extension, add its name to the variable
|
Extensions are optional. To enable an extension, add its name to the variable
|
||||||
g:ctrlp_extensions: >
|
g:ctrlp_extensions: >
|
||||||
let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript']
|
let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript',
|
||||||
|
\ 'undo', 'line', 'changes']
|
||||||
<
|
<
|
||||||
The order of the items will be the order they appear on the statusline and when
|
The order of the items will be the order they appear on the statusline and when
|
||||||
using <c-f>, <c-b>.
|
using <c-f>, <c-b>.
|
||||||
@@ -634,8 +698,8 @@ Available extensions:~
|
|||||||
- Name: 'buffertag'
|
- Name: 'buffertag'
|
||||||
- Commands: ':CtrlPBufTag [buffer-name]',
|
- Commands: ':CtrlPBufTag [buffer-name]',
|
||||||
':CtrlPBufTagAll'.
|
':CtrlPBufTagAll'.
|
||||||
- Search for a tag within the current buffer or all buffers and jump to the
|
- Search for a tag within the current buffer or all listed buffers and jump
|
||||||
definition. Requires |exuberant_ctags| or compatible programs.
|
to the definition. Requires |exuberant_ctags| or compatible programs.
|
||||||
|
|
||||||
*:CtrlPQuickfix*
|
*:CtrlPQuickfix*
|
||||||
* Quickfix mode:~
|
* Quickfix mode:~
|
||||||
@@ -661,6 +725,27 @@ Available extensions:~
|
|||||||
- Command: ':CtrlPRTS'
|
- Command: ':CtrlPRTS'
|
||||||
- Search for files (vimscripts, docs, snippets...) in runtimepath.
|
- Search for files (vimscripts, docs, snippets...) in runtimepath.
|
||||||
|
|
||||||
|
*:CtrlPUndo*
|
||||||
|
* Undo mode:~
|
||||||
|
- Name: 'undo'
|
||||||
|
- Command: ':CtrlPUndo'
|
||||||
|
- Browse undo history.
|
||||||
|
|
||||||
|
*:CtrlPLine*
|
||||||
|
* Line mode:~
|
||||||
|
- Name: 'line'
|
||||||
|
- Command: ':CtrlPLine'
|
||||||
|
- Search for a line in all listed buffers.
|
||||||
|
|
||||||
|
*:CtrlPChange*
|
||||||
|
*:CtrlPChangeAll*
|
||||||
|
* Change list mode:~
|
||||||
|
- Name: 'changes'
|
||||||
|
- Commands: ':CtrlPChange [buffer-name]',
|
||||||
|
':CtrlPChangeAll'.
|
||||||
|
- Search for and jump to a recent change in the current buffer or in all
|
||||||
|
listed buffers.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Buffer Tag mode options:~
|
Buffer Tag mode options:~
|
||||||
|
|
||||||
@@ -703,10 +788,14 @@ Highlighting:~
|
|||||||
|
|
||||||
* In extensions:
|
* In extensions:
|
||||||
CtrlPTabExtra : the part of each line that’s not matched against (Comment)
|
CtrlPTabExtra : the part of each line that’s not matched against (Comment)
|
||||||
CtrlPqfLineCol : the line and column numbers in quickfix mode (|hl-Search|)
|
CtrlPBufName : the buffer name an entry belongs to (|hl-Directory|)
|
||||||
|
CtrlPTagKind : the kind of the tag in buffer-tag mode (|hl-Title|)
|
||||||
|
CtrlPqfLineCol : the line and column numbers in quickfix mode (Comment)
|
||||||
CtrlPUndoT : the elapsed time in undo mode (|hl-Directory|)
|
CtrlPUndoT : the elapsed time in undo mode (|hl-Directory|)
|
||||||
CtrlPUndoBr : the square brackets [] in undo mode (Comment)
|
CtrlPUndoBr : the square brackets [] in undo mode (Comment)
|
||||||
CtrlPUndoNr : the undo number inside [] in undo mode (String)
|
CtrlPUndoNr : the undo number inside [] in undo mode (String)
|
||||||
|
CtrlPUndoSv : the point where the file was saved (Comment)
|
||||||
|
CtrlPUndoPo : the current position in the undo tree (|hl-Title|)
|
||||||
|
|
||||||
Statuslines:~
|
Statuslines:~
|
||||||
* Highlight groups:
|
* Highlight groups:
|
||||||
@@ -789,6 +878,7 @@ Special thanks:~
|
|||||||
===============================================================================
|
===============================================================================
|
||||||
CHANGELOG *ctrlp-changelog*
|
CHANGELOG *ctrlp-changelog*
|
||||||
|
|
||||||
|
+ New option: |g:ctrlp_match_func|, allow using a custom fuzzy matcher.
|
||||||
+ Rename:
|
+ Rename:
|
||||||
*ClearCtrlPCache* -> |CtrlPClearCache|
|
*ClearCtrlPCache* -> |CtrlPClearCache|
|
||||||
*ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|
|
*ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|
|
||||||
|
|||||||
@@ -65,4 +65,18 @@ if index(s:ext, 'rtscript') >= 0
|
|||||||
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||||
en
|
en
|
||||||
|
|
||||||
|
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
|
unl s:ext
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ function! s:HightlightErrors()
|
|||||||
let force_callback = has_key(item, 'force_highlight_callback') && item['force_highlight_callback']
|
let force_callback = has_key(item, 'force_highlight_callback') && item['force_highlight_callback']
|
||||||
|
|
||||||
let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
||||||
if item['col'] && !force_callback
|
if get( item, 'col' ) && !force_callback
|
||||||
let lastcol = col([item['lnum'], '$'])
|
let lastcol = col([item['lnum'], '$'])
|
||||||
let lcol = min([lastcol, item['col']])
|
let lcol = min([lastcol, item['col']])
|
||||||
call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c')
|
call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c')
|
||||||
@@ -466,8 +466,8 @@ endfunction
|
|||||||
|
|
||||||
"load the chosen checker for the current filetype - useful for filetypes like
|
"load the chosen checker for the current filetype - useful for filetypes like
|
||||||
"javascript that have more than one syntax checker
|
"javascript that have more than one syntax checker
|
||||||
function! s:LoadChecker(checker)
|
function! s:LoadChecker(checker, ft)
|
||||||
exec "runtime syntax_checkers/" . &ft . "/" . a:checker . ".vim"
|
exec "runtime syntax_checkers/" . a:ft . "/" . a:checker . ".vim"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"return a string representing the state of buffer according to
|
"return a string representing the state of buffer according to
|
||||||
@@ -602,22 +602,24 @@ endfunction
|
|||||||
"well as the names of the actual syntax checker executables. The checkers
|
"well as the names of the actual syntax checker executables. The checkers
|
||||||
"should be listed in order of default preference.
|
"should be listed in order of default preference.
|
||||||
"
|
"
|
||||||
"if a option called 'g:syntastic_[filetype]_checker' exists then attempt to
|
"a:ft should be the filetype for the checkers being loaded
|
||||||
|
"
|
||||||
|
"if a option called 'g:syntastic_{a:ft}_checker' exists then attempt to
|
||||||
"load the checker that it points to
|
"load the checker that it points to
|
||||||
function! SyntasticLoadChecker(checkers)
|
function! SyntasticLoadChecker(checkers, ft)
|
||||||
let opt_name = "g:syntastic_" . &ft . "_checker"
|
let opt_name = "g:syntastic_" . a:ft . "_checker"
|
||||||
|
|
||||||
if exists(opt_name)
|
if exists(opt_name)
|
||||||
let opt_val = {opt_name}
|
let opt_val = {opt_name}
|
||||||
if index(a:checkers, opt_val) != -1 && executable(opt_val)
|
if index(a:checkers, opt_val) != -1 && executable(opt_val)
|
||||||
call s:LoadChecker(opt_val)
|
call s:LoadChecker(opt_val, a:ft)
|
||||||
else
|
else
|
||||||
echoerr &ft . " syntax not supported or not installed."
|
echoerr &ft . " syntax not supported or not installed."
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
for checker in a:checkers
|
for checker in a:checkers
|
||||||
if executable(checker)
|
if executable(checker)
|
||||||
return s:LoadChecker(checker)
|
return s:LoadChecker(checker, a:ft)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ endif
|
|||||||
let loaded_go_syntax_checker = 1
|
let loaded_go_syntax_checker = 1
|
||||||
|
|
||||||
let s:supported_checkers = ["6g", "gofmt"]
|
let s:supported_checkers = ["6g", "gofmt"]
|
||||||
call SyntasticLoadChecker(s:supported_checkers)
|
call SyntasticLoadChecker(s:supported_checkers, 'go')
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ endif
|
|||||||
let loaded_javascript_syntax_checker = 1
|
let loaded_javascript_syntax_checker = 1
|
||||||
|
|
||||||
let s:supported_checkers = ["gjslint", "jslint", "jsl", "jshint"]
|
let s:supported_checkers = ["gjslint", "jslint", "jsl", "jshint"]
|
||||||
call SyntasticLoadChecker(s:supported_checkers)
|
call SyntasticLoadChecker(s:supported_checkers, 'javascript')
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ endif
|
|||||||
let loaded_json_syntax_checker = 1
|
let loaded_json_syntax_checker = 1
|
||||||
|
|
||||||
let s:supported_checkers = ["jsonlint", "jsonval"]
|
let s:supported_checkers = ["jsonlint", "jsonval"]
|
||||||
call SyntasticLoadChecker(s:supported_checkers)
|
call SyntasticLoadChecker(s:supported_checkers, 'json')
|
||||||
|
|||||||
@@ -19,21 +19,46 @@ if !executable("puppet")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:ExtractVersion()
|
if !exists("g:syntastic_puppet_lint_disable")
|
||||||
|
let g:syntastic_puppet_lint_disable = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !executable("puppet-lint")
|
||||||
|
let g:syntastic_puppet_lint_disable = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:PuppetExtractVersion()
|
||||||
let output = system("puppet --version")
|
let output = system("puppet --version")
|
||||||
let output = substitute(output, '\n$', '', '')
|
let output = substitute(output, '\n$', '', '')
|
||||||
return split(output, '\.')
|
return split(output, '\.')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:puppetVersion = s:ExtractVersion()
|
function! s:PuppetLintExtractVersion()
|
||||||
|
let output = system("puppet-lint --version")
|
||||||
|
let output = substitute(output, '\n$', '', '')
|
||||||
|
let output = substitute(output, '^puppet-lint ', '', 'i')
|
||||||
|
return split(output, '\.')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_puppet_GetLocList()
|
let s:puppetVersion = s:PuppetExtractVersion()
|
||||||
|
let s:lintVersion = s:PuppetLintExtractVersion()
|
||||||
|
|
||||||
|
if !(s:lintVersion[0] >= '0' && s:lintVersion[1] >= '1' && s:lintVersion[2] >= '10')
|
||||||
|
let g:syntastic_puppet_lint_disable = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:getPuppetLintErrors()
|
||||||
|
let makeprg = 'puppet-lint --log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}" '.shellescape(expand('%'))
|
||||||
|
let errorformat = '%t%*[a-zA-Z] %m at %f:%l'
|
||||||
|
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' })
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:getPuppetMakeprg()
|
||||||
"If puppet is >= version 2.7 then use the new executable
|
"If puppet is >= version 2.7 then use the new executable
|
||||||
if s:puppetVersion[0] >= '2' && s:puppetVersion[1] >= '7'
|
if s:puppetVersion[0] >= '2' && s:puppetVersion[1] >= '7'
|
||||||
let makeprg = 'puppet parser validate ' .
|
let makeprg = 'puppet parser validate ' .
|
||||||
\ shellescape(expand('%')) .
|
\ shellescape(expand('%')) .
|
||||||
\ ' --color=false' .
|
\ ' --color=false'
|
||||||
\ ' --storeconfigs'
|
|
||||||
|
|
||||||
"add --ignoreimport for versions < 2.7.10
|
"add --ignoreimport for versions < 2.7.10
|
||||||
if s:puppetVersion[2] < '10'
|
if s:puppetVersion[2] < '10'
|
||||||
@@ -43,12 +68,24 @@ function! SyntaxCheckers_puppet_GetLocList()
|
|||||||
else
|
else
|
||||||
let makeprg = 'puppet --color=false --parseonly --ignoreimport '.shellescape(expand('%'))
|
let makeprg = 'puppet --color=false --parseonly --ignoreimport '.shellescape(expand('%'))
|
||||||
endif
|
endif
|
||||||
|
return makeprg
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! SyntaxCheckers_puppet_GetLocList()
|
||||||
|
|
||||||
|
let makeprg = s:getPuppetMakeprg()
|
||||||
|
|
||||||
"some versions of puppet (e.g. 2.7.10) output the message below if there
|
"some versions of puppet (e.g. 2.7.10) output the message below if there
|
||||||
"are any syntax errors
|
"are any syntax errors
|
||||||
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
|
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
|
||||||
|
|
||||||
let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
|
let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
|
||||||
|
|
||||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||||
|
|
||||||
|
if !g:syntastic_puppet_lint_disable
|
||||||
|
let errors = errors + s:getPuppetLintErrors()
|
||||||
|
endif
|
||||||
|
|
||||||
|
return errors
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ if !exists('g:syntastic_python_checker_args')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let s:supported_checkers = ["flake8", "pyflakes", "pylint"]
|
let s:supported_checkers = ["flake8", "pyflakes", "pylint"]
|
||||||
call SyntasticLoadChecker(s:supported_checkers)
|
call SyntasticLoadChecker(s:supported_checkers, 'python')
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
"
|
"
|
||||||
"============================================================================
|
"============================================================================
|
||||||
function! SyntaxCheckers_python_GetLocList()
|
function! SyntaxCheckers_python_GetLocList()
|
||||||
let makeprg = 'pylint -f parseable -r n -i y ' .
|
let makeprg = 'pylint '.g:syntastic_python_checker_args.' -f parseable -r n -i y ' .
|
||||||
\ shellescape(expand('%')) .
|
\ shellescape(expand('%')) .
|
||||||
\ ' \| sed ''s_: \[[RC]_: \[W_''' .
|
\ ' 2>&1 \| sed ''s_: \[[RC]_: \[W_''' .
|
||||||
\ ' \| sed ''s_: \[[F]_:\ \[E_'''
|
\ ' \| sed ''s_: \[[F]_:\ \[E_'''
|
||||||
let errorformat = '%f:%l: [%t%n%.%#] %m,%-GNo config%m'
|
let errorformat = '%f:%l: [%t%n%.%#] %m,%f:%l: [%t%.%#] %m,%Z,%-GNo config%m'
|
||||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
" "// modules: " and containing space delimited list of vala
|
" "// modules: " and containing space delimited list of vala
|
||||||
" modules, used by the file, so this script can build correct
|
" modules, used by the file, so this script can build correct
|
||||||
" --pkg arguments.
|
" --pkg arguments.
|
||||||
|
" Alternatively you can set g:syntastic_vala_modules array
|
||||||
|
" in your .vimrc or .lvimrc with localvimrc plugin
|
||||||
|
" (http://www.vim.org/scripts/script.php?script_id=441).
|
||||||
" Valac compiler is not the fastest thing in the world, so you
|
" Valac compiler is not the fastest thing in the world, so you
|
||||||
" may want to disable this plugin with
|
" may want to disable this plugin with
|
||||||
" let g:syntastic_vala_check_disabled = 1 command in your .vimrc or
|
" let g:syntastic_vala_check_disabled = 1 command in your .vimrc or
|
||||||
@@ -38,10 +41,19 @@ function! SyntaxCheckers_vala_GetHighlightRegex(pos)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:GetValaModules()
|
function! s:GetValaModules()
|
||||||
|
if exists('g:syntastic_vala_modules')
|
||||||
|
if type(g:syntastic_vala_modules) == type('')
|
||||||
|
return split(g:syntastic_vala_modules, '\s\+')
|
||||||
|
elseif type(g:syntastic_vala_modules) == type([])
|
||||||
|
return g:syntastic_vala_modules
|
||||||
|
else
|
||||||
|
echoerr 'g:syntastic_vala_modules must be either list or string: fallback to in file modules string'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let modules_line = search('^// modules: ', 'n')
|
let modules_line = search('^// modules: ', 'n')
|
||||||
let modules_str = getline(modules_line)
|
let modules_str = getline(modules_line)
|
||||||
let modules = split(strpart(modules_str, 12), '\s\+')
|
return split(strpart(modules_str, 12), '\s\+')
|
||||||
return modules
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_vala_GetLocList()
|
function! SyntaxCheckers_vala_GetLocList()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
" Author: Eric Van Dewoestine
|
" Author: Eric Van Dewoestine
|
||||||
"
|
"
|
||||||
" License: {{{
|
" License: {{{
|
||||||
" Copyright (c) 2005 - 2011, Eric Van Dewoestine
|
" Copyright (c) 2005 - 2012, Eric Van Dewoestine
|
||||||
" All rights reserved.
|
" All rights reserved.
|
||||||
"
|
"
|
||||||
" Redistribution and use of this software in source and binary forms, with
|
" Redistribution and use of this software in source and binary forms, with
|
||||||
@@ -122,7 +122,6 @@ function! s:ParseRegex(file, settings) " {{{
|
|||||||
|
|
||||||
" prototype.js has Object.extend to extend existing objects.
|
" prototype.js has Object.extend to extend existing objects.
|
||||||
call add(patterns, ['o', '(?:var\s+)?\b([A-Z][A-Za-z0-9_.]+)\s*=\s*Object\.extend\s*\(', 1])
|
call add(patterns, ['o', '(?:var\s+)?\b([A-Z][A-Za-z0-9_.]+)\s*=\s*Object\.extend\s*\(', 1])
|
||||||
call add(patterns, ['o', '\bObject\.extend\s*\(\b([A-Z][A-Za-z0-9_.]+)\s*,\s*\{', 1])
|
|
||||||
|
|
||||||
" mootools uses 'new Class'
|
" mootools uses 'new Class'
|
||||||
call add(patterns, ['o', '(?:var\s+)?\b([A-Z][A-Za-z0-9_.]+)\s*=\s*new\s+Class\s*\(', 1])
|
call add(patterns, ['o', '(?:var\s+)?\b([A-Z][A-Za-z0-9_.]+)\s*=\s*new\s+Class\s*\(', 1])
|
||||||
@@ -135,6 +134,11 @@ function! s:ParseRegex(file, settings) " {{{
|
|||||||
" vimperator uses var = (function()
|
" vimperator uses var = (function()
|
||||||
call add(patterns, ['o', '([A-Za-z0-9_.]+)\s*=\s*\(function\s*\(', 1])
|
call add(patterns, ['o', '([A-Za-z0-9_.]+)\s*=\s*\(function\s*\(', 1])
|
||||||
|
|
||||||
|
" other library based exend calls (backbone, etc)
|
||||||
|
call add(patterns,
|
||||||
|
\ ['o', '(?:var\s+)?\b([A-Z][A-Za-z0-9_.]+)\s*=\s*[A-Za-z0-9_.]+\.extend\s*\({', 1])
|
||||||
|
call add(patterns, ['o', '\.extend\s*\(\b([A-Z][A-Za-z0-9_.]+)\s*,\s*\{', 1])
|
||||||
|
|
||||||
" Match Functions
|
" Match Functions
|
||||||
call add(patterns, ['f', '\bfunction\s+([a-zA-Z0-9_.\$]+?)\s*\(', 1])
|
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])
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
*mark.txt* Highlight several words in different colors simultaneously.
|
*mark.txt* Highlight several words in different colors simultaneously.
|
||||||
|
|
||||||
MARK by Ingo Karkat
|
MARK by Ingo Karkat
|
||||||
(original version by Yuheng Xie)
|
(original version by Yuheng Xie)
|
||||||
@@ -26,25 +26,27 @@ doesn't maintain his original version anymore and cannot be reached via the
|
|||||||
email address in his profile. This plugin offers the following advantages over
|
email address in his profile. This plugin offers the following advantages over
|
||||||
the original:
|
the original:
|
||||||
- Much faster, all colored words can now be highlighted, no more clashes with
|
- Much faster, all colored words can now be highlighted, no more clashes with
|
||||||
syntax highlighting (due to use of matchadd()).
|
syntax highlighting (due to use of matchadd()).
|
||||||
- Many bug fixes.
|
- Many bug fixes.
|
||||||
- Jumps behave like the built-in search, including wrap and error messages.
|
- Jumps behave like the built-in search, including wrap and error messages.
|
||||||
- Like the built-in commands, jumps take an optional [count] to quickly skip
|
- Like the built-in commands, jumps take an optional [count] to quickly skip
|
||||||
over some marks.
|
over some marks.
|
||||||
|
- Marks can be persisted, and patterns can be added / subtracted from
|
||||||
|
mark highlight groups.
|
||||||
|
|
||||||
RELATED WORKS *
|
RELATED WORKS *
|
||||||
|
|
||||||
- MultipleSearch (vimscript #479) can highlight in a single window and in all
|
- MultipleSearch (vimscript #479) can highlight in a single window and in all
|
||||||
buffers, but still relies on the :syntax highlighting method, which is
|
buffers, but still relies on the :syntax highlighting method, which is
|
||||||
slower and less reliable.
|
slower and less reliable.
|
||||||
- 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
|
- highlight.vim (vimscript #1599) highlights lines or patterns of interest in
|
||||||
different colors, using mappings that start with CTRL-H and work on cword.
|
different colors, using mappings that start with CTRL-H and work on cword.
|
||||||
- quickhl.vim (vimscript #3692) can also list the matches with colors and in
|
- quickhl.vim (vimscript #3692) can also list the matches with colors and in
|
||||||
addition offers on-the-fly highlighting of the current word (like many IDEs
|
addition offers on-the-fly highlighting of the current word (like many IDEs
|
||||||
do).
|
do).
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
USAGE *mark-usage*
|
USAGE *mark-usage*
|
||||||
@@ -52,38 +54,68 @@ USAGE *mark-usage*
|
|||||||
HIGHLIGHTING *mark-highlighting*
|
HIGHLIGHTING *mark-highlighting*
|
||||||
*<Leader>m* *v_<Leader>m*
|
*<Leader>m* *v_<Leader>m*
|
||||||
<Leader>m Mark the word under the cursor, similar to the |star|
|
<Leader>m Mark the word under the cursor, similar to the |star|
|
||||||
command. The next free highlight group is used.
|
command. The next free highlight group is used.
|
||||||
If already on a mark: Clear the mark, like
|
If already on a mark: Clear the mark, like
|
||||||
|<Leader>n|.
|
|<Leader>n|.
|
||||||
{Visual}<Leader>m Mark or unmark the visual selection.
|
{Visual}<Leader>m Mark or unmark the visual selection.
|
||||||
|
[N]<Leader>m With [N], mark the word under the cursor with the
|
||||||
|
named highlight group [N]. When that group is not
|
||||||
|
empty, the word is added as an alternative match, so
|
||||||
|
you can highlight multiple words with the same color.
|
||||||
|
When the word is already contained in the list of
|
||||||
|
alternatives, it is removed.
|
||||||
|
|
||||||
|
When [N] is greater than the number of defined mark
|
||||||
|
groups, a summary of marks is printed. Active mark
|
||||||
|
groups are prefixed with "*" (or "M*" when there are
|
||||||
|
M pattern alternatives), the default next group with
|
||||||
|
">", the last used search with "/" (like |:Marks|
|
||||||
|
does). Input the mark group, accept the default with
|
||||||
|
<CR>, or abort with <Esc> or any other key.
|
||||||
|
This way, when unsure about which number represents
|
||||||
|
which color, just use 99<Leader>n and pick the color
|
||||||
|
interactively!
|
||||||
|
|
||||||
|
{Visual}[N]<Leader>m Ditto, based on the visual selection.
|
||||||
|
|
||||||
*<Leader>r* *v_<Leader>r*
|
*<Leader>r* *v_<Leader>r*
|
||||||
<Leader>r Manually input a regular expression to mark.
|
<Leader>r Manually input a regular expression to mark.
|
||||||
{Visual}<Leader>r Ditto, based on the visual selection.
|
{Visual}<Leader>r Ditto, 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.
|
<Leader>n Clear the mark under the cursor.
|
||||||
If not on a mark: Disable all marks, similar to
|
If not on a mark: Disable all marks, similar to
|
||||||
|:nohlsearch|.
|
|:nohlsearch|.
|
||||||
|
|
||||||
Note: Marks that span multiple lines are not detected,
|
Note: Marks that span multiple lines are not detected,
|
||||||
so the use of <Leader>n on such a mark will
|
so the use of <Leader>n on such a mark will
|
||||||
unintentionally remove all marks! Use
|
unintentionally remove all marks! Use
|
||||||
{Visual}<Leader>r or :Mark {pattern} to clear
|
{Visual}<Leader>r or :Mark {pattern} to clear
|
||||||
multi-line marks.
|
multi-line marks (or pass [N] if you happen to know
|
||||||
|
the group number).
|
||||||
|
[N]<Leader>n Clear the marks represented by highlight group [N].
|
||||||
|
|
||||||
*:Mark*
|
*:Mark*
|
||||||
:Mark {pattern} Mark or unmark {pattern}.
|
:[N]Mark Clear the marks represented by highlight group [N].
|
||||||
|
:[N]Mark {pattern} Mark or unmark {pattern}. Unless [N] is given, the
|
||||||
|
next free highlight group is used.
|
||||||
|
With [N], mark the word under the cursor with the
|
||||||
|
named highlight group [N]. When that group is not
|
||||||
|
empty, the word is added as an alternative match, so
|
||||||
|
you can highlight multiple words with the same color.
|
||||||
|
When the word is already contained in the list of
|
||||||
|
alternatives, it is removed.
|
||||||
For implementation reasons, {pattern} cannot use the
|
For implementation reasons, {pattern} cannot use the
|
||||||
'smartcase' setting, only 'ignorecase'.
|
'smartcase' setting, only 'ignorecase'.
|
||||||
:Mark Disable all marks, similar to |:nohlsearch|. Marks
|
:Mark Disable all marks, similar to |:nohlsearch|. Marks
|
||||||
will automatically re-enable when a mark is added or
|
will automatically re-enable when a mark is added or
|
||||||
removed, or a search for marks is performed.
|
removed, or a search for marks is performed.
|
||||||
*:MarkClear*
|
*:MarkClear*
|
||||||
:MarkClear Clear all marks. In contrast to disabling marks, the
|
:MarkClear Clear all marks. In contrast to disabling marks, the
|
||||||
actual mark information is cleared, the next mark will
|
actual mark information is cleared, the next mark will
|
||||||
use the first highlight group. This cannot be undone.
|
use the first highlight group. This cannot be undone.
|
||||||
|
|
||||||
|
|
||||||
SEARCHING *mark-searching*
|
SEARCHING *mark-searching*
|
||||||
@@ -92,63 +124,79 @@ SEARCHING *mark-searching*
|
|||||||
[count]<Leader>* [count]<Leader>#
|
[count]<Leader>* [count]<Leader>#
|
||||||
[count]<Leader>/ [count]<Leader>?
|
[count]<Leader>/ [count]<Leader>?
|
||||||
Use these six keys to jump to the [count]'th next /
|
Use these six keys to jump to the [count]'th next /
|
||||||
previous occurrence of a mark.
|
previous occurrence of a mark.
|
||||||
You could also use Vim's / and ? to search, since the
|
You could also use Vim's / and ? to search, since the
|
||||||
mark patterns are (optionally, see configuration)
|
mark patterns are (optionally, see configuration)
|
||||||
added to the search history, too.
|
added to the search history, too.
|
||||||
|
|
||||||
Cursor over mark Cursor not over mark
|
Cursor over mark Cursor not over mark
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
<Leader>* Jump to the next occurrence of Jump to the next occurrence of
|
<Leader>* Jump to the next occurrence of Jump to the next occurrence of
|
||||||
current mark, and remember it "last mark".
|
current mark, and remember it "last mark".
|
||||||
as "last mark".
|
as "last mark".
|
||||||
|
|
||||||
<Leader>/ Jump to the next occurrence of Same as left.
|
<Leader>/ Jump to the next occurrence of Same as left.
|
||||||
ANY mark.
|
ANY mark.
|
||||||
|
|
||||||
* If <Leader>* is the most recently Do Vim's original * command.
|
* If <Leader>* is the most recently Do Vim's original * command.
|
||||||
used, do a <Leader>*; otherwise
|
used, do a <Leader>*; otherwise
|
||||||
(<Leader>/ is the most recently
|
(<Leader>/ is the most recently
|
||||||
used), do a <Leader>/.
|
used), do a <Leader>/.
|
||||||
|
|
||||||
Note: When the cursor is on a mark, the backwards
|
Note: When the cursor is on a mark, the backwards
|
||||||
search does not jump to the beginning of the current
|
search does not jump to the beginning of the current
|
||||||
mark (like the built-in search), but to the previous
|
mark (like the built-in search), but to the previous
|
||||||
mark. The entire mark text is treated as one entity.
|
mark. The entire mark text is treated as one entity.
|
||||||
|
|
||||||
You can use Vim's |jumplist| to go back to previous
|
You can use Vim's |jumplist| to go back to previous
|
||||||
mark matches and the position before a mark search.
|
mark matches and the position before a mark search.
|
||||||
|
|
||||||
MARK PERSISTENCE *mark-persistence*
|
MARK PERSISTENCE *mark-persistence*
|
||||||
|
|
||||||
The marks can be kept and restored across Vim sessions, using the |viminfo|
|
The marks can be kept and restored across Vim sessions, using the |viminfo|
|
||||||
file. For this to work, the "!" flag must be part of the 'viminfo' setting: >
|
file. For this to work, the "!" flag must be part of the 'viminfo' setting: >
|
||||||
set viminfo+=! " Save and restore global variables.
|
set viminfo+=! " Save and restore global variables.
|
||||||
< *:MarkLoad*
|
< *:MarkLoad*
|
||||||
:MarkLoad Restore the marks from the previous Vim session. All
|
:MarkLoad Restore the marks from the previous Vim session. All
|
||||||
current marks are discarded.
|
current marks are discarded.
|
||||||
*:MarkSave*
|
*:MarkSave*
|
||||||
:MarkSave Save the currently defined marks (or clear the
|
:MarkSave Save the currently defined marks (or clear the
|
||||||
persisted marks if no marks are currently defined) for
|
persisted marks if no marks are currently defined) for
|
||||||
use in a future Vim session.
|
use in a future Vim session.
|
||||||
|
|
||||||
By default, automatic persistence is enabled (so you don't need to explicitly
|
By default, automatic persistence is enabled (so you don't need to explicitly
|
||||||
|:MarkSave|), but you have to explicitly load the persisted marks in a new Vim
|
|:MarkSave|), but you have to explicitly load the persisted marks in a new Vim
|
||||||
session via |:MarkLoad|, to avoid that you accidentally drag along outdated
|
session via |:MarkLoad|, to avoid that you accidentally drag along outdated
|
||||||
highlightings from Vim session to session, and be surprised by the arbitrary
|
highlightings from Vim session to session, and be surprised by the arbitrary
|
||||||
highlight groups and occasional appearance of forgotten marks. If you want
|
highlight groups and occasional appearance of forgotten marks. If you want
|
||||||
just that though and automatically restore any marks, set |g:mwAutoLoadMarks|.
|
just that though and automatically restore any marks, set |g:mwAutoLoadMarks|.
|
||||||
|
|
||||||
You can also initialize the marks to static values, e.g. by including this in
|
You can also initialize some marks (even using particular highlight groups) to
|
||||||
|vimrc|: >
|
static values, e.g. by including this in |vimrc|: >
|
||||||
runtime plugin/mark.vim
|
runtime plugin/mark.vim
|
||||||
silent MarkClear
|
silent MarkClear
|
||||||
Mark foo
|
5Mark foo
|
||||||
Mark bar
|
6Mark bar
|
||||||
Or you can define custom commands that preset certain marks: >
|
Or you can define custom commands that preset certain marks: >
|
||||||
command -bar MyMarks silent MarkClear | execute 'Mark foo' | execute 'Mark bar'
|
command -bar MyMarks silent MarkClear | execute '5Mark foo' | execute '6Mark bar'
|
||||||
Or a command that adds to the existing marks and then toggles them: >
|
Or a command that adds to the existing marks and then toggles them: >
|
||||||
command -bar ToggleFooBarMarks execute 'Mark foo' | execute 'Mark bar'
|
command -bar ToggleFooBarMarks execute 'Mark foo' | execute 'Mark bar'
|
||||||
|
<
|
||||||
|
MARK INFORMATION *mark-information*
|
||||||
|
|
||||||
|
Both |mark-highlighting| and |mark-searching| commands print information about
|
||||||
|
the mark and search pattern, e.g.
|
||||||
|
mark-1/\<pattern\> ~
|
||||||
|
This is especially useful when you want to add or subtract patterns to a mark
|
||||||
|
highlight group via [N].
|
||||||
|
|
||||||
|
*:Marks*
|
||||||
|
:Marks List all mark highlight groups and the search patterns
|
||||||
|
defined for them.
|
||||||
|
The group that will be used for the next |:Mark| or
|
||||||
|
|<Leader>m| command (with [N]) is shown with a ">".
|
||||||
|
The last mark used for a search (via |<Leader>*|) is
|
||||||
|
shown with a "/".
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
INSTALLATION *mark-installation*
|
INSTALLATION *mark-installation*
|
||||||
@@ -159,26 +207,26 @@ the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
|
|||||||
vimball or via the |:UseVimball| command. >
|
vimball or via the |:UseVimball| command. >
|
||||||
vim mark.vba.gz
|
vim mark.vba.gz
|
||||||
:so %
|
:so %
|
||||||
To uninstall, use the |:RmVimball| command.
|
To uninstall, use the |:RmVimball| command.
|
||||||
|
|
||||||
DEPENDENCIES *mark-dependencies*
|
DEPENDENCIES *mark-dependencies*
|
||||||
|
|
||||||
- Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher.
|
- Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
CONFIGURATION *mark-configuration*
|
CONFIGURATION *mark-configuration*
|
||||||
|
|
||||||
For a permanent configuration, put the following commands into your |vimrc|.
|
For a permanent configuration, put the following commands into your |vimrc|.
|
||||||
|
|
||||||
*mark-highlight-colors*
|
*mark-highlight-colors*
|
||||||
You may define your own colors or more than the default 6 highlightings in
|
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.
|
Higher numbers always take precedence and are displayed above lower ones.
|
||||||
If you want to avoid losing the highlightings on |:colorscheme| commands, you
|
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
|
need to re-apply your highlights on the |ColorScheme| event, similar to how
|
||||||
this plugin does.
|
this plugin does.
|
||||||
|
|
||||||
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
|
||||||
@@ -194,11 +242,11 @@ To enable the automatic restore of marks from a previous Vim session: >
|
|||||||
< *g:mwAutoSaveMarks*
|
< *g:mwAutoSaveMarks*
|
||||||
To turn off the automatic persistence of marks across Vim sessions: >
|
To turn off the automatic persistence of marks across Vim sessions: >
|
||||||
let g:mwAutoSaveMarks = 0
|
let g:mwAutoSaveMarks = 0
|
||||||
You can still explicitly save marks via |:MarkSave|.
|
You can still explicitly save marks via |:MarkSave|.
|
||||||
|
|
||||||
*mark-mappings*
|
*mark-mappings*
|
||||||
You can use different mappings by mapping to the <Plug>Mark... mappings (use
|
You can use different mappings by mapping to the <Plug>Mark... mappings (use
|
||||||
":map <Plug>Mark" to list them all) before this plugin is sourced.
|
":map <Plug>Mark" to list them all) before this plugin is sourced.
|
||||||
|
|
||||||
There are no default mappings for toggling all marks and for the |:MarkClear|
|
There are no default mappings for toggling all marks and for the |:MarkClear|
|
||||||
command, but you can define some yourself: >
|
command, but you can define some yourself: >
|
||||||
@@ -214,7 +262,7 @@ Some people like to create a mark based on the visual selection, like
|
|||||||
|v_<Leader>m|, but have whitespace in the selection match any whitespace when
|
|v_<Leader>m|, but have whitespace in the selection match any whitespace when
|
||||||
searching (searching for "hello world" will also find "hello<Tab>world" as
|
searching (searching for "hello world" will also find "hello<Tab>world" as
|
||||||
well as "hello" at the end of a line, with "world" at the start of the next
|
well as "hello" at the end of a line, with "world" at the start of the next
|
||||||
line). The Vim Tips Wiki describes such a setup for the built-in search at
|
line). The Vim Tips Wiki describes such a setup for the built-in search at
|
||||||
http://vim.wikia.com/wiki/Search_for_visually_selected_text
|
http://vim.wikia.com/wiki/Search_for_visually_selected_text
|
||||||
You can achieve the same with the Mark plugin through the following scriptlet: >
|
You can achieve the same with the Mark plugin through the following scriptlet: >
|
||||||
function! s:GetVisualSelectionAsLiteralWhitespaceIndifferentPattern()
|
function! s:GetVisualSelectionAsLiteralWhitespaceIndifferentPattern()
|
||||||
@@ -232,11 +280,11 @@ behavior: >
|
|||||||
LIMITATIONS *mark-limitations*
|
LIMITATIONS *mark-limitations*
|
||||||
|
|
||||||
- If the 'ignorecase' setting is changed, there will be discrepancies between
|
- If the 'ignorecase' setting is changed, there will be discrepancies between
|
||||||
the highlighted marks and subsequent jumps to marks.
|
the highlighted marks and subsequent jumps to marks.
|
||||||
- If {pattern} in a :Mark command contains atoms that change the semantics of
|
- If {pattern} in a :Mark command contains atoms that change the semantics of
|
||||||
the entire (|/\c|, |/\C|) or following (|/\v|,|/\V|, |/\M|) regular
|
the entire (|/\c|, |/\C|) or following (|/\v|,|/\V|, |/\M|) regular
|
||||||
expression, there may be discrepancies between the highlighted marks and
|
expression, there may be discrepancies between the highlighted marks and
|
||||||
subsequent jumps to marks.
|
subsequent jumps to marks.
|
||||||
|
|
||||||
KNOWN PROBLEMS *mark-known-problems*
|
KNOWN PROBLEMS *mark-known-problems*
|
||||||
|
|
||||||
@@ -245,103 +293,130 @@ TODO *mark-todo*
|
|||||||
IDEAS *mark-ideas*
|
IDEAS *mark-ideas*
|
||||||
|
|
||||||
Taken from an alternative implementation at
|
Taken from an alternative implementation at
|
||||||
http://vim.wikia.com/wiki/Highlight_multiple_words:
|
http://vim.wikia.com/wiki/Highlight_multiple_words:
|
||||||
- Allow to specify the highlight group number via :[N]Mark {regexp}
|
- Use keys 1-9 on the numeric keypad to toggle a highlight group number.
|
||||||
- Use keys 1-9 on the numeric keypad to toggle a highlight group number.
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
HISTORY *mark-history*
|
HISTORY *mark-history*
|
||||||
|
|
||||||
|
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.
|
||||||
|
This allows to interactively choose a color via 99<Leader>m.
|
||||||
|
- ENH: Include count of alternative patterns in :Marks list.
|
||||||
|
- CHG: Use ">" for next mark and "/" for last search in :Marks.
|
||||||
|
|
||||||
|
2.6.1 23-Mar-2012
|
||||||
|
- ENH: Add :Marks command that prints all mark highlight groups and their
|
||||||
|
search patterns, plus information about the current search mark, next mark
|
||||||
|
group, and whether marks are disabled.
|
||||||
|
- ENH: Show which mark group a pattern was set / added / removed / cleared.
|
||||||
|
- FIX: When the cursor is positioned on the current mark, [N]<Leader>n /
|
||||||
|
<Plug>MarkClear with [N] appended the pattern for the current mark (again
|
||||||
|
and again) instead of clearing it. Must not pass current mark pattern when
|
||||||
|
[N] is given.
|
||||||
|
- CHG: Show mark group number in same-mark search and rename search types from
|
||||||
|
"any-mark", "same-mark", and "new-mark" to the shorter "mark-*", "mark-N",
|
||||||
|
and "mark-N!", respectively.
|
||||||
|
|
||||||
|
2.6.0 22-Mar-2012
|
||||||
|
- ENH: Allow [count] for <Leader>m and :Mark to add / subtract match to / from
|
||||||
|
highlight group [count], and use [count]<Leader>n to clear only highlight
|
||||||
|
group [count]. This was also requested by Philipp Marek.
|
||||||
|
- FIX: :Mark and <Leader>n actually toggled marks back on when they were
|
||||||
|
already off. Now, they stay off on multiple invocations. Use :call
|
||||||
|
mark#Toggle() / <Plug>MarkToggle if you want toggling.
|
||||||
|
|
||||||
2.5.3 02-Mar-2012
|
2.5.3 02-Mar-2012
|
||||||
- BUG: Version check mistakenly excluded Vim 7.1 versions that do have the
|
- BUG: Version check mistakenly excluded Vim 7.1 versions that do have the
|
||||||
matchadd() function. Thanks to Philipp Marek for sending a patch.
|
matchadd() function. Thanks to Philipp Marek for sending a patch.
|
||||||
|
|
||||||
2.5.2 09-Nov-2011
|
2.5.2 09-Nov-2011
|
||||||
Fixed various problems with wrap-around warnings:
|
Fixed various problems with wrap-around warnings:
|
||||||
- BUG: With a single match and 'wrapscan' set, a search error was issued.
|
- BUG: With a single match and 'wrapscan' set, a search error was issued.
|
||||||
- FIX: Backwards search with single match leads to wrong error message
|
- FIX: Backwards search with single match leads to wrong error message
|
||||||
instead.
|
instead.
|
||||||
- FIX: Wrong logic for determining l:isWrapped lets wrap-around go undetected.
|
- FIX: Wrong logic for determining l:isWrapped lets wrap-around go undetected.
|
||||||
|
|
||||||
2.5.1 17-May-2011
|
2.5.1 17-May-2011
|
||||||
- FIX: == comparison in s:DoMark() leads to wrong regexp (\A vs. \a) being
|
- FIX: == comparison in s:DoMark() leads to wrong regexp (\A vs. \a) being
|
||||||
cleared when 'ignorecase' is set. Use case-sensitive comparison ==# instead.
|
cleared when 'ignorecase' is set. Use case-sensitive comparison ==# instead.
|
||||||
- Refine :MarkLoad messages
|
- Refine :MarkLoad messages
|
||||||
- Add whitespace-indifferent visual mark configuration example. Thanks to Greg
|
- Add whitespace-indifferent visual mark configuration example. Thanks to Greg
|
||||||
Klein for the suggestion.
|
Klein for the suggestion.
|
||||||
|
|
||||||
2.5.0 07-May-2011
|
2.5.0 07-May-2011
|
||||||
- ENH: Add explicit mark persistence via :MarkLoad and :MarkSave commands and
|
- ENH: Add explicit mark persistence via :MarkLoad and :MarkSave commands and
|
||||||
automatic persistence via the g:mwAutoLoadMarks and g:mwAutoSaveMarks
|
automatic persistence via the g:mwAutoLoadMarks and g:mwAutoSaveMarks
|
||||||
configuration flags. (Request from Mun Johl, 16-Apr-2010)
|
configuration flags. (Request from Mun Johl, 16-Apr-2010)
|
||||||
- Expose toggling of mark display (keeping the mark patterns) via new
|
- Expose toggling of mark display (keeping the mark patterns) via new
|
||||||
<Plug>MarkToggle mapping. Offer :MarkClear command as a replacement for the
|
<Plug>MarkToggle mapping. Offer :MarkClear command as a replacement for the
|
||||||
old argumentless :Mark command, which now just disables, but not clears all
|
old argumentless :Mark command, which now just disables, but not clears all
|
||||||
marks.
|
marks.
|
||||||
|
|
||||||
2.4.4 18-Apr-2011
|
2.4.4 18-Apr-2011
|
||||||
- BUG: Include trailing newline character in check for current mark, so that a
|
- 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
|
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.
|
cleared via <Leader>n. Thanks to ping for reporting this.
|
||||||
- FIX: On overlapping marks, mark#CurrentMark() returned the lowest, not the
|
- FIX: On overlapping marks, mark#CurrentMark() returned the lowest, not the
|
||||||
highest visible mark. So on overlapping marks, the one that was not visible
|
highest visible mark. So on overlapping marks, the one that was not visible
|
||||||
at the cursor position was removed; very confusing! Use reverse iteration
|
at the cursor position was removed; very confusing! Use reverse iteration
|
||||||
order.
|
order.
|
||||||
- FIX: To avoid an arbitrary ordering of highlightings when the highlighting
|
- FIX: To avoid an arbitrary ordering of highlightings when the highlighting
|
||||||
group names roll over, and to avoid order inconsistencies across different
|
group names roll over, and to avoid order inconsistencies across different
|
||||||
windows and tabs, we assign a different priority based on the highlighting
|
windows and tabs, we assign a different priority based on the highlighting
|
||||||
group.
|
group.
|
||||||
|
|
||||||
2.4.3 16-Apr-2011
|
2.4.3 16-Apr-2011
|
||||||
- Avoid losing the mark highlightings on :syn on or :colorscheme commands.
|
- 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.
|
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
|
- 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
|
or when the window-local reckoning of match IDs got lost. I had very
|
||||||
occasionally encountered such script errors in the past.
|
occasionally encountered such script errors in the past.
|
||||||
- Made global housekeeping variables script-local, only g:mwHistAdd is used
|
- Made global housekeeping variables script-local, only g:mwHistAdd is used
|
||||||
for configuration.
|
for configuration.
|
||||||
|
|
||||||
2.4.2 14-Jan-2011 (unreleased)
|
2.4.2 14-Jan-2011 (unreleased)
|
||||||
- FIX: Capturing the visual selection could still clobber the blockwise yank
|
- FIX: Capturing the visual selection could still clobber the blockwise yank
|
||||||
mode of the unnamed register.
|
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
|
||||||
using the unnamed register.
|
using the unnamed register.
|
||||||
|
|
||||||
2.4.0 13-Jul-2010
|
2.4.0 13-Jul-2010
|
||||||
- ENH: The MarkSearch mappings (<Leader>[*#/?]) add the original cursor
|
- ENH: The MarkSearch mappings (<Leader>[*#/?]) add the original cursor
|
||||||
position to the jump list, like the built-in [/?*#nN] commands. This allows
|
position to the jump list, like the built-in [/?*#nN] commands. This allows
|
||||||
to use the regular jump commands for mark matches, like with regular search
|
to use the regular jump commands for mark matches, like with regular search
|
||||||
matches.
|
matches.
|
||||||
|
|
||||||
2.3.3 19-Feb-2010
|
2.3.3 19-Feb-2010
|
||||||
- BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results
|
- BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results
|
||||||
in endless loop. Thanks to Andy Wokula for the patch.
|
in endless loop. Thanks to Andy Wokula for the patch.
|
||||||
|
|
||||||
2.3.2 17-Nov-2009
|
2.3.2 17-Nov-2009
|
||||||
- BUG: Creation of literal pattern via '\V' in {Visual}<Leader>m mapping
|
- BUG: Creation of literal pattern via '\V' in {Visual}<Leader>m mapping
|
||||||
collided with individual escaping done in <Leader>m mapping so that an
|
collided with individual escaping done in <Leader>m mapping so that an
|
||||||
escaped '\*' would be interpreted as a multi item when both modes are used
|
escaped '\*' would be interpreted as a multi item when both modes are used
|
||||||
for marking. Thanks to Andy Wokula for the patch.
|
for marking. Thanks to Andy Wokula for the patch.
|
||||||
|
|
||||||
2.3.1 06-Jul-2009
|
2.3.1 06-Jul-2009
|
||||||
- Now working correctly when 'smartcase' is set. All mappings and the :Mark
|
- Now working correctly when 'smartcase' is set. All mappings and the :Mark
|
||||||
command use 'ignorecase', but not 'smartcase'.
|
command use 'ignorecase', but not 'smartcase'.
|
||||||
|
|
||||||
2.3.0 04-Jul-2009
|
2.3.0 04-Jul-2009
|
||||||
- All jump commands now take an optional [count], so you can quickly skip over
|
- All jump commands now take an optional [count], so you can quickly skip over
|
||||||
some marks, as with the built-in */# and n/N commands. For this, the entire
|
some marks, as with the built-in */# and n/N commands. For this, the entire
|
||||||
core search algorithm has been rewritten. The script's logic has been
|
core search algorithm has been rewritten. The script's logic has been
|
||||||
simplified through the use of Vim 7 features like Lists.
|
simplified through the use of Vim 7 features like Lists.
|
||||||
- Now also printing a Vim-alike search error message when 'nowrapscan' is set.
|
- Now also printing a Vim-alike search error message when 'nowrapscan' is set.
|
||||||
|
|
||||||
2.2.0 02-Jul-2009
|
2.2.0 02-Jul-2009
|
||||||
- Split off functions into autoload script.
|
- Split off functions into autoload script.
|
||||||
- Initialization of global variables and autocommands is now done lazily on
|
- Initialization of global variables and autocommands is now done lazily on
|
||||||
the first use, not during loading of the plugin. This reduces Vim startup
|
the first use, not during loading of the plugin. This reduces Vim startup
|
||||||
time and footprint as long as the functionality isn't yet used.
|
time and footprint as long as the functionality isn't yet used.
|
||||||
- Split off documentation into separate help file. Now packaging as VimBall.
|
- Split off documentation into separate help file. Now packaging as VimBall.
|
||||||
|
|
||||||
|
|
||||||
@@ -349,37 +424,37 @@ Fixed various problems with wrap-around warnings:
|
|||||||
- Replaced highlighting via :syntax with matchadd() / matchdelete(). This
|
- Replaced highlighting via :syntax with matchadd() / matchdelete(). This
|
||||||
requires Vim 7.2 / 7.1 with patches. This method is faster, there are no
|
requires Vim 7.2 / 7.1 with patches. This method is faster, there are no
|
||||||
more clashes with syntax highlighting (:match always has preference), and
|
more clashes with syntax highlighting (:match always has preference), and
|
||||||
the background highlighting does not disappear under 'cursorline'.
|
the background highlighting does not disappear under 'cursorline'.
|
||||||
- Using winrestcmd() to fix effects of :windo: By entering a window, its
|
- Using winrestcmd() to fix effects of :windo: By entering a window, its
|
||||||
height is potentially increased from 0 to 1.
|
height is potentially increased from 0 to 1.
|
||||||
- Handling multiple tabs by calling s:UpdateScope() on the TabEnter event.
|
- Handling multiple tabs by calling s:UpdateScope() on the TabEnter event.
|
||||||
|
|
||||||
2.0.0 01-Jun-2009
|
2.0.0 01-Jun-2009
|
||||||
- Now using Vim List for g:mwWord and thus requiring Vim 7. g:mwCycle is now
|
- Now using Vim List for g:mwWord and thus requiring Vim 7. g:mwCycle is now
|
||||||
zero-based, but the syntax groups "MarkWordx" are still one-based.
|
zero-based, but the syntax groups "MarkWordx" are still one-based.
|
||||||
- Factored :syntax operations out of s:DoMark() and s:UpdateMark() so that
|
- Factored :syntax operations out of s:DoMark() and s:UpdateMark() so that
|
||||||
they can all be done in a single :windo.
|
they can all be done in a single :windo.
|
||||||
- Normal mode <Plug>MarkSet now has the same semantics as its visual mode
|
- Normal mode <Plug>MarkSet now has the same semantics as its visual mode
|
||||||
cousin: If the cursor is on an existing mark, the mark is removed.
|
cousin: If the cursor is on an existing mark, the mark is removed.
|
||||||
Beforehand, one could only remove a visually selected mark via again
|
Beforehand, one could only remove a visually selected mark via again
|
||||||
selecting it. Now, one simply can invoke the mapping when on such a mark.
|
selecting it. Now, one simply can invoke the mapping when on such a mark.
|
||||||
|
|
||||||
1.6.1 31-May-2009
|
1.6.1 31-May-2009
|
||||||
Publication of improved version by Ingo Karkat.
|
Publication of improved version by Ingo Karkat.
|
||||||
- Now prepending search type ("any-mark", "same-mark", "new-mark") for better
|
- Now prepending search type ("any-mark", "same-mark", "new-mark") for better
|
||||||
identification.
|
identification.
|
||||||
- Retired the algorithm in s:PrevWord in favor of simply using <cword>, which
|
- Retired the algorithm in s:PrevWord in favor of simply using <cword>, which
|
||||||
makes mark.vim work like the * command. At the end of a line, non-keyword
|
makes mark.vim work like the * command. At the end of a line, non-keyword
|
||||||
characters may now be marked; the previous algorithm preferred any preceding
|
characters may now be marked; the previous algorithm preferred any preceding
|
||||||
word.
|
word.
|
||||||
- BF: If 'iskeyword' contains characters that have a special meaning in a
|
- BF: If 'iskeyword' contains characters that have a special meaning in a
|
||||||
regexp (e.g. [.*]), these are now escaped properly.
|
regexp (e.g. [.*]), these are now escaped properly.
|
||||||
- Highlighting can now actually be overridden in the vimrc (anywhere _before_
|
- Highlighting can now actually be overridden in the vimrc (anywhere _before_
|
||||||
sourcing this script) by using ':hi def'.
|
sourcing this script) by using ':hi def'.
|
||||||
- Added missing setter for re-inclusion guard.
|
- Added missing setter for re-inclusion guard.
|
||||||
|
|
||||||
1.5.0 01-Sep-2008
|
1.5.0 01-Sep-2008
|
||||||
Bug fixes and enhancements by Ingo Karkat.
|
Bug fixes and enhancements by Ingo Karkat.
|
||||||
- Added <Plug>MarkAllClear (without a default mapping), which clears all
|
- Added <Plug>MarkAllClear (without a default mapping), which clears all
|
||||||
marks, even when the cursor is on a mark.
|
marks, even when the cursor is on a mark.
|
||||||
- Added <Plug>... mappings for hard-coded \*, \#, \/, \?, * and #, to allow
|
- Added <Plug>... mappings for hard-coded \*, \#, \/, \?, * and #, to allow
|
||||||
@@ -395,18 +470,18 @@ Bug fixes and enhancements by Ingo Karkat.
|
|||||||
continuing at TOP" and "Pattern not found:..." messages, like the * and n/N
|
continuing at TOP" and "Pattern not found:..." messages, like the * and n/N
|
||||||
Vim search commands.
|
Vim search commands.
|
||||||
- ENH: Jumps now open folds if the occurrence is inside a closed fold, just
|
- ENH: Jumps now open folds if the occurrence is inside a closed fold, just
|
||||||
like n/N do.
|
like n/N do.
|
||||||
|
|
||||||
1.1.8-g 25-Apr-2008
|
1.1.8-g 25-Apr-2008
|
||||||
Last version published by Yuheng Xie on vim.org.
|
Last version published by Yuheng Xie on vim.org.
|
||||||
|
|
||||||
1.1.2 22-Mar-2005
|
1.1.2 22-Mar-2005
|
||||||
Initial version published by Yuheng Xie on vim.org.
|
Initial version published by Yuheng Xie on vim.org.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Copyright: (C) 2005-2008 Yuheng Xie
|
Copyright: (C) 2005-2008 Yuheng Xie
|
||||||
(C) 2008-2012 Ingo Karkat
|
(C) 2008-2012 Ingo Karkat
|
||||||
The VIM LICENSE applies to this script; see|copyright|.
|
The VIM LICENSE applies to this script; see|copyright|.
|
||||||
|
|
||||||
Maintainer: Ingo Karkat <ingo@karkat.de>
|
Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|||||||
@@ -1,111 +1,125 @@
|
|||||||
" Script Name: mark.vim
|
" Script Name: mark.vim
|
||||||
" Description: Highlight several words in different colors simultaneously.
|
" Description: Highlight several words in different colors simultaneously.
|
||||||
"
|
"
|
||||||
" Copyright: (C) 2005-2008 Yuheng Xie
|
" Copyright: (C) 2005-2008 Yuheng Xie
|
||||||
" (C) 2008-2012 Ingo Karkat
|
" (C) 2008-2012 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>
|
||||||
" Orig Author: Yuheng Xie <elephant@linux.net.cn>
|
" Orig Author: Yuheng Xie <elephant@linux.net.cn>
|
||||||
" Contributors:Luc Hermitte, Ingo Karkat
|
" Contributors:Luc Hermitte, Ingo Karkat
|
||||||
"
|
"
|
||||||
" Dependencies:
|
" Dependencies:
|
||||||
" - 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.5.3
|
" Version: 2.6.1
|
||||||
" Changes:
|
" Changes:
|
||||||
|
" 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
|
||||||
|
" group, and whether marks are disabled.
|
||||||
|
" - FIX: When the cursor is positioned on the current mark, [N]<Leader>n /
|
||||||
|
" <Plug>MarkClear with [N] appended the pattern for the current mark (again
|
||||||
|
" and again) instead of clearing it. Must not pass current mark pattern when
|
||||||
|
" [N] is given.
|
||||||
|
"
|
||||||
|
" 22-Mar-2012, Ingo Karkat
|
||||||
|
" - ENH: Allow [count] for <Leader>m and :Mark to add / subtract match to / from
|
||||||
|
" highlight group [count], and use [count]<Leader>n to clear only highlight
|
||||||
|
" group [count]. This was also requested by Philipp Marek.
|
||||||
|
"
|
||||||
" 02-Mar-2012, Philipp Marek
|
" 02-Mar-2012, Philipp Marek
|
||||||
" - BUG: Version check mistakenly excluded Vim 7.1 versions that do have the
|
" - BUG: Version check mistakenly excluded Vim 7.1 versions that do have the
|
||||||
" matchadd() function.
|
" matchadd() function.
|
||||||
"
|
"
|
||||||
" 06-May-2011, Ingo Karkat
|
" 06-May-2011, Ingo Karkat
|
||||||
" - By default, enable g:mwAutoSaveMarks, so that marks are always persisted,
|
" - By default, enable g:mwAutoSaveMarks, so that marks are always persisted,
|
||||||
" but disable g:mwAutoLoadMarks, so that persisted marks have to be explicitly
|
" but disable g:mwAutoLoadMarks, so that persisted marks have to be explicitly
|
||||||
" loaded, if that is desired. I often wondered why I got unexpected mark
|
" loaded, if that is desired. I often wondered why I got unexpected mark
|
||||||
" highlightings in a new Vim session until I realized that I had used marks in
|
" highlightings in a new Vim session until I realized that I had used marks in
|
||||||
" a previous session and forgot to clear them.
|
" a previous session and forgot to clear them.
|
||||||
"
|
"
|
||||||
" 21-Apr-2011, Ingo Karkat
|
" 21-Apr-2011, Ingo Karkat
|
||||||
" - Expose toggling of mark display (keeping the mark patterns) via new
|
" - Expose toggling of mark display (keeping the mark patterns) via new
|
||||||
" <Plug>MarkToggle mapping. Offer :MarkClear command as a replacement for the
|
" <Plug>MarkToggle mapping. Offer :MarkClear command as a replacement for the
|
||||||
" old argumentless :Mark command, which now just disables, but not clears all
|
" old argumentless :Mark command, which now just disables, but not clears all
|
||||||
" marks.
|
" marks.
|
||||||
" - Implement lazy-loading of disabled persistent marks via g:mwDoDeferredLoad
|
" - Implement lazy-loading of disabled persistent marks via g:mwDoDeferredLoad
|
||||||
" flag passing to autoload/mark.vim.
|
" flag passing to autoload/mark.vim.
|
||||||
"
|
"
|
||||||
" 19-Apr-2011, Ingo Karkat
|
" 19-Apr-2011, Ingo Karkat
|
||||||
" - ENH: Add explicit mark persistence via :MarkLoad and :MarkSave commands and
|
" - ENH: Add explicit mark persistence via :MarkLoad and :MarkSave commands and
|
||||||
" automatic persistence via the g:mwAutoLoadMarks and g:mwAutoSaveMarks
|
" automatic persistence via the g:mwAutoLoadMarks and g:mwAutoSaveMarks
|
||||||
" configuration flags.
|
" configuration flags.
|
||||||
"
|
"
|
||||||
" 15-Apr-2011, Ingo Karkat
|
" 15-Apr-2011, Ingo Karkat
|
||||||
" - Avoid losing the mark highlightings on :syn on or :colorscheme commands.
|
" - 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.
|
" 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
|
||||||
" mark#GetVisualSelectionAsLiteralPattern().
|
" mark#GetVisualSelectionAsLiteralPattern().
|
||||||
"
|
"
|
||||||
" 04-Jul-2009, Ingo Karkat
|
" 04-Jul-2009, Ingo Karkat
|
||||||
" - A [count] before any mapping either caused "No range allowed" error or just
|
" - A [count] before any mapping either caused "No range allowed" error or just
|
||||||
" repeated the :call [count] times, resulting in the current search pattern
|
" repeated the :call [count] times, resulting in the current search pattern
|
||||||
" echoed [count] times and a hit-enter prompt. Now suppressing [count] via
|
" echoed [count] times and a hit-enter prompt. Now suppressing [count] via
|
||||||
" <C-u> and handling it inside the implementation.
|
" <C-u> and handling it inside the implementation.
|
||||||
" - Now passing isBackward (0/1) instead of optional 'b' flag into functions.
|
" - Now passing isBackward (0/1) instead of optional 'b' flag into functions.
|
||||||
" Also passing empty regexp to mark#MarkRegex() to avoid any optional
|
" Also passing empty regexp to mark#MarkRegex() to avoid any optional
|
||||||
" arguments.
|
" arguments.
|
||||||
"
|
"
|
||||||
" 02-Jul-2009, Ingo Karkat
|
" 02-Jul-2009, Ingo Karkat
|
||||||
" - Split off functions into autoload script.
|
" - Split off functions into autoload script.
|
||||||
" - Removed g:force_reload_mark.
|
" - Removed g:force_reload_mark.
|
||||||
" - Initialization of global variables and autocommands is now done lazily on
|
" - Initialization of global variables and autocommands is now done lazily on
|
||||||
" the first use, not during loading of the plugin. This reduces Vim startup
|
" the first use, not during loading of the plugin. This reduces Vim startup
|
||||||
" time and footprint as long as the functionality isn't yet used.
|
" time and footprint as long as the functionality isn't yet used.
|
||||||
"
|
"
|
||||||
" 6-Jun-2009, Ingo Karkat
|
" 6-Jun-2009, Ingo Karkat
|
||||||
" 1. Somehow s:WrapMessage() needs a redraw before the :echo to avoid that a
|
" 1. Somehow s:WrapMessage() needs a redraw before the :echo to avoid that a
|
||||||
" later Vim redraw clears the wrap message. This happened when there's no
|
" later Vim redraw clears the wrap message. This happened when there's no
|
||||||
" statusline and thus :echo'ing into the ruler.
|
" statusline and thus :echo'ing into the ruler.
|
||||||
" 2. Removed line-continuations and ':set cpo=...'. Upper-cased <SID> and <CR>.
|
" 2. Removed line-continuations and ':set cpo=...'. Upper-cased <SID> and <CR>.
|
||||||
" 3. Added default highlighting for the special search type.
|
" 3. Added default highlighting for the special search type.
|
||||||
"
|
"
|
||||||
" 2-Jun-2009, Ingo Karkat
|
" 2-Jun-2009, Ingo Karkat
|
||||||
" 1. Replaced highlighting via :syntax with matchadd() / matchdelete(). This
|
" 1. Replaced highlighting via :syntax with matchadd() / matchdelete(). This
|
||||||
" requires Vim 7.2 / 7.1 with patches. This method is faster, there are no
|
" requires Vim 7.2 / 7.1 with patches. This method is faster, there are no
|
||||||
" more clashes with syntax highlighting (:match always has preference), and
|
" more clashes with syntax highlighting (:match always has preference), and
|
||||||
" the background highlighting does not disappear under 'cursorline'.
|
" the background highlighting does not disappear under 'cursorline'.
|
||||||
" 2. Factored :windo application out into s:MarkScope().
|
" 2. Factored :windo application out into s:MarkScope().
|
||||||
" 3. Using winrestcmd() to fix effects of :windo: By entering a window, its
|
" 3. Using winrestcmd() to fix effects of :windo: By entering a window, its
|
||||||
" height is potentially increased from 0 to 1.
|
" height is potentially increased from 0 to 1.
|
||||||
" 4. Handling multiple tabs by calling s:UpdateScope() on the TabEnter event.
|
" 4. Handling multiple tabs by calling s:UpdateScope() on the TabEnter event.
|
||||||
"
|
"
|
||||||
" 1-Jun-2009, Ingo Karkat
|
" 1-Jun-2009, Ingo Karkat
|
||||||
" 1. Now using Vim List for g:mwWord and thus requiring Vim 7. g:mwCycle is now
|
" 1. Now using Vim List for g:mwWord and thus requiring Vim 7. g:mwCycle is now
|
||||||
" zero-based, but the syntax groups "MarkWordx" are still one-based.
|
" zero-based, but the syntax groups "MarkWordx" are still one-based.
|
||||||
" 2. Added missing setter for re-inclusion guard.
|
" 2. Added missing setter for re-inclusion guard.
|
||||||
" 3. Factored :syntax operations out of s:DoMark() and s:UpdateMark() so that
|
" 3. Factored :syntax operations out of s:DoMark() and s:UpdateMark() so that
|
||||||
" they can all be done in a single :windo.
|
" they can all be done in a single :windo.
|
||||||
" 4. Normal mode <Plug>MarkSet now has the same semantics as its visual mode
|
" 4. Normal mode <Plug>MarkSet now has the same semantics as its visual mode
|
||||||
" cousin: If the cursor is on an existing mark, the mark is removed.
|
" cousin: If the cursor is on an existing mark, the mark is removed.
|
||||||
" Beforehand, one could only remove a visually selected mark via again
|
" Beforehand, one could only remove a visually selected mark via again
|
||||||
" selecting it. Now, one simply can invoke the mapping when on such a mark.
|
" selecting it. Now, one simply can invoke the mapping when on such a mark.
|
||||||
" 5. Highlighting can now actually be overridden in the vimrc (anywhere
|
" 5. Highlighting can now actually be overridden in the vimrc (anywhere
|
||||||
" _before_ sourcing this script) by using ':hi def'.
|
" _before_ sourcing this script) by using ':hi def'.
|
||||||
"
|
"
|
||||||
" 31-May-2009, Ingo Karkat
|
" 31-May-2009, Ingo Karkat
|
||||||
" 1. Refactored s:Search() to optionally take advantage of SearchSpecial.vim
|
" 1. Refactored s:Search() to optionally take advantage of SearchSpecial.vim
|
||||||
" autoload functionality for echoing of search pattern, wrap and error
|
" autoload functionality for echoing of search pattern, wrap and error
|
||||||
" messages.
|
" messages.
|
||||||
" 2. Now prepending search type ("any-mark", "same-mark", "new-mark") for
|
" 2. Now prepending search type ("any-mark", "same-mark", "new-mark") for
|
||||||
" better identification.
|
" better identification.
|
||||||
" 3. Retired the algorithm in s:PrevWord in favor of simply using <cword>,
|
" 3. Retired the algorithm in s:PrevWord in favor of simply using <cword>,
|
||||||
" which makes mark.vim work like the * command. At the end of a line,
|
" which makes mark.vim work like the * command. At the end of a line,
|
||||||
" non-keyword characters may now be marked; the previous algorithm prefered
|
" non-keyword characters may now be marked; the previous algorithm prefered
|
||||||
" any preceding word.
|
" any preceding word.
|
||||||
" 4. BF: If 'iskeyword' contains characters that have a special meaning in a
|
" 4. BF: If 'iskeyword' contains characters that have a special meaning in a
|
||||||
" regex (e.g. [.*]), these are now escaped properly.
|
" regex (e.g. [.*]), these are now escaped properly.
|
||||||
"
|
"
|
||||||
" 01-Sep-2008, Ingo Karkat: bugfixes and enhancements
|
" 01-Sep-2008, Ingo Karkat: bugfixes and enhancements
|
||||||
" 1. Added <Plug>MarkAllClear (without a default mapping), which clears all
|
" 1. Added <Plug>MarkAllClear (without a default mapping), which clears all
|
||||||
@@ -127,7 +141,7 @@
|
|||||||
" continuing at TOP" and "Pattern not found:..." messages, like the * and
|
" continuing at TOP" and "Pattern not found:..." messages, like the * and
|
||||||
" n/N Vim search commands.
|
" n/N Vim search commands.
|
||||||
" 9. Jumps now open folds if the occurrence is inside a closed fold, just like n/N
|
" 9. Jumps now open folds if the occurrence is inside a closed fold, just like n/N
|
||||||
" do.
|
" do.
|
||||||
"
|
"
|
||||||
" 10th Mar 2006, Yuheng Xie: jump to ANY mark
|
" 10th Mar 2006, Yuheng Xie: jump to ANY mark
|
||||||
" (*) added \* \# \/ \? for the ability of jumping to ANY mark, even when the
|
" (*) added \* \# \/ \? for the ability of jumping to ANY mark, even when the
|
||||||
@@ -155,7 +169,7 @@
|
|||||||
" (*) command :Mark
|
" (*) command :Mark
|
||||||
" -> e.g. :Mark Mark.\{-}\ze(
|
" -> e.g. :Mark Mark.\{-}\ze(
|
||||||
|
|
||||||
" Avoid installing twice or when in unsupported Vim version.
|
" Avoid installing twice or when in unsupported Vim version.
|
||||||
if exists('g:loaded_mark') || (v:version == 701 && ! exists('*matchadd')) || (v:version < 701)
|
if exists('g:loaded_mark') || (v:version == 701 && ! exists('*matchadd')) || (v:version < 701)
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
@@ -188,20 +202,20 @@ endfunction
|
|||||||
call s:DefaultHighlightings()
|
call s:DefaultHighlightings()
|
||||||
autocmd ColorScheme * call <SID>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'
|
||||||
" highlight group before this script is sourced.
|
" highlight group before this script is sourced.
|
||||||
highlight def link SearchSpecialSearchType MoreMsg
|
highlight def link SearchSpecialSearchType MoreMsg
|
||||||
|
|
||||||
|
|
||||||
"- mappings -------------------------------------------------------------------
|
"- mappings -------------------------------------------------------------------
|
||||||
nnoremap <silent> <Plug>MarkSet :<C-u>call mark#MarkCurrentWord()<CR>
|
nnoremap <silent> <Plug>MarkSet :<C-u>if !mark#MarkCurrentWord(v:count)<Bar>execute "normal! \<lt>C-\>\<lt>C-n>\<lt>Esc>"<Bar>endif<CR>
|
||||||
vnoremap <silent> <Plug>MarkSet <C-\><C-n>:call mark#DoMark(mark#GetVisualSelectionAsLiteralPattern())<CR>
|
vnoremap <silent> <Plug>MarkSet :<C-u>if !mark#DoMark(v:count, mark#GetVisualSelectionAsLiteralPattern())<Bar>execute "normal! \<lt>C-\>\<lt>C-n>\<lt>Esc>"<Bar>endif<CR>
|
||||||
nnoremap <silent> <Plug>MarkRegex :<C-u>call mark#MarkRegex('')<CR>
|
nnoremap <silent> <Plug>MarkRegex :<C-u>call mark#MarkRegex('')<CR>
|
||||||
vnoremap <silent> <Plug>MarkRegex <C-\><C-n>:call mark#MarkRegex(mark#GetVisualSelectionAsRegexp())<CR>
|
vnoremap <silent> <Plug>MarkRegex :<C-u>call mark#MarkRegex(mark#GetVisualSelectionAsRegexp())<CR>
|
||||||
nnoremap <silent> <Plug>MarkClear :<C-u>call mark#DoMark(mark#CurrentMark()[0])<CR>
|
nnoremap <silent> <Plug>MarkClear :<C-u>if !mark#DoMark(v:count, (v:count ? '' : mark#CurrentMark()[0]))<Bar>execute "normal! \<lt>C-\>\<lt>C-n>\<lt>Esc>"<Bar>endif<CR>
|
||||||
nnoremap <silent> <Plug>MarkAllClear :<C-u>call mark#ClearAll()<CR>
|
nnoremap <silent> <Plug>MarkAllClear :<C-u>call mark#ClearAll()<CR>
|
||||||
nnoremap <silent> <Plug>MarkToggle :<C-u>call mark#Toggle()<CR>
|
nnoremap <silent> <Plug>MarkToggle :<C-u>call mark#Toggle()<CR>
|
||||||
|
|
||||||
nnoremap <silent> <Plug>MarkSearchCurrentNext :<C-u>call mark#SearchCurrentMark(0)<CR>
|
nnoremap <silent> <Plug>MarkSearchCurrentNext :<C-u>call mark#SearchCurrentMark(0)<CR>
|
||||||
nnoremap <silent> <Plug>MarkSearchCurrentPrev :<C-u>call mark#SearchCurrentMark(1)<CR>
|
nnoremap <silent> <Plug>MarkSearchCurrentPrev :<C-u>call mark#SearchCurrentMark(1)<CR>
|
||||||
@@ -210,7 +224,7 @@ nnoremap <silent> <Plug>MarkSearchAnyPrev :<C-u>call mark#SearchAnyMark(1)<C
|
|||||||
nnoremap <silent> <Plug>MarkSearchNext :<C-u>if !mark#SearchNext(0)<Bar>execute 'normal! *zv'<Bar>endif<CR>
|
nnoremap <silent> <Plug>MarkSearchNext :<C-u>if !mark#SearchNext(0)<Bar>execute 'normal! *zv'<Bar>endif<CR>
|
||||||
nnoremap <silent> <Plug>MarkSearchPrev :<C-u>if !mark#SearchNext(1)<Bar>execute 'normal! #zv'<Bar>endif<CR>
|
nnoremap <silent> <Plug>MarkSearchPrev :<C-u>if !mark#SearchNext(1)<Bar>execute 'normal! #zv'<Bar>endif<CR>
|
||||||
" When typed, [*#nN] open the fold at the search result, but inside a mapping or
|
" When typed, [*#nN] open the fold at the search result, but inside a mapping or
|
||||||
" :normal this must be done explicitly via 'zv'.
|
" :normal this must be done explicitly via 'zv'.
|
||||||
|
|
||||||
|
|
||||||
if !hasmapto('<Plug>MarkSet', 'n')
|
if !hasmapto('<Plug>MarkSet', 'n')
|
||||||
@@ -228,8 +242,8 @@ endif
|
|||||||
if !hasmapto('<Plug>MarkClear', 'n')
|
if !hasmapto('<Plug>MarkClear', 'n')
|
||||||
nmap <unique> <silent> <Leader>n <Plug>MarkClear
|
nmap <unique> <silent> <Leader>n <Plug>MarkClear
|
||||||
endif
|
endif
|
||||||
" No default mapping for <Plug>MarkAllClear.
|
" No default mapping for <Plug>MarkAllClear.
|
||||||
" No default mapping for <Plug>MarkToggle.
|
" No default mapping for <Plug>MarkToggle.
|
||||||
|
|
||||||
if !hasmapto('<Plug>MarkSearchCurrentNext', 'n')
|
if !hasmapto('<Plug>MarkSearchCurrentNext', 'n')
|
||||||
nmap <unique> <silent> <Leader>* <Plug>MarkSearchCurrentNext
|
nmap <unique> <silent> <Leader>* <Plug>MarkSearchCurrentNext
|
||||||
@@ -252,8 +266,9 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
"- commands -------------------------------------------------------------------
|
"- commands -------------------------------------------------------------------
|
||||||
command! -nargs=? Mark call mark#DoMark(<f-args>)
|
command! -count -nargs=? Mark if !mark#DoMark(<count>, <f-args>) | echoerr printf('Only %d mark highlight groups', mark#GetGroupNum()) | endif
|
||||||
command! -bar MarkClear call mark#ClearAll()
|
command! -bar MarkClear call mark#ClearAll()
|
||||||
|
command! -bar Marks call mark#List()
|
||||||
|
|
||||||
command! -bar MarkLoad call mark#LoadCommand(1)
|
command! -bar MarkLoad call mark#LoadCommand(1)
|
||||||
command! -bar MarkSave call mark#SaveCommand()
|
command! -bar MarkSave call mark#SaveCommand()
|
||||||
@@ -263,19 +278,19 @@ command! -bar MarkSave call mark#SaveCommand()
|
|||||||
if g:mwAutoLoadMarks
|
if g:mwAutoLoadMarks
|
||||||
" As the viminfo is only processed after sourcing of the runtime files, the
|
" As the viminfo is only processed after sourcing of the runtime files, the
|
||||||
" persistent global variables are not yet available here. Defer this until Vim
|
" persistent global variables are not yet available here. Defer this until Vim
|
||||||
" startup has completed.
|
" startup has completed.
|
||||||
function! s:AutoLoadMarks()
|
function! s:AutoLoadMarks()
|
||||||
if g:mwAutoLoadMarks && exists('g:MARK_MARKS') && g:MARK_MARKS !=# '[]'
|
if g:mwAutoLoadMarks && exists('g:MARK_MARKS') && g:MARK_MARKS !=# '[]'
|
||||||
if ! exists('g:MARK_ENABLED') || g:MARK_ENABLED
|
if ! exists('g:MARK_ENABLED') || g:MARK_ENABLED
|
||||||
" There are persistent marks and they haven't been disabled; we need to
|
" There are persistent marks and they haven't been disabled; we need to
|
||||||
" show them right now.
|
" show them right now.
|
||||||
call mark#LoadCommand(0)
|
call mark#LoadCommand(0)
|
||||||
else
|
else
|
||||||
" Though there are persistent marks, they have been disabled. We avoid
|
" Though there are persistent marks, they have been disabled. We avoid
|
||||||
" sourcing the autoload script and its invasive autocmds right now;
|
" sourcing the autoload script and its invasive autocmds right now;
|
||||||
" maybe the marks are never turned on. We just inform the autoload
|
" maybe the marks are never turned on. We just inform the autoload
|
||||||
" script that it should do this once it is sourced on-demand by a
|
" script that it should do this once it is sourced on-demand by a
|
||||||
" mark mapping or command.
|
" mark mapping or command.
|
||||||
let g:mwDoDeferredLoad = 1
|
let g:mwDoDeferredLoad = 1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -285,9 +300,9 @@ if g:mwAutoLoadMarks
|
|||||||
autocmd!
|
autocmd!
|
||||||
" Note: Avoid triggering the autoload unless there actually are persistent
|
" Note: Avoid triggering the autoload unless there actually are persistent
|
||||||
" marks. For that, we need to check that g:MARK_MARKS doesn't contain the
|
" marks. For that, we need to check that g:MARK_MARKS doesn't contain the
|
||||||
" empty list representation, and also :execute the :call.
|
" empty list representation, and also :execute the :call.
|
||||||
autocmd VimEnter * call <SID>AutoLoadMarks()
|
autocmd VimEnter * call <SID>AutoLoadMarks()
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vim: ts=2 sw=2
|
" vim: ts=4 sts=0 sw=4 noet
|
||||||
|
|||||||
Reference in New Issue
Block a user