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

Update of CtrlP, Syntastic, Tagbar, Taglisttoo, and Mark plugins

This commit is contained in:
2012-09-20 18:57:57 +02:00
parent 71a1d914e0
commit b033e2bb39
44 changed files with 1987 additions and 994 deletions

View File

@@ -7,7 +7,7 @@ ScriptID SourceID Filename
3304 18081 gundo.vim
2727 11120 jsbeautify.vim
2289 8922 loremipsum
2666 18218 Mark
2666 18598 Mark
1218 14455 nerdcommenter
2262 8944 occur.vim
2136 8206 repeat.vim

View File

@@ -1,8 +1,6 @@
.hgignore
*.markdown
*.zip
wiki.md
note.txt
tags
.hg/*
.hg*
tmp/*

File diff suppressed because it is too large Load Diff

View File

@@ -149,8 +149,11 @@ fu! s:esctagscmd(bin, args, ...)
if exists('+ssl')
let [ssl, &ssl] = [&ssl, 0]
en
let fname = a:0 == 1 ? shellescape(a:1) : ''
let fname = a:0 ? shellescape(a:1) : ''
let cmd = shellescape(a:bin).' '.a:args.' '.fname
if &sh =~ 'cmd\.exe'
let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g')
en
if exists('+ssl')
let &ssl = ssl
en
@@ -170,12 +173,14 @@ fu! s:process(fname, ftype)
el
let data = s:exectagsonfile(a:fname, a:ftype)
let [raw, lines] = [split(data, '\n\+'), []]
for line in raw | if len(split(line, ';"')) == 2
let parsed_line = s:parseline(line)
if parsed_line != ''
cal add(lines, parsed_line)
for line in raw
if line !~# '^!_TAG_' && len(split(line, ';"')) == 2
let parsed_line = s:parseline(line)
if parsed_line != ''
cal add(lines, parsed_line)
en
en
en | endfo
endfo
let cache = { a:fname : { 'time': ftime, 'lines': lines } }
cal extend(g:ctrlp_buftags, cache)
en
@@ -183,8 +188,8 @@ fu! s:process(fname, ftype)
endf
fu! s:parseline(line)
let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)'
let vals = matchlist(a:line, eval)
let vals = matchlist(a:line,
\ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)')
if vals == [] | retu '' | en
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
@@ -200,6 +205,19 @@ fu! s:syntax()
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
en
endf
fu! s:chknearby(pat)
if match(getline('.'), a:pat) < 0
let [int, forw, maxl] = [1, 1, line('$')]
wh !search(a:pat, 'W'.( forw ? '' : 'b' ))
if !forw
if int > maxl | brea | en
let int += int
en
let forw = !forw
endw
en
endf
" Public {{{1
fu! ctrlp#buffertag#init(fname)
let bufs = exists('s:btmode') && s:btmode
@@ -208,7 +226,7 @@ fu! ctrlp#buffertag#init(fname)
let lines = []
for each in bufs
let bname = fnamemodify(each, ':p')
let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '')
let tftype = get(split(getbufvar('^'.bname.'$', '&ft'), '\.'), 0, '')
cal extend(lines, s:process(bname, tftype))
endfo
cal s:syntax()
@@ -216,10 +234,15 @@ fu! ctrlp#buffertag#init(fname)
endf
fu! ctrlp#buffertag#accept(mode, str)
let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|')
if vals == [] | retu | en
let [bufnm, linenr] = [fnamemodify(bufname(str2nr(vals[1])), ':p'), vals[2]]
cal ctrlp#acceptfile(a:mode, bufnm, linenr)
let vals = matchlist(a:str,
\ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$')
let bufnr = str2nr(get(vals, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, bufname(bufnr))
exe 'norm!' str2nr(get(vals, 2, line('.'))).'G'
cal s:chknearby('\V\C'.get(vals, 3, ''))
sil! norm! zvzz
en
endf
fu! ctrlp#buffertag#cmd(mode, ...)

View File

@@ -71,10 +71,9 @@ endf
fu! ctrlp#changes#accept(mode, str)
let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$')
if info == [] | retu | en
let bufnr = str2nr(get(info, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'))
cal ctrlp#acceptfile(a:mode, bufname(bufnr))
cal cursor(get(info, 2), get(info, 3))
sil! norm! zvzz
en

View File

@@ -10,12 +10,7 @@ if exists('g:loaded_ctrlp_dir') && g:loaded_ctrlp_dir
en
let [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0]
let s:ars = [
\ 's:maxdepth',
\ 's:maxfiles',
\ 's:compare_lim',
\ 's:glob',
\ ]
let s:ars = ['s:maxdepth', 's:maxfiles', 's:compare_lim', 's:glob', 's:caching']
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
@@ -27,6 +22,8 @@ cal add(g:ctrlp_ext_vars, {
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
let s:dircounts = {}
" Utilities {{{1
fu! s:globdirs(dirs, depth)
let entries = split(globpath(a:dirs, s:glob), "\n")
@@ -35,12 +32,17 @@ fu! s:globdirs(dirs, depth)
let nr = len(g:ctrlp_alldirs)
if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
sil! cal ctrlp#progress(nr)
cal map(dirs, 'ctrlp#utils#fnesc(v:val, "g", ",")')
cal s:globdirs(join(dirs, ','), depth)
en
endf
fu! s:max(len, max)
retu a:max && a:len > a:max ? 1 : 0
retu a:max && a:len > a:max
endf
fu! s:nocache()
retu !s:caching || ( s:caching > 1 && get(s:dircounts, s:cwd) < s:caching )
endf
" Public {{{1
fu! ctrlp#dir#init(...)
@@ -50,9 +52,9 @@ fu! ctrlp#dir#init(...)
endfo
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
if g:ctrlp_newdir || !filereadable(cafile)
if g:ctrlp_newdir || s:nocache() || !filereadable(cafile)
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
cal s:globdirs(s:cwd, 0)
cal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0)
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
if len(g:ctrlp_alldirs) <= s:compare_lim
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
@@ -65,6 +67,7 @@ fu! ctrlp#dir#init(...)
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
en
en
cal extend(s:dircounts, { s:cwd : len(g:ctrlp_alldirs) })
retu g:ctrlp_alldirs
endf

View File

@@ -48,10 +48,9 @@ endf
fu! ctrlp#line#accept(mode, str)
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
if info == [] | retu | en
let [bufnr, linenr] = [str2nr(get(info, 1)), get(info, 2)]
if bufnr > 0
cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'), linenr)
let bufnr = str2nr(get(info, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(info, 2))
en
endf

View File

@@ -48,15 +48,19 @@ endf
fu! s:record(bufnr)
if s:locked | retu | en
let bufnr = a:bufnr + 0
if bufnr <= 0 | retu | en
let bufname = bufname(bufnr)
if empty(bufname) | retu | en
let fn = fnamemodify(bufname, ':p')
if bufnr > 0 && !empty(bufname)
cal filter(s:mrbs, 'v:val != bufnr')
cal insert(s:mrbs, bufnr)
cal s:addtomrufs(bufname)
en
endf
fu! s:addtomrufs(fname)
let fn = fnamemodify(a:fname, ':p')
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
cal filter(s:mrbs, 'v:val != bufnr')
cal insert(s:mrbs, bufnr)
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
\ || !empty(&bt) || !filereadable(fn) | retu
\ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu
en
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
cal insert(s:mrufs, fn)
@@ -87,6 +91,12 @@ fu! ctrlp#mrufiles#remove(files)
retu s:reformat(copy(s:mrufs))
endf
fu! ctrlp#mrufiles#add(fn)
if !empty(a:fn)
cal s:addtomrufs(a:fn)
en
endf
fu! ctrlp#mrufiles#list(...)
retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists())
endf

View File

@@ -40,18 +40,15 @@ fu! ctrlp#quickfix#init()
endf
fu! ctrlp#quickfix#accept(mode, str)
let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
if items == [] | retu | en
let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')]
if empty(filpath) | retu | en
cal ctrlp#exit()
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
\ : ctrlp#normcmd('e')
let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
exe cmd ctrlp#fnesc(filpath)
cal cursor(items[2], items[3])
let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
if vals == [] || vals[1] == '' | retu | en
cal ctrlp#acceptfile(a:mode, vals[1])
let cur_pos = getpos('.')[1:2]
if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)')
mark '
en
cal cursor(vals[2], vals[3])
sil! norm! zvzz
cal ctrlp#setlcdir()
endf
fu! ctrlp#quickfix#id()

View File

@@ -11,7 +11,7 @@ en
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#rtscript#init()',
\ 'init': 'ctrlp#rtscript#init(s:caching)',
\ 'accept': 'ctrlp#acceptfile',
\ 'lname': 'runtime scripts',
\ 'sname': 'rts',
@@ -20,24 +20,34 @@ cal add(g:ctrlp_ext_vars, {
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
let s:filecounts = {}
" Utilities {{{1
fu! s:nocache()
retu g:ctrlp_newrts ||
\ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
endf
" Public {{{1
fu! ctrlp#rtscript#init()
if g:ctrlp_newrts
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
fu! ctrlp#rtscript#init(caching)
let [s:caching, s:cwd] = [a:caching, getcwd()]
if s:nocache() ||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
sil! cal ctrlp#progress('Indexing...')
let entries = split(globpath(&rtp, '**/*.*'), "\n")
let entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), "\n")
cal filter(entries, 'count(entries, v:val) == 1')
let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
el
let [entries, results] = g:ctrlp_rtscache[2:3]
en
let cwd = getcwd()
if g:ctrlp_newrts
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, cwd] )
if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en
if s:nocache() ||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
if !exists('echoed')
sil! cal ctrlp#progress('Processing...')
en
let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
en
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, cwd, entries, results], 0]
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]
cal extend(s:filecounts, { s:cwd : len(results) })
retu results
endf

View File

@@ -23,9 +23,20 @@ let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Utilities {{{1
fu! s:findcount(str)
let [tg, fname] = split(a:str, '\t\+\ze[^\t]\+$')
let [fname, tgs] = [expand(fname, 1), taglist('^'.tg.'$')]
if empty(tgs) | retu [1, 1] | en
let [fnd, ct, pos] = [0, 0, 0]
let tgs = taglist('^'.tg.'$')
if len(tgs) < 2
retu [1, 1]
en
let bname = fnamemodify(bufname('%'), ':p')
let fname = expand(fnamemodify(simplify(fname), ':s?^[.\/]\+??:p:.'), 1)
let [fnd, ct, pos, idx] = [0, 0, 0, 0]
wh idx < len(tgs)
if bname == fnamemodify(tgs[idx]["filename"], ':p')
cal insert(tgs, remove(tgs, idx))
brea
en
let idx += 1
endw
for each in tgs
let ct += 1
let fulname = fnamemodify(each["filename"], ':p')
@@ -43,11 +54,11 @@ fu! s:filter(tags)
let nr = 0
wh 0 < 1
if a:tags == [] | brea | en
if a:tags[nr] =~ '^!' && a:tags[nr] !~ '^!_TAG_'
if a:tags[nr] =~ '^!' && a:tags[nr] !~# '^!_TAG_'
let nr += 1
con
en
if a:tags[nr] =~ '^!_TAG_' && len(a:tags) > nr
if a:tags[nr] =~# '^!_TAG_' && len(a:tags) > nr
cal remove(a:tags, nr)
el
brea
@@ -86,8 +97,9 @@ fu! ctrlp#tag#accept(mode, str)
\ 'e': ['', 'tj'],
\ }
let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1]
let cmd = cmd == 'tj' && &modified ? 'hid '.cmd : cmd
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw)
\ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd
let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd
if fnd[0] == 1
if cmd != ''
exe cmd

View File

@@ -8,25 +8,28 @@
fu! ctrlp#utils#lash()
retu &ssl || !exists('+ssl') ? '/' : '\'
endf
let s:lash = ctrlp#utils#lash()
fu! s:lash(...)
retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
endf
fu! ctrlp#utils#opts()
let s:lash = ctrlp#utils#lash()
let usrhome = $HOME.s:lash($HOME)
let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
let s:cache_dir = isdirectory(usrhome.'.ctrlp_cache')
let cadir = isdirectory(usrhome.'.ctrlp_cache')
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
if exists('g:ctrlp_cache_dir')
let s:cache_dir = expand(g:ctrlp_cache_dir, 1)
if isdirectory(s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache')
let s:cache_dir = s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache'
let cadir = expand(g:ctrlp_cache_dir, 1)
if isdirectory(cadir.s:lash(cadir).'.ctrlp_cache')
let cadir = cadir.s:lash(cadir).'.ctrlp_cache'
en
en
let s:cache_dir = cadir
endf
cal ctrlp#utils#opts()
let s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') )
" Files and Directories {{{1
fu! ctrlp#utils#cachedir()
retu s:cache_dir
@@ -64,8 +67,53 @@ fu! ctrlp#utils#writecache(lines, ...)
endf
fu! ctrlp#utils#glob(...)
let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
retu call('glob', cond ? a:000 : [a:1])
let path = ctrlp#utils#fnesc(a:1, 'g')
retu s:wig_cond ? glob(path, a:2) : glob(path)
endf
fu! ctrlp#utils#globpath(...)
retu call('globpath', s:wig_cond ? a:000 : a:000[:1])
endf
fu! ctrlp#utils#fnesc(path, type, ...)
if exists('*fnameescape')
if exists('+ssl')
if a:type == 'c'
let path = escape(a:path, '%#')
elsei a:type == 'f'
let path = fnameescape(a:path)
elsei a:type == 'g'
let path = escape(a:path, '?*')
en
let path = substitute(path, '[', '[[]', 'g')
el
let path = fnameescape(a:path)
en
el
if exists('+ssl')
if a:type == 'c'
let path = escape(a:path, '%#')
elsei a:type == 'f'
let path = escape(a:path, " \t\n%#*?|<\"")
elsei a:type == 'g'
let path = escape(a:path, '?*')
en
let path = substitute(path, '[', '[[]', 'g')
el
let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<")
en
en
retu a:0 ? escape(path, a:1) : path
endf
fu! ctrlp#utils#dircompl(...)
let [hsl, str] = [match(a:1, '[\/]'), '']
let par = substitute(a:1, '[^\/]*$', '', '')
let path = !hsl ? par : hsl > 0 ? getcwd().s:lash().par : getcwd()
for dir in split(globpath(ctrlp#utils#fnesc(path, 'g', ','), '*/'), '\n')
let str .= par.split(dir, '[\/]')[-1]."\n"
endfo
retu str
endf
"}}}

View File

@@ -1,4 +1,4 @@
*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.7.7
*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.78
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
===============================================================================
# #
@@ -35,48 +35,52 @@ OPTIONS *ctrlp-options*
Overview:~
|loaded_ctrlp| Disable the plugin.
|ctrlp_map| Default mapping.
|ctrlp_cmd| Default command used for the default mapping.
|ctrlp_by_filename| Default to filename mode or not.
|ctrlp_regexp| Default to regexp mode or not.
|ctrlp_match_window_bottom| Where to show the match window.
|ctrlp_match_window_reversed| Sort order in the match window.
|ctrlp_max_height| Max height of the match window.
|ctrlp_switch_buffer| Jump to an open buffer if already opened.
|ctrlp_reuse_window| Reuse special windows (help, quickfix, etc).
|ctrlp_working_path_mode| How to set CtrlP's local working directory.
|ctrlp_root_markers| Additional, high priority root markers.
|ctrlp_use_caching| Use per-session caching or not.
|ctrlp_clear_cache_on_exit| Keep cache after exiting Vim or not.
|ctrlp_cache_dir| Location of the cache directory.
|ctrlp_dotfiles| Ignore dotfiles and dotdirs or not.
|ctrlp_custom_ignore| Hide stuff when using |globpath()|.
|ctrlp_max_files| Number of files to scan initially.
|ctrlp_max_depth| Directory depth to recurse into when scanning.
|ctrlp_user_command| Use an external scanner.
|ctrlp_max_history| Number of entries saved in the prompt history.
|ctrlp_open_new_file| How to open a file created by <c-y>.
|ctrlp_open_multiple_files| How to open files selected by <c-z>.
|ctrlp_arg_map| Intercept <c-y> and <c-o> or not.
|ctrlp_follow_symlinks| Follow symbolic links or not.
|ctrlp_lazy_update| Only update when typing has stopped.
|ctrlp_default_input| Seed the prompt with an initial string.
|ctrlp_use_migemo| Use Migemo patterns for Japanese filenames.
|ctrlp_prompt_mappings| Change the mappings in the prompt.
|loaded_ctrlp|................Disable the plugin.
|ctrlp_map|...................Default mapping.
|ctrlp_cmd|...................Default command used for the default mapping.
|ctrlp_by_filename|...........Default to filename mode or not.
|ctrlp_regexp|................Default to regexp mode or not.
|ctrlp_match_window_bottom|...Where to show the match window.
|ctrlp_match_window_reversed|.Sort order in the match window.
|ctrlp_max_height|............Max height of the match window.
|ctrlp_switch_buffer|.........Jump to an open buffer if already opened.
|ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc).
|ctrlp_tabpage_position|......Where to put the new tab page.
|ctrlp_working_path_mode|.....How to set CtrlP's local working directory.
|ctrlp_root_markers|..........Additional, high priority root markers.
|ctrlp_use_caching|...........Use per-session caching or not.
|ctrlp_clear_cache_on_exit|...Keep cache after exiting Vim or not.
|ctrlp_cache_dir|.............Location of the cache directory.
|ctrlp_show_hidden|...........Ignore dotfiles and dotdirs or not.
|ctrlp_custom_ignore|.........Hide stuff when using |globpath()|.
|ctrlp_max_files|.............Number of files to scan initially.
|ctrlp_max_depth|.............Directory depth to recurse into when scanning.
|ctrlp_user_command|..........Use an external scanner.
|ctrlp_max_history|...........Number of entries saved in the prompt history.
|ctrlp_open_new_file|.........How to open a file created by <c-y>.
|ctrlp_open_multiple_files|...How to open files selected by <c-z>.
|ctrlp_arg_map|...............Intercept <c-y> and <c-o> or not.
|ctrlp_follow_symlinks|.......Follow symbolic links or not.
|ctrlp_lazy_update|...........Only update when typing has stopped.
|ctrlp_default_input|.........Seed the prompt with an initial string.
|ctrlp_abbrev|................Input abbreviations.
|ctrlp_key_loop|..............Use input looping for multi-byte input.
|ctrlp_use_migemo|............Use Migemo patterns for Japanese filenames.
|ctrlp_prompt_mappings|.......Change the mappings inside the prompt.
MRU mode:
|ctrlp_mruf_max| Max MRU entries to remember.
|ctrlp_mruf_exclude| Files that shouldn't be remembered.
|ctrlp_mruf_include| Files to be remembered.
|ctrlp_mruf_relative| Show only MRU files in the working directory.
|ctrlp_mruf_default_order| Disable sorting.
|ctrlp_mruf_case_sensitive| MRU files are case sensitive or not.
|ctrlp_mruf_max|..............Max MRU entries to remember.
|ctrlp_mruf_exclude|..........Files that shouldn't be remembered.
|ctrlp_mruf_include|..........Files to be remembered.
|ctrlp_mruf_relative|.........Show only MRU files in the working directory.
|ctrlp_mruf_default_order|....Disable sorting.
|ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not.
Advanced options:
|ctrlp_status_func| Change CtrlP's two statuslines.
|ctrlp_buffer_func| Call custom functions in the CtrlP buffer.
|ctrlp_match_func| Replace the built-in matching algorithm.
|ctrlp_open_func|.............Use custom file opening functions.
|ctrlp_status_func|...........Change CtrlP's two statuslines.
|ctrlp_buffer_func|...........Call custom functions in the CtrlP buffer.
|ctrlp_match_func|............Replace the built-in matching algorithm.
-------------------------------------------------------------------------------
Detailed descriptions and default values:~
@@ -126,13 +130,16 @@ Set the maximum height of the match window: >
<
*'g:ctrlp_switch_buffer'*
When opening a file with <cr> or <c-t>, if the file's already opened somewhere
CtrlP will try to jump to it instead of opening a new instance: >
let g:ctrlp_switch_buffer = 2
When opening a file, if it's already open in a window somewhere, CtrlP will try
to jump to it instead of opening a new instance: >
let g:ctrlp_switch_buffer = 'Et'
<
1 - only jump to the buffer if it's opened in the current tab.
2 - jump tab as well if the buffer's opened in another tab.
0 - disable this feature.
e - jump when <cr> is pressed, but only to windows in the current tab.
t - jump when <c-t> is pressed, but only to windows in another tab.
v - like "e", but jump when <c-v> is pressed.
h - like "e", but jump when <c-x> is pressed.
E, T, V, H - like "e", "t", "v", and "h", but jump to windows anywhere.
0 or <empty> - disable this feature.
*'g:ctrlp_reuse_window'*
When opening a file with <cr>, CtrlP avoids opening it in windows created by
@@ -145,29 +152,52 @@ Example: >
let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
<
*'g:ctrlp_tabpage_position'*
Where to put the new tab page when opening one: >
let g:ctrlp_tabpage_position = 'ac'
<
a - after.
b - before.
c - the current tab page.
l - the last tab page.
f - the first tab page.
*'g:ctrlp_working_path_mode'*
When starting up, CtrlP sets its local working directory according to this
variable: >
let g:ctrlp_working_path_mode = 2
let g:ctrlp_working_path_mode = 'ra'
<
1 - the directory of the current file.
2 - the nearest ancestor that contains one of these directories or files:
c - the directory of the current file.
a - like "c", but only applies when the current working directory outside of
CtrlP isn't a direct ancestor of the directory of the current file.
r - the nearest ancestor that contains one of these directories or files:
.git .hg .svn .bzr _darcs
0 - don't manage working directory.
Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a
per buffer basis.
w - begin finding a root from the current working directory outside of CtrlP
instead of from the directory of the current file (default). Only applies
when "r" is also present.
0 or <empty> - disable this feature.
Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as
a fallback) when a root can't be found.
Note #2: you can use a |b:var| to set this option on a per buffer basis.
*'g:ctrlp_root_markers'*
Use this to set your own root markers in addition to the default ones (.git,
.hg, .svn, .bzr, and _darcs). Your markers will take precedence: >
let g:ctrlp_root_markers = ['']
<
Note: you can use a |b:var| to set this option on a per buffer basis.
*'g:ctrlp_use_caching'*
Set this to 0 to disable per-session caching. When disabled, caching will still
be enabled for directories that have more than 4000 files: >
Enable/Disable per-session caching: >
let g:ctrlp_use_caching = 1
<
0 - Disable caching.
1 - Enable caching.
n - When bigger than 1, disable caching and use the number as the limit to
enable caching again.
Note: you can quickly purge the cache by pressing <F5> while inside CtrlP.
*'g:ctrlp_clear_cache_on_exit'*
@@ -181,15 +211,20 @@ Set the directory to store the cache files: >
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
<
*'g:ctrlp_dotfiles'*
Set this to 0 if you don't want CtrlP to scan for dotfiles and dotdirs: >
let g:ctrlp_dotfiles = 1
*'g:ctrlp_show_hidden'*
Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: >
let g:ctrlp_show_hidden = 0
<
You can use |'wildignore'| to exclude anything from the search.
Note: does not apply when a command defined with |g:ctrlp_user_command| is
being used.
*'ctrlp-wildignore'*
You can use Vim's |'wildignore'| to exclude files and directories from the
results.
Examples: >
" Excluding version control directories
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
set wildignore+=.git\*,.hg\*,.svn\* " Windows
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash')
<
Note #1: the `*/` in front of each directory glob is required.
@@ -204,25 +239,36 @@ CtrlP to not show. Use regexp to specify the patterns: >
let g:ctrlp_custom_ignore = ''
<
Examples: >
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$',
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ }
let g:ctrlp_custom_ignore = {
\ 'file': '\v(\.cpp|\.h|\.hh|\.cxx)@<!$'
\ }
<
Note: ignoring only works when |globpath()| is used to scan for files.
Note #1: by default, |wildignore| and |g:ctrlp_custom_ignore| only apply when
|globpath()| is used to scan for files, thus these options do not apply when a
command defined with |g:ctrlp_user_command| is being used.
Note #2: when changing the option's variable type, remember to |:unlet| it
first or restart Vim to avoid the "E706: Variable type mismatch" error.
*'g:ctrlp_max_files'*
The maximum number of files to scan, set to 0 for no limit: >
let g:ctrlp_max_files = 10000
<
Note: does not apply when a command defined with |g:ctrlp_user_command| is
being used.
*'g:ctrlp_max_depth'*
The maximum depth of a directory tree to recurse into: >
let g:ctrlp_max_depth = 40
<
Note: the larger these values, the more memory Vim uses.
Note: does not apply when a command defined with |g:ctrlp_user_command| is
being used.
*'g:ctrlp_user_command'*
Specify an external tool to use for listing files instead of using Vim's
@@ -235,8 +281,10 @@ Examples: >
<
You can also use 'grep', 'findstr' or something else to filter the results.
Examples: >
let g:ctrlp_user_command = 'find %s -type f | grep (?!tmp/.*)'
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d | findstr .*\.py$'
let g:ctrlp_user_command =
\ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"' " MacOSX/Linux
let g:ctrlp_user_command =
\ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows
<
Use a version control listing command when inside a repository, this is faster
when scanning large projects: >
@@ -246,22 +294,46 @@ when scanning large projects: >
\ 1: [root_marker_1, listing_command_1],
\ n: [root_marker_n, listing_command_n],
\ },
\ 'fallback': fallback_command
\ 'fallback': fallback_command,
\ 'ignore': 0 or 1
\ }
<
Examples: >
let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files']
let g:ctrlp_user_command = ['.hg/', 'hg --cwd %s locate -I .']
Some examples: >
" Single VCS, listing command does not list untracked files:
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .']
" Multiple VCS's:
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git/', 'cd %s && git ls-files'],
\ 2: ['.hg/', 'hg --cwd %s locate -I .'],
\ 1: ['.git', 'cd %s && git ls-files'],
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
\ },
\ 'fallback': 'find %s -type f'
\ }
" Single VCS, listing command lists untracked files (slower):
let g:ctrlp_user_command =
\ ['.git', 'cd %s && git ls-files . -co --exclude-standard']
let g:ctrlp_user_command =
\ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] " MacOSX/Linux
let g:ctrlp_user_command = ['.hg', 'for /f "tokens=1" %%a in (''hg root'') '
\ . 'do hg --cwd %s status -numac -I . %%a'] " Windows
<
If the fallback_command is empty or not defined, |globpath()| will then be used
when searching outside a repo.
Note #1: if the fallback_command is empty or the 'fallback' key is not defined,
|globpath()| will then be used when scanning outside of a repository.
Note #2: unless the |Dictionary| format is used and 'ignore' is defined and set
to 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when
these custom commands are being used. When not present, 'ignore' is set to 0 by
default to retain the performance advantage of using external commands.
Note #3: when changing the option's variable type, remember to |:unlet| it
first or restart Vim to avoid the "E706: Variable type mismatch" error.
Note #4: you can use a |b:var| to set this option on a per buffer basis.
*'g:ctrlp_max_history'*
The maximum number of input strings you want CtrlP to remember. The default
@@ -272,14 +344,13 @@ Set to 0 to disable prompt's history. Browse the history with <c-n> and <c-p>.
*'g:ctrlp_open_new_file'*
Use this option to specify how the newly created file is to be opened when
pressing <c-y>:
t - in a new tab
h - in a new horizontal split
v - in a new vertical split
r - in the current window
>
pressing <c-y>: >
let g:ctrlp_open_new_file = 'v'
<
t - in a new tab.
h - in a new horizontal split.
v - in a new vertical split.
r - in the current window.
*'g:ctrlp_open_multiple_files'*
If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
@@ -292,17 +363,16 @@ For the number:
- If given, it'll be used as the maximum number of windows or tabs to create
when opening the files (the rest will be opened as hidden buffers).
- If not given, <c-o> will open all files, each in a new window or new tab.
For the letters:
t - each file in a new tab.
h - each file in a new horizontal split.
v - each file in a new vertical split.
i - all files as hidden buffers.
j - after opening, jump to the first opened tab or window.
Reuse the current window:
tr,
hr,
vr - open the first file in the current window, then the remaining files in
new splits or new tabs just like with t, h, v.
r - open the first file in the current window, then the remaining files in
new splits or new tabs depending on which of "h", "v" and "t" is also
present.
*'g:ctrlp_arg_map'*
When this is set to 1, the <c-o> and <c-y> mappings will accept one extra key
@@ -328,6 +398,9 @@ If non-zero, CtrlP will follow symbolic links when listing files: >
1 - follow but ignore looped internal symlinks to avoid duplicates.
2 - follow all symlinks indiscriminately.
Note: does not apply when a command defined with |g:ctrlp_user_command| is
being used.
*'g:ctrlp_lazy_update'*
Set this to 1 to enable the lazy-update feature: only update the match window
after typing's been stopped for a certain amount of time: >
@@ -341,6 +414,72 @@ Set this to 1 to enable seeding the prompt with the current file's relative
path: >
let g:ctrlp_default_input = 0
<
Instead of 1 or 0, if the value of the option is a string, it'll be used as-is
as the default input: >
let g:ctrlp_default_input = 'anystring'
<
*'g:ctrlp_abbrev'*
Define input abbreviations that can be expanded (either internally or visibly)
in the prompt: >
let g:ctrlp_abbrev = {}
<
Examples: >
let g:ctrlp_abbrev = {
\ 'gmode': 'i',
\ 'abbrevs': [
\ {
\ 'pattern': '^cd b',
\ 'expanded': '@cd ~/.vim/bundle',
\ 'mode': 'pfrz',
\ },
\ {
\ 'pattern': '\(^@.\+\|\\\@<!:.\+\)\@<! ',
\ 'expanded': '.\{-}',
\ 'mode': 'pfr',
\ },
\ {
\ 'pattern': '\\\@<!:.\+\zs\\\@<! ',
\ 'expanded': '\ ',
\ 'mode': 'pfz',
\ },
\ ]
\ }
<
The 'pattern' string is regexp matched against the entered input. The expansion
is as if the 'expanded' string was typed into the prompt.
For 'gmode' (optional):
i - expand internally (default).
t - insert the expanded results into the prompt as you type.
k - insert the expanded results when a non-keyword character is typed. Only
applies when "t" is also present.
For 'mode' (of each entry; optional):
f - only in filename mode.
p - only in full path mode.
r - only in regexp mode.
z - only in fuzzy mode.
n - only when creating a new file with <c-y> (use the expanded string in the
new filename).
c - only when auto-completing directory names with <tab> (expand the pattern
immediately before doing the auto-completion).
<empty> or not defined - always enable.
Note: the abbrev entries are evaluated in sequence, so a later entry can be
evaluated against the expanded result of a previous entry; this includes itself
when 'gmode' is "t".
*'g:ctrlp_key_loop'*
An experimental feature. Set this to 1 to enable input looping for the typing
of multi-byte characters: >
let g:ctrlp_key_loop = 0
<
Note #1: when set, this option resets the |g:ctrlp_lazy_update| option.
Note #2: you can toggle this feature inside the prompt with a custom mapping: >
let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': ['<F3>'] }
<
*'g:ctrlp_use_migemo'*
Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
@@ -388,9 +527,8 @@ only need to keep the lines that you've changed the values (inside []): >
\ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
\ }
<
Note: In some terminals, it's not possible to remap <c-h> without also changing
<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 plugin's
Note: if pressing <bs> moves the cursor one character to the left instead of
deleting a character for you, add this to your |.vimrc| to disable the plugin's
default <c-h> mapping: >
let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
<
@@ -439,6 +577,65 @@ MRU entries: >
----------------------------------------
Advanced options:~
*'g:ctrlp_open_func'*
Define a custom function to open the selected file: >
let g:ctrlp_open_func = {}
<
Example: >
let g:ctrlp_open_func = {
\ 'files' : 'Function_Name_1',
\ 'buffers' : 'Function_Name_2',
\ 'mru files' : 'Function_Name_3',
\ }
<
Structure of the functions: >
function! Function_Name(action, line)
" Arguments:
" |
" +- a:action : The opening action:
" | + 'e' : user pressed <cr> (default)
" | + 'h' : user pressed <c-x> (default)
" | + 'v' : user pressed <c-v> (default)
" | + 't' : user pressed <c-t> (default)
" | + 'x' : user used the <c-o> console dialog (default) and
" | chose "e[x]ternal".
" |
" +- a:line : The selected line.
endfunction
<
Note: does not apply when opening multiple files with <c-z> and <c-o>.
Example: open HTML files in the default web browser when <c-t> is pressed and
in Vim otherwise >
function! HTMLOpenFunc(action, line)
if a:action =~ '^[tx]$' && fnamemodify(a:line, ':e') =~? '^html\?$'
" Get the filename
let filename = fnameescape(fnamemodify(a:line, ':p'))
" Close CtrlP
call ctrlp#exit()
" Open the file
silent! execute '!xdg-open' filename
elseif a:action == 'x' && fnamemodify(a:line, ':e') !~? '^html\?$'
" Not a HTML file, simulate pressing <c-o> again and wait for new input
call feedkeys("\<c-o>")
else
" Use CtrlP's default file opening function
call call('ctrlp#acceptfile', [a:action, a:line])
endif
endfunction
let g:ctrlp_open_func = { 'files': 'HTMLOpenFunc' }
<
*'g:ctrlp_status_func'*
Use this to customize the statuslines for the CtrlP window: >
let g:ctrlp_status_func = {}
@@ -551,13 +748,14 @@ COMMANDS *ctrlp-commands*
Open CtrlP in find Most-Recently-Used file mode.
*:CtrlPLastMode*
:CtrlPLastMode
Open CtrlP in the last mode used.
:CtrlPLastMode [--dir]
Open CtrlP in the last mode used. When having the "--dir" argument, also
reuse the last working directory.
*:CtrlPRoot*
:CtrlPRoot
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 2 (ignores the
variable's current value).
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores
the variable's current value.
*:CtrlPClearCache*
:CtrlPClearCache
@@ -665,7 +863,7 @@ Opening/Creating a file:~
Open the selected file in the 'current' window if possible.
<c-t>
Open the selected file in a new 'tab' after the last tabpage.
Open the selected file in a new 'tab'.
<c-v>
Open the selected file in a 'vertical' split.
@@ -685,7 +883,22 @@ Opening multiple files:~
- Mark/unmark a file to create a new file in its directory using <c-y>.
<c-o>
Open files marked by <c-z>.
- Open files marked by <c-z>.
- When no file has been marked by <c-z>, open a console dialog with the
following options:
Open the selected file:
t - in a tab page.
v - in a vertical split.
h - in a horizontal split.
r - in the current window.
i - as a hidden buffer.
x - (optional) with the function defined in |g:ctrlp_open_func|.
Other options (not shown):
a - mark all files in the match window.
d - change CtrlP's local working directory to the selected file's
directory and switch to find file mode.
Function keys:~
@@ -704,7 +917,7 @@ Pasting:~
Paste the clipboard content into the prompt.
<c-\>
Open a text dialog to paste <cword>, <cfile>, the content of the search
Open a console dialog to paste <cword>, <cfile>, the content of the search
register, the last visual selection, the clipboard or any register into the
prompt.
@@ -716,8 +929,7 @@ When inside the match window (press <s-tab> to switch):~
a-z
0-9
~^-=;`',.+!@#$%&_(){}[]
Cycle through the lines with the first letter (of paths or filenames) that
matches that key.
Cycle through the lines which have the matching first character.
===============================================================================
INPUT FORMATS *ctrlp-input-formats*
@@ -809,7 +1021,7 @@ Available extensions:~
*:CtrlPTag*
* Tag mode:~
- Name: 'tag'
- Command: ':CtrlPTag'
- Command: ":CtrlPTag"
- Search for a tag within a generated central tags file, and jump to the
definition. Use the Vim's option |'tags'| to specify the names and the
locations of the tags file(s).
@@ -819,21 +1031,21 @@ Available extensions:~
*:CtrlPBufTagAll*
* Buffer Tag mode:~
- Name: 'buffertag'
- Commands: ':CtrlPBufTag [buffer]',
':CtrlPBufTagAll'.
- Commands: ":CtrlPBufTag [buffer]",
":CtrlPBufTagAll".
- Search for a tag within the current buffer or all listed buffers and jump
to the definition. Requires |exuberant_ctags| or compatible programs.
*:CtrlPQuickfix*
* Quickfix mode:~
- Name: 'quickfix'
- Command: ':CtrlPQuickfix'
- Command: ":CtrlPQuickfix"
- Search for an entry in the current quickfix errors and jump to it.
*:CtrlPDir*
* Directory mode:~
- Name: 'dir'
- Command: ':CtrlPDir [starting-directory]'
- Command: ":CtrlPDir [starting-directory]"
- Search for a directory and change the working directory to it.
- Mappings:
+ <cr> change the local working directory for CtrlP and keep it open.
@@ -845,42 +1057,42 @@ Available extensions:~
*:CtrlPRTS*
* Runtime script mode:~
- Name: 'rtscript'
- Command: ':CtrlPRTS'
- Command: ":CtrlPRTS"
- Search for files (vimscripts, docs, snippets...) in runtimepath.
*:CtrlPUndo*
* Undo mode:~
- Name: 'undo'
- Command: ':CtrlPUndo'
- Command: ":CtrlPUndo"
- Browse undo history.
*:CtrlPLine*
* Line mode:~
- Name: 'line'
- Command: ':CtrlPLine'
- Command: ":CtrlPLine"
- Search for a line in all listed buffers.
*:CtrlPChange*
*:CtrlPChangeAll*
* Change list mode:~
- Name: 'changes'
- Commands: ':CtrlPChange [buffer]',
':CtrlPChangeAll'.
- Commands: ":CtrlPChange [buffer]",
":CtrlPChangeAll".
- Search for and jump to a recent change in the current buffer or in all
listed buffers.
*:CtrlPMixed*
* Mixed mode:~
- Name: 'mixed'
- Command: ':CtrlPMixed'
- Command: ":CtrlPMixed"
- Search in files, buffers and MRU files at the same time.
*:CtrlPBookmarkDir*
*:CtrlPBookmarkDirAdd*
* BookmarkDir mode:~
- Name: 'bookmarkdir'
- Commands: ':CtrlPBookmarkDir',
':CtrlPBookmarkDirAdd [directory]'.
- Commands: ":CtrlPBookmarkDir",
":CtrlPBookmarkDirAdd [directory]".
- Search for a bookmarked directory and change the working directory to it.
- Mappings:
+ <cr> change the local working directory for CtrlP, keep it open and
@@ -1026,11 +1238,22 @@ Special thanks:~
* Tacahiroy <github.com/tacahiroy>
* Luca Pette <github.com/lucapette>
* Seth Fowler <github.com/sfowler>
* Lowe Thiderman <github.com/daethorian>
* Lowe Thiderman <github.com/thiderman>
* Christopher Fredén <github.com/icetan>
===============================================================================
CHANGELOG *ctrlp-changelog*
+ New options: |g:ctrlp_abbrev|,
|g:ctrlp_key_loop|,
|g:ctrlp_open_func|,
|g:ctrlp_tabpage_position|
+ Rename:
*g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|.
+ Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type
(old values still work).
+ New key for |g:ctrlp_user_command| when it's a Dictionary: 'ignore'.
Before 2012/06/15~
+ New value for |g:ctrlp_follow_symlinks|: 2.

View File

@@ -17,24 +17,24 @@ let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
com! -n=? -com=dir CtrlP cal ctrlp#init(0, <q-args>)
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlP
\ cal ctrlp#init(0, { 'dir': <q-args> })
com! CtrlPBuffer cal ctrlp#init(1)
com! CtrlPMRUFiles cal ctrlp#init(2)
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPMRUFiles
\ cal ctrlp#init(2, { 'dir': <q-args> })
com! CtrlPLastMode cal ctrlp#init(-1)
com! -bar CtrlPBuffer cal ctrlp#init(1)
com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
com! CtrlPClearCache cal ctrlp#clr()
com! CtrlPClearAllCaches cal ctrlp#clra()
com! CtrlPReload cal ctrlp#reset()
com! -bar CtrlPClearCache cal ctrlp#clr()
com! -bar CtrlPClearAllCaches cal ctrlp#clra()
com! ClearCtrlPCache cal ctrlp#clr()
com! ClearAllCtrlPCaches cal ctrlp#clra()
com! ResetCtrlP cal ctrlp#reset()
com! -bar ClearCtrlPCache cal ctrlp#clr()
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
com! CtrlPCurWD cal ctrlp#init(0, 0)
com! CtrlPCurFile cal ctrlp#init(0, 1)
com! CtrlPRoot cal ctrlp#init(0, 2)
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' })
if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
@@ -42,20 +42,28 @@ en
cal ctrlp#mrufiles#init()
com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
com! -n=? -com=dir CtrlPDir
\ cal ctrlp#init(ctrlp#dir#id(), <q-args>)
com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id())
com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPDir
\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })
com! -n=? -com=buffer CtrlPBufTag
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
com! -bar CtrlPLine cal ctrlp#init(ctrlp#line#id())
com! -n=? -com=buffer CtrlPChange
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
com! CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
com! CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
com! -n=? -com=dir CtrlPBookmarkDirAdd
com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPBookmarkDirAdd
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
" vim:ts=2:sw=2:sts=2

View File

@@ -1,5 +1,5 @@
# ctrlp.vim
Fuzzy __file__, __buffer__, __mru__, __tag__, ... finder for Vim.
Full path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim.
* Written in pure Vimscript for MacVim, gVim and Vim 7.0+.
* Full support for Vim's regexp as search patterns.
@@ -11,68 +11,60 @@ Fuzzy __file__, __buffer__, __mru__, __tag__, ... finder for Vim.
![ctrlp][1]
## Installation
1. Clone the plugin into a separate directory:
## Basic Usage
* Run `:CtrlP` or `:CtrlP [starting-directory]` to invoke CtrlP in find file mode.
* Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in find buffer or find MRU file mode.
* Run `:CtrlPMixed` to search in Files, Buffers and MRU files at the same time.
```
$ cd ~/.vim
$ git clone https://github.com/kien/ctrlp.vim.git bundle/ctrlp.vim
```
Check `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands.
2. Add to your `~/.vimrc`:
##### Once CtrlP is open:
* Press `<F5>` to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options.
* Press `<c-f>` and `<c-b>` to cycle between modes.
* Press `<c-d>` to switch to filename only search instead of full path.
* Press `<c-r>` to switch to regexp mode.
* Use `<c-n>`, `<c-p>` to select the next/previous string in the prompt's history.
* Use `<c-y>` to create a new file and its parent directories.
* Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.
Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help.
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
* End the input string with a colon `:` followed by a command to execute it on the opening file(s):
Use `:25` to jump to line 25.
Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files.
## Basic Options
* Change the default mapping and the default command to invoke CtrlP:
```vim
set runtimepath^=~/.vim/bundle/ctrlp.vim
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
```
3. Run at Vim's command line:
```
:helptags ~/.vim/bundle/ctrlp.vim/doc
```
4. Restart Vim and start reading `:help ctrlp.txt` for usage and configuration details.
On Windows, use the `$HOME/vimfiles` or the `$VIM/vimfiles` directory instead of the `~/.vim` directory.
## Usage
1. See `:help ctrlp-commands` and `:help ctrlp-extensions`.
2. Once the prompt's open:
* Press `<c-f>` and `<c-b>` to cycle between modes.
* Press `<c-d>` to switch to filename only search instead of full path.
* Press `<F5>` to purge the cache for the current directory and get new files.
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
* Use `<c-n>`, `<c-p>` to go to the next/previous string in the prompt's history.
* Use `<c-y>` to create a new file and its parent dirs.
* Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.
* End the input string with a colon `:` followed by a command to execute it on the opening file(s).
More at `:help ctrlp-mappings`.
## Configuration
* Unless a starting directory is specified, the local working directory will be set according to this variable:
* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable:
```vim
let g:ctrlp_working_path_mode = 2
let g:ctrlp_working_path_mode = 'ra'
```
0 - don't manage working directory.
1 - the directory of the current file.
2 - the nearest ancestor that contains one of these directories or files:
`.git` `.hg` `.svn` `.bzr` `_darcs`
`'c'` - the directory of the current file.
`'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`
`'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.
`0` or `''` (empty string) - disable this feature.
Define additional root markers with the `g:ctrlp_root_markers` option.
* Exclude files and directories:
* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`:
```vim
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=tmp\*,*.swp,*.zip,*.exe " Windows
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$',
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
```
@@ -84,7 +76,11 @@ On Windows, use the `$HOME/vimfiles` or the `$VIM/vimfiles` directory instead of
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
```
More at `:help ctrlp-options`.
Check `:help ctrlp-options` for other options.
## Installation
Use your favorite method or check the homepage for a [quick installation guide][3].
[1]: http://i.imgur.com/yIynr.png
[2]: https://github.com/kien/ctrlp.vim/tree/extensions
[3]: http://kien.github.com/ctrlp.vim#installation

View File

@@ -50,12 +50,44 @@ enabled.
Installation
------------
[pathogen.vim](https://github.com/tpope/vim-pathogen) is the recommended way to install syntastic.
Installing syntastic is easy but first you need to have the pathogen plugin installed. If you already
have pathogen working then skip Step 1 and go to Step 2.
Step 1: Install pathogen.vim
----------------------------
First I'll show you how to install tpope's [pathogen.vim](https://github.com/tpope/vim-pathogen) so that
it's easy to install syntastic. Do this in your Terminal so that you get the pathogen.vim file
and the directories it needs:
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -so ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
Next you *need to add this* to your ~/.vimrc:
call pathogen#infect()
Step 2: Install syntastic as a pathogen bundle
----------------------------------------------
You now have pathogen installed and can put syntastic into ~/.vim/bundle like this:
cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git
Then reload vim, run `:Helptags`, and check out `:help syntastic.txt`.
Quit vim and start it back up to reload it, then type:
:Helptags
If you get an error when you do this, then you probably didn't install pathogen right. Go back to
step 1 and make sure you did the following:
1. Created both the ~/.vim/autoload and ~/.vim/bundle directories.
2. Added the "call pathogen#infect()" line to your ~/.vimrc file
3. Did the git clone of syntastic inside ~/.vim/bundle
4. Have permissions to access all of these directories.
Google group
@@ -69,10 +101,15 @@ FAQ
__Q. I installed syntastic but it isn't reporting any errors ...__
A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/<filetype>.vim`.
A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/<filetype>.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay.
Another reason it could fail is that the error output for the syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request.
__Q. How can I jump between the different errors without using the location list at the bottom of the window?__
A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`.
If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired) - which provides such mappings (among other things).
Changelog
---------

View File

@@ -163,6 +163,20 @@ syntax errors: >
let g:syntastic_enable_signs=1
<
*'syntastic_error_symbol'* *'syntastic_style_error_symbol'*
*'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'*
Use this option to control what the syntastic |:sign| text contains. Several
error symobls can be customized:
syntastic_error_symbol - For syntax errors, defaults to '>>'
syntastic_style_error_symbol - For style errors, defaults to 'S>'
syntastic_warning_symbol - For syntax warnings, defaults to '>>'
syntastic_style_warning_symbol - For style warnings, defaults to 'S>'
Example: >
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
<
*'syntastic_enable_balloons'*
Default: 1
Use this option to tell syntastic whether to display error messages in balloons
@@ -340,7 +354,7 @@ The author of syntastic is a mighty wild stallion, hear him roar! >
<
He likes to trot around in the back yard reading his emails and sipping a
scolding hot cup of Earl Grey. Email him at martin.grenfell at gmail dot com.
scalding hot cup of Earl Grey. Email him at martin.grenfell at gmail dot com.
He can also be found trolling the #vim channel on the freenode IRC network as
scrooloose.

View File

@@ -26,6 +26,23 @@ endif
if !exists("g:syntastic_enable_signs")
let g:syntastic_enable_signs = 1
endif
if !exists("g:syntastic_error_symbol")
let g:syntastic_error_symbol = '>>'
endif
if !exists("g:syntastic_warning_symbol")
let g:syntastic_warning_symbol = '>>'
endif
if !exists("g:syntastic_style_error_symbol")
let g:syntastic_style_error_symbol = 'S>'
endif
if !exists("g:syntastic_style_warning_symbol")
let g:syntastic_style_warning_symbol = 'S>'
endif
if !has('signs')
let g:syntastic_enable_signs = 0
endif
@@ -115,9 +132,7 @@ function! s:UpdateErrors(auto_invoked)
call s:CacheErrors()
end
if s:BufHasErrorsOrWarningsToDisplay()
call setloclist(0, s:LocList())
endif
call setloclist(0, s:LocList())
if g:syntastic_enable_balloons
call s:RefreshBalloons()
@@ -183,7 +198,7 @@ function! s:CacheErrors()
"functions legally for filetypes like "gentoo-metadata"
let fts = substitute(&ft, '-', '_', 'g')
for ft in split(fts, '\.')
if s:Checkable(ft)
if SyntasticCheckable(ft)
let errors = SyntaxCheckers_{ft}_GetLocList()
"keep only lines that effectively match an error/warning
let errors = s:FilterLocList({'valid': 1}, errors)
@@ -226,7 +241,10 @@ function! s:ModeMapAllowsAutoChecking()
endfunction
function! s:BufHasErrorsOrWarningsToDisplay()
return len(s:Errors()) || (!g:syntastic_quiet_warnings && !empty(s:LocList()))
if empty(s:LocList())
return 0
endif
return len(s:Errors()) || !g:syntastic_quiet_warnings
endfunction
function! s:Errors()
@@ -274,10 +292,10 @@ endfunction
if g:syntastic_enable_signs
"define the signs used to display syntax and style errors/warns
sign define SyntasticError text=>> texthl=error
sign define SyntasticWarning text=>> texthl=todo
sign define SyntasticStyleError text=S> texthl=error
sign define SyntasticStyleWarning text=S> texthl=todo
exe 'sign define SyntasticError text='.g:syntastic_error_symbol.' texthl=error'
exe 'sign define SyntasticWarning text='.g:syntastic_warning_symbol.' texthl=todo'
exe 'sign define SyntasticStyleError text='.g:syntastic_style_error_symbol.' texthl=error'
exe 'sign define SyntasticStyleWarning text='.g:syntastic_style_warning_symbol.' texthl=todo'
endif
"start counting sign ids at 5000, start here to hopefully avoid conflicting
@@ -348,6 +366,7 @@ endfunction
"display the cached errors for this buf in the location list
function! s:ShowLocList()
if !empty(s:LocList())
call setloclist(0, s:LocList())
let num = winnr()
exec "lopen " . g:syntastic_loc_list_height
if num != winnr()
@@ -402,16 +421,6 @@ function! s:ClearErrorHighlights()
endfor
endfunction
"check if a syntax checker exists for the given filetype - and attempt to
"load one
function! s:Checkable(ft)
if !exists("g:loaded_" . a:ft . "_syntax_checker")
exec "runtime syntax_checkers/" . a:ft . ".vim"
endif
return exists("*SyntaxCheckers_". a:ft ."_GetLocList")
endfunction
"set up error ballons for the current set of errors
function! s:RefreshBalloons()
let b:syntastic_balloons = {}
@@ -472,6 +481,25 @@ function! s:LoadChecker(checker, ft)
exec "runtime syntax_checkers/" . a:ft . "/" . a:checker . ".vim"
endfunction
"the script changes &shellpipe and &shell to stop the screen flicking when
"shelling out to syntax checkers. Not all OSs support the hacks though
function! s:OSSupportsShellpipeHack()
if !exists("s:os_supports_shellpipe_hack")
let s:os_supports_shellpipe_hack = !s:running_windows && (s:uname !~ "FreeBSD") && (s:uname !~ "OpenBSD")
endif
return s:os_supports_shellpipe_hack
endfunction
"check if a syntax checker exists for the given filetype - and attempt to
"load one
function! SyntasticCheckable(ft)
if !exists("g:loaded_" . a:ft . "_syntax_checker")
exec "runtime syntax_checkers/" . a:ft . ".vim"
endif
return exists("*SyntaxCheckers_". a:ft ."_GetLocList")
endfunction
"return a string representing the state of buffer according to
"g:syntastic_stl_format
"
@@ -536,7 +564,7 @@ function! SyntasticMake(options)
let old_shell = &shell
let old_errorformat = &l:errorformat
if !s:running_windows && (s:uname !~ "FreeBSD")
if s:OSSupportsShellpipeHack()
"this is a hack to stop the screen needing to be ':redraw'n when
"when :lmake is run. Otherwise the screen flickers annoyingly
let &shellpipe='&>'
@@ -560,7 +588,7 @@ function! SyntasticMake(options)
let &shellpipe=old_shellpipe
let &shell=old_shell
if !s:running_windows && s:uname =~ "FreeBSD"
if s:OSSupportsShellpipeHack()
redraw!
endif
@@ -613,7 +641,7 @@ function! SyntasticLoadChecker(checkers, ft)
if exists(opt_name)
let opt_val = {opt_name}
if index(a:checkers, opt_val) != -1 && executable(opt_val)
if index(a:checkers, opt_val) != -1
call s:LoadChecker(opt_val, a:ft)
else
echoerr &ft . " syntax not supported or not installed."

View File

@@ -58,6 +58,11 @@
" setting are removed from the result set:
"
" let g:syntastic_c_remove_include_errors = 1
"
" Use the variable 'g:syntastic_c_errorformat' to override the default error
" format:
"
" let g:syntastic_c_errorformat = '%f:%l:%c: %trror: %m'
if exists('loaded_c_syntax_checker')
finish
@@ -84,7 +89,13 @@ function! SyntaxCheckers_c_GetLocList()
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
\ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '.
\ 'each function it appears%.%#,%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m'
\ '%-G %#from %f:%l\,,%f:%l:%c: %trror: %m,%f:%l:%c: '.
\ '%tarning: %m,%f:%l:%c: %m,%f:%l: %trror: %m,'.
\ '%f:%l: %tarning: %m,%f:%l: %m'
if exists('g:syntastic_c_errorformat')
let errorformat = g:syntastic_c_errorformat
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_c_compiler_options

View File

@@ -19,9 +19,31 @@ if !executable("coffee")
finish
endif
if !exists('g:syntastic_coffee_lint_options')
let g:syntastic_coffee_lint_options = ""
endif
function! SyntaxCheckers_coffee_GetLocList()
let makeprg = 'coffee -c -l -o /tmp '.shellescape(expand('%'))
let errorformat = 'Syntax%trror: In %f\, %m on line %l,%EError: In %f\, Parse error on line %l: %m,%EError: In %f\, %m on line %l,%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
let coffee_results = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
if !empty(coffee_results)
return coffee_results
endif
if executable("coffeelint")
return s:GetCoffeeLintErrors()
endif
return []
endfunction
function s:GetCoffeeLintErrors()
let coffeelint = 'coffeelint --csv '.g:syntastic_coffee_lint_options.' '.shellescape(expand('%'))
let lint_results = SyntasticMake({ 'makeprg': coffeelint, 'errorformat': '%f\,%l\,%trror\,%m', 'subtype': 'Style' })
return lint_results
endfunction

View File

@@ -58,13 +58,26 @@
" g:syntastic_cpp_include_dirs' setting are removed from the result set:
"
" let g:syntastic_cpp_remove_include_errors = 1
"
" Use the variable 'g:syntastic_cpp_errorformat' to override the default error
" format:
"
" let g:syntastic_cpp_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to g++)
"
" let g:syntastic_cpp_compiler = 'clang++'
if exists('loaded_cpp_syntax_checker')
finish
endif
let loaded_cpp_syntax_checker = 1
if !executable('g++')
if !exists('g:syntastic_cpp_compiler')
let g:syntastic_cpp_compiler = 'g++'
endif
if !executable(g:syntastic_cpp_compiler)
finish
endif
@@ -76,8 +89,14 @@ if !exists('g:syntastic_cpp_config_file')
endif
function! SyntaxCheckers_cpp_GetLocList()
let makeprg = 'g++ -fsyntax-only '
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
let makeprg = g:syntastic_cpp_compiler . ' -fsyntax-only '
let errorformat = '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: '.
\ '%m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,'.
\ '%f:%l: %m'
if exists('g:syntastic_cpp_errorformat')
let errorformat = g:syntastic_cpp_errorformat
endif
if exists('g:syntastic_cpp_compiler_options')
let makeprg .= g:syntastic_cpp_compiler_options
@@ -88,7 +107,7 @@ function! SyntaxCheckers_cpp_GetLocList()
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
if exists('g:syntastic_cpp_check_header')
let makeprg = 'g++ -c '.shellescape(expand('%')).
let makeprg = g:syntastic_cpp_compiler.' -c '.shellescape(expand('%')).
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
else
return []

View File

@@ -8,18 +8,29 @@
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" Specify additional options to csslint with this option. e.g. to disable
" warnings:
"
" let g:syntastic_csslint_options = "--warnings=none"
if exists("loaded_css_syntax_checker")
finish
endif
let loaded_css_syntax_checker = 1
if !exists('g:syntastic_csslint_options')
let g:syntastic_csslint_options = ""
endif
" Bail if the user doesn't have `csslint` installed.
if !executable("csslint")
finish
endif
function! SyntaxCheckers_css_GetLocList()
let makeprg = 'csslint --format=compact '.shellescape(expand('%'))
let makeprg = 'csslint --format=compact '.g:syntastic_csslint_options.' '.
\ shellescape(expand('%'))
" Print CSS Lint's error/warning messages from compact format. Ignores blank lines.
let errorformat = '%-G,%-G%f: lint free!,%f: line %l\, col %c\, %trror - %m,%f: line %l\, col %c\, %tarning - %m,%f: line %l\, col %c\, %m,'

View File

@@ -11,6 +11,13 @@
"
" let g:syntastic_cuda_check_header = 1
" By default, nvcc and thus syntastic, defaults to the most basic architecture.
" This can produce false errors if the developer intends to compile for newer
" hardware and use newer features, eg. double precision numbers. To pass a
" specific target arch to nvcc, e.g. add the following to your .vimrc:
"
" let g:syntastic_cuda_arch = "sm_20"
if exists('loaded_cuda_syntax_checker')
finish
endif
@@ -21,13 +28,18 @@ if !executable('nvcc')
endif
function! SyntaxCheckers_cuda_GetLocList()
let makeprg = 'nvcc --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
if exists('g:syntastic_cuda_arch')
let arch_flag = '-arch='.g:syntastic_cuda_arch
else
let arch_flag = ''
endif
let makeprg = 'nvcc '.arch_flag.' --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
"let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
let errorformat = '%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f'',%X%*\a[%*\d]: Leaving directory `%f'',%D%*\a: Entering directory `%f'',%X%*\a: Leaving directory `%f'',%DMaking %*\a in %f,%f|%l| %m'
if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$'
if exists('g:syntastic_cuda_check_header')
let makeprg = 'echo > .syntastic_dummy.cu ; nvcc --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null'
let makeprg = 'echo > .syntastic_dummy.cu ; nvcc '.arch_flag.' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null'
else
return []
endif

View File

@@ -70,11 +70,11 @@
use strict;
use Getopt::Std;
use vars qw/$opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars'
use vars qw/$opt_I $opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars'
use constant VERSION => 0.2;
getopts('cwf:h');
getopts('cwf:hI:');
&usage if $opt_h; # not necessarily needed, but good for further extension
@@ -92,13 +92,13 @@ my $handle = (defined $opt_f ? \*FILE : \*STDOUT);
(my $file = shift) or &usage; # display usage if no filename is supplied
my $args = (@ARGV ? ' ' . join ' ', @ARGV : '');
my @error_lines = `perl @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-w ']} "$file$args" 2>&1`;
my @error_lines = `perl @{[defined $opt_I ? "-I$opt_I" : '']} @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-w ']} "$file$args" 2>&1`;
my @lines = map { "E:$_" } @error_lines;
my @warn_lines;
if(defined($opt_w)) {
@warn_lines = `perl @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`;
@warn_lines = `perl @{[defined $opt_I ? $opt_I : '']} @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`;
}
# Any new errors must be warnings
@@ -114,7 +114,7 @@ foreach my $line (@lines) {
chomp($line);
my ($file, $lineno, $message, $rest, $severity);
if ($line =~ /^(.*)\sat\s(.*)\sline\s(\d+)(.*)$/) {
if ($line =~ /^([EW]):(.*)\sat\s(.*)\sline\s(\d+)(.*)$/) {
($severity, $message, $file, $lineno, $rest) = ($1, $2, $3, $4, $5);
$errors++;
$message .= $rest if ($rest =~ s/^,//);
@@ -153,6 +153,7 @@ Usage:
-c compile only, don't run (executes 'perl -c')
-w output warnings as warnings instead of errors (slightly slower)
-f write errors to <errorfile>
-I specify \@INC/#include directory <perl_lib_path>
Examples:
* At the command line:

View File

@@ -11,7 +11,7 @@
"============================================================================
function! SyntaxCheckers_go_GetLocList()
let makeprg = 'go build -o /dev/null'
let errorformat = '%f:%l:%c:%m,%f:%l%m,%-G#%.%#'
let errorformat = '%f:%l:%c:%m,%E%f:%l:%m,%C%m,%-G#%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -50,7 +50,7 @@ endfunction
function! SyntaxCheckers_html_GetLocList()
let encopt = s:TidyEncOptByFenc()
let makeprg="tidy ".encopt." --new-blocklevel-tags ".shellescape('section, article, aside, hgroup, header, footer, nav, figure, figcaption')." --new-inline-tags ".shellescape('video, audio, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist')." --new-empty-tags ".shellescape('wbr, keygen')." -e ".shellescape(expand('%'))." 2>&1"
let makeprg="tidy ".encopt." --new-blocklevel-tags ".shellescape('section, article, aside, hgroup, header, footer, nav, figure, figcaption')." --new-inline-tags ".shellescape('video, audio, source, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist')." --new-empty-tags ".shellescape('wbr, keygen')." -e ".shellescape(expand('%'))." 2>&1"
let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })

View File

@@ -19,5 +19,5 @@ if exists("loaded_javascript_syntax_checker")
endif
let loaded_javascript_syntax_checker = 1
let s:supported_checkers = ["gjslint", "jslint", "jsl", "jshint"]
let s:supported_checkers = ["gjslint", "jslint", "jsl", "jshint", "closurecompiler"]
call SyntasticLoadChecker(s:supported_checkers, 'javascript')

View File

@@ -10,6 +10,20 @@
"
"============================================================================
"
" The more reliable way to check for a single .ml file is to use ocamlc.
" You can do that setting this in your .vimrc:
"
" let g:syntastic_ocaml_use_ocamlc = 1
" It's possible to use ocamlc in conjuction with Jane Street's Core. In order
" to do that, you have to specify this in your .vimrc:
"
" let g:syntastic_ocaml_use_janestreet_core = 1
" let g:syntastic_ocaml_janestreet_core_dir = <path>
"
" Where path is the path to your core installation (usually a collection of
" .cmx and .cmxa files).
"
"
" By default the camlp4o preprocessor is used to check the syntax of .ml, and .mli files,
" ocamllex is used to check .mll files and menhir is used to check .mly files.
" The output is all redirected to /dev/null, nothing is written to the disk.
@@ -51,30 +65,24 @@ if !executable(s:ocamlpp)
finish
endif
if !exists('g:syntastic_ocaml_use_ocamlc') || !executable('ocamlc')
let g:syntastic_ocaml_use_ocamlc = 0
endif
if !exists('g:syntastic_ocaml_use_janestreet_core')
let g:syntastic_ocaml_use_ocamlc = 0
endif
if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable("ocamlbuild")
let g:syntastic_ocaml_use_ocamlbuild = 0
endif
function! SyntaxCheckers_ocaml_GetLocList()
if exists('g:syntastic_ocaml_use_ocamlbuild') &&
\ g:syntastic_ocaml_use_ocamlbuild != 0 &&
\ executable("ocamlbuild") &&
\ isdirectory('_build')
let makeprg = "ocamlbuild -quiet -no-log -tag annot,". s:ocamlpp. " -no-links -no-hygiene -no-sanitize ".
\ shellescape(expand('%:r')).".cmi"
else
let extension = expand('%:e')
if match(extension, 'mly') >= 0
" ocamlyacc output can't be redirected, so use menhir
if !executable("menhir")
return []
endif
let makeprg = "menhir --only-preprocess ".shellescape(expand('%')) . " >/dev/null"
elseif match(extension,'mll') >= 0
if !executable("ocamllex")
return []
endif
let makeprg = "ocamllex -q -o /dev/null ".shellescape(expand('%'))
else
let makeprg = "camlp4o -o /dev/null ".shellescape(expand('%'))
endif
let makeprg = s:GetMakeprg()
if makeprg == ""
return []
endif
let errorformat = '%AFile "%f"\, line %l\, characters %c-%*\d:,'.
\ '%AFile "%f"\, line %l\, characters %c-%*\d (end at line %*\d\, character %*\d):,'.
\ '%AFile "%f"\, line %l\, character %c:,'.
@@ -87,3 +95,51 @@ function! SyntaxCheckers_ocaml_GetLocList()
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
function s:GetMakeprg()
if g:syntastic_ocaml_use_ocamlc
return s:GetOcamlcMakeprg()
endif
if g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')
return s:GetOcamlBuildMakeprg()
endif
return s:GetOtherMakeprg()
endfunction
function s:GetOcamlcMakeprg()
if g:syntastic_ocaml_use_janestreet_core
let build_cmd = "ocamlc -I "
let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir)
let build_cmd .= " -c ".expand('%')
return build_cmd
else
return "ocamlc -c ". expand('%')
endif
endfunction
function s:GetOcamlBuildMakeprg()
return "ocamlbuild -quiet -no-log -tag annot,". s:ocamlpp. " -no-links -no-hygiene -no-sanitize ".
\ shellescape(expand('%:r')).".cmi"
endfunction
function s:GetOtherMakeprg()
"TODO: give this function a better name?
"
"TODO: should use throw/catch instead of returning an empty makeprg
let extension = expand('%:e')
let makeprg = ""
if match(extension, 'mly') >= 0 && executable("menhir")
" ocamlyacc output can't be redirected, so use menhir
let makeprg = "menhir --only-preprocess ".shellescape(expand('%')) . " >/dev/null"
elseif match(extension,'mll') >= 0 && executable("ocamllex")
let makeprg = "ocamllex -q -o /dev/null ".shellescape(expand('%'))
else
let makeprg = "camlp4o -o /dev/null ".shellescape(expand('%'))
endif
return makeprg
endfunction

View File

@@ -10,6 +10,20 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" In order to add some custom lib directories that should be added to the
" perl command line you can add those to the global variable
" g:syntastic_perl_lib_path.
"
" let g:syntastic_perl_lib_path = './lib'
"
" To use your own perl error output munger script, use the
" g:syntastic_perl_efm_program option. Any command line parameters should be
" included in the variable declaration. The program should expect a single
" parameter; the fully qualified filename of the file to be checked.
"
" let g:syntastic_perl_efm_program = "foo.pl -o -m -g"
"
if exists("loaded_perl_syntax_checker")
finish
endif
@@ -20,11 +34,16 @@ if !executable("perl")
finish
endif
"remove '-w' switch to change all warnings to errors
let s:checker = 'perl ' . shellescape(expand('<sfile>:p:h') . '/efm_perl.pl') . ' -c -w'
if !exists("g:syntastic_perl_efm_program")
let g:syntastic_perl_efm_program = 'perl ' . shellescape(expand('<sfile>:p:h') . '/efm_perl.pl') . ' -c -w'
endif
function! SyntaxCheckers_perl_GetLocList()
let makeprg = s:checker . ' ' . shellescape(expand('%'))
if exists("g:syntastic_perl_lib_path")
let makeprg = g:syntastic_perl_efm_program . ' -I' . g:syntastic_perl_lib_path . ' ' . shellescape(expand('%'))
else
let makeprg = g:syntastic_perl_efm_program . ' ' . shellescape(expand('%'))
endif
let errorformat = '%t:%f:%l:%m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })

View File

@@ -19,6 +19,10 @@ if !executable("puppet")
finish
endif
if !exists("g:syntastic_puppet_validate_disable")
let g:syntastic_puppet_validate_disable = 0
endif
if !exists("g:syntastic_puppet_lint_disable")
let g:syntastic_puppet_lint_disable = 0
endif
@@ -27,25 +31,43 @@ if !executable("puppet-lint")
let g:syntastic_puppet_lint_disable = 1
endif
function! s:PuppetExtractVersion()
let output = system("puppet --version")
let output = substitute(output, '\n$', '', '')
return split(output, '\.')
function! s:PuppetVersion()
if !exists("s:puppet_version")
let output = system("puppet --version 2>/dev/null")
let output = substitute(output, '\n$', '', '')
let s:puppet_version = split(output, '\.')
endif
return s:puppet_version
endfunction
function! s:PuppetLintExtractVersion()
let output = system("puppet-lint --version")
let output = substitute(output, '\n$', '', '')
let output = substitute(output, '^puppet-lint ', '', 'i')
return split(output, '\.')
function! s:PuppetLintVersion()
if !exists("s:puppet_lint_version")
let output = system("puppet-lint --version 2>/dev/null")
let output = substitute(output, '\n$', '', '')
let output = substitute(output, '^puppet-lint ', '', 'i')
let s:puppet_lint_version = split(output, '\.')
endif
return s:puppet_lint_version
endfunction
let s:puppetVersion = s:PuppetExtractVersion()
let s:lintVersion = s:PuppetLintExtractVersion()
"the args must be arrays of the form [major, minor, macro]
function s:IsVersionAtLeast(installed, required)
if a:installed[0] != a:required[0]
return a:installed[0] > a:required[0]
endif
if !(s:lintVersion[0] >= '0' && s:lintVersion[1] >= '1' && s:lintVersion[2] >= '10')
let g:syntastic_puppet_lint_disable = 1
endif
if a:installed[1] != a:required[1]
return a:installed[1] > a:required[1]
endif
return a:installed[2] >= a:required[2]
endfunction
if !g:syntastic_puppet_lint_disable
if !s:IsVersionAtLeast(s:PuppetLintVersion(), [0,1,10])
let g:syntastic_puppet_lint_disable = 1
endif
end
function! s:getPuppetLintErrors()
if !exists("g:syntastic_puppet_lint_arguments")
@@ -57,15 +79,15 @@ function! s:getPuppetLintErrors()
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' })
endfunction
function! s:getPuppetMakeprg()
function! s:getPuppetMakeprg()
"If puppet is >= version 2.7 then use the new executable
if s:puppetVersion[0] >= '2' && s:puppetVersion[1] >= '7'
if s:IsVersionAtLeast(s:PuppetVersion(), [2,7,0])
let makeprg = 'puppet parser validate ' .
\ shellescape(expand('%')) .
\ ' --color=false'
"add --ignoreimport for versions < 2.7.10
if s:puppetVersion[2] < '10'
if s:PuppetVersion()[2] < '10'
let makeprg .= ' --ignoreimport'
endif
@@ -76,16 +98,19 @@ function! s:getPuppetMakeprg()
endfunction
function! SyntaxCheckers_puppet_GetLocList()
let errors = []
let makeprg = s:getPuppetMakeprg()
if !g:syntastic_puppet_validate_disable
let makeprg = s:getPuppetMakeprg()
"some versions of puppet (e.g. 2.7.10) output the message below if there
"are any syntax errors
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
"some versions of puppet (e.g. 2.7.10) output the message below if there
"are any syntax errors
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 errors = errors + SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endif
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
if !g:syntastic_puppet_lint_disable
let errors = errors + s:getPuppetLintErrors()
endif

View File

@@ -7,8 +7,8 @@
function! SyntaxCheckers_python_GetLocList()
let makeprg = 'pylint '.g:syntastic_python_checker_args.' -f parseable -r n -i y ' .
\ shellescape(expand('%')) .
\ ' 2>&1 \| sed ''s_: \[[RC]_: \[W_''' .
\ ' \| sed ''s_: \[[F]_:\ \[E_'''
let errorformat = '%f:%l: [%t%n%.%#] %m,%f:%l: [%t%.%#] %m,%Z,%-GNo config%m'
\ ' 2>&1 \| sed ''s_: \[\([RCW]\)_: \[W] \[\1_''' .
\ ' \| sed ''s_: \[\([FE]\)_:\ \[E] \[\1_'''
let errorformat = '%f:%l: [%t] %m,%Z,%-GNo config %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -18,8 +18,12 @@ if exists("loaded_ruby_syntax_checker")
endif
let loaded_ruby_syntax_checker = 1
"bail if the user doesnt have ruby installed
if !executable("ruby")
if !exists("g:syntastic_ruby_exec")
let g:syntastic_ruby_exec = "ruby"
endif
"bail if the user doesnt have ruby installed where they said it is
if !executable(expand(g:syntastic_ruby_exec))
finish
endif

View File

@@ -10,7 +10,12 @@
"
"============================================================================
function! SyntaxCheckers_ruby_GetLocList()
"let makeprg = ''
"let errorformat = ''
"return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
if has('win32')
let makeprg = 'jruby -W1 -T1 -c '.shellescape(expand('%'))
else
let makeprg = 'RUBYOPT= jruby -W1 -c '.shellescape(expand('%'))
endif
let errorformat = '%-GSyntax OK for %f,%ESyntaxError in %f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -10,13 +10,20 @@
"
"============================================================================
function! SyntaxCheckers_ruby_GetLocList()
" we cannot set RUBYOPT on windows like that
if has('win32')
let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%'))
else
let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%'))
let makeprg = expand(g:syntastic_ruby_exec).' -w -T1 -c '.shellescape(expand('%'))
if !has('win32')
let makeprg = 'RUBYOPT= ' . makeprg
endif
let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
"this is a hack to filter out a repeated useless warning in rspec files
"containing lines like
"
" foo.should == 'bar'
"
"Which always generate the warning below. Note that ruby >= 1.9.3 includes
"the word "possibly" in the warning
let errorformat = '%-G%.%#warning: %\(possibly %\)%\?useless use of == in void context'
let errorformat .= ',%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -31,22 +31,29 @@ function! s:GetShell()
return b:shell
endfunction
function! SyntaxCheckers_sh_GetLocList()
if len(s:GetShell()) == 0 || !executable(s:GetShell())
function! s:ForwardToZshChecker()
if SyntasticCheckable('zsh')
return SyntaxCheckers_zsh_GetLocList()
else
return []
endif
let output = split(system(s:GetShell().' -n '.shellescape(expand('%'))), '\n')
if v:shell_error != 0
let result = []
for err_line in output
let line = substitute(err_line, '^[^:]*:\D\{-}\(\d\+\):.*', '\1', '')
let msg = substitute(err_line, '^[^:]*:\D\{-}\d\+: \(.*\)', '\1', '')
call add(result, {'lnum' : line,
\ 'text' : msg,
\ 'bufnr': bufnr(''),
\ 'type': 'E' })
endfor
return result
endif
return []
endfunction
function! s:IsShellValid()
return len(s:GetShell()) > 0 && executable(s:GetShell())
endfunction
function! SyntaxCheckers_sh_GetLocList()
if s:GetShell() == 'zsh'
return s:ForwardToZshChecker()
endif
if !s:IsShellValid()
return []
endif
let makeprg = s:GetShell() . ' -n ' . shellescape(expand('%'))
let errorformat = '%f: line %l: %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat})
endfunction

View File

@@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"
"Installation: $ npm install -g js-yaml.bin
"Installation: $ npm install -g js-yaml
"
"============================================================================
if exists("loaded_yaml_syntax_checker")

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
Author: Jan Larres <jan@majutsushi.net>
Licence: Vim licence, see |license|
Homepage: http://majutsushi.github.com/tagbar/
Version: 2.4
Version: 2.4.1
==============================================================================
Contents *tagbar* *tagbar-contents*
@@ -223,11 +223,12 @@ strange things will happen. This is unfortunately unavoidable.
Displaying the prototype of a tag~
Tagbar can display the prototype of a tag. More precisely it can display the
line in which the tag is defined. This can be done by either pressing <Space>
when on a tag or hovering over a tag with the mouse. In the former case the
prototype will be displayed in the command line |Command-line|, in the latter
case it will be displayed in a pop-up window. The prototype will also be
displayed when the cursor stays on a tag for 'updatetime' milliseconds.
line(s) in which the tag is defined. This can be done by either pressing
<Space> when on a tag or hovering over a tag with the mouse. In the former
case the prototype will be displayed in the |Command-line|, in the latter case
it will be displayed in a pop-up window. The prototype will also be displayed
if the cursor stays on a tag for 'updatetime' milliseconds. In that case the
prototype may be abbreviated in order to avoid |hit-enter| prompts.
------------------------------------------------------------------------------
COMMANDS *tagbar-commands*
@@ -241,7 +242,8 @@ COMMANDS *tagbar-commands*
were set to 1)
'j' Jump to Tagbar window if already open
'c' Close Tagbar on tag selection (just as if |g:tagbar_autoclose| were
set to 1, but doesn't imply 'f')
set to 1, but doesn't imply 'f'), but only if the Tagbar window was
opened using this command.
For example, the following command would always jump to the Tagbar window,
opening it first if necessary, but keep it open after selecting a tag
@@ -256,7 +258,7 @@ COMMANDS *tagbar-commands*
:TagbarOpenAutoClose *:TagbarOpenAutoClose*
Open the Tagbar window, jump to it and close it on tag selection. This is
an alias for ":TagbarOpen fc".
an alias for ":TagbarOpen fjc".
:TagbarSetFoldlevel[!] {number} *:TagbarSetFoldlevel*
Set the foldlevel of the tags of the current file to {number}. The
@@ -269,6 +271,10 @@ COMMANDS *tagbar-commands*
Open the parent folds of the current tag in the file window as much as
needed for the tag to be visible in the Tagbar window.
:TagbarCurrentTag [{flags}] *:TagbarCurrentTag*
Echo the current tag in the command line. For {flags} see
|tagbar-statusline|.
:TagbarGetTypeConfig {filetype} *:TagbarGetTypeConfig*
Paste the Tagbar configuration of the vim filetype {filetype} at the
current cursor position (provided that filetype is supported by Tagbar)
@@ -473,19 +479,9 @@ Example:
*g:tagbar_updateonsave_maxlines*
g:tagbar_updateonsave_maxlines~
Default: 5000
If the current file has fewer lines than the value of this variable, Tagbar
will update immediately after saving the file. If it is longer then the update
will only happen on the |CursorHold| event and when switching buffers (or
windows). This is to prevent the time it takes to save a large file from
becoming annoying in case you have a slow computer. If you have a fast
computer you can set it to a higher value.
Deprecated. Tagbar will now always get updated when the file is being saved.
Example:
>
let g:tagbar_updateonsave_maxlines = 10000
<
*g:tagbar_systemenc*
g:tagbar_systemenc~
@@ -496,6 +492,8 @@ system is different from the one set in Vim, i.e. the 'encoding' option. For
example, if you use a Simplified Chinese Windows version that has a system
encoding of "cp936", and you have set 'encoding' to "utf-8", then you would
have to set this variable to "cp936".
Note that this requires Vim to be compiled with the |+multi_byte| and (unless
your encoding is latin1) |+iconv| features to work.
Example:
>
@@ -617,10 +615,13 @@ tagbar#currenttag({format}, {default} [, {flags}])
's' If the tag is a function, the complete signature will be shown,
otherwise just "()" will be appended to distinguish functions from
other tags.
'p' Display the raw prototype instead of the parsed tag. This can be
useful in cases where ctags doesn't report some information, like
the signature. Note that this can get quite long.
For example, if you put the following into your statusline: >
%{tagbar#currenttag('[%s] ', '')}
< then the function "myfunc" will be show as "[myfunc()] ".
%{tagbar#currenttag('[%s] ','')}
< then the function "myfunc" will be shown as "[myfunc()] ".
==============================================================================
6. Extending Tagbar *tagbar-extend*
@@ -916,6 +917,11 @@ that.
Tagbar should now be able to show the sections and other tags from LaTeX
files.
Note: As of 2012-05-05 the ctags development version contains an improved
LaTeX parser that works better than the example configuration presented here.
So if you are using a development build newer than that or a stable version
newer than 5.8 you should use the built-in support instead of this example.
Writing your own tag-generating program~
If you want to write your own program for generating tags then here are some
imporant tips to get it to integrate well with Tagbar:
@@ -933,17 +939,21 @@ imporant tips to get it to integrate well with Tagbar:
other fields need to have a fieldname in order to determine what they are.
The following fields are supported for all filetypes:
* line: The line number of the tag
* column: The column number of the tag
* signature: The signature of a function
* line: The line number of the tag.
* column: The column number of the tag.
* signature: The signature of a function.
* access: Visibility/access information of a tag; the values
"public", "protected" and "private" will be denoted with
a special symbol in Tagbar
a special symbol in Tagbar.
In addition fields that describe the surrounding scope of the tag are
supported if they are specified in the type configuration as explained at
the beginning of this section. For example, for a tag in class "Foo" this
could look like "class:Foo".
Important: the value of such a scope-specifying field should be the entire
hierarchy of scopes that the tag is in, so if for example in C++ you have
a member in class "Foo" which is in namespace "Bar" then the scope field
should be "class:Bar::Foo".
==============================================================================
7. Troubleshooting & Known issues *tagbar-issues*
@@ -1018,6 +1028,14 @@ file.
==============================================================================
8. History *tagbar-history*
2.4.1 (2012-07-16)
- Fixed some bugs related to the currenttag() function when it was called
before the rest of the plugin was loaded. Also fail silently in case
something goes wrong so the statusline doesn't get messed up.
- In certain cases highlighting tags in deeply nested folds could cause an
error message.
- Spellchecking is now correctly getting disabled in the Tagbar window.
2.4 (2012-06-17)
- New function tagbar#currenttag() that reports the current tag, for
example for putting it into the statusline.

View File

@@ -4,7 +4,7 @@
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.4
" Version: 2.4.1
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
" Yegappan Lakshmanan and uses a small amount of code from it.
"
@@ -91,10 +91,6 @@ if !exists('g:tagbar_autoshowtag')
let g:tagbar_autoshowtag = 0
endif
if !exists('g:tagbar_updateonsave_maxlines')
let g:tagbar_updateonsave_maxlines = 5000
endif
if !exists('g:tagbar_systemenc')
let g:tagbar_systemenc = &encoding
endif
@@ -107,10 +103,11 @@ augroup END
" Commands {{{1
command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
command! -nargs=? TagbarOpen call tagbar#OpenWindow(<f-args>)
command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fc')
command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fcj')
command! -nargs=0 TagbarClose call tagbar#CloseWindow()
command! -nargs=1 -bang TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>, <bang>0)
command! -nargs=0 TagbarShowTag call tagbar#OpenParents()
command! -nargs=0 TagbarShowTag call tagbar#highlighttag(1, 1)
command! -nargs=? TagbarCurrentTag echo tagbar#currenttag('%s', 'No current tag', <f-args>)
command! -nargs=1 TagbarGetTypeConfig call tagbar#gettypeconfig(<f-args>)
command! -nargs=? TagbarDebug call tagbar#StartDebug(<f-args>)
command! -nargs=0 TagbarDebugEnd call tagbar#StopDebug()

View File

@@ -3,7 +3,7 @@
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.4
" Version: 2.4.1
scriptencoding utf-8

View File

@@ -65,7 +65,7 @@ endif
" no ctags found, no need to continue.
if !exists('g:Tlist_Ctags_Cmd')
echohl WarningMsg | echom 'ctags not found' | echohl Normal
command TlistToo :echohl WarningMsg | echom 'ctags not found' | echohl Normal
finish
endif

View File

@@ -10,8 +10,12 @@
" Dependencies:
" - SearchSpecial.vim autoload script (optional, for improved search messages).
"
" Version: 2.7.0
" Version: 2.7.1
" Changes:
" 13-Sep-2012, Ingo Karkat
" - Enable alternative * / # mappings that do not remember the last search type
" by adding optional search function argument to mark#SearchNext().
"
" 04-Jul-2012, Ingo Karkat
" - ENH: Handle on-the-fly change of mark highlighting via mark#ReInit(), which
" truncates / expands s:pattern and corrects the indices. Also, w:mwMatch List
@@ -771,18 +775,16 @@ function! mark#SearchAnyMark( isBackward )
endfunction
" Search last searched mark.
function! mark#SearchNext( isBackward )
function! mark#SearchNext( isBackward, ... )
let l:markText = mark#CurrentMark()[0]
if empty(l:markText)
return 0
else
if s:lastSearch == -1
call mark#SearchAnyMark(a:isBackward)
else
call mark#SearchCurrentMark(a:isBackward)
endif
return 1
return 0 " Fall back to the built-in * / # command (done by the mapping).
endif
" Use the provided search type or choose depending on last use of
" <Plug>MarkSearchCurrentNext / <Plug>MarkSearchAnyNext.
call call(a:0 ? a:1 : (s:lastSearch == -1 ? 'mark#SearchAnyMark' : 'mark#SearchCurrentMark'), [a:isBackward])
return 1
endfunction
" Load mark patterns from list.
@@ -809,12 +811,12 @@ function! mark#ToPatternList()
" may differ on the next invocation (e.g. due to a different number of
" highlight groups in Vim and GVIM). We want to keep empty patterns in the
" front and middle to maintain the mapping to highlight groups, though.
let l:highestNonEmptyIndex = s:markNum -1
let l:highestNonEmptyIndex = s:markNum - 1
while l:highestNonEmptyIndex >= 0 && empty(s:pattern[l:highestNonEmptyIndex])
let l:highestNonEmptyIndex -= 1
endwhile
return (l:highestNonEmptyIndex < 0 ? [] : s:pattern[0:l:highestNonEmptyIndex])
return (l:highestNonEmptyIndex < 0 ? [] : s:pattern[0 : l:highestNonEmptyIndex])
endfunction
" :MarkLoad command.

View File

@@ -21,10 +21,9 @@ highlighting of search results and the * |star| command. For example, when you
are browsing a big program file, you could highlight multiple identifiers in
parallel. This will make it easier to trace the source code.
This is a continuation of vimscript #1238 by Yuheng Xie, who apparently
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
the original:
This is a continuation of vimscript #1238 by Yuheng Xie, who doesn't maintain
his original version anymore and recommends switching to this fork. This
plugin offers the following advantages over the original:
- Much faster, all colored words can now be highlighted, no more clashes with
syntax highlighting (due to use of matchadd()).
- Many bug fixes.
@@ -216,17 +215,17 @@ and |mark-palette-define| for how to add your own custom palettes.
==============================================================================
INSTALLATION *mark-installation*
This script is packaged as a|vimball|. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vba.gz package in Vim; otherwise, decompress
This script is packaged as a |vimball|. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the |:UseVimball| command. >
vim mark.vba.gz
vim mark*.vmb.gz
:so %
To uninstall, use the |:RmVimball| command.
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*
@@ -311,6 +310,12 @@ command, but you can define some yourself: >
To remove the default overriding of * and #, use: >
nmap <Plug>IgnoreMarkSearchNext <Plug>MarkSearchNext
nmap <Plug>IgnoreMarkSearchPrev <Plug>MarkSearchPrev
<
If you don't want the * and # mappings remember the last search type and
instead always search for the next occurrence of the current mark, with a
fallback to Vim's original * command, use: >
nmap * <Plug>MarkSearchOrCurNext
nmap # <Plug>MarkSearchOrCurPrev
<
*mark-whitespace-indifferent*
Some people like to create a mark based on the visual selection, like
@@ -354,6 +359,12 @@ http://vim.wikia.com/wiki/Highlight_multiple_words:
==============================================================================
HISTORY *mark-history*
2.7.1 14-Sep-2012
- Enable alternative * / # mappings that do not remember the last search type
through new <Plug>MarkSearchOrCurNext, <Plug>MarkSearchOrCurPrev,
<Plug>MarkSearchOrAnyNext, <Plug>MarkSearchOrAnyPrev mappings. Based on an
inquiry from Kevin Huanpeng Du.
2.7.0 04-Jul-2012
- ENH: Implement :MarkPalette command to switch mark highlighting on-the-fly
during runtime.
@@ -558,7 +569,7 @@ Initial version published by Yuheng Xie on vim.org.
==============================================================================
Copyright: (C) 2005-2008 Yuheng Xie
(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>
==============================================================================

View File

@@ -14,8 +14,13 @@
" - mark.vim autoload script
" - mark/palettes.vim autoload script for additional palettes
"
" Version: 2.7.0
" Version: 2.7.1
" Changes:
" 13-Sep-2012, Ingo Karkat
" - Enable alternative * / # mappings that do not remember the last search type
" through new <Plug>MarkSearchOrCurNext, <Plug>MarkSearchOrCurPrev,
" <Plug>MarkSearchOrAnyNext, <Plug>MarkSearchOrAnyPrev mappings.
"
" 04-Jul-2012, Ingo Karkat
" - Introduce g:mwPalettes instead of hard-coding them in
" s:DefaultHighlightings(), which got s:DefineHighlightings() extracted and
@@ -298,47 +303,51 @@ nnoremap <silent> <Plug>MarkSearchCurrentNext :<C-u>call mark#SearchCurrentMark(
nnoremap <silent> <Plug>MarkSearchCurrentPrev :<C-u>call mark#SearchCurrentMark(1)<CR>
nnoremap <silent> <Plug>MarkSearchAnyNext :<C-u>call mark#SearchAnyMark(0)<CR>
nnoremap <silent> <Plug>MarkSearchAnyPrev :<C-u>call mark#SearchAnyMark(1)<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>
" When typed, [*#nN] open the fold at the search result, but inside a mapping or
" :normal this must be done explicitly via 'zv'.
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>MarkSearchOrCurNext :<C-u>if !mark#SearchNext(0,'mark#SearchCurrentMark')<Bar>execute 'normal! *zv'<Bar>endif<CR>
nnoremap <silent> <Plug>MarkSearchOrCurPrev :<C-u>if !mark#SearchNext(1,'mark#SearchCurrentMark')<Bar>execute 'normal! #zv'<Bar>endif<CR>
nnoremap <silent> <Plug>MarkSearchOrAnyNext :<C-u>if !mark#SearchNext(0,'mark#SearchAnyMark')<Bar>execute 'normal! *zv'<Bar>endif<CR>
nnoremap <silent> <Plug>MarkSearchOrAnyPrev :<C-u>if !mark#SearchNext(1,'mark#SearchAnyMark')<Bar>execute 'normal! #zv'<Bar>endif<CR>
if !hasmapto('<Plug>MarkSet', 'n')
nmap <unique> <silent> <Leader>m <Plug>MarkSet
nmap <unique> <Leader>m <Plug>MarkSet
endif
if !hasmapto('<Plug>MarkSet', 'v')
xmap <unique> <silent> <Leader>m <Plug>MarkSet
xmap <unique> <Leader>m <Plug>MarkSet
endif
if !hasmapto('<Plug>MarkRegex', 'n')
nmap <unique> <silent> <Leader>r <Plug>MarkRegex
nmap <unique> <Leader>r <Plug>MarkRegex
endif
if !hasmapto('<Plug>MarkRegex', 'v')
xmap <unique> <silent> <Leader>r <Plug>MarkRegex
xmap <unique> <Leader>r <Plug>MarkRegex
endif
if !hasmapto('<Plug>MarkClear', 'n')
nmap <unique> <silent> <Leader>n <Plug>MarkClear
nmap <unique> <Leader>n <Plug>MarkClear
endif
" No default mapping for <Plug>MarkAllClear.
" No default mapping for <Plug>MarkToggle.
if !hasmapto('<Plug>MarkSearchCurrentNext', 'n')
nmap <unique> <silent> <Leader>* <Plug>MarkSearchCurrentNext
nmap <unique> <Leader>* <Plug>MarkSearchCurrentNext
endif
if !hasmapto('<Plug>MarkSearchCurrentPrev', 'n')
nmap <unique> <silent> <Leader># <Plug>MarkSearchCurrentPrev
nmap <unique> <Leader># <Plug>MarkSearchCurrentPrev
endif
if !hasmapto('<Plug>MarkSearchAnyNext', 'n')
nmap <unique> <silent> <Leader>/ <Plug>MarkSearchAnyNext
nmap <unique> <Leader>/ <Plug>MarkSearchAnyNext
endif
if !hasmapto('<Plug>MarkSearchAnyPrev', 'n')
nmap <unique> <silent> <Leader>? <Plug>MarkSearchAnyPrev
nmap <unique> <Leader>? <Plug>MarkSearchAnyPrev
endif
if !hasmapto('<Plug>MarkSearchNext', 'n')
nmap <unique> <silent> * <Plug>MarkSearchNext
nmap <unique> * <Plug>MarkSearchNext
endif
if !hasmapto('<Plug>MarkSearchPrev', 'n')
nmap <unique> <silent> # <Plug>MarkSearchPrev
nmap <unique> # <Plug>MarkSearchPrev
endif