mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
Update of plugins (vimwiki, ctrlp, syntastic, tagbar, gundo and mark),
added draft syntax file for kickassembler
This commit is contained in:
1
.vimrc
1
.vimrc
@@ -91,6 +91,7 @@ autocmd BufWritePre *.xml :call <SID>StripTrailingWhitespaces()
|
||||
"set correct filetype for tmux
|
||||
autocmd BufRead *.tmux.conf set filetype=tmux
|
||||
autocmd BufRead *.mako set filetype=mako
|
||||
autocmd BufRead *.ass set filetype=kickass
|
||||
" }}}
|
||||
"TERMINAL: options for terminal emulators {{{
|
||||
if $TERM == 'rxvt-unicode-256color' || $TERM == 'xterm'
|
||||
|
||||
@@ -4,23 +4,22 @@ ScriptID SourceID Filename
|
||||
2572 10433 ack.vim
|
||||
102 16171 DirDiff.vim
|
||||
311 7645 grep.vim
|
||||
3304 17406 gundo.vim
|
||||
3304 18081 gundo.vim
|
||||
2727 11120 jsbeautify.vim
|
||||
2289 8922 loremipsum
|
||||
2666 17666 Mark
|
||||
2666 17810 Mark
|
||||
1218 14455 nerdcommenter
|
||||
2262 8944 occur.vim
|
||||
2136 8206 repeat.vim
|
||||
152 3342 showmarks.vim
|
||||
2540 11006 snipMate.vim
|
||||
1697 12566 surround.vim
|
||||
3465 17112 Tagbar
|
||||
3465 18143 Tagbar
|
||||
90 17031 vcscommand.vim
|
||||
2226 15854 vimwiki.vim
|
||||
2226 18100 vimwiki.vim
|
||||
1334 6377 vst.vim
|
||||
2321 9055 zoom.vim
|
||||
52 14880 calendar.vim
|
||||
3736 17669 ctrlp.vim
|
||||
### ftplugin
|
||||
3818 16921 MatchTag
|
||||
910 14691 pydoc.vim
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
140
bundle/git_ctrlp/autoload/ctrlp/bookmarkdir.vim
Normal file
140
bundle/git_ctrlp/autoload/ctrlp/bookmarkdir.vim
Normal file
@@ -0,0 +1,140 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/bookmarkdir.vim
|
||||
" Description: Bookmarked directories extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_bookmarkdir = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#bookmarkdir#init()',
|
||||
\ 'accept': 'ctrlp#bookmarkdir#accept',
|
||||
\ 'lname': 'bookmarked dirs',
|
||||
\ 'sname': 'bkd',
|
||||
\ 'type': 'tabs',
|
||||
\ 'opmul': 1,
|
||||
\ 'nolim': 1,
|
||||
\ 'wipe': 'ctrlp#bookmarkdir#remove',
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:getinput(str, ...)
|
||||
echoh Identifier
|
||||
cal inputsave()
|
||||
let input = call('input', a:0 ? [a:str] + a:000 : [a:str])
|
||||
cal inputrestore()
|
||||
echoh None
|
||||
retu input
|
||||
endf
|
||||
|
||||
fu! s:cachefile()
|
||||
if !exists('s:cadir') || !exists('s:cafile')
|
||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd'
|
||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
||||
en
|
||||
retu s:cafile
|
||||
endf
|
||||
|
||||
fu! s:writecache(lines)
|
||||
cal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile)
|
||||
endf
|
||||
|
||||
fu! s:getbookmarks()
|
||||
retu ctrlp#utils#readfile(s:cachefile())
|
||||
endf
|
||||
|
||||
fu! s:savebookmark(name, cwd)
|
||||
let cwds = exists('+ssl') ? [tr(a:cwd, '\', '/'), tr(a:cwd, '/', '\')] : [a:cwd]
|
||||
let entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0')
|
||||
cal s:writecache(insert(entries, a:name.' '.a:cwd))
|
||||
endf
|
||||
|
||||
fu! s:setentries()
|
||||
let time = getftime(s:cachefile())
|
||||
if !( exists('s:bookmarks') && time == s:bookmarks[0] )
|
||||
let s:bookmarks = [time, s:getbookmarks()]
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:parts(str)
|
||||
let mlist = matchlist(a:str, '\v([^\t]+)\t(.*)$')
|
||||
retu mlist != [] ? mlist[1:2] : ['', '']
|
||||
endf
|
||||
|
||||
fu! s:process(entries, type)
|
||||
retu map(a:entries, 's:modify(v:val, a:type)')
|
||||
endf
|
||||
|
||||
fu! s:modify(entry, type)
|
||||
let [name, dir] = s:parts(a:entry)
|
||||
let dir = fnamemodify(dir, a:type)
|
||||
retu name.' '.( dir == '' ? '.' : dir )
|
||||
endf
|
||||
|
||||
fu! s:msg(name, cwd)
|
||||
redr
|
||||
echoh Identifier | echon 'Bookmarked ' | echoh Constant
|
||||
echon a:name.' ' | echoh Directory | echon a:cwd
|
||||
echoh None
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBookmark', 'Identifier')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBookmark '^> [^\t]\+' contains=CtrlPLinePre
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#bookmarkdir#init()
|
||||
cal s:setentries()
|
||||
cal s:syntax()
|
||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#accept(mode, str)
|
||||
let parts = s:parts(s:modify(a:str, ':p'))
|
||||
cal call('s:savebookmark', parts)
|
||||
if a:mode =~ 't\|v\|h'
|
||||
cal ctrlp#exit()
|
||||
en
|
||||
cal ctrlp#setdir(parts[1], a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
||||
if a:mode == 'e'
|
||||
cal ctrlp#switchtype(0)
|
||||
cal ctrlp#recordhist()
|
||||
cal ctrlp#prtclear()
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#add(dir)
|
||||
let str = 'Directory to bookmark: '
|
||||
let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir')
|
||||
if cwd == '' | retu | en
|
||||
let cwd = fnamemodify(cwd, ':p')
|
||||
let name = s:getinput('Bookmark as: ', cwd)
|
||||
if name == '' | retu | en
|
||||
let name = tr(name, ' ', ' ')
|
||||
cal s:savebookmark(name, cwd)
|
||||
cal s:msg(name, cwd)
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#remove(entries)
|
||||
cal s:process(a:entries, ':p')
|
||||
cal s:writecache(a:entries == [] ? [] :
|
||||
\ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0'))
|
||||
cal s:setentries()
|
||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
@@ -13,7 +13,7 @@ if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
|
||||
en
|
||||
let g:loaded_ctrlp_buftag = 1
|
||||
|
||||
let s:buftag_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
|
||||
\ 'accept': 'ctrlp#buffertag#accept',
|
||||
\ 'lname': 'buffer tags',
|
||||
@@ -21,27 +21,17 @@ let s:buftag_var = {
|
||||
\ 'exit': 'ctrlp#buffertag#exit()',
|
||||
\ 'type': 'tabs',
|
||||
\ 'opts': 'ctrlp#buffertag#opts()',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:buftag_var) : [s:buftag_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
fu! ctrlp#buffertag#opts()
|
||||
let opts = {
|
||||
\ 'g:ctrlp_buftag_systemenc': ['s:enc', &enc],
|
||||
\ 'g:ctrlp_buftag_ctags_bin': ['s:bin', ''],
|
||||
\ 'g:ctrlp_buftag_types': ['s:usr_types', ''],
|
||||
\ }
|
||||
for [ke, va] in items(opts)
|
||||
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
||||
endfo
|
||||
endf
|
||||
cal ctrlp#buffertag#opts()
|
||||
let [s:pref, s:opts] = ['g:ctrlp_buftag_', {
|
||||
\ 'systemenc': ['s:enc', &enc],
|
||||
\ 'ctags_bin': ['s:bin', ''],
|
||||
\ 'types': ['s:usr_types', {}],
|
||||
\ }]
|
||||
|
||||
fu! s:bins()
|
||||
let bins = [
|
||||
let s:bins = [
|
||||
\ 'ctags-exuberant',
|
||||
\ 'exuberant-ctags',
|
||||
\ 'exctags',
|
||||
@@ -51,18 +41,7 @@ fu! s:bins()
|
||||
\ 'ctags.exe',
|
||||
\ 'tags',
|
||||
\ ]
|
||||
if empty(s:bin)
|
||||
for bin in bins | if executable(bin)
|
||||
let s:bin = bin
|
||||
brea
|
||||
en | endfo
|
||||
el
|
||||
let s:bin = expand(s:bin, 1)
|
||||
en
|
||||
endf
|
||||
cal s:bins()
|
||||
|
||||
" s:types {{{2
|
||||
let s:types = {
|
||||
\ 'asm' : '%sasm%sasm%sdlmt',
|
||||
\ 'aspperl': '%sasp%sasp%sfsv',
|
||||
@@ -109,9 +88,22 @@ if executable('jsctags')
|
||||
cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } })
|
||||
en
|
||||
|
||||
if type(s:usr_types) == 4
|
||||
cal extend(s:types, s:usr_types)
|
||||
fu! ctrlp#buffertag#opts()
|
||||
for [ke, va] in items(s:opts)
|
||||
let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
|
||||
endfo
|
||||
" Ctags bin
|
||||
if empty(s:bin)
|
||||
for bin in s:bins | if executable(bin)
|
||||
let s:bin = bin
|
||||
brea
|
||||
en | endfo
|
||||
el
|
||||
let s:bin = expand(s:bin, 1)
|
||||
en
|
||||
" Types
|
||||
cal extend(s:types, s:usr_types)
|
||||
endf
|
||||
" Utilities {{{1
|
||||
fu! s:validfile(fname, ftype)
|
||||
if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname)
|
||||
@@ -193,24 +185,20 @@ endf
|
||||
fu! s:parseline(line)
|
||||
let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)'
|
||||
let vals = matchlist(a:line, eval)
|
||||
if empty(vals) | retu '' | en
|
||||
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]
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !hlexists('CtrlPTagKind')
|
||||
hi link CtrlPTagKind Title
|
||||
en
|
||||
if !hlexists('CtrlPBufName')
|
||||
hi link CtrlPBufName Directory
|
||||
en
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPTagKind', 'Title')
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
||||
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#buffertag#init(fname)
|
||||
@@ -223,14 +211,13 @@ fu! ctrlp#buffertag#init(fname)
|
||||
let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '')
|
||||
cal extend(lines, s:process(bname, tftype))
|
||||
endfo
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal s:syntax()
|
||||
en
|
||||
retu lines
|
||||
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)
|
||||
endf
|
||||
|
||||
@@ -10,18 +10,16 @@ if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes
|
||||
en
|
||||
let g:loaded_ctrlp_changes = 1
|
||||
|
||||
let s:changes_var = {
|
||||
\ 'init': 'ctrlp#changes#init(s:bufnr, s:crfile)',
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#changes#init(s:bufnr, s:crbufnr)',
|
||||
\ 'accept': 'ctrlp#changes#accept',
|
||||
\ 'lname': 'changes',
|
||||
\ 'sname': 'chs',
|
||||
\ 'exit': 'ctrlp#changes#exit()',
|
||||
\ 'type': 'tabe',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:changes_var) : [s:changes_var]
|
||||
\ 'nolim': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
@@ -46,41 +44,34 @@ fu! s:process(clines, ...)
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !hlexists('CtrlPBufName')
|
||||
hi link CtrlPBufName Directory
|
||||
en
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#changes#init(original_bufnr, fname)
|
||||
let fname = exists('s:bufname') ? s:bufname : a:fname
|
||||
let bufs = exists('s:clmode') && s:clmode
|
||||
\ ? filter(ctrlp#buffers(), 'filereadable(v:val)') : [fname]
|
||||
fu! ctrlp#changes#init(original_bufnr, bufnr)
|
||||
let bufnr = exists('s:bufnr') ? s:bufnr : a:bufnr
|
||||
let bufs = exists('s:clmode') && s:clmode ? ctrlp#buffers('id') : [bufnr]
|
||||
cal filter(bufs, 'v:val > 0')
|
||||
let [swb, &swb] = [&swb, '']
|
||||
let lines = []
|
||||
for each in bufs
|
||||
let [bname, fnamet] = [fnamemodify(each, ':p'), fnamemodify(each, ':t')]
|
||||
let bufnr = bufnr('^'.bname.'$')
|
||||
if bufnr > 0
|
||||
cal extend(lines, s:process(s:changelist(bufnr), bufnr, fnamet))
|
||||
en
|
||||
let fnamet = fnamemodify(bufname(each), ':t')
|
||||
cal extend(lines, s:process(s:changelist(each), each, fnamet))
|
||||
endfo
|
||||
sil! exe 'noa hid b' a:original_bufnr
|
||||
let &swb = swb
|
||||
let g:ctrlp_nolimit = 1
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal ctrlp#syntax()
|
||||
cal s:syntax()
|
||||
en
|
||||
retu lines
|
||||
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'))
|
||||
@@ -92,13 +83,13 @@ endf
|
||||
fu! ctrlp#changes#cmd(mode, ...)
|
||||
let s:clmode = a:mode
|
||||
if a:0 && !empty(a:1)
|
||||
let s:bufname = fnamemodify(a:1, ':p')
|
||||
let s:bufnr = bufnr('^'.fnamemodify(a:1, ':p').'$')
|
||||
en
|
||||
retu s:id
|
||||
endf
|
||||
|
||||
fu! ctrlp#changes#exit()
|
||||
unl! s:clmode s:bufname
|
||||
unl! s:clmode s:bufnr
|
||||
endf
|
||||
"}}}
|
||||
|
||||
|
||||
@@ -17,16 +17,14 @@ let s:ars = [
|
||||
\ 's:glob',
|
||||
\ ]
|
||||
|
||||
let s:dir_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
|
||||
\ 'accept': 'ctrlp#dir#accept',
|
||||
\ 'lname': 'dirs',
|
||||
\ 'sname': 'dir',
|
||||
\ 'type': 'path',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:dir_var) : [s:dir_var]
|
||||
\ 'specinput': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
@@ -34,9 +32,9 @@ fu! s:globdirs(dirs, depth)
|
||||
let entries = split(globpath(a:dirs, s:glob), "\n")
|
||||
let [dirs, depth] = [ctrlp#dirnfile(entries)[0], a:depth + 1]
|
||||
cal extend(g:ctrlp_alldirs, dirs)
|
||||
if !empty(dirs) && !s:max(len(g:ctrlp_alldirs), s:maxfiles)
|
||||
\ && depth <= s:maxdepth
|
||||
sil! cal ctrlp#progress(len(g:ctrlp_alldirs))
|
||||
let nr = len(g:ctrlp_alldirs)
|
||||
if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
|
||||
sil! cal ctrlp#progress(nr)
|
||||
cal s:globdirs(join(dirs, ','), depth)
|
||||
en
|
||||
endf
|
||||
@@ -48,25 +46,24 @@ endf
|
||||
fu! ctrlp#dir#init(...)
|
||||
let s:cwd = getcwd()
|
||||
for each in range(len(s:ars))
|
||||
exe 'let' s:ars[each] '=' string(eval('a:'.(each + 1)))
|
||||
let {s:ars[each]} = a:{each + 1}
|
||||
endfo
|
||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().s:dir_var['sname']
|
||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile(s:dir_var['sname'])
|
||||
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)
|
||||
let g:ctrlp_alldirs = []
|
||||
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
|
||||
cal s:globdirs(s:cwd, 0)
|
||||
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
|
||||
let read_cache = 0
|
||||
if len(g:ctrlp_alldirs) <= s:compare_lim
|
||||
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
|
||||
en
|
||||
el
|
||||
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
|
||||
let read_cache = 1
|
||||
en
|
||||
if !read_cache
|
||||
cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile)
|
||||
let g:ctrlp_newdir = 0
|
||||
el
|
||||
if !( exists('s:initcwd') && s:initcwd == s:cwd )
|
||||
let s:initcwd = s:cwd
|
||||
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
|
||||
en
|
||||
en
|
||||
retu g:ctrlp_alldirs
|
||||
endf
|
||||
|
||||
@@ -10,52 +10,45 @@ if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
||||
en
|
||||
let g:loaded_ctrlp_line = 1
|
||||
|
||||
let s:line_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#line#init()',
|
||||
\ 'accept': 'ctrlp#line#accept',
|
||||
\ 'lname': 'lines',
|
||||
\ 'sname': 'lns',
|
||||
\ 'type': 'tabe',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:line_var) : [s:line_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:syntax()
|
||||
if !hlexists('CtrlPBufName')
|
||||
hi link CtrlPBufName Directory
|
||||
en
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#line#init()
|
||||
let [bufs, lines] = [filter(ctrlp#buffers(), 'filereadable(v:val)'), []]
|
||||
for each in bufs
|
||||
let [fnamet, from_file] = [fnamemodify(each, ':t'), readfile(each)]
|
||||
let bname = fnamemodify(each, ':p')
|
||||
cal map(from_file, 'tr(v:val, '' '', '' '')')
|
||||
let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.bname.'$')]
|
||||
wh id <= len_ff
|
||||
let from_file[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|'
|
||||
let id += 1
|
||||
let [bufs, lines] = [ctrlp#buffers('id'), []]
|
||||
for bufnr in bufs
|
||||
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
|
||||
let lfb = lfb == [] ? ctrlp#utils#readfile(fnamemodify(bufn, ':p')) : lfb
|
||||
cal map(lfb, 'tr(v:val, '' '', '' '')')
|
||||
let [linenr, len_lfb, buft] = [1, len(lfb), fnamemodify(bufn, ':t')]
|
||||
wh linenr <= len_lfb
|
||||
let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|'
|
||||
let linenr += 1
|
||||
endw
|
||||
cal filter(from_file, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$''')
|
||||
cal extend(lines, from_file)
|
||||
cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
|
||||
endfo
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal s:syntax()
|
||||
en
|
||||
retu lines
|
||||
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)
|
||||
|
||||
83
bundle/git_ctrlp/autoload/ctrlp/mixed.vim
Normal file
83
bundle/git_ctrlp/autoload/ctrlp/mixed.vim
Normal file
@@ -0,0 +1,83 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/mixed.vim
|
||||
" Description: Mixing Files + MRU + Buffers
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0]
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#mixed#init(s:compare_lim)',
|
||||
\ 'accept': 'ctrlp#acceptfile',
|
||||
\ 'lname': 'fil + mru + buf',
|
||||
\ 'sname': 'mix',
|
||||
\ 'type': 'path',
|
||||
\ 'opmul': 1,
|
||||
\ 'specinput': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:newcache(cwd)
|
||||
if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en
|
||||
retu g:ctrlp_allmixes['cwd'] != a:cwd
|
||||
\ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile())
|
||||
\ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile())
|
||||
\ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#bufs())
|
||||
endf
|
||||
|
||||
fu! s:getnewmix(cwd, clim)
|
||||
if g:ctrlp_newmix
|
||||
cal ctrlp#mrufiles#refresh('raw')
|
||||
let g:ctrlp_newcache = 1
|
||||
en
|
||||
let g:ctrlp_lines = copy(ctrlp#files())
|
||||
cal ctrlp#progress('Mixing...')
|
||||
let mrufs = copy(ctrlp#mrufiles#list('raw'))
|
||||
if exists('+ssl') && &ssl
|
||||
cal map(mrufs, 'tr(v:val, "\\", "/")')
|
||||
en
|
||||
let bufs = map(ctrlp#buffers('id'), 'fnamemodify(bufname(v:val), ":p")')
|
||||
let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0')
|
||||
if len(mrufs) > len(g:ctrlp_lines)
|
||||
cal filter(mrufs, 'stridx(v:val, a:cwd)')
|
||||
el
|
||||
let cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)')
|
||||
let cwd_mrufs = ctrlp#rmbasedir(cwd_mrufs)
|
||||
for each in cwd_mrufs
|
||||
let id = index(g:ctrlp_lines, each)
|
||||
if id >= 0 | cal remove(g:ctrlp_lines, id) | en
|
||||
endfo
|
||||
en
|
||||
cal map(mrufs, 'fnamemodify(v:val, ":.")')
|
||||
let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines)
|
||||
\ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines
|
||||
if len(g:ctrlp_lines) <= a:clim
|
||||
cal sort(g:ctrlp_lines, 'ctrlp#complen')
|
||||
en
|
||||
let g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()),
|
||||
\ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd,
|
||||
\ 'bufs': len(ctrlp#mrufiles#bufs()), 'data': g:ctrlp_lines }
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#mixed#init(clim)
|
||||
let cwd = getcwd()
|
||||
if s:newcache(cwd)
|
||||
cal s:getnewmix(cwd, a:clim)
|
||||
el
|
||||
let g:ctrlp_lines = g:ctrlp_allmixes['data']
|
||||
en
|
||||
let g:ctrlp_newmix = 0
|
||||
retu g:ctrlp_lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#mixed#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
@@ -5,120 +5,114 @@
|
||||
" =============================================================================
|
||||
|
||||
" Static variables {{{1
|
||||
let [s:mrbs, s:mrufs] = [[], []]
|
||||
|
||||
fu! ctrlp#mrufiles#opts()
|
||||
let opts = {
|
||||
\ 'g:ctrlp_mruf_max': ['s:max', 250],
|
||||
\ 'g:ctrlp_mruf_include': ['s:in', ''],
|
||||
\ 'g:ctrlp_mruf_exclude': ['s:ex', ''],
|
||||
\ 'g:ctrlp_mruf_case_sensitive': ['s:csen', 1],
|
||||
\ 'g:ctrlp_mruf_relative': ['s:re', 0],
|
||||
\ 'g:ctrlp_mruf_last_entered': ['s:mre', 0],
|
||||
\ }
|
||||
let [pref, opts] = ['g:ctrlp_mruf_', {
|
||||
\ 'max': ['s:max', 250],
|
||||
\ 'include': ['s:in', ''],
|
||||
\ 'exclude': ['s:ex', ''],
|
||||
\ 'case_sensitive': ['s:cseno', 1],
|
||||
\ 'relative': ['s:re', 0],
|
||||
\ }]
|
||||
for [ke, va] in items(opts)
|
||||
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
||||
let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]
|
||||
endfo
|
||||
let [s:csen, s:mrbs] = [s:csen ? '#' : '?', []]
|
||||
if exists('s:locked')
|
||||
cal ctrlp#mrufiles#init()
|
||||
en
|
||||
endf
|
||||
cal ctrlp#mrufiles#opts()
|
||||
" Utilities {{{1
|
||||
fu! s:excl(fn)
|
||||
retu !empty(s:ex) && a:fn =~# s:ex
|
||||
retu !empty({s:ex}) && a:fn =~# {s:ex}
|
||||
endf
|
||||
|
||||
fu! s:readcache()
|
||||
if !exists('s:cadir') || !exists('s:cafile')
|
||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
||||
en
|
||||
retu ctrlp#utils#readfile(s:cafile)
|
||||
fu! s:mergelists()
|
||||
let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile())
|
||||
cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0')
|
||||
let mrufs = s:mrufs + diskmrufs
|
||||
retu s:chop(mrufs)
|
||||
endf
|
||||
|
||||
fu! s:chop(mrufs)
|
||||
if len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en
|
||||
retu a:mrufs
|
||||
endf
|
||||
|
||||
fu! s:reformat(mrufs)
|
||||
if s:re
|
||||
if {s:re}
|
||||
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
|
||||
cal filter(a:mrufs, '!stridx(v:val, cwd)')
|
||||
en
|
||||
retu map(a:mrufs, 'fnamemodify(v:val, '':.'')')
|
||||
retu map(a:mrufs, 'fnamemodify(v:val, ":.")')
|
||||
endf
|
||||
|
||||
fu! s:record(bufnr, ...)
|
||||
fu! s:record(bufnr)
|
||||
if s:locked | retu | en
|
||||
let bufnr = a:bufnr + 0
|
||||
if bufnr <= 0 | retu | en
|
||||
let fn = fnamemodify(bufname(bufnr), ':p')
|
||||
let bufname = bufname(bufnr)
|
||||
if empty(bufname) | retu | en
|
||||
let fn = fnamemodify(bufname, ':p')
|
||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
||||
cal filter(s:mrbs, 'v:val !='.s:csen.' fn')
|
||||
cal insert(s:mrbs, fn)
|
||||
if empty(fn) || !empty(&bt) || ( !empty(s:in) && fn !~# s:in )
|
||||
\ || ( !empty(s:ex) && fn =~# s:ex ) || !filereadable(fn)
|
||||
\ || ( a:0 && a:1 == 1 )
|
||||
retu
|
||||
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
|
||||
en
|
||||
let mrufs = s:readcache()
|
||||
cal filter(mrufs, 'v:val !='.s:csen.' fn')
|
||||
cal insert(mrufs, fn)
|
||||
if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en
|
||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
|
||||
cal insert(s:mrufs, fn)
|
||||
endf
|
||||
|
||||
fu! s:savetofile(mrufs)
|
||||
cal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile)
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#mrufiles#refresh()
|
||||
let mrufs = s:readcache()
|
||||
cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
|
||||
fu! ctrlp#mrufiles#refresh(...)
|
||||
let s:mrufs = s:mergelists()
|
||||
cal filter(s:mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
|
||||
if exists('+ssl')
|
||||
cal map(mrufs, 'tr(v:val, ''/'', ''\'')')
|
||||
cal filter(mrufs, 'count(mrufs, v:val) == 1')
|
||||
cal map(s:mrufs, 'tr(v:val, "/", "\\")')
|
||||
cal filter(s:mrufs, 'count(s:mrufs, v:val) == 1')
|
||||
en
|
||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||
retu s:reformat(mrufs)
|
||||
cal s:savetofile(s:mrufs)
|
||||
retu a:0 && a:1 == 'raw' ? [] : s:reformat(copy(s:mrufs))
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#remove(files)
|
||||
let mrufs = []
|
||||
let s:mrufs = []
|
||||
if a:files != []
|
||||
let mrufs = s:readcache()
|
||||
cal filter(mrufs, 'index(a:files, v:val) < 0')
|
||||
let s:mrufs = s:mergelists()
|
||||
cal filter(s:mrufs, 'index(a:files, v:val, 0, '.(!{s:cseno}).') < 0')
|
||||
en
|
||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||
retu map(mrufs, 'fnamemodify(v:val, '':.'')')
|
||||
cal s:savetofile(s:mrufs)
|
||||
retu s:reformat(copy(s:mrufs))
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#list(...)
|
||||
if a:0 | cal s:record(a:1) | retu | en
|
||||
retu s:reformat(s:readcache())
|
||||
retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists())
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#bufs()
|
||||
retu s:mrbs
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#cachefile()
|
||||
if !exists('s:cadir') || !exists('s:cafile')
|
||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
||||
en
|
||||
retu s:cafile
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#init()
|
||||
if !has('autocmd') | retu | en
|
||||
let s:locked = 0
|
||||
aug CtrlPMRUF
|
||||
au!
|
||||
au BufReadPost,BufNewFile,BufWritePost * cal s:record(expand('<abuf>', 1))
|
||||
au BufAdd,BufEnter,BufLeave,BufUnload * cal s:record(expand('<abuf>', 1))
|
||||
au QuickFixCmdPre *vimgrep* let s:locked = 1
|
||||
au QuickFixCmdPost *vimgrep* let s:locked = 0
|
||||
au VimLeavePre * cal s:savetofile(s:mergelists())
|
||||
aug END
|
||||
aug CtrlPMREB
|
||||
au!
|
||||
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1), 1)
|
||||
aug END
|
||||
if exists('#CtrlPMREF')
|
||||
au! CtrlPMREF
|
||||
en
|
||||
if s:mre
|
||||
aug CtrlPMREF
|
||||
au!
|
||||
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1))
|
||||
aug END
|
||||
if exists('#CtrlPMREB')
|
||||
au! CtrlPMREB
|
||||
en
|
||||
en
|
||||
endf
|
||||
"}}}
|
||||
|
||||
|
||||
@@ -10,17 +10,15 @@ if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
|
||||
en
|
||||
let g:loaded_ctrlp_quickfix = 1
|
||||
|
||||
let s:var_qf = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#quickfix#init()',
|
||||
\ 'accept': 'ctrlp#quickfix#accept',
|
||||
\ 'lname': 'quickfix',
|
||||
\ 'sname': 'qfx',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:var_qf) : [s:var_qf]
|
||||
\ 'nolim': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
@@ -28,20 +26,22 @@ fu! s:lineout(dict)
|
||||
retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'],
|
||||
\ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S'))
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#quickfix#init()
|
||||
let g:ctrlp_nolimit = 1
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
if !hlexists('CtrlPqfLineCol')
|
||||
hi link CtrlPqfLineCol Search
|
||||
en
|
||||
" Utilities {{{1
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPqfLineCol', 'Search')
|
||||
sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|'
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#quickfix#init()
|
||||
cal s:syntax()
|
||||
retu map(getqflist(), 's:lineout(v:val)')
|
||||
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()
|
||||
|
||||
@@ -10,16 +10,14 @@ if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
|
||||
en
|
||||
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
|
||||
|
||||
let s:rtscript_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#rtscript#init()',
|
||||
\ 'accept': 'ctrlp#acceptfile',
|
||||
\ 'lname': 'runtime scripts',
|
||||
\ 'sname': 'rts',
|
||||
\ 'type': 'path',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:rtscript_var) : [s:rtscript_var]
|
||||
\ 'opmul': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Public {{{1
|
||||
|
||||
@@ -10,17 +10,14 @@ if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag
|
||||
en
|
||||
let g:loaded_ctrlp_tag = 1
|
||||
|
||||
let s:tag_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#tag#init()',
|
||||
\ 'accept': 'ctrlp#tag#accept',
|
||||
\ 'lname': 'tags',
|
||||
\ 'sname': 'tag',
|
||||
\ 'enter': 'ctrlp#tag#enter()',
|
||||
\ 'type': 'tabs',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:tag_var) : [s:tag_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
@@ -43,19 +40,27 @@ fu! s:findcount(str)
|
||||
endf
|
||||
|
||||
fu! s:filter(tags)
|
||||
let [nr, alltags] = [0, a:tags]
|
||||
let nr = 0
|
||||
wh 0 < 1
|
||||
if alltags[nr] =~ '^!' && alltags[nr] !~ '^!_TAG_'
|
||||
if a:tags == [] | brea | en
|
||||
if a:tags[nr] =~ '^!' && a:tags[nr] !~ '^!_TAG_'
|
||||
let nr += 1
|
||||
con
|
||||
en
|
||||
if alltags[nr] =~ '^!_TAG_' && len(alltags) > nr
|
||||
cal remove(alltags, nr)
|
||||
if a:tags[nr] =~ '^!_TAG_' && len(a:tags) > nr
|
||||
cal remove(a:tags, nr)
|
||||
el
|
||||
brea
|
||||
en
|
||||
endw
|
||||
retu alltags
|
||||
retu a:tags
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#tag#init()
|
||||
@@ -66,12 +71,7 @@ fu! ctrlp#tag#init()
|
||||
let alltags = s:filter(ctrlp#utils#readfile(each))
|
||||
cal extend(g:ctrlp_alltags, alltags)
|
||||
endfo
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
en
|
||||
cal s:syntax()
|
||||
retu g:ctrlp_alltags
|
||||
endf
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
||||
en
|
||||
let g:loaded_ctrlp_undo = 1
|
||||
|
||||
let s:undo_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#undo#init()',
|
||||
\ 'accept': 'ctrlp#undo#accept',
|
||||
\ 'lname': 'undo',
|
||||
@@ -19,10 +19,8 @@ let s:undo_var = {
|
||||
\ 'exit': 'ctrlp#undo#exit()',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:undo_var) : [s:undo_var]
|
||||
\ 'nolim': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
@@ -82,11 +80,10 @@ fu! s:elapsed(nr)
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if ctrlp#nosy() | retu | en
|
||||
for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String',
|
||||
\ 'Sv': 'Comment', 'Po': 'Title'})
|
||||
if !hlexists('CtrlPUndo'.ke)
|
||||
exe 'hi link CtrlPUndo'.ke va
|
||||
en
|
||||
cal ctrlp#hicheck('CtrlPUndo'.ke, va)
|
||||
endfo
|
||||
sy match CtrlPUndoT '\v\d+ \zs[^ ]+\ze|\d+:\d+:\d+'
|
||||
sy match CtrlPUndoBr '\[\|\]'
|
||||
@@ -115,16 +112,13 @@ endf
|
||||
fu! s:formatul(...)
|
||||
let parts = matchlist(a:1,
|
||||
\ '\v^\s+(\d+)\s+\d+\s+([^ ]+\s?[^ ]+|\d+\s\w+\s\w+)(\s*\d*)$')
|
||||
retu parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
|
||||
retu parts == [] ? '----'
|
||||
\ : parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#undo#init()
|
||||
let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]
|
||||
if empty(entries) | retu [] | en
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal s:syntax()
|
||||
en
|
||||
let g:ctrlp_nolimit = 1
|
||||
if !exists('s:lines')
|
||||
if s:undos[0]
|
||||
let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))
|
||||
@@ -133,6 +127,7 @@ fu! ctrlp#undo#init()
|
||||
let s:lines = map(reverse(entries), 's:formatul(v:val)')
|
||||
en
|
||||
en
|
||||
cal s:syntax()
|
||||
retu s:lines
|
||||
endf
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ endf
|
||||
let s:lash = ctrlp#utils#lash()
|
||||
|
||||
fu! s:lash(...)
|
||||
retu match(a:0 ? a:1 : getcwd(), '[\/]$') < 0 ? s:lash : ''
|
||||
retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#opts()
|
||||
@@ -33,9 +33,9 @@ fu! ctrlp#utils#cachedir()
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#cachefile(...)
|
||||
let tail = a:0 ? '.'.a:1 : ''
|
||||
let cache_file = substitute(getcwd(), '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt'
|
||||
retu a:0 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file
|
||||
let [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()]
|
||||
let cache_file = substitute(dir, '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt'
|
||||
retu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#readfile(file)
|
||||
@@ -60,9 +60,6 @@ endf
|
||||
fu! ctrlp#utils#writecache(lines, ...)
|
||||
if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir))
|
||||
sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile())
|
||||
if !a:0
|
||||
let g:ctrlp_newcache = 0
|
||||
en
|
||||
en
|
||||
endf
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.4
|
||||
*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.7.7
|
||||
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
|
||||
===============================================================================
|
||||
# #
|
||||
@@ -23,17 +23,63 @@ CONTENTS *ctrlp-contents*
|
||||
===============================================================================
|
||||
INTRO *ctrlp-intro*
|
||||
|
||||
Full path fuzzy file, buffer, mru and tag finder with an intuitive interface.
|
||||
Written in pure Vimscript for MacVim and Vim version 7.0+. Has full support for
|
||||
Vim’s |regexp| as search pattern, built-in MRU files monitoring, project’s root
|
||||
finder, and more.
|
||||
Full path fuzzy file, buffer, mru, tag, ... finder with an intuitive interface.
|
||||
Written in pure Vimscript for MacVim, gVim and Vim version 7.0+. Has full
|
||||
support for Vim's |regexp| as search pattern, built-in MRU files monitoring,
|
||||
project's root finder, and more.
|
||||
|
||||
To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|.
|
||||
|
||||
===============================================================================
|
||||
OPTIONS *ctrlp-options*
|
||||
|
||||
Below are the available options and their default values:~
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Detailed descriptions and default values:~
|
||||
|
||||
*'g:ctrlp_map'*
|
||||
Use this option to change the mapping to invoke CtrlP in |Normal| mode: >
|
||||
@@ -58,7 +104,7 @@ default: >
|
||||
Can be toggled on/off by pressing <c-d> inside the prompt.
|
||||
|
||||
*'g:ctrlp_regexp'*
|
||||
Set this to 1 to set |regexp| search as the default: >
|
||||
Set this to 1 to set regexp search as the default: >
|
||||
let g:ctrlp_regexp = 0
|
||||
<
|
||||
Can be toggled on/off by pressing <c-r> inside the prompt.
|
||||
@@ -80,12 +126,12 @@ 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
|
||||
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
|
||||
<
|
||||
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.
|
||||
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.
|
||||
|
||||
*'g:ctrlp_reuse_window'*
|
||||
@@ -94,7 +140,7 @@ plugins, help and quickfix. Use this to setup some exceptions: >
|
||||
let g:ctrlp_reuse_window = 'netrw'
|
||||
<
|
||||
Acceptable values are partial name, filetype or buftype of the special buffers.
|
||||
Use |regexp| to specify the pattern.
|
||||
Use regexp to specify the pattern.
|
||||
Example: >
|
||||
let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
|
||||
<
|
||||
@@ -104,16 +150,16 @@ When starting up, CtrlP sets its local working directory according to this
|
||||
variable: >
|
||||
let g:ctrlp_working_path_mode = 2
|
||||
<
|
||||
1 - the parent directory of the current file.
|
||||
1 - the directory of the current file.
|
||||
2 - the nearest ancestor that contains one of these directories or files:
|
||||
.git/ .hg/ .svn/ .bzr/ _darcs/
|
||||
0 - don’t manage working directory.
|
||||
.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.
|
||||
|
||||
*'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: >
|
||||
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 = ['']
|
||||
<
|
||||
|
||||
@@ -135,91 +181,8 @@ Set the directory to store the cache files: >
|
||||
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
|
||||
<
|
||||
|
||||
*'g:ctrlp_prompt_mappings'*
|
||||
Use this to customize the mappings inside CtrlP’s prompt to your liking. You
|
||||
only need to keep the lines that you’ve changed the values (inside []): >
|
||||
let g:ctrlp_prompt_mappings = {
|
||||
\ 'PrtBS()': ['<bs>', '<c-]>'],
|
||||
\ 'PrtDelete()': ['<del>'],
|
||||
\ 'PrtDeleteWord()': ['<c-w>'],
|
||||
\ 'PrtClear()': ['<c-u>'],
|
||||
\ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
|
||||
\ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
|
||||
\ 'PrtHistory(-1)': ['<c-n>'],
|
||||
\ 'PrtHistory(1)': ['<c-p>'],
|
||||
\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
|
||||
\ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'],
|
||||
\ 'AcceptSelection("t")': ['<c-t>', '<MiddleMouse>'],
|
||||
\ 'AcceptSelection("v")': ['<c-v>', '<RightMouse>'],
|
||||
\ 'ToggleFocus()': ['<s-tab>'],
|
||||
\ 'ToggleRegex()': ['<c-r>'],
|
||||
\ 'ToggleByFname()': ['<c-d>'],
|
||||
\ 'ToggleType(1)': ['<c-f>', '<c-up>'],
|
||||
\ 'ToggleType(-1)': ['<c-b>', '<c-down>'],
|
||||
\ 'PrtExpandDir()': ['<tab>'],
|
||||
\ 'PrtInsert("w")': ['<F2>', '<insert>'],
|
||||
\ 'PrtInsert("s")': ['<F3>'],
|
||||
\ 'PrtInsert("v")': ['<F4>'],
|
||||
\ 'PrtInsert("+")': ['<F6>'],
|
||||
\ 'PrtCurStart()': ['<c-a>'],
|
||||
\ 'PrtCurEnd()': ['<c-e>'],
|
||||
\ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'],
|
||||
\ 'PrtCurRight()': ['<c-l>', '<right>'],
|
||||
\ 'PrtClearCache()': ['<F5>'],
|
||||
\ 'PrtDeleteMRU()': ['<F7>'],
|
||||
\ 'CreateNewFile()': ['<c-y>'],
|
||||
\ 'MarkToOpen()': ['<c-z>'],
|
||||
\ 'OpenMulti()': ['<c-o>'],
|
||||
\ '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
|
||||
default <c-h> mapping: >
|
||||
let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_max'*
|
||||
Specify the number of recently opened files you want CtrlP to remember: >
|
||||
let g:ctrlp_mruf_max = 250
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_exclude'*
|
||||
Files you don’t want CtrlP to remember. Use |regexp| to specify the patterns: >
|
||||
let g:ctrlp_mruf_exclude = ''
|
||||
<
|
||||
Examples: >
|
||||
let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux
|
||||
let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_include'*
|
||||
And if you want CtrlP to only remember some files, specify them here: >
|
||||
let g:ctrlp_mruf_include = ''
|
||||
<
|
||||
Example: >
|
||||
let g:ctrlp_mruf_include = '\.py$\|\.rb$'
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_relative'*
|
||||
Set this to 1 to show only MRU files in the current working directory: >
|
||||
let g:ctrlp_mruf_relative = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_case_sensitive'*
|
||||
Match this with your file system case-sensitivity setting to avoid duplicate
|
||||
MRU entries: >
|
||||
let g:ctrlp_mruf_case_sensitive = 1
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_last_entered'*
|
||||
Set to 1 to sort the MRU file list to most-recently-entered-buffer order: >
|
||||
let g:ctrlp_mruf_last_entered = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_dotfiles'*
|
||||
Set this to 0 if you don’t want CtrlP to scan for dotfiles and dotdirs: >
|
||||
Set this to 0 if you don't want CtrlP to scan for dotfiles and dotdirs: >
|
||||
let g:ctrlp_dotfiles = 1
|
||||
<
|
||||
You can use |'wildignore'| to exclude anything from the search.
|
||||
@@ -237,7 +200,7 @@ tools on Windows). So be a little mindful of what you put in your |wildignore|.
|
||||
|
||||
*'g:ctrlp_custom_ignore'*
|
||||
In addition to |'wildignore'|, use this for files and directories you want only
|
||||
CtrlP to not show. Use |regexp| to specify the patterns: >
|
||||
CtrlP to not show. Use regexp to specify the patterns: >
|
||||
let g:ctrlp_custom_ignore = ''
|
||||
<
|
||||
Examples: >
|
||||
@@ -262,7 +225,7 @@ The maximum depth of a directory tree to recurse into: >
|
||||
Note: the larger these values, the more memory Vim uses.
|
||||
|
||||
*'g:ctrlp_user_command'*
|
||||
Specify an external tool to use for listing files instead of using Vim’s
|
||||
Specify an external tool to use for listing files instead of using Vim's
|
||||
|globpath()|. Use %s in place of the target directory: >
|
||||
let g:ctrlp_user_command = ''
|
||||
<
|
||||
@@ -302,10 +265,10 @@ when searching outside a repo.
|
||||
|
||||
*'g:ctrlp_max_history'*
|
||||
The maximum number of input strings you want CtrlP to remember. The default
|
||||
value mirrors Vim’s global |'history'| option: >
|
||||
value mirrors Vim's global |'history'| option: >
|
||||
let g:ctrlp_max_history = &history
|
||||
<
|
||||
Set to 0 to disable prompt’s history. Browse the history with <c-n> and <c-p>.
|
||||
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
|
||||
@@ -323,16 +286,18 @@ If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
|
||||
let g:ctrlp_open_multiple_files = 'v'
|
||||
<
|
||||
Example: >
|
||||
let g:ctrlp_open_multiple_files = '2vr'
|
||||
let g:ctrlp_open_multiple_files = '2vjr'
|
||||
<
|
||||
For the number:
|
||||
- If given, it’ll be used as the maximum number of windows or tabs to create
|
||||
- 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,
|
||||
@@ -348,37 +313,132 @@ Pressing <c-o> or <c-y> will then prompt for a keypress. The key can be:
|
||||
t - open in tab(s)
|
||||
h - open in horizontal split(s)
|
||||
v - open in vertical split(s)
|
||||
r - open in current window (for <c-y> only)
|
||||
<esc>, <c-c> - cancel and go back to the prompt.
|
||||
Any other key - use the behavior specified with |g:ctrlp_open_new_file| and
|
||||
i - open as hidden buffers (for <c-o> only)
|
||||
c - clear the marked files (for <c-o> only)
|
||||
r - open in the current window (for <c-y> only)
|
||||
<esc>, <c-c>, <c-u> - cancel and go back to the prompt.
|
||||
<cr> - use the default behavior specified with |g:ctrlp_open_new_file| and
|
||||
|g:ctrlp_open_multiple_files|.
|
||||
|
||||
*'g:ctrlp_follow_symlinks'*
|
||||
Set this to 1 to follow symbolic links when listing files: >
|
||||
If non-zero, CtrlP will follow symbolic links when listing files: >
|
||||
let g:ctrlp_follow_symlinks = 0
|
||||
<
|
||||
When enabled, looped internal symlinks will be ignored to avoid duplicates.
|
||||
0 - don't follow symbolic links.
|
||||
1 - follow but ignore looped internal symlinks to avoid duplicates.
|
||||
2 - follow all symlinks indiscriminately.
|
||||
|
||||
*'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: >
|
||||
after typing's been stopped for a certain amount of time: >
|
||||
let g:ctrlp_lazy_update = 0
|
||||
<
|
||||
If is 1, update after 250ms. If bigger than 1, the number will be used as the
|
||||
delay time in milliseconds.
|
||||
|
||||
*'g:ctrlp_default_input'*
|
||||
Set this to 1 to enable seeding the prompt with the current file’s relative
|
||||
Set this to 1 to enable seeding the prompt with the current file's relative
|
||||
path: >
|
||||
let g:ctrlp_default_input = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_use_migemo'*
|
||||
Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
|
||||
works in |regexp| mode. To split the pattern, separate words with space: >
|
||||
works in regexp mode. To split the pattern, separate words with space: >
|
||||
let g:ctrlp_use_migemo = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_prompt_mappings'*
|
||||
Use this to customize the mappings inside CtrlP's prompt to your liking. You
|
||||
only need to keep the lines that you've changed the values (inside []): >
|
||||
let g:ctrlp_prompt_mappings = {
|
||||
\ 'PrtBS()': ['<bs>', '<c-]>'],
|
||||
\ 'PrtDelete()': ['<del>'],
|
||||
\ 'PrtDeleteWord()': ['<c-w>'],
|
||||
\ 'PrtClear()': ['<c-u>'],
|
||||
\ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
|
||||
\ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
|
||||
\ 'PrtSelectMove("t")': ['<Home>', '<kHome>'],
|
||||
\ 'PrtSelectMove("b")': ['<End>', '<kEnd>'],
|
||||
\ 'PrtSelectMove("u")': ['<PageUp>', '<kPageUp>'],
|
||||
\ 'PrtSelectMove("d")': ['<PageDown>', '<kPageDown>'],
|
||||
\ 'PrtHistory(-1)': ['<c-n>'],
|
||||
\ 'PrtHistory(1)': ['<c-p>'],
|
||||
\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
|
||||
\ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'],
|
||||
\ 'AcceptSelection("t")': ['<c-t>'],
|
||||
\ 'AcceptSelection("v")': ['<c-v>', '<RightMouse>'],
|
||||
\ 'ToggleFocus()': ['<s-tab>'],
|
||||
\ 'ToggleRegex()': ['<c-r>'],
|
||||
\ 'ToggleByFname()': ['<c-d>'],
|
||||
\ 'ToggleType(1)': ['<c-f>', '<c-up>'],
|
||||
\ 'ToggleType(-1)': ['<c-b>', '<c-down>'],
|
||||
\ 'PrtExpandDir()': ['<tab>'],
|
||||
\ 'PrtInsert("c")': ['<MiddleMouse>', '<insert>'],
|
||||
\ 'PrtInsert()': ['<c-\>'],
|
||||
\ 'PrtCurStart()': ['<c-a>'],
|
||||
\ 'PrtCurEnd()': ['<c-e>'],
|
||||
\ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'],
|
||||
\ 'PrtCurRight()': ['<c-l>', '<right>'],
|
||||
\ 'PrtClearCache()': ['<F5>'],
|
||||
\ 'PrtDeleteEnt()': ['<F7>'],
|
||||
\ 'CreateNewFile()': ['<c-y>'],
|
||||
\ 'MarkToOpen()': ['<c-z>'],
|
||||
\ 'OpenMulti()': ['<c-o>'],
|
||||
\ '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
|
||||
default <c-h> mapping: >
|
||||
let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
|
||||
<
|
||||
|
||||
----------------------------------------
|
||||
MRU mode options:~
|
||||
|
||||
*'g:ctrlp_mruf_max'*
|
||||
Specify the number of recently opened files you want CtrlP to remember: >
|
||||
let g:ctrlp_mruf_max = 250
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_exclude'*
|
||||
Files you don't want CtrlP to remember. Use regexp to specify the patterns: >
|
||||
let g:ctrlp_mruf_exclude = ''
|
||||
<
|
||||
Examples: >
|
||||
let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux
|
||||
let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_include'*
|
||||
And if you want CtrlP to only remember some files, specify them here: >
|
||||
let g:ctrlp_mruf_include = ''
|
||||
<
|
||||
Example: >
|
||||
let g:ctrlp_mruf_include = '\.py$\|\.rb$'
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_relative'*
|
||||
Set this to 1 to show only MRU files in the current working directory: >
|
||||
let g:ctrlp_mruf_relative = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_default_order'*
|
||||
Set this to 1 to disable sorting when searching in MRU mode: >
|
||||
let g:ctrlp_mruf_default_order = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_case_sensitive'*
|
||||
Match this with your file system case-sensitivity setting to avoid duplicate
|
||||
MRU entries: >
|
||||
let g:ctrlp_mruf_case_sensitive = 1
|
||||
<
|
||||
|
||||
----------------------------------------
|
||||
Advanced options:~
|
||||
|
||||
*'g:ctrlp_status_func'*
|
||||
Use this to customize the statuslines for the CtrlP window: >
|
||||
let g:ctrlp_status_func = {}
|
||||
@@ -407,7 +467,7 @@ Structure of the functions: >
|
||||
" +- a:next : The next search mode.
|
||||
" |
|
||||
" +- a:marked : The number of marked files, or a comma separated list of
|
||||
" the filenames.
|
||||
" the marked filenames.
|
||||
|
||||
return full_statusline
|
||||
endfunction
|
||||
@@ -422,6 +482,18 @@ Structure of the functions: >
|
||||
<
|
||||
See https://gist.github.com/1610859 for a working example.
|
||||
|
||||
*'g:ctrlp_buffer_func'*
|
||||
Specify the functions that will be called after entering and before exiting the
|
||||
CtrlP buffer: >
|
||||
let g:ctrlp_buffer_func = {}
|
||||
<
|
||||
Example: >
|
||||
let g:ctrlp_buffer_func = {
|
||||
\ 'enter': 'Function_Name_1',
|
||||
\ 'exit': 'Function_Name_2',
|
||||
\ }
|
||||
<
|
||||
|
||||
*'g:ctrlp_match_func'*
|
||||
Set an external fuzzy matching function for CtrlP to use: >
|
||||
let g:ctrlp_match_func = {}
|
||||
@@ -446,8 +518,8 @@ Structure of the function: >
|
||||
" | + "first-non-tab": match until the first tab char.
|
||||
" | + "until-last-tab": match until the last tab char.
|
||||
" |
|
||||
" +- a:ispath : Is 1 when searching in file, buffer, mru, dir, and rtscript
|
||||
" | modes. Is 0 otherwise.
|
||||
" +- a:ispath : Is 1 when searching in file, buffer, mru, mixed, dir, and
|
||||
" | rtscript modes. Is 0 otherwise.
|
||||
" |
|
||||
" +- a:crfile : The file in the current window. Should be excluded from the
|
||||
" | results when a:ispath == 1.
|
||||
@@ -467,6 +539,7 @@ COMMANDS *ctrlp-commands*
|
||||
|
||||
If no argument is given, the value of |g:ctrlp_working_path_mode| will be
|
||||
used to determine the starting directory.
|
||||
|
||||
You can use <tab> to auto-complete the [starting-directory] when typing it.
|
||||
|
||||
*:CtrlPBuffer*
|
||||
@@ -477,31 +550,27 @@ COMMANDS *ctrlp-commands*
|
||||
:CtrlPMRU
|
||||
Open CtrlP in find Most-Recently-Used file mode.
|
||||
|
||||
*:CtrlPLastMode*
|
||||
:CtrlPLastMode
|
||||
Open CtrlP in the last mode used.
|
||||
|
||||
*:CtrlPRoot*
|
||||
:CtrlPRoot
|
||||
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 2 (ignores the
|
||||
variable's current value).
|
||||
|
||||
*:CtrlPClearCache*
|
||||
:CtrlPClearCache
|
||||
Flush the cache for the current working directory. The same as pressing <F5>
|
||||
inside CtrlP.
|
||||
You can enable/disable caching with the |g:ctrlp_use_caching| option.
|
||||
To enable or disable caching, use the |g:ctrlp_use_caching| option.
|
||||
|
||||
*:CtrlPClearAllCaches*
|
||||
:CtrlPClearAllCaches
|
||||
Delete all the cache files saved in |g:ctrlp_cache_dir|.
|
||||
|
||||
*:CtrlPReload*
|
||||
:CtrlPReload
|
||||
Load new values for the option variables.
|
||||
Delete all the cache files saved in |g:ctrlp_cache_dir| location.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The following commands ignore the current value of |g:ctrlp_working_path_mode|:
|
||||
|
||||
:CtrlPCurWD *:CtrlPCurWD*
|
||||
This acts like |:CtrlP| with |path_mode| = 0
|
||||
|
||||
:CtrlPCurFile *:CtrlPCurFile*
|
||||
This acts like |:CtrlP| with |path_mode| = 1
|
||||
|
||||
:CtrlPRoot *:CtrlPRoot*
|
||||
This acts like |:CtrlP| with |path_mode| = 2
|
||||
For commands provided by bundled extensions, see |ctrlp-extensions|.
|
||||
|
||||
===============================================================================
|
||||
MAPPINGS *ctrlp-mappings*
|
||||
@@ -510,17 +579,18 @@ MAPPINGS *ctrlp-mappings*
|
||||
<c-p>
|
||||
Default |Normal| mode mapping to open the CtrlP prompt in find file mode.
|
||||
|
||||
----------------------------------------
|
||||
Once inside the prompt:~
|
||||
|
||||
<c-d>
|
||||
Toggle between full-path search and filename only search.
|
||||
Note: in filename mode, the prompt’s base is '>d>' instead of '>>>'
|
||||
Note: in filename mode, the prompt's base is '>d>' instead of '>>>'
|
||||
|
||||
<c-r> *'ctrlp-fullregexp'*
|
||||
Toggle between the string mode and full |regexp| mode.
|
||||
Note: in full |regexp| mode, the prompt’s base is 'r>>' instead of '>>>'
|
||||
Toggle between the string mode and full regexp mode.
|
||||
Note: in full regexp mode, the prompt's base is 'r>>' instead of '>>>'
|
||||
|
||||
See also |input-formats| (guide) and |g:ctrlp_regexp_search| (option).
|
||||
See also: |input-formats| (guide) and |g:ctrlp_regexp_search| (option).
|
||||
|
||||
<c-f>, 'forward'
|
||||
<c-up>
|
||||
@@ -530,13 +600,19 @@ Once inside the prompt:~
|
||||
<c-down>
|
||||
Scroll to the 'previous' search mode in the sequence.
|
||||
|
||||
<tab>
|
||||
<tab> *'ctrlp-autocompletion'*
|
||||
Auto-complete directory names under the current working directory inside
|
||||
the prompt.
|
||||
|
||||
<s-tab>
|
||||
Toggle the focus between the match window and the prompt.
|
||||
|
||||
<esc>,
|
||||
<c-c>
|
||||
Exit CtrlP.
|
||||
|
||||
Moving:~
|
||||
|
||||
<c-j>,
|
||||
<down>
|
||||
Move selection down.
|
||||
@@ -560,6 +636,8 @@ Once inside the prompt:~
|
||||
<right>
|
||||
Move the cursor one character to the 'right'.
|
||||
|
||||
Editing:~
|
||||
|
||||
<c-]>,
|
||||
<bs>
|
||||
Delete the preceding character.
|
||||
@@ -573,55 +651,66 @@ Once inside the prompt:~
|
||||
<c-u>
|
||||
Clear the input field.
|
||||
|
||||
Browsing input history:~
|
||||
|
||||
<c-n>
|
||||
Next string in the prompt's history.
|
||||
|
||||
<c-p>
|
||||
Previous string in the prompt's history.
|
||||
|
||||
Opening/Creating a file:~
|
||||
|
||||
<cr>
|
||||
Open selected file in the active window if possible.
|
||||
Open the selected file in the 'current' window if possible.
|
||||
|
||||
<c-t>
|
||||
Open selected file in a new 'tab' after the last tabpage.
|
||||
Open the selected file in a new 'tab' after the last tabpage.
|
||||
|
||||
<c-v>
|
||||
Open selected file in a 'vertical' split.
|
||||
Open the selected file in a 'vertical' split.
|
||||
|
||||
<c-x>,
|
||||
<c-cr>,
|
||||
<c-s>
|
||||
Open selected file in a 'horizontal' split.
|
||||
Open the selected file in a 'horizontal' split.
|
||||
|
||||
<c-y>
|
||||
Create a new file and its parent directories.
|
||||
|
||||
<c-n>
|
||||
Next string in the prompt’s history.
|
||||
|
||||
<c-p>
|
||||
Previous string in the prompt’s history.
|
||||
Opening multiple files:~
|
||||
|
||||
<c-z>
|
||||
- Mark/unmark a file to be opened with <c-o>.
|
||||
- Or mark/unmark a file to create a new file in its directory using <c-y>.
|
||||
- Mark/unmark a file to create a new file in its directory using <c-y>.
|
||||
|
||||
<c-o>
|
||||
Open files marked by <c-z>.
|
||||
|
||||
Function keys:~
|
||||
|
||||
<F5>
|
||||
- Refresh the match window and purge the cache for the current directory.
|
||||
- Or remove deleted files from the MRU list.
|
||||
- Remove deleted files from the MRU list.
|
||||
|
||||
<F7>
|
||||
- Wipe the MRU list.
|
||||
- Or delete MRU entries marked by <c-z>.
|
||||
- Delete MRU entries marked by <c-z>.
|
||||
|
||||
<insert>
|
||||
Insert the word under the cursor (in the current buffer) into the prompt.
|
||||
Pasting:~
|
||||
|
||||
<esc>,
|
||||
<c-c>,
|
||||
<c-g>
|
||||
Exit CtrlP.
|
||||
Note: <c-c> can also be used to stop the scan if it’s taking too long.
|
||||
<Insert>, *'ctrlp-pasting'*
|
||||
<MiddleMouse>
|
||||
Paste the clipboard content into the prompt.
|
||||
|
||||
<c-\>
|
||||
Open a text dialog to paste <cword>, <cfile>, the content of the search
|
||||
register, the last visual selection, the clipboard or any register into the
|
||||
prompt.
|
||||
|
||||
Choose your own mappings with |g:ctrlp_prompt_mappings|.
|
||||
|
||||
----------------------------------------
|
||||
When inside the match window (press <s-tab> to switch):~
|
||||
|
||||
a-z
|
||||
@@ -639,61 +728,78 @@ a) Simple string.
|
||||
|
||||
E.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c'
|
||||
|
||||
b) Vim |regexp|. If the input string contains '*' or '|', it’ll be treated as
|
||||
a Vim’s |regexp| |pattern| without any modification.
|
||||
b) When in regexp mode, the input string's treated as a Vim's regexp |pattern|
|
||||
without any modification.
|
||||
|
||||
E.g. 'abc\d*efg' will be read as 'abc\d*efg'.
|
||||
|
||||
See also |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option).
|
||||
See |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option) for
|
||||
how to enable regexp mode.
|
||||
|
||||
c) End the string with a colon ':' followed by a Vim command to execute that
|
||||
command after opening the file. If you need to use ':' literally, escape it
|
||||
with a backslash: '\:'. When opening multiple files, the command will be
|
||||
executed on each opening file.
|
||||
|
||||
E.g. 'abc:45' will open the selected file and jump to line 45.
|
||||
E.g. Use ':45' to jump to line 45.
|
||||
|
||||
'abc:/any\:string' will open the selected file and jump to the first
|
||||
instance of 'any:string'.
|
||||
Use ':/any\:string' to jump to the first instance of 'any:string'.
|
||||
|
||||
'abc:+setf\ myfiletype|50' will open the selected file and set its
|
||||
filetype to 'myfiletype', then jump to line 50.
|
||||
Use ':+setf\ myfiletype|50' to set the filetype to 'myfiletype', then
|
||||
jump to line 50.
|
||||
|
||||
'abc:diffthis' will open the selected files and run |:diffthis| on the
|
||||
first 4 files (if marked).
|
||||
Use ':diffthis' when opening multiple files to run |:diffthis| on the
|
||||
first 4 files.
|
||||
|
||||
See also Vim’s |++opt| and |+cmd|.
|
||||
See also: Vim's |++opt| and |+cmd|.
|
||||
|
||||
d) Type exactly two dots '..' at the start of the prompt and press enter to go
|
||||
backward in the directory tree by 1 level. If the parent directory is
|
||||
large, this might be slow.
|
||||
d) Submit two dots '..' to go upward the directory tree by 1 level. To go up
|
||||
multiple levels, use one extra dot for each extra level:
|
||||
>
|
||||
Raw input Interpreted as
|
||||
.. ../
|
||||
... ../../
|
||||
.... ../../../
|
||||
<
|
||||
Note: if the parent directories are large and uncached, this can be slow.
|
||||
|
||||
e) Similarly, submit '/' or '\' to find and go to the project’s root. If the
|
||||
project is large, using a VCS listing command to look for files might help
|
||||
speeding up the intial scan (see |g:ctrlp_user_command| for more details).
|
||||
You can also use '@cd path/' to change CtrlP's local working directory.
|
||||
Use '@cd %:h' to change to the directory of the current file.
|
||||
|
||||
e) Similarly, submit '/' or '\' to find and go to the project's root.
|
||||
|
||||
If the project is large, using a VCS listing command to look for files
|
||||
might help speeding up the intial scan (see |g:ctrlp_user_command| for more
|
||||
details).
|
||||
|
||||
Note: d) and e) only work in file, directory and mixed modes.
|
||||
|
||||
f) Type the name of a non-existent file and press <c-y> to create it. Mark a
|
||||
file with <c-z> to create the new file in the same directory as the marked
|
||||
file.
|
||||
|
||||
E.g. 'parentdir/newfile.txt' will create a directory named 'parentdir' as
|
||||
well as 'newfile.txt'.
|
||||
E.g. Using 'newdir/newfile.txt' will create a directory named 'newdir' as
|
||||
well as a file named 'newfile.txt'.
|
||||
|
||||
If 'some/old/dirs/oldfile.txt' is marked with <c-z>, then 'parentdir'
|
||||
and 'newfile.txt' will be created in 'some/old/dirs'. The final path
|
||||
will then be 'some/old/dirs/parentdir/newfile.txt'.
|
||||
If an entry 'some/old/dirs/oldfile.txt' is marked with <c-z>, then
|
||||
'newdir' and 'newfile.txt' will be created under 'some/old/dirs'. The
|
||||
final path will then be 'some/old/dirs/newdir/newfile.txt'.
|
||||
|
||||
Use '\' in place of '/' on Windows (if |'ssl'| is not set).
|
||||
Note: use '\' in place of '/' on Windows (if |'shellslash'| is not set).
|
||||
|
||||
g) Submit ? to open this help file.
|
||||
g) In filename mode (toggle with <c-d>), you can use one primary pattern and
|
||||
one refining pattern separated by a semicolon. Both patterns work like (a),
|
||||
or (b) when in regexp mode.
|
||||
|
||||
h) Submit ? to open this help file.
|
||||
|
||||
===============================================================================
|
||||
EXTENSIONS *g:ctrlp-extensions*
|
||||
EXTENSIONS *ctrlp-extensions*
|
||||
|
||||
Extensions are optional. To enable an extension, add its name to the variable
|
||||
g:ctrlp_extensions: >
|
||||
let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript',
|
||||
\ 'undo', 'line', 'changes']
|
||||
\ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir']
|
||||
<
|
||||
The order of the items will be the order they appear on the statusline and when
|
||||
using <c-f>, <c-b>.
|
||||
@@ -705,7 +811,7 @@ Available extensions:~
|
||||
- Name: 'tag'
|
||||
- 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
|
||||
definition. Use the Vim's option |'tags'| to specify the names and the
|
||||
locations of the tags file(s).
|
||||
E.g. set tags+=doc/tags
|
||||
|
||||
@@ -713,7 +819,7 @@ Available extensions:~
|
||||
*:CtrlPBufTagAll*
|
||||
* Buffer Tag mode:~
|
||||
- Name: 'buffertag'
|
||||
- Commands: ':CtrlPBufTag [buffer-name]',
|
||||
- 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.
|
||||
@@ -733,7 +839,7 @@ Available extensions:~
|
||||
+ <cr> change the local working directory for CtrlP and keep it open.
|
||||
+ <c-t> change the global working directory (exit).
|
||||
+ <c-v> change the local working directory for the current window (exit).
|
||||
+ <c-x> change the global working directory to CtrlP’s current local
|
||||
+ <c-x> change the global working directory to CtrlP's current local
|
||||
working directory (exit).
|
||||
|
||||
*:CtrlPRTS*
|
||||
@@ -758,21 +864,43 @@ Available extensions:~
|
||||
*:CtrlPChangeAll*
|
||||
* Change list mode:~
|
||||
- Name: 'changes'
|
||||
- Commands: ':CtrlPChange [buffer-name]',
|
||||
- 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'
|
||||
- Search in files, buffers and MRU files at the same time.
|
||||
|
||||
*:CtrlPBookmarkDir*
|
||||
*:CtrlPBookmarkDirAdd*
|
||||
* BookmarkDir mode:~
|
||||
- Name: 'bookmarkdir'
|
||||
- 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
|
||||
switch to find file mode.
|
||||
+ <c-x> change the global working directory (exit).
|
||||
+ <c-v> change the local working directory for the current window (exit).
|
||||
+ <F7>
|
||||
- Wipe bookmark list.
|
||||
- Delete entries marked by <c-z>.
|
||||
|
||||
----------------------------------------
|
||||
Buffer Tag mode options:~
|
||||
|
||||
*'g:ctrlp_buftag_ctags_bin'*
|
||||
If ctags isn’t in your $PATH, use this to set its location: >
|
||||
If ctags isn't in your $PATH, use this to set its location: >
|
||||
let g:ctrlp_buftag_ctags_bin = ''
|
||||
<
|
||||
|
||||
*'g:ctrlp_buftag_systemenc'*
|
||||
Match this with your OS’s encoding (not Vim’s). The default value mirrors Vim’s
|
||||
Match this with your OS's encoding (not Vim's). The default value mirrors Vim's
|
||||
global |'encoding'| option: >
|
||||
let g:ctrlp_buftag_systemenc = &encoding
|
||||
<
|
||||
@@ -799,12 +927,12 @@ Highlighting:~
|
||||
CtrlPNoEntries : the message when no match is found (Error)
|
||||
CtrlPMatch : the matched pattern (Identifier)
|
||||
CtrlPLinePre : the line prefix '>' in the match window
|
||||
CtrlPPrtBase : the prompt’s base (Comment)
|
||||
CtrlPPrtText : the prompt’s text (|hl-Normal|)
|
||||
CtrlPPrtCursor : the prompt’s cursor when moving over the text (Constant)
|
||||
CtrlPPrtBase : the prompt's base (Comment)
|
||||
CtrlPPrtText : the prompt's text (|hl-Normal|)
|
||||
CtrlPPrtCursor : the prompt's cursor when moving over the text (Constant)
|
||||
|
||||
* In extensions:
|
||||
CtrlPTabExtra : the part of each line that’s not matched against (Comment)
|
||||
CtrlPTabExtra : the part of each line that's not matched against (Comment)
|
||||
CtrlPBufName : the buffer name an entry belongs to (|hl-Directory|)
|
||||
CtrlPTagKind : the kind of the tag in buffer-tag mode (|hl-Title|)
|
||||
CtrlPqfLineCol : the line and column numbers in quickfix mode (Comment)
|
||||
@@ -813,6 +941,7 @@ Highlighting:~
|
||||
CtrlPUndoNr : the undo number inside [] in undo mode (String)
|
||||
CtrlPUndoSv : the point where the file was saved (Comment)
|
||||
CtrlPUndoPo : the current position in the undo tree (|hl-Title|)
|
||||
CtrlPBookmark : the name of the bookmark (Identifier)
|
||||
|
||||
Statuslines:~
|
||||
* Highlight groups:
|
||||
@@ -825,7 +954,7 @@ Statuslines:~
|
||||
===============================================================================
|
||||
MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
|
||||
|
||||
* Use |wildignore| for |g:ctrlp_user_command|:
|
||||
* Using |wildignore| for |g:ctrlp_user_command|:
|
||||
>
|
||||
function! s:wig2cmd()
|
||||
" Change wildignore into space or | separated groups
|
||||
@@ -847,12 +976,12 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
|
||||
<
|
||||
(submitted by Rich Alesi <github.com/ralesi>)
|
||||
|
||||
* A standalone function to set the working directory to the project’s root, or
|
||||
to the parent directory of the current file if a root can’t be found:
|
||||
* A standalone function to set the working directory to the project's root, or
|
||||
to the parent directory of the current file if a root can't be found:
|
||||
>
|
||||
function! s:setcwd()
|
||||
let cph = expand('%:p:h', 1)
|
||||
if match(cph, '\v^<.+>://') >= 0 | retu | en
|
||||
if cph =~ '^.\+://' | retu | en
|
||||
for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects']
|
||||
let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';'])
|
||||
if wd != '' | let &acd = 0 | brea | en
|
||||
@@ -864,12 +993,17 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
|
||||
<
|
||||
(requires Vim 7.1.299+)
|
||||
|
||||
* Using a |count| to invoke different commands using the same mapping:
|
||||
>
|
||||
let g:ctrlp_cmd = 'exe "CtrlP".get(["", "Buffer", "MRU"], v:count)'
|
||||
<
|
||||
|
||||
===============================================================================
|
||||
CREDITS *ctrlp-credits*
|
||||
|
||||
Developed by Kien Nguyen <github.com/kien>.
|
||||
|
||||
Project’s homepage: http://kien.github.com/ctrlp.vim
|
||||
Project's homepage: http://kien.github.com/ctrlp.vim
|
||||
Git repository: https://github.com/kien/ctrlp.vim
|
||||
Mercurial repository: https://bitbucket.org/kien/ctrlp.vim
|
||||
|
||||
@@ -891,13 +1025,37 @@ Special thanks:~
|
||||
* Kent Sibilev <github.com/datanoise>
|
||||
* Tacahiroy <github.com/tacahiroy>
|
||||
* Luca Pette <github.com/lucapette>
|
||||
* Seth Fowler <github.com/sfowler>
|
||||
* Lowe Thiderman <github.com/daethorian>
|
||||
|
||||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
Before 2012/06/15~
|
||||
|
||||
+ New value for |g:ctrlp_follow_symlinks|: 2.
|
||||
+ New value for |g:ctrlp_open_multiple_files|: 'j'.
|
||||
+ Allow using <c-t>, <c-x>, <c-v> to open files marked by <c-z>.
|
||||
+ Extend '..' (|ctrlp-input-formats| (d))
|
||||
+ New input format: '@cd' (|ctrlp-input-formats| (d))
|
||||
|
||||
Before 2012/04/30~
|
||||
|
||||
+ New option: |g:ctrlp_mruf_default_order|
|
||||
+ New feature: Bookmarked directories extension.
|
||||
+ New commands: |:CtrlPBookmarkDir|
|
||||
|:CtrlPBookmarkDirAdd|
|
||||
|
||||
Before 2012/04/15~
|
||||
|
||||
+ New option: |g:ctrlp_buffer_func|, callback functions for CtrlP buffer.
|
||||
+ Remove: g:ctrlp_mruf_last_entered, make it a default for MRU mode.
|
||||
+ New commands: |:CtrlPLastMode|, open CtrlP in the last mode used.
|
||||
|:CtrlPMixed|, search in files, buffers and MRU files.
|
||||
|
||||
Before 2012/03/31~
|
||||
|
||||
+ New option: |g:ctrlp_default_input|, default input when entering CtrlP.
|
||||
+ New options: |g:ctrlp_default_input|, default input when entering CtrlP.
|
||||
|g:ctrlp_match_func|, allow using a custom fuzzy matcher.
|
||||
+ Rename:
|
||||
*ClearCtrlPCache* -> |CtrlPClearCache|
|
||||
@@ -959,7 +1117,7 @@ Before 2011/10/30~
|
||||
Before 2011/10/12~
|
||||
|
||||
+ New features: Open multiple files.
|
||||
Pass Vim’s |++opt| and |+cmd| to the opening file
|
||||
Pass Vim's |++opt| and |+cmd| to the opening file
|
||||
(|ctrlp-input-formats| (c))
|
||||
Auto-complete each dir for |:CtrlP| [starting-directory]
|
||||
+ New mappings: <c-z> mark/unmark a file to be opened with <c-o>.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
" =============================================================================
|
||||
" File: plugin/ctrlp.vim
|
||||
" Description: Fuzzy file, buffer, mru and tag finder.
|
||||
" Description: Fuzzy file, buffer, mru, tag, etc finder.
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
" GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip
|
||||
@@ -11,7 +11,8 @@ en
|
||||
let g:loaded_ctrlp = 1
|
||||
|
||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
||||
\ g:ctrlp_buftags, g:ctrlp_builtins] = [[], [], [], [], {}, 2]
|
||||
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
|
||||
\ = [[], [], [], [], {}, {}, [], 2]
|
||||
|
||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
||||
@@ -21,6 +22,8 @@ com! -n=? -com=dir CtrlP cal ctrlp#init(0, <q-args>)
|
||||
com! CtrlPBuffer cal ctrlp#init(1)
|
||||
com! CtrlPMRUFiles cal ctrlp#init(2)
|
||||
|
||||
com! CtrlPLastMode cal ctrlp#init(-1)
|
||||
|
||||
com! CtrlPClearCache cal ctrlp#clr()
|
||||
com! CtrlPClearAllCaches cal ctrlp#clra()
|
||||
com! CtrlPReload cal ctrlp#reset()
|
||||
@@ -40,21 +43,19 @@ 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! -n=? -com=dir CtrlPDir
|
||||
\ cal ctrlp#init(ctrlp#dir#id(), <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! -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
|
||||
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
|
||||
|
||||
@@ -1,56 +1,69 @@
|
||||
# ctrlp.vim
|
||||
Full path fuzzy __file__, __buffer__, __mru__ and __tag__ finder for Vim.
|
||||
Fuzzy __file__, __buffer__, __mru__, __tag__, ... finder for Vim.
|
||||
|
||||
* Written in pure Vimscript for MacVim and Vim 7.0+.
|
||||
* Full support for Vim’s regexp as search pattern.
|
||||
* Written in pure Vimscript for MacVim, gVim and Vim 7.0+.
|
||||
* Full support for Vim's regexp as search patterns.
|
||||
* Built-in Most Recently Used (MRU) files monitoring.
|
||||
* Built-in project’s root finder.
|
||||
* Open Multiple Files.
|
||||
* [Extensible][3].
|
||||
* Built-in project's root finder.
|
||||
* Open multiple files at once.
|
||||
* Create new files and directories.
|
||||
* [Extensible][2].
|
||||
|
||||
![ctrlp][1]
|
||||
|
||||
## Basic Usage
|
||||
* Press `<c-p>` or run `:CtrlP` to invoke CtrlP in find file mode.
|
||||
* Or run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in buffer or MRU mode.
|
||||
## Installation
|
||||
1. Clone the plugin into a separate directory:
|
||||
|
||||
Once CtrlP is open:
|
||||
|
||||
* Press `<c-f>` and `<c-b>` to switch between find file, buffer, and MRU file
|
||||
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.
|
||||
* Use `*` or `|` in the prompt to submit the string as a Vim’s regexp pattern.
|
||||
* Or press `<c-r>` to switch to regexp mode.
|
||||
* End the input string with a colon `:` followed by a command to execute after
|
||||
opening the file.
|
||||
e.g. `abc:45` will open the file matched the pattern and jump to line 45.
|
||||
* Submit two dots `..` as the input string to go backward the directory tree by
|
||||
1 level.
|
||||
* Use `<c-y>` to create a new file and its parent dirs.
|
||||
* Use `<c-z>` to mark/unmark files and `<c-o>` to open them.
|
||||
|
||||
## Basic Options
|
||||
* Change the mapping to invoke CtrlP:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_map = '<c-p>'
|
||||
```
|
||||
$ cd ~/.vim
|
||||
$ git clone https://github.com/kien/ctrlp.vim.git bundle/ctrlp.vim
|
||||
```
|
||||
|
||||
* When CtrlP is invoked, it automatically sets its local working directory
|
||||
according to this variable:
|
||||
2. Add to your `~/.vimrc`:
|
||||
|
||||
```vim
|
||||
set runtimepath^=~/.vim/bundle/ctrlp.vim
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_working_path_mode = 2
|
||||
```
|
||||
|
||||
0 - don’t manage working directory.
|
||||
1 - the parent directory of the current file.
|
||||
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/`
|
||||
`.git` `.hg` `.svn` `.bzr` `_darcs`
|
||||
|
||||
* If you want to exclude directories or files from the search, use the Vim’s
|
||||
option `wildignore` and/or the option `g:ctrlp_custom_ignore`. Examples:
|
||||
Define additional root markers with the `g:ctrlp_root_markers` option.
|
||||
|
||||
* Exclude files and directories:
|
||||
|
||||
```vim
|
||||
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
|
||||
@@ -64,15 +77,14 @@ option `wildignore` and/or the option `g:ctrlp_custom_ignore`. Examples:
|
||||
\ }
|
||||
```
|
||||
|
||||
* Use a custom file listing command with:
|
||||
* Use a custom file listing command:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
|
||||
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
|
||||
```
|
||||
|
||||
_Check [the docs][2] for more mappings, commands and options._
|
||||
More at `:help ctrlp-options`.
|
||||
|
||||
[1]: http://i.imgur.com/yIynr.png
|
||||
[2]: https://github.com/kien/ctrlp.vim/blob/master/doc/ctrlp.txt
|
||||
[3]: https://github.com/kien/ctrlp.vim/tree/extensions
|
||||
[2]: https://github.com/kien/ctrlp.vim/tree/extensions
|
||||
|
||||
@@ -128,7 +128,7 @@ function! syntastic#c#SearchHeaders()
|
||||
" search included headers
|
||||
for hfile in files
|
||||
if hfile != ''
|
||||
let filename = expand('%:p:h') . ((has('win32') || has('win64')) ?
|
||||
let filename = expand('%:p:h') . (has('win32') ?
|
||||
\ '\' : '/') . hfile
|
||||
try
|
||||
let lines = readfile(filename, '', 100)
|
||||
|
||||
@@ -17,7 +17,7 @@ if exists("g:loaded_syntastic_plugin")
|
||||
endif
|
||||
let g:loaded_syntastic_plugin = 1
|
||||
|
||||
let s:running_windows = has("win16") || has("win32") || has("win64")
|
||||
let s:running_windows = has("win16") || has("win32")
|
||||
|
||||
if !s:running_windows
|
||||
let s:uname = system('uname')
|
||||
@@ -185,6 +185,8 @@ function! s:CacheErrors()
|
||||
for ft in split(fts, '\.')
|
||||
if s:Checkable(ft)
|
||||
let errors = SyntaxCheckers_{ft}_GetLocList()
|
||||
"keep only lines that effectively match an error/warning
|
||||
let errors = s:FilterLocList({'valid': 1}, errors)
|
||||
"make errors have type "E" by default
|
||||
call SyntasticAddToErrors(errors, {'type': 'E'})
|
||||
call extend(s:LocList(), errors)
|
||||
@@ -529,10 +531,10 @@ endfunction
|
||||
" 'subtype' - all errors will be assigned the given subtype
|
||||
function! SyntasticMake(options)
|
||||
let old_loclist = getloclist(0)
|
||||
let old_makeprg = &makeprg
|
||||
let old_makeprg = &l:makeprg
|
||||
let old_shellpipe = &shellpipe
|
||||
let old_shell = &shell
|
||||
let old_errorformat = &errorformat
|
||||
let old_errorformat = &l:errorformat
|
||||
|
||||
if !s:running_windows && (s:uname !~ "FreeBSD")
|
||||
"this is a hack to stop the screen needing to be ':redraw'n when
|
||||
@@ -542,19 +544,19 @@ function! SyntasticMake(options)
|
||||
endif
|
||||
|
||||
if has_key(a:options, 'makeprg')
|
||||
let &makeprg = a:options['makeprg']
|
||||
let &l:makeprg = a:options['makeprg']
|
||||
endif
|
||||
|
||||
if has_key(a:options, 'errorformat')
|
||||
let &errorformat = a:options['errorformat']
|
||||
let &l:errorformat = a:options['errorformat']
|
||||
endif
|
||||
|
||||
silent lmake!
|
||||
let errors = getloclist(0)
|
||||
|
||||
call setloclist(0, old_loclist)
|
||||
let &makeprg = old_makeprg
|
||||
let &errorformat = old_errorformat
|
||||
let &l:makeprg = old_makeprg
|
||||
let &l:errorformat = old_errorformat
|
||||
let &shellpipe=old_shellpipe
|
||||
let &shell=old_shell
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ function! SyntaxCheckers_c_GetLocList()
|
||||
endif
|
||||
|
||||
" add optional config file parameters
|
||||
let makeprg .= syntastic#c#ReadConfig(g:syntastic_c_config_file)
|
||||
let makeprg .= ' '.syntastic#c#ReadConfig(g:syntastic_c_config_file)
|
||||
|
||||
" process makeprg
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg,
|
||||
|
||||
@@ -113,7 +113,7 @@ function! SyntaxCheckers_cpp_GetLocList()
|
||||
endif
|
||||
|
||||
" add optional config file parameters
|
||||
let makeprg .= syntastic#c#ReadConfig(g:syntastic_cpp_config_file)
|
||||
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_cpp_config_file)
|
||||
|
||||
" process makeprg
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg,
|
||||
|
||||
140
bundle/git_syntastic/syntax_checkers/d.vim
Normal file
140
bundle/git_syntastic/syntax_checkers/d.vim
Normal file
@@ -0,0 +1,140 @@
|
||||
"============================================================================
|
||||
"File: d.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Alfredo Di Napoli <alfredo dot dinapoli at gmail dot com>
|
||||
"License: Based on the original work of Gregor Uhlenheuer and his
|
||||
" cpp.vim checker so credits are dued.
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
" HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
" OTHER DEALINGS IN THE SOFTWARE.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
" in order to also check header files add this to your .vimrc:
|
||||
" (this usually creates a .gch file in your source directory)
|
||||
"
|
||||
" let g:syntastic_d_check_header = 1
|
||||
"
|
||||
" To disable the search of included header files after special
|
||||
" libraries like gtk and glib add this line to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_d_no_include_search = 1
|
||||
"
|
||||
" In order to add some custom include directories that should be added to the
|
||||
" gcc command line you can add those to the global variable
|
||||
" g:syntastic_d_include_dirs. This list can be used like this:
|
||||
"
|
||||
" let g:syntastic_d_include_dirs = [ 'includes', 'headers' ]
|
||||
"
|
||||
" To enable header files being re-checked on every file write add the
|
||||
" following line to your .vimrc. Otherwise the header files are checked only
|
||||
" one time on initially loading the file.
|
||||
" In order to force syntastic to refresh the header includes simply
|
||||
" unlet b:syntastic_d_includes. Then the header files are being re-checked
|
||||
" on the next file write.
|
||||
"
|
||||
" let g:syntastic_d_auto_refresh_includes = 1
|
||||
"
|
||||
" Alternatively you can set the buffer local variable b:syntastic_d_cflags.
|
||||
" If this variable is set for the current buffer no search for additional
|
||||
" libraries is done. I.e. set the variable like this:
|
||||
"
|
||||
" let b:syntastic_d_cflags = ' -I/usr/include/libsoup-2.4'
|
||||
"
|
||||
" Moreover it is possible to add additional compiler options to the syntax
|
||||
" checking execution via the variable 'g:syntastic_d_compiler_options':
|
||||
"
|
||||
" let g:syntastic_d_compiler_options = ' -std=c++0x'
|
||||
"
|
||||
" Additionally the setting 'g:syntastic_d_config_file' allows you to define
|
||||
" a file that contains additional compiler arguments like include directories
|
||||
" or CFLAGS. The file is expected to contain one option per line. If none is
|
||||
" given the filename defaults to '.syntastic_d_config':
|
||||
"
|
||||
" let g:syntastic_d_config_file = '.config'
|
||||
"
|
||||
" Using the global variable 'g:syntastic_d_remove_include_errors' you can
|
||||
" specify whether errors of files included via the
|
||||
" g:syntastic_d_include_dirs' setting are removed from the result set:
|
||||
"
|
||||
" let g:syntastic_d_remove_include_errors = 1
|
||||
|
||||
if exists('loaded_d_syntax_checker')
|
||||
finish
|
||||
endif
|
||||
let loaded_d_syntax_checker = 1
|
||||
|
||||
if !executable('dmd')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists('g:syntastic_d_config_file')
|
||||
let g:syntastic_d_config_file = '.syntastic_d_config'
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_d_GetLocList()
|
||||
let makeprg = 'dmd -of/dev/null -c '
|
||||
let errorformat = '%-G%f:%s:,%f(%l): %m,%f:%l: %m'
|
||||
|
||||
if exists('g:syntastic_d_compiler_options')
|
||||
let makeprg .= g:syntastic_d_compiler_options
|
||||
endif
|
||||
|
||||
let makeprg .= ' ' . shellescape(expand('%')) .
|
||||
\ ' ' . syntastic#c#GetIncludeDirs('d')
|
||||
|
||||
if expand('%') =~? '\%(.di\)$'
|
||||
if exists('g:syntastic_d_check_header')
|
||||
let makeprg = 'dmd -c '.shellescape(expand('%')).
|
||||
\ ' ' . syntastic#c#GetIncludeDirs('d')
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
if !exists('b:syntastic_d_cflags')
|
||||
if !exists('g:syntastic_d_no_include_search') ||
|
||||
\ g:syntastic_d_no_include_search != 1
|
||||
if exists('g:syntastic_d_auto_refresh_includes') &&
|
||||
\ g:syntastic_d_auto_refresh_includes != 0
|
||||
let makeprg .= syntastic#c#SearchHeaders()
|
||||
else
|
||||
if !exists('b:syntastic_d_includes')
|
||||
let b:syntastic_d_includes = syntastic#c#SearchHeaders()
|
||||
endif
|
||||
let makeprg .= b:syntastic_d_includes
|
||||
endif
|
||||
endif
|
||||
else
|
||||
let makeprg .= b:syntastic_d_cflags
|
||||
endif
|
||||
|
||||
" add optional config file parameters
|
||||
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_d_config_file)
|
||||
|
||||
" process makeprg
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
|
||||
" filter the processed errors if desired
|
||||
if exists('g:syntastic_d_remove_include_errors') &&
|
||||
\ g:syntastic_d_remove_include_errors != 0
|
||||
return filter(errors,
|
||||
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
|
||||
else
|
||||
return errors
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
@@ -4,6 +4,7 @@
|
||||
# with the quickfix mode of Vim
|
||||
#
|
||||
# Copyright (<28>) 2001 by J<>rg Ziefle <joerg.ziefle@gmx.de>
|
||||
# Copyright (c) 2012 Eric Harmon <http://eharmon.net>
|
||||
# You may use and distribute this software under the same terms as Perl itself.
|
||||
#
|
||||
# Usage: put one of the two configurations below in your ~/.vimrc (without the
|
||||
@@ -13,25 +14,27 @@
|
||||
# Program is run interactively with 'perl -w':
|
||||
#
|
||||
# set makeprg=$HOME/bin/vimparse.pl\ %\ $*
|
||||
# set errorformat=%f:%l:%m
|
||||
# set errorformat=%t:%f:%l:%m
|
||||
#
|
||||
# Program is only compiled with 'perl -wc':
|
||||
#
|
||||
# set makeprg=$HOME/bin/vimparse.pl\ -c\ %\ $*
|
||||
# set errorformat=%f:%l:%m
|
||||
# set errorformat=%t:%f:%l:%m
|
||||
#
|
||||
# Usage:
|
||||
# vimparse.pl [-c] [-f <errorfile>] <programfile> [programargs]
|
||||
# vimparse.pl [-c] [-w] [-f <errorfile>] <programfile> [programargs]
|
||||
#
|
||||
# -c compile only, don't run (perl -wc)
|
||||
# -w output warnings as warnings instead of errors (slightly slower)
|
||||
# -f write errors to <errorfile>
|
||||
#
|
||||
# Example usages:
|
||||
# * From the command line:
|
||||
# vimparse.pl program.pl
|
||||
#
|
||||
# vimparse.pl -c -f errorfile program.pl
|
||||
# vimparse.pl -c -w -f errorfile program.pl
|
||||
# Then run vim -q errorfile to edit the errors with Vim.
|
||||
# This uses the custom errorformat: %t:%f:%l:%m.
|
||||
#
|
||||
# * From Vim:
|
||||
# Edit in Vim (and save, if you don't have autowrite on), then
|
||||
@@ -39,6 +42,9 @@
|
||||
# to error check.
|
||||
#
|
||||
# Version history:
|
||||
# 0.3 (05/31/2012):
|
||||
# * Added support for the seperate display of warnings
|
||||
# * Switched output format to %t:%f:%l:%m to support error levels
|
||||
# 0.2 (04/12/2001):
|
||||
# * First public version (sent to Bram)
|
||||
# * -c command line option for compiling only
|
||||
@@ -64,11 +70,11 @@
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
|
||||
use vars qw/$opt_c $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars'
|
||||
use vars qw/$opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars'
|
||||
|
||||
use constant VERSION => 0.2;
|
||||
|
||||
getopts('cf:h');
|
||||
getopts('cwf:h');
|
||||
|
||||
&usage if $opt_h; # not necessarily needed, but good for further extension
|
||||
|
||||
@@ -86,20 +92,33 @@ 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 @lines = `perl @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`;
|
||||
my @error_lines = `perl @{[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`;
|
||||
}
|
||||
|
||||
# Any new errors must be warnings
|
||||
foreach my $line (@warn_lines) {
|
||||
if(!grep { $_ eq $line } @error_lines) {
|
||||
push(@lines, "W:$line");
|
||||
}
|
||||
}
|
||||
|
||||
my $errors = 0;
|
||||
foreach my $line (@lines) {
|
||||
|
||||
chomp($line);
|
||||
my ($file, $lineno, $message, $rest);
|
||||
my ($file, $lineno, $message, $rest, $severity);
|
||||
|
||||
if ($line =~ /^(.*)\sat\s(.*)\sline\s(\d+)(\.|,\snear\s\".*\")$/) {
|
||||
|
||||
($message, $file, $lineno, $rest) = ($1, $2, $3, $4);
|
||||
if ($line =~ /^(.*)\sat\s(.*)\sline\s(\d+)(.*)$/) {
|
||||
($severity, $message, $file, $lineno, $rest) = ($1, $2, $3, $4, $5);
|
||||
$errors++;
|
||||
$message .= $rest if ($rest =~ s/^,//);
|
||||
print $handle "$file:$lineno:$message\n";
|
||||
print $handle "$severity:$file:$lineno:$message\n";
|
||||
|
||||
} else { next };
|
||||
|
||||
@@ -129,9 +148,10 @@ sub usage {
|
||||
(local $0 = $0) =~ s/^.*\/([^\/]+)$/$1/; # remove path from name of program
|
||||
print<<EOT;
|
||||
Usage:
|
||||
$0 [-c] [-f <errorfile>] <programfile> [programargs]
|
||||
$0 [-c] [-w] [-f <errorfile>] <programfile> [programargs]
|
||||
|
||||
-c compile only, don't run (executes 'perl -wc')
|
||||
-c compile only, don't run (executes 'perl -c')
|
||||
-w output warnings as warnings instead of errors (slightly slower)
|
||||
-f write errors to <errorfile>
|
||||
|
||||
Examples:
|
||||
@@ -139,8 +159,9 @@ Examples:
|
||||
$0 program.pl
|
||||
Displays output on STDOUT.
|
||||
|
||||
$0 -c -f errorfile program.pl
|
||||
$0 -c -w -f errorfile program.pl
|
||||
Then run 'vim -q errorfile' to edit the errors with Vim.
|
||||
This uses the custom errorformat: %t:%f:%l:%m.
|
||||
|
||||
* In Vim:
|
||||
Edit in Vim (and save, if you don't have autowrite on), then
|
||||
|
||||
@@ -20,7 +20,7 @@ if !executable("ruby") || !executable("cat")
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_eruby_GetLocList()
|
||||
if has('win32') || has('win64')
|
||||
if has('win32')
|
||||
let makeprg='sed "s/<\%=/<\%/g" '. shellescape(expand("%")) . ' \| ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| ruby -c'
|
||||
else
|
||||
let makeprg='sed "s/<\%=/<\%/g" '. shellescape(expand("%")) . ' \| RUBYOPT= ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| RUBYOPT= ruby -c'
|
||||
|
||||
@@ -18,5 +18,5 @@ if exists("loaded_go_syntax_checker")
|
||||
endif
|
||||
let loaded_go_syntax_checker = 1
|
||||
|
||||
let s:supported_checkers = ["6g", "gofmt"]
|
||||
let s:supported_checkers = ["go", "6g", "gofmt"]
|
||||
call SyntasticLoadChecker(s:supported_checkers, 'go')
|
||||
|
||||
17
bundle/git_syntastic/syntax_checkers/go/go.vim
Normal file
17
bundle/git_syntastic/syntax_checkers/go/go.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
"============================================================================
|
||||
"File: go.vim
|
||||
"Description: Check go syntax using 'go build'
|
||||
"Maintainer: Kamil Kisiel <kamil@kamilkisiel.net>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
function! SyntaxCheckers_go_GetLocList()
|
||||
let makeprg = 'go build -o /dev/null'
|
||||
let errorformat = '%f:%l:%c:%m,%f:%l%m,%-G#%.%#'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
@@ -14,73 +14,16 @@ if exists("loaded_html_syntax_checker")
|
||||
endif
|
||||
let loaded_html_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have tidy or grep installed
|
||||
if !executable("tidy") || !executable("grep")
|
||||
finish
|
||||
if !exists('g:syntastic_html_checker')
|
||||
let g:syntastic_html_checker = "tidy"
|
||||
endif
|
||||
|
||||
" TODO: join this with xhtml.vim for DRY's sake?
|
||||
function! s:TidyEncOptByFenc()
|
||||
let tidy_opts = {
|
||||
\'utf-8' : '-utf8',
|
||||
\'ascii' : '-ascii',
|
||||
\'latin1' : '-latin1',
|
||||
\'iso-2022-jp' : '-iso-2022',
|
||||
\'cp1252' : '-win1252',
|
||||
\'macroman' : '-mac',
|
||||
\'utf-16le' : '-utf16le',
|
||||
\'utf-16' : '-utf16',
|
||||
\'big5' : '-big5',
|
||||
\'sjis' : '-shiftjis',
|
||||
\'cp850' : '-ibm858',
|
||||
\}
|
||||
return get(tidy_opts, &fileencoding, '-utf8')
|
||||
endfunction
|
||||
|
||||
let s:ignore_html_errors = [
|
||||
\ "<table> lacks \"summary\" attribute",
|
||||
\ "not approved by W3C",
|
||||
\ "attribute \"placeholder\"",
|
||||
\ "<meta> proprietary attribute \"charset\"",
|
||||
\ "<meta> lacks \"content\" attribute",
|
||||
\ "inserting \"type\" attribute",
|
||||
\ "proprietary attribute \"data-"
|
||||
\]
|
||||
|
||||
function! s:ValidateError(text)
|
||||
let valid = 0
|
||||
for i in s:ignore_html_errors
|
||||
if stridx(a:text, i) != -1
|
||||
let valid = 1
|
||||
break
|
||||
if g:syntastic_html_checker == "tidy"
|
||||
if executable("tidy") && executable("grep")
|
||||
runtime! syntax_checkers/html/tidy.vim
|
||||
endif
|
||||
elseif g:syntastic_html_checker == "w3"
|
||||
if executable("curl") && executable("sed")
|
||||
runtime! syntax_checkers/html/w3.vim
|
||||
endif
|
||||
endfor
|
||||
return valid
|
||||
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 errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
" process loclist since we need to add some info and filter out valid HTML5
|
||||
" from the errors
|
||||
let n = len(loclist) - 1
|
||||
let bufnum = bufnr("")
|
||||
while n >= 0
|
||||
let i = loclist[n]
|
||||
" filter out valid HTML5
|
||||
if s:ValidateError(i['text']) == 1
|
||||
unlet loclist[n]
|
||||
else
|
||||
"the file name isnt in the output so stick in the buf num manually
|
||||
let i['bufnr'] = bufnum
|
||||
endif
|
||||
let n -= 1
|
||||
endwhile
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
74
bundle/git_syntastic/syntax_checkers/html/tidy.vim
Normal file
74
bundle/git_syntastic/syntax_checkers/html/tidy.vim
Normal file
@@ -0,0 +1,74 @@
|
||||
"============================================================================
|
||||
"File: tidy.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
" TODO: join this with xhtml.vim for DRY's sake?
|
||||
function! s:TidyEncOptByFenc()
|
||||
let tidy_opts = {
|
||||
\'utf-8' : '-utf8',
|
||||
\'ascii' : '-ascii',
|
||||
\'latin1' : '-latin1',
|
||||
\'iso-2022-jp' : '-iso-2022',
|
||||
\'cp1252' : '-win1252',
|
||||
\'macroman' : '-mac',
|
||||
\'utf-16le' : '-utf16le',
|
||||
\'utf-16' : '-utf16',
|
||||
\'big5' : '-big5',
|
||||
\'sjis' : '-shiftjis',
|
||||
\'cp850' : '-ibm858',
|
||||
\}
|
||||
return get(tidy_opts, &fileencoding, '-utf8')
|
||||
endfunction
|
||||
|
||||
let s:ignore_html_errors = [
|
||||
\ "<table> lacks \"summary\" attribute",
|
||||
\ "not approved by W3C",
|
||||
\ "attribute \"placeholder\"",
|
||||
\ "<meta> proprietary attribute \"charset\"",
|
||||
\ "<meta> lacks \"content\" attribute",
|
||||
\ "inserting \"type\" attribute",
|
||||
\ "proprietary attribute \"data-"
|
||||
\]
|
||||
|
||||
function! s:ValidateError(text)
|
||||
let valid = 0
|
||||
for i in s:ignore_html_errors
|
||||
if stridx(a:text, i) != -1
|
||||
let valid = 1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
return valid
|
||||
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 errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
" process loclist since we need to add some info and filter out valid HTML5
|
||||
" from the errors
|
||||
let n = len(loclist) - 1
|
||||
let bufnum = bufnr("")
|
||||
while n >= 0
|
||||
let i = loclist[n]
|
||||
" filter out valid HTML5
|
||||
if s:ValidateError(i['text']) == 1
|
||||
unlet loclist[n]
|
||||
else
|
||||
"the file name isnt in the output so stick in the buf num manually
|
||||
let i['bufnr'] = bufnum
|
||||
endif
|
||||
let n -= 1
|
||||
endwhile
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
32
bundle/git_syntastic/syntax_checkers/html/w3.vim
Normal file
32
bundle/git_syntastic/syntax_checkers/html/w3.vim
Normal file
@@ -0,0 +1,32 @@
|
||||
"============================================================================
|
||||
"File: w3.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
function! SyntaxCheckers_html_GetLocList()
|
||||
let makeprg2="curl -s -F output=text -F \"uploaded_file=@".expand('%:p').";type=text/html\" http://validator.w3.org/check \\| sed -n -e '/\<em\>Line\.\*/ \{ N; s/\\n//; N; s/\\n//; /msg/p; \}' -e ''/msg_warn/p'' -e ''/msg_info/p'' \\| sed -e 's/[ ]\\+/ /g' -e 's/\<[\^\>]\*\>//g' -e 's/\^[ ]//g'"
|
||||
let errorformat2='Line %l\, Column %c: %m'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg2, 'errorformat': errorformat2 })
|
||||
|
||||
let n = len(loclist) - 1
|
||||
let bufnum = bufnr("")
|
||||
while n >= 0
|
||||
let i = loclist[n]
|
||||
let i['bufnr'] = bufnum
|
||||
|
||||
if i['lnum'] == 0
|
||||
let i['type'] = 'w'
|
||||
else
|
||||
let i['type'] = 'e'
|
||||
endif
|
||||
let n -= 1
|
||||
endwhile
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
28
bundle/git_syntastic/syntax_checkers/java.vim
Normal file
28
bundle/git_syntastic/syntax_checkers/java.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
"============================================================================
|
||||
"File: java.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Jochen Keil <jochen.keil at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
function! SyntaxCheckers_java_GetLocList()
|
||||
|
||||
let makeprg = 'javac -Xlint '
|
||||
\. expand ( '%:p:h' ) . '/' . expand ( '%:t' )
|
||||
\. ' 2>&1 \| '
|
||||
\. 'sed -e "s\|'
|
||||
\. expand ( '%:t' )
|
||||
\. '\|'
|
||||
\. expand ( '%:p:h' ) . '/' . expand ( '%:t' )
|
||||
\. '\|"'
|
||||
|
||||
" unashamedly stolen from *errorformat-javac* (quickfix.txt)
|
||||
let errorformat = '%A%f:%l:\ %m,%+Z%p^,%+C%.%#,%-G%.%#'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
endfunction
|
||||
@@ -1,7 +1,8 @@
|
||||
"============================================================================
|
||||
"File: perl.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>
|
||||
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>,
|
||||
" Eric Harmon <http://eharmon.net>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
@@ -19,11 +20,12 @@ if !executable("perl")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:checker = 'perl ' . shellescape(expand('<sfile>:p:h') . '/efm_perl.pl') . ' -c'
|
||||
"remove '-w' switch to change all warnings to errors
|
||||
let s:checker = 'perl ' . shellescape(expand('<sfile>:p:h') . '/efm_perl.pl') . ' -c -w'
|
||||
|
||||
function! SyntaxCheckers_perl_GetLocList()
|
||||
let makeprg = s:checker . ' ' . shellescape(expand('%'))
|
||||
let errorformat = '%f:%l:%m'
|
||||
let errorformat = '%t:%f:%l:%m'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
@@ -41,7 +41,7 @@ function! SyntaxCheckers_php_GetLocList()
|
||||
let errors = []
|
||||
|
||||
let makeprg = "php -l -d error_reporting=E_ALL -d display_errors=0 -d error_log='' ".shellescape(expand('%'))
|
||||
let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l'
|
||||
let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l,PHP Parse %trror: %m in %f on line %l'
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
if empty(errors) && !g:syntastic_phpcs_disable && executable("phpcs")
|
||||
|
||||
@@ -24,7 +24,7 @@ if !exists("g:syntastic_puppet_lint_disable")
|
||||
endif
|
||||
|
||||
if !executable("puppet-lint")
|
||||
let g:syntastic_puppet_lint_disable = 0
|
||||
let g:syntastic_puppet_lint_disable = 1
|
||||
endif
|
||||
|
||||
function! s:PuppetExtractVersion()
|
||||
@@ -44,11 +44,15 @@ let s:puppetVersion = s:PuppetExtractVersion()
|
||||
let s:lintVersion = s:PuppetLintExtractVersion()
|
||||
|
||||
if !(s:lintVersion[0] >= '0' && s:lintVersion[1] >= '1' && s:lintVersion[2] >= '10')
|
||||
let g:syntastic_puppet_lint_disable = 0
|
||||
let g:syntastic_puppet_lint_disable = 1
|
||||
endif
|
||||
|
||||
function! s:getPuppetLintErrors()
|
||||
let makeprg = 'puppet-lint --log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}" '.shellescape(expand('%'))
|
||||
if !exists("g:syntastic_puppet_lint_arguments")
|
||||
let g:syntastic_puppet_lint_arguments = ''
|
||||
endif
|
||||
|
||||
let makeprg = 'puppet-lint --log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}" '.g:syntastic_puppet_lint_arguments.shellescape(expand('%'))
|
||||
let errorformat = '%t%*[a-zA-Z] %m at %f:%l'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' })
|
||||
endfunction
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
"
|
||||
"============================================================================
|
||||
function! SyntaxCheckers_python_GetHighlightRegex(i)
|
||||
if a:i['type'] ==# 'E'
|
||||
let a:i['text'] = "Syntax error"
|
||||
endif
|
||||
if match(a:i['text'], 'is assigned to but never used') > -1
|
||||
\ || match(a:i['text'], 'imported but unused') > -1
|
||||
\ || match(a:i['text'], 'undefined name') > -1
|
||||
|
||||
15
bundle/git_syntastic/syntax_checkers/ruby/macruby.vim
Normal file
15
bundle/git_syntastic/syntax_checkers/ruby/macruby.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
"============================================================================
|
||||
"File: macruby.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
function! SyntaxCheckers_ruby_GetLocList()
|
||||
let makeprg = 'RUBYOPT= macruby -W1 -c '.shellescape(expand('%'))
|
||||
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
|
||||
@@ -11,7 +11,7 @@
|
||||
"============================================================================
|
||||
function! SyntaxCheckers_ruby_GetLocList()
|
||||
" we cannot set RUBYOPT on windows like that
|
||||
if has('win32') || has('win64')
|
||||
if has('win32')
|
||||
let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%'))
|
||||
else
|
||||
let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%'))
|
||||
|
||||
@@ -26,7 +26,7 @@ if executable("compass")
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_sass_GetLocList()
|
||||
let makeprg='sass '.s:imports.' --check '.shellescape(expand('%'))
|
||||
let makeprg='sass --no-cache '.s:imports.' --check '.shellescape(expand('%'))
|
||||
let errorformat = '%ESyntax %trror:%m,%C on line %l of %f,%Z%.%#'
|
||||
let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
4
bundle/git_tagbar/.gitattributes
vendored
Normal file
4
bundle/git_tagbar/.gitattributes
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.gitignore export-ignore
|
||||
.gitattributes export-ignore
|
||||
README export-ignore
|
||||
.info export-ignore
|
||||
1
bundle/git_tagbar/.gitignore
vendored
Normal file
1
bundle/git_tagbar/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/doc/tags
|
||||
2
bundle/git_tagbar/.info
Normal file
2
bundle/git_tagbar/.info
Normal file
@@ -0,0 +1,2 @@
|
||||
tagbar
|
||||
3465
|
||||
7
bundle/git_tagbar/README
Normal file
7
bundle/git_tagbar/README
Normal file
@@ -0,0 +1,7 @@
|
||||
Tagbar is a vim plugin for browsing the tags of source code files. It provides
|
||||
a sidebar that displays the ctags-generated tags of the current file, ordered
|
||||
by their scope. This means that for example methods in C++ are displayed under
|
||||
the class they are defined in.
|
||||
|
||||
Check out the homepage at http://majutsushi.github.com/tagbar/ for more
|
||||
information.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
||||
*tagbar.txt* Display tags of a file in their correct scope
|
||||
*tagbar.txt* Display tags of a file ordered by scope
|
||||
|
||||
Author: Jan Larres <jan@majutsushi.net>
|
||||
Licence: Vim licence, see |license|
|
||||
Homepage: http://majutsushi.github.com/tagbar/
|
||||
Version: 2.3
|
||||
Version: 2.4
|
||||
|
||||
==============================================================================
|
||||
Contents *tagbar* *tagbar-contents*
|
||||
@@ -20,6 +20,7 @@ Contents *tagbar* *tagbar-contents*
|
||||
5. Configuration ................... |tagbar-configuration|
|
||||
Highlight colours ............. |tagbar-highlight|
|
||||
Automatically opening Tagbar .. |tagbar-autoopen|
|
||||
Show current tag in statusline |tagbar-statusline|
|
||||
6. Extending Tagbar ................ |tagbar-extend|
|
||||
7. Troubleshooting & Known issues .. |tagbar-issues|
|
||||
8. History ......................... |tagbar-history|
|
||||
@@ -152,8 +153,7 @@ Use the normal Vimball install method for installing tagbar.vba:
|
||||
:q
|
||||
<
|
||||
Alternatively you can clone the git repository and then add the path to
|
||||
'runtimepath' or use the pathogen plugin. Don't forget to run |:helptags| if
|
||||
you're not using pathogen.
|
||||
'runtimepath' or use the pathogen plugin. Don't forget to run |:helptags|.
|
||||
|
||||
If the ctags executable is not installed in one of the directories in your
|
||||
$PATH environment variable you have to set the g:tagbar_ctags_bin variable,
|
||||
@@ -184,7 +184,7 @@ closed. By default the window is opened on the right side, set the option
|
||||
|:TagbarClose| will simply close the window if it is open.
|
||||
|
||||
It is probably a good idea to assign a key to these commands. For example, put
|
||||
this in your |vimrc|:
|
||||
this into your |vimrc|:
|
||||
>
|
||||
nnoremap <silent> <F9> :TagbarToggle<CR>
|
||||
<
|
||||
@@ -206,7 +206,7 @@ order. Sorting them by name simply displays the tags in their alphabetical
|
||||
order under their corresponding scope. Sorting by file order means that the
|
||||
tags keep the order they have in the source file, but are still associated
|
||||
with the correct scope. You can change the sort order by pressing the "s" key
|
||||
in the Tagbar window. The current sort order is displayed in the statusbar of
|
||||
in the Tagbar window. The current sort order is displayed in the statusline of
|
||||
the Tagbar window.
|
||||
|
||||
Folding~
|
||||
@@ -214,6 +214,13 @@ The displayed scopes (and unscoped types) can be folded to hide uninteresting
|
||||
information. Mappings similar to Vim's built-in ones are provided. Folds can
|
||||
also be opened and closed by clicking on the fold icon with the mouse.
|
||||
|
||||
Highlighting the current tag~
|
||||
When the Tagbar window is open the current tag will automatically be
|
||||
highlighted in it after a short pause if the cursor is not moving. The length
|
||||
of this pause is determined by the 'updatetime' option. If you want to make
|
||||
that pause shorter you can change the option, but don't set it too low or
|
||||
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>
|
||||
@@ -225,7 +232,7 @@ displayed when the cursor stays on a tag for 'updatetime' milliseconds.
|
||||
------------------------------------------------------------------------------
|
||||
COMMANDS *tagbar-commands*
|
||||
|
||||
:TagbarOpen [{flags}]
|
||||
:TagbarOpen [{flags}] *:TagbarOpen*
|
||||
Open the Tagbar window if it is closed.
|
||||
|
||||
Additional behaviour can be specified with the optional {flags} argument.
|
||||
@@ -241,31 +248,41 @@ COMMANDS *tagbar-commands*
|
||||
(unless |g:tagbar_autoclose| is set): >
|
||||
:TagbarOpen fj
|
||||
<
|
||||
:TagbarClose
|
||||
:TagbarClose *:TagbarClose*
|
||||
Close the Tagbar window if it is open.
|
||||
|
||||
:TagbarToggle
|
||||
:TagbarToggle *:TagbarToggle*
|
||||
Open the Tagbar window if it is closed or close it if it is open.
|
||||
|
||||
:TagbarOpenAutoClose
|
||||
:TagbarOpenAutoClose *:TagbarOpenAutoClose*
|
||||
Open the Tagbar window, jump to it and close it on tag selection. This is
|
||||
an alias for ":TagbarOpen fc".
|
||||
|
||||
:TagbarSetFoldlevel {number}
|
||||
:TagbarSetFoldlevel[!] {number} *:TagbarSetFoldlevel*
|
||||
Set the foldlevel of the tags of the current file to {number}. The
|
||||
foldlevel of tags in other files remains unaffected. Works in the same way
|
||||
as 'foldlevel'.
|
||||
as 'foldlevel'. Folds that are specified to be closed by default in the
|
||||
type configuration will not be opened, use a "!" to force applying the new
|
||||
foldlevel to those folds as well.
|
||||
|
||||
:TagbarShowTag
|
||||
:TagbarShowTag *:TagbarShowTag*
|
||||
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.
|
||||
|
||||
:TagbarDebug [logfile]
|
||||
:TagbarGetTypeConfig {filetype} *:TagbarGetTypeConfig*
|
||||
Paste the Tagbar configuration of the vim filetype {filetype} at the
|
||||
current cursor position (provided that filetype is supported by Tagbar)
|
||||
for easy customization. The configuration will be ready to use as is but
|
||||
will only contain the "kinds" entry as that is the only one that really
|
||||
makes sense to customize. See |tagbar-extend| for more information about
|
||||
type configurations.
|
||||
|
||||
:TagbarDebug [logfile] *:TagbarDebug*
|
||||
Start debug mode. This will write debug messages to file [logfile] while
|
||||
using Tagbar. If no argument is given "tagbardebug.log" in the current
|
||||
directory is used. Note: an existing file will be overwritten!
|
||||
|
||||
:TagbarDebugEnd
|
||||
:TagbarDebugEnd *:TagbarDebugEnd*
|
||||
End debug mode, debug messages will no longer be written to the logfile.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
@@ -413,8 +430,8 @@ Example:
|
||||
g:tagbar_foldlevel~
|
||||
Default: 99
|
||||
|
||||
The initial foldlevel for folds in the Tagbar window. Fold with a level higher
|
||||
than this number will be closed.
|
||||
The initial foldlevel for folds in the Tagbar window. Folds with a level
|
||||
higher than this number will be closed.
|
||||
|
||||
Example:
|
||||
>
|
||||
@@ -430,8 +447,8 @@ fonts. With this variable you can set the icons to characters of your liking.
|
||||
The first character in the list specifies the icon to use for a closed fold,
|
||||
and the second one for an open fold.
|
||||
|
||||
Examples (don't worry if some the characters aren't displayed correctly, just
|
||||
choose other characters in that case):
|
||||
Examples (don't worry if some of the characters aren't displayed correctly,
|
||||
just choose other characters in that case):
|
||||
>
|
||||
let g:tagbar_iconchars = ['▶', '▼'] (default on Linux and Mac OS X)
|
||||
let g:tagbar_iconchars = ['▾', '▸']
|
||||
@@ -446,8 +463,8 @@ Default: 0
|
||||
If this variable is set and the current tag is inside of a closed fold then
|
||||
the folds will be opened as much as needed for the tag to be visible so it can
|
||||
be highlighted. If it is not set then the folds won't be opened and the parent
|
||||
tag will be highlighted instead. You can use the TagbarShowTag command to open
|
||||
the folds manually.
|
||||
tag will be highlighted instead. You can use the |:TagbarShowTag| command to
|
||||
open the folds manually.
|
||||
|
||||
Example:
|
||||
>
|
||||
@@ -540,7 +557,11 @@ AUTOMATICALLY OPENING TAGBAR *tagbar-autoopen*
|
||||
Since there are several different situations in which you might want to open
|
||||
Tagbar automatically there is no single option to enable automatic opening.
|
||||
Instead, autocommands can be used together with a convenience function that
|
||||
opens Tagbar only if a supported file is open(ed).
|
||||
opens Tagbar only if a supported file is open(ed). It has a boolean parameter
|
||||
that specifies whether Tagbar should be opened if any loaded buffer is
|
||||
supported (in case the parameter is set to true) or only if a supported
|
||||
file/buffer is currently being shown in a window. This can be useful if you
|
||||
use multiple tabs and don't edit supported files in all of them.
|
||||
|
||||
If you want to open Tagbar automatically on Vim startup no matter what put
|
||||
this into your vimrc:
|
||||
@@ -550,29 +571,84 @@ this into your vimrc:
|
||||
If you want to open it only if you're opening Vim with a supported file/files
|
||||
use this instead:
|
||||
>
|
||||
autocmd VimEnter * nested :call tagbar#autoopen()
|
||||
autocmd VimEnter * nested :call tagbar#autoopen(1)
|
||||
<
|
||||
The above is exactly what the Taglist plugin does if you set the
|
||||
Tlist_Auto_Open option, in case you want to emulate this behaviour.
|
||||
|
||||
For opening Tagbar also if you open a supported file in an already running
|
||||
Vim:
|
||||
>
|
||||
autocmd FileType * nested :call tagbar#autoopen()
|
||||
autocmd FileType * nested :call tagbar#autoopen(0)
|
||||
<
|
||||
And if you only want to open Tagbar only for specific filetypes, not for all
|
||||
of the supported ones:
|
||||
If you use multiple tabs and want Tagbar to also open in the current tab when
|
||||
you switch to an already loaded, supported buffer:
|
||||
>
|
||||
autocmd BufEnter * nested :call tagbar#autoopen(0)
|
||||
<
|
||||
And if you want to open Tagbar only for specific filetypes, not for all of the
|
||||
supported ones:
|
||||
>
|
||||
autocmd FileType c,cpp nested :TagbarOpen
|
||||
<
|
||||
Check out |autocmd.txt| if you want it to open automatically in more
|
||||
complicated cases.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
SHOWING THE CURRENT TAG IN THE STATUSLINE *tagbar-statusline*
|
||||
|
||||
You can show the current tag in the 'statusline', or in any other place that
|
||||
you want to, by calling the tagbar#currenttag() function. The current tag is
|
||||
exactly the same as would be highlighted in the Tagbar window if it is open.
|
||||
It is defined as the nearest tag upwards in the file starting from the cursor
|
||||
position. This means that for example in a function it should usually be the
|
||||
name of the function.
|
||||
|
||||
The function has the following signature:
|
||||
|
||||
tagbar#currenttag({format}, {default} [, {flags}])
|
||||
{format} is a |printf()|-compatible format string where "%s" will be
|
||||
replaced by the name of the tag. {default} will be displayed instead of
|
||||
the format string if no tag can be found.
|
||||
|
||||
The optional {flags} argument specifies some additional properties of the
|
||||
displayed tags. It is a string which can contain these character flags:
|
||||
'f' Display the full hierarchy of the tag, not just the tag itself.
|
||||
's' If the tag is a function, the complete signature will be shown,
|
||||
otherwise just "()" will be appended to distinguish functions from
|
||||
other tags.
|
||||
|
||||
For example, if you put the following into your statusline: >
|
||||
%{tagbar#currenttag('[%s] ', '')}
|
||||
< then the function "myfunc" will be show as "[myfunc()] ".
|
||||
|
||||
==============================================================================
|
||||
6. Extending Tagbar *tagbar-extend*
|
||||
|
||||
Tagbar has a flexible mechanism for extending the existing file type (i.e.
|
||||
language) definitions. This can be used both to change the settings of the
|
||||
existing types and to add completely new types. A complete configuration
|
||||
consists of a type definition for Tagbar in your |vimrc| and optionally a
|
||||
language definition for ctags in case you want to add a new language.
|
||||
existing types and to add completely new types. For Tagbar to support a
|
||||
filetype two things are needed: a program that generates the tag information,
|
||||
usually Exuberant Ctags, and a Tagbar type definition in your |vimrc| or an
|
||||
|ftplugin| that tells Tagbar how to interpret the generated tags.
|
||||
|
||||
Note: if you only want to customize an existing definition (like changing the
|
||||
order in which tag kinds are displayed) see "Changing an existing definition"
|
||||
below.
|
||||
|
||||
There are two ways to generate the tag information for new filetypes: add a
|
||||
definition to Exuberant Ctags or create a specialized program for your
|
||||
language that generates ctags-compatible tag information (see
|
||||
|tags-file-format| for information about how a "tags" file is structured). The
|
||||
former allows simple regular expression-based parsing that is easy to get
|
||||
started with, but doesn't support scopes unless you instead want to write a
|
||||
C-based parser module for Exuberant Ctags. The regex approach is described in
|
||||
more detail below.
|
||||
Writing your own program is the approach used by for example jsctags and can
|
||||
be useful if your language can best be parsed by a program written in the
|
||||
language itself, or if you want to provide the program as part of a complete
|
||||
support package for the language. Some tips on how to write such a program are
|
||||
given at the end of this section.
|
||||
|
||||
Before writing your own extension have a look at the wiki
|
||||
(https://github.com/majutsushi/tagbar/wiki/Support-for-additional-filetypes)
|
||||
@@ -591,18 +667,26 @@ kinds: A list of the "language kinds" that should be listed in Tagbar,
|
||||
Use the command >
|
||||
ctags --list-kinds={language name}
|
||||
< to get a list of the kinds ctags supports for a given language. An
|
||||
entry in this list is a string with two or three parts separated
|
||||
by a colon: the first part is the one-character abbreviation that
|
||||
ctags uses, and the second part is an arbitrary string that will
|
||||
be used in Tagbar as the header for the tags of this kind that are
|
||||
not listed under a specific scope. The optional third part
|
||||
determines whether tags of this kind should be folded by default,
|
||||
with 1 meaning they should be folded and 0 they should not. If
|
||||
this part is omitted the tags will not be folded by default. For
|
||||
example, the string >
|
||||
entry in this list is a colon-separated string with the following
|
||||
syntax: >
|
||||
{short}:{long}[:{fold}[:{stl}]]
|
||||
< {short} is the one-character abbreviation that ctags uses, and
|
||||
{long} is an arbitrary string that will be used in Tagbar as the
|
||||
header for the the tags of this kind that are not listed under a
|
||||
specific scope. {fold} determines whether tags of this kind should
|
||||
be folded by default, with 1 meaning they should be folded and 0
|
||||
they should not. If this part is omitted the tags will not be
|
||||
folded by default. {stl} is used by the tagbar#currenttag()
|
||||
function (see |tagbar-statusline|) to decide whether tags of this
|
||||
kind should be shown in the statusline or not, with 1 meaning they
|
||||
will be shown and 0 meaning they will be ignored. Omitting this
|
||||
part means that the tags will be shown. Note that you have to
|
||||
specify {fold} too if you want to specify {stl}.
|
||||
For example, the string >
|
||||
"f:functions:1"
|
||||
< would list all the function definitions in a file under the header
|
||||
"functions" and fold them.
|
||||
"functions", fold them, and implicitly show them in the statusline
|
||||
if tagbar#currenttag() is used.
|
||||
sro: The scope resolution operator. For example, in C++ it is "::" and
|
||||
in Java it is ".". If in doubt run ctags as shown below and check
|
||||
the output.
|
||||
@@ -662,7 +746,8 @@ ctagsbin: The path to a filetype-specific ctags-compatible program like
|
||||
used automatically if found in your $PATH and does not have to be
|
||||
set in that case. If it is not in your path you have to set this
|
||||
key, the rest of the configuration should not be necessary (unless
|
||||
you want to change something, of course).
|
||||
you want to change something, of course). Note: if you use this
|
||||
then the "ctagstype" key is not needed.
|
||||
ctagsargs: The arguments to be passed to the filetype-specific ctags program
|
||||
{optional} (without the filename). Make sure you set an option that makes the
|
||||
program output its data on stdout. Not used for the normal ctags
|
||||
@@ -689,18 +774,18 @@ configurations will usually be less complicated.
|
||||
let g:tagbar_type_cpp = {
|
||||
\ 'ctagstype' : 'c++',
|
||||
\ 'kinds' : [
|
||||
\ 'd:macros:1',
|
||||
\ 'p:prototypes:1',
|
||||
\ 'd:macros:1:0',
|
||||
\ 'p:prototypes:1:0',
|
||||
\ 'g:enums',
|
||||
\ 'e:enumerators',
|
||||
\ 't:typedefs',
|
||||
\ 'e:enumerators:0:0',
|
||||
\ 't:typedefs:0:0',
|
||||
\ 'n:namespaces',
|
||||
\ 'c:classes',
|
||||
\ 's:structs',
|
||||
\ 'u:unions',
|
||||
\ 'f:functions',
|
||||
\ 'm:members',
|
||||
\ 'v:variables'
|
||||
\ 'm:members:0:0',
|
||||
\ 'v:variables:0:0'
|
||||
\ ],
|
||||
\ 'sro' : '::',
|
||||
\ 'kind2scope' : {
|
||||
@@ -724,25 +809,31 @@ Which of the keys you have to specify depends on what you want to do.
|
||||
|
||||
Changing an existing definition~
|
||||
If you want to change an existing definition you only need to specify the
|
||||
parts that you want to change. It probably only makes sense to change "kinds"
|
||||
and/or "scopes", which would be the case if you wanted to exclude certain
|
||||
kinds from appearing in Tagbar or if you want to change their order. As an
|
||||
example, if you didn't want Tagbar to show prototypes for C++ files and switch
|
||||
the order of enums and typedefs, you would do it like this:
|
||||
parts that you want to change. It probably only makes sense to change "kinds",
|
||||
which would be the case if you wanted to for example change the order of
|
||||
certain kinds, change their default fold state or exclude them from appearing
|
||||
in Tagbar. The easiest way to do that is to use the |:TagbarGetTypeConfig|
|
||||
command, which will paste a ready-to-use configuration with the "kinds" entry
|
||||
for the specified type at the current cursor position.
|
||||
|
||||
As an example, if you didn't want Tagbar to show prototypes for C++ files,
|
||||
switch the order of enums and typedefs, and show macros in the statusline, you
|
||||
would first run ":TagbarGetTypeConfig cpp" in your vimrc and then change the
|
||||
definition like this:
|
||||
>
|
||||
let g:tagbar_type_cpp = {
|
||||
\ 'kinds' : [
|
||||
\ 'd:macros:1',
|
||||
\ 'g:enums',
|
||||
\ 't:typedefs',
|
||||
\ 'e:enumerators',
|
||||
\ 't:typedefs:0:0',
|
||||
\ 'e:enumerators:0:0',
|
||||
\ 'n:namespaces',
|
||||
\ 'c:classes',
|
||||
\ 's:structs',
|
||||
\ 'u:unions',
|
||||
\ 'f:functions',
|
||||
\ 'm:members',
|
||||
\ 'v:variables'
|
||||
\ 'm:members:0:0',
|
||||
\ 'v:variables:0:0'
|
||||
\ ]
|
||||
\ }
|
||||
<
|
||||
@@ -805,10 +896,10 @@ Now we have to create the Tagbar language definition in our vimrc:
|
||||
\ 'ctagstype' : 'latex',
|
||||
\ 'kinds' : [
|
||||
\ 's:sections',
|
||||
\ 'g:graphics',
|
||||
\ 'g:graphics:0:0',
|
||||
\ 'l:labels',
|
||||
\ 'r:refs:1',
|
||||
\ 'p:pagerefs:1'
|
||||
\ 'r:refs:1:0',
|
||||
\ 'p:pagerefs:1:0'
|
||||
\ ],
|
||||
\ 'sort' : 0,
|
||||
\ 'deffile' : expand('<sfile>:p:h:h') . '/ctags/latex.cnf'
|
||||
@@ -825,6 +916,35 @@ that.
|
||||
Tagbar should now be able to show the sections and other tags from LaTeX
|
||||
files.
|
||||
|
||||
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:
|
||||
|
||||
- Tagbar supports the same tag format as Vim itself. The format is described
|
||||
in |tags-file-format|, the third format mentioned there is the relevant
|
||||
one. Note that the {tagaddress} part should be a search pattern since the
|
||||
line number can be specified in a field (see below).
|
||||
- Tagbar reads the tag information from a program's standard output
|
||||
(stdout), it doesn't generate files and reads them in after that. So make
|
||||
sure that your program has an option to output the tags on stdout.
|
||||
- Some fields are supported for providing additional information about a
|
||||
tag. One field is required: the "kind" field as a single letter without
|
||||
a "kind:" fieldname. This field has to be the first one in the list. All
|
||||
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
|
||||
* access: Visibility/access information of a tag; the values
|
||||
"public", "protected" and "private" will be denoted with
|
||||
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".
|
||||
|
||||
==============================================================================
|
||||
7. Troubleshooting & Known issues *tagbar-issues*
|
||||
|
||||
@@ -891,13 +1011,23 @@ file.
|
||||
def bar(self):
|
||||
pass
|
||||
<
|
||||
I haven't found a clean way around this yet, but it shouldn't be much of a
|
||||
problem in practice anyway. Tags with the same name at any other level are
|
||||
no problem, though.
|
||||
I haven't found a proper way around this yet, but it shouldn't be much of
|
||||
a problem in practice anyway. Tags with the same name at any other level
|
||||
are no problem, though.
|
||||
|
||||
==============================================================================
|
||||
8. History *tagbar-history*
|
||||
|
||||
2.4 (2012-06-17)
|
||||
- New function tagbar#currenttag() that reports the current tag, for
|
||||
example for putting it into the statusline.
|
||||
- New command TagbarGetTypeConfig for easy customization of an existing
|
||||
type.
|
||||
- Type definitions now can be loaded from ftplugins.
|
||||
- The autoopen() function is now a bit more flexible.
|
||||
- Vala is now supported if Anjuta is installed.
|
||||
- Various other small improvements and bugfixes.
|
||||
|
||||
2.3 (2011-12-24)
|
||||
- Add a convenience function that allows more flexible ways to
|
||||
automatically open Tagbar.
|
||||
@@ -1006,11 +1136,13 @@ The folding technique was inspired by NERDTree by Martin Grenfell.
|
||||
|
||||
Thanks to the following people for code contributions, feature suggestions etc:
|
||||
Jan Christoph Ebersbach
|
||||
Vadim Fint
|
||||
Leandro Freitas
|
||||
Seth Milliken
|
||||
Kien N
|
||||
pielgrzym
|
||||
Taybin Rutkin
|
||||
Ville Valkonen
|
||||
|
||||
==============================================================================
|
||||
vim: tw=78 ts=8 sw=8 sts=8 noet ft=help
|
||||
vim: tw=78 ts=8 sw=4 sts=4 et ft=help
|
||||
@@ -4,7 +4,7 @@
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 2.3
|
||||
" Version: 2.4
|
||||
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
|
||||
" Yegappan Lakshmanan and uses a small amount of code from it.
|
||||
"
|
||||
@@ -109,8 +109,9 @@ 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 TagbarClose call tagbar#CloseWindow()
|
||||
command! -nargs=1 TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>)
|
||||
command! -nargs=1 -bang TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>, <bang>0)
|
||||
command! -nargs=0 TagbarShowTag call tagbar#OpenParents()
|
||||
command! -nargs=1 TagbarGetTypeConfig call tagbar#gettypeconfig(<f-args>)
|
||||
command! -nargs=? TagbarDebug call tagbar#StartDebug(<f-args>)
|
||||
command! -nargs=0 TagbarDebugEnd call tagbar#StopDebug()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 2.3
|
||||
" Version: 2.4
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1062,7 +1062,12 @@ function! s:Window(settings, tags) " {{{
|
||||
let content = format.content
|
||||
exe winnum . 'wincmd w'
|
||||
|
||||
silent! syn clear TagListKeyword
|
||||
silent! syn clear
|
||||
\ TagListKeyword
|
||||
\ TagListVisibilityPublic
|
||||
\ TagListVisibilityPrivate
|
||||
\ TagListVisibilityProtected
|
||||
\ TagListVisibilityStatic
|
||||
for syn_cmd in format.syntax
|
||||
exec syn_cmd
|
||||
endfor
|
||||
|
||||
112
bundle/git_vimwiki/README
Normal file
112
bundle/git_vimwiki/README
Normal file
@@ -0,0 +1,112 @@
|
||||
This is a mirror of http://www.vim.org/scripts/script.php?script_id=2226
|
||||
|
||||
A Personal Wiki For Vim Plugin
|
||||
==============================================================================
|
||||
Screenshots are available on http://code.google.com/p/vimwiki/
|
||||
There are also zipped vimwiki files there in case you do not like vimball archives.
|
||||
|
||||
|
||||
Prerequisites
|
||||
==============================================================================
|
||||
Make sure you have these settings in your vimrc file:
|
||||
|
||||
set nocompatible
|
||||
filetype plugin on
|
||||
syntax on
|
||||
|
||||
Without them Vimwiki will not work properly.
|
||||
|
||||
|
||||
Intro
|
||||
==============================================================================
|
||||
Vimwiki is a personal wiki for Vim -- a number of linked text files that have
|
||||
their own syntax highlighting.
|
||||
|
||||
With vimwiki you can:
|
||||
- organize notes and ideas;
|
||||
- manage todo-lists;
|
||||
- write documentation.
|
||||
|
||||
To do a quick start press <Leader>ww (this is usually \ww) to go to your index
|
||||
wiki file. By default it is located in:
|
||||
~/vimwiki/index.wiki
|
||||
|
||||
Feed it with the following example:
|
||||
|
||||
= My knowledge base =
|
||||
* Tasks -- things to be done _yesterday_!!!
|
||||
* Project Gutenberg -- good books are power.
|
||||
* Scratchpad -- various temporary stuff.
|
||||
|
||||
Place your cursor on 'Tasks' and press Enter to create a link. Once pressed,
|
||||
'Tasks' will become '[[Tasks]]' -- a vimwiki link. Press Enter again to
|
||||
open it. Edit the file, save it, and then press Backspace to jump back to your
|
||||
index.
|
||||
|
||||
A vimwiki link can be constructed from more than one word. Just visually
|
||||
select the words to be linked and press Enter. Try it with 'Project
|
||||
Gutenberg'. The result should look something like:
|
||||
|
||||
= My knowledge base =
|
||||
* [[Tasks]] -- things to be done _yesterday_!!!
|
||||
* [[Project Gutenberg]] -- good books are power.
|
||||
* Scratchpad -- various temporary stuff.
|
||||
|
||||
|
||||
For the various options see :h vimwiki-options.
|
||||
|
||||
|
||||
Basic Markup
|
||||
==============================================================================
|
||||
see :h vimwiki-syntax
|
||||
|
||||
*bold* -- bold
|
||||
_italic_ -- italic
|
||||
|
||||
[[wiki link]] -- link with spaces
|
||||
[[wiki link|description]] -- link with description
|
||||
|
||||
Lists:
|
||||
* bullet list item 1
|
||||
- bullet list item 2
|
||||
- bullet list item 3
|
||||
* bullet list item 4
|
||||
* bullet list item 5
|
||||
* bullet list item 6
|
||||
* bullet list item 7
|
||||
- bullet list item 8
|
||||
- bullet list item 9
|
||||
|
||||
# numbered list item 1
|
||||
# numbered list item 2
|
||||
# numbered list item 3
|
||||
# numbered list item 4
|
||||
|
||||
= Header1 =
|
||||
== Header2 ==
|
||||
=== Header3 ===
|
||||
|
||||
|
||||
Key bindings
|
||||
==============================================================================
|
||||
see :h vimwiki-mappings
|
||||
|
||||
normal mode:
|
||||
<Leader>ww -- Open default wiki index file.
|
||||
<Leader>wt -- Open default wiki index file in a new tab.
|
||||
<Leader>ws -- Select and open wiki index file.
|
||||
<Leader>wd -- Delete wiki file you are in.
|
||||
<Leader>wr -- Rename wiki file you are in.
|
||||
<Enter> -- Folow/Create wiki link
|
||||
<Shift-Enter> -- Split and folow/create wiki link
|
||||
<Ctrl-Enter> -- Vertical split and folow/create wiki link
|
||||
<Backspace> -- Go back to parent(previous) wiki link
|
||||
<Tab> -- Find next wiki link
|
||||
<Shift-Tab> -- Find previous wiki link
|
||||
|
||||
|
||||
Commands
|
||||
==============================================================================
|
||||
:Vimwiki2HTML -- Convert current wiki link to HTML
|
||||
:VimwikiAll2HTML -- Convert all your wiki links to HTML
|
||||
|
||||
1502
bundle/git_vimwiki/autoload/vimwiki/base.vim
Normal file
1502
bundle/git_vimwiki/autoload/vimwiki/base.vim
Normal file
File diff suppressed because it is too large
Load Diff
358
bundle/git_vimwiki/autoload/vimwiki/diary.vim
Normal file
358
bundle/git_vimwiki/autoload/vimwiki/diary.vim
Normal file
@@ -0,0 +1,358 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Desc: Handle diary notes
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" Load only once {{{
|
||||
if exists("g:loaded_vimwiki_diary_auto") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimwiki_diary_auto = 1
|
||||
"}}}
|
||||
|
||||
let s:vimwiki_max_scan_for_caption = 5
|
||||
|
||||
" Helpers {{{
|
||||
function! s:prefix_zero(num) "{{{
|
||||
if a:num < 10
|
||||
return '0'.a:num
|
||||
endif
|
||||
return a:num
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_date_link(fmt) "{{{
|
||||
return strftime(a:fmt)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:link_exists(lines, link) "{{{
|
||||
let link_exists = 0
|
||||
for line in a:lines
|
||||
if line =~ escape(a:link, '[]\')
|
||||
let link_exists = 1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
return link_exists
|
||||
endfunction "}}}
|
||||
|
||||
function! s:diary_path(...) "{{{
|
||||
let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1
|
||||
return VimwikiGet('path', idx).VimwikiGet('diary_rel_path', idx)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:diary_index(...) "{{{
|
||||
let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1
|
||||
return s:diary_path(idx).VimwikiGet('diary_index', idx).VimwikiGet('ext', idx)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:diary_date_link(...) "{{{
|
||||
let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1
|
||||
return s:get_date_link(VimwikiGet('diary_link_fmt', idx))
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_position_links(link) "{{{
|
||||
let idx = -1
|
||||
let links = []
|
||||
if a:link =~ '^\d\{4}-\d\d-\d\d'
|
||||
let links = keys(s:get_diary_links())
|
||||
" include 'today' into links
|
||||
if index(links, s:diary_date_link()) == -1
|
||||
call add(links, s:diary_date_link())
|
||||
endif
|
||||
call sort(links)
|
||||
let idx = index(links, a:link)
|
||||
endif
|
||||
return [idx, links]
|
||||
endfunction "}}}
|
||||
|
||||
fun! s:get_month_name(month) "{{{
|
||||
return g:vimwiki_diary_months[str2nr(a:month)]
|
||||
endfun "}}}
|
||||
|
||||
" Helpers }}}
|
||||
|
||||
" Diary index stuff {{{
|
||||
fun! s:read_captions(files) "{{{
|
||||
let result = {}
|
||||
for fl in a:files
|
||||
" remove paths and extensions
|
||||
let fl_key = fnamemodify(fl, ':t:r')
|
||||
|
||||
if filereadable(fl)
|
||||
for line in readfile(fl, '', s:vimwiki_max_scan_for_caption)
|
||||
if line =~ g:vimwiki_rxHeader && !has_key(result, fl_key)
|
||||
let result[fl_key] = vimwiki#u#trim(matchstr(line, g:vimwiki_rxHeader))
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if !has_key(result, fl_key)
|
||||
let result[fl_key] = ''
|
||||
endif
|
||||
|
||||
endfor
|
||||
return result
|
||||
endfun "}}}
|
||||
|
||||
fun! s:get_diary_links(...) "{{{
|
||||
let rx = '^\d\{4}-\d\d-\d\d'
|
||||
let s_files = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').'*'.VimwikiGet('ext'))
|
||||
let files = split(s_files, '\n')
|
||||
call filter(files, 'fnamemodify(v:val, ":t") =~ "'.escape(rx, '\').'"')
|
||||
|
||||
" remove backup files (.wiki~)
|
||||
call filter(files, 'v:val !~ ''.*\~$''')
|
||||
|
||||
if a:0
|
||||
call add(files, a:1)
|
||||
endif
|
||||
let links_with_captions = s:read_captions(files)
|
||||
|
||||
return links_with_captions
|
||||
endfun "}}}
|
||||
|
||||
fun! s:group_links(links) "{{{
|
||||
let result = {}
|
||||
let p_year = 0
|
||||
let p_month = 0
|
||||
for fl in sort(keys(a:links))
|
||||
let year = strpart(fl, 0, 4)
|
||||
let month = strpart(fl, 5, 2)
|
||||
if p_year != year
|
||||
let result[year] = {}
|
||||
let p_month = 0
|
||||
endif
|
||||
if p_month != month
|
||||
let result[year][month] = {}
|
||||
endif
|
||||
let result[year][month][fl] = a:links[fl]
|
||||
let p_year = year
|
||||
let p_month = month
|
||||
endfor
|
||||
return result
|
||||
endfun "}}}
|
||||
|
||||
fun! s:sort(lst) "{{{
|
||||
if VimwikiGet("diary_sort") == 'desc'
|
||||
return reverse(sort(a:lst))
|
||||
else
|
||||
return sort(a:lst)
|
||||
endif
|
||||
endfun "}}}
|
||||
|
||||
fun! s:format_diary(...) "{{{
|
||||
let result = []
|
||||
|
||||
call add(result, substitute(g:vimwiki_rxH1_Template, '__Header__', VimwikiGet('diary_header'), ''))
|
||||
|
||||
if a:0
|
||||
let g_files = s:group_links(s:get_diary_links(a:1))
|
||||
else
|
||||
let g_files = s:group_links(s:get_diary_links())
|
||||
endif
|
||||
|
||||
" for year in s:rev(sort(keys(g_files)))
|
||||
for year in s:sort(keys(g_files))
|
||||
call add(result, '')
|
||||
call add(result, substitute(g:vimwiki_rxH2_Template, '__Header__', year , ''))
|
||||
|
||||
" for month in s:rev(sort(keys(g_files[year])))
|
||||
for month in s:sort(keys(g_files[year]))
|
||||
call add(result, '')
|
||||
call add(result, substitute(g:vimwiki_rxH3_Template, '__Header__', s:get_month_name(month), ''))
|
||||
|
||||
" for [fl, cap] in s:rev(sort(items(g_files[year][month])))
|
||||
for [fl, cap] in s:sort(items(g_files[year][month]))
|
||||
if empty(cap)
|
||||
let entry = substitute(g:vimwiki_WikiLinkTemplate1, '__LinkUrl__', fl, '')
|
||||
let entry = substitute(entry, '__LinkDescription__', cap, '')
|
||||
call add(result, repeat(' ', &sw).'* '.entry)
|
||||
else
|
||||
let entry = substitute(g:vimwiki_WikiLinkTemplate2, '__LinkUrl__', fl, '')
|
||||
let entry = substitute(entry, '__LinkDescription__', cap, '')
|
||||
call add(result, repeat(' ', &sw).'* '.entry)
|
||||
endif
|
||||
endfor
|
||||
|
||||
endfor
|
||||
endfor
|
||||
call add(result, '')
|
||||
|
||||
return result
|
||||
endfun "}}}
|
||||
|
||||
function! s:delete_diary_section() "{{{
|
||||
" remove diary section
|
||||
let old_pos = getpos('.')
|
||||
let ln_start = -1
|
||||
let ln_end = -1
|
||||
call cursor(1, 1)
|
||||
if search(substitute(g:vimwiki_rxH1_Template, '__Header__', VimwikiGet('diary_header'), ''), 'Wc')
|
||||
let ln_start = line('.')
|
||||
if search(g:vimwiki_rxH1, 'W')
|
||||
let ln_end = line('.') - 1
|
||||
else
|
||||
let ln_end = line('$')
|
||||
endif
|
||||
endif
|
||||
|
||||
if ln_start < 0 || ln_end < 0
|
||||
call setpos('.', old_pos)
|
||||
return
|
||||
endif
|
||||
|
||||
if !&readonly
|
||||
exe ln_start.",".ln_end."delete _"
|
||||
endif
|
||||
|
||||
call setpos('.', old_pos)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:insert_diary_section() "{{{
|
||||
if !&readonly
|
||||
let ln = line('.')
|
||||
call append(ln, s:format_diary())
|
||||
if ln == 1 && getline(ln) == ''
|
||||
1,1delete
|
||||
endif
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" Diary index stuff }}}
|
||||
|
||||
function! vimwiki#diary#make_note(wnum, ...) "{{{
|
||||
if a:wnum > len(g:vimwiki_list)
|
||||
echom "vimwiki: Wiki ".a:wnum." is not registered in g:vimwiki_list!"
|
||||
return
|
||||
endif
|
||||
|
||||
" TODO: refactor it. base#goto_index uses the same
|
||||
if a:wnum > 0
|
||||
let idx = a:wnum - 1
|
||||
else
|
||||
let idx = 0
|
||||
endif
|
||||
|
||||
call vimwiki#base#validate_wiki_options(idx)
|
||||
call vimwiki#base#mkdir(VimwikiGet('path', idx).VimwikiGet('diary_rel_path', idx))
|
||||
|
||||
if a:0
|
||||
let cmd = 'tabedit'
|
||||
else
|
||||
let cmd = 'edit'
|
||||
endif
|
||||
if len(a:0)>1
|
||||
let link = 'diary:'.a:2
|
||||
else
|
||||
let link = 'diary:'.s:diary_date_link(idx)
|
||||
endif
|
||||
|
||||
call vimwiki#base#open_link(cmd, link, s:diary_index(idx))
|
||||
call vimwiki#base#setup_buffer_state(idx)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#goto_diary_index(wnum) "{{{
|
||||
if a:wnum > len(g:vimwiki_list)
|
||||
echom "vimwiki: Wiki ".a:wnum." is not registered in g:vimwiki_list!"
|
||||
return
|
||||
endif
|
||||
|
||||
" TODO: refactor it. base#goto_index uses the same
|
||||
if a:wnum > 0
|
||||
let idx = a:wnum - 1
|
||||
else
|
||||
let idx = 0
|
||||
endif
|
||||
|
||||
call vimwiki#base#validate_wiki_options(idx)
|
||||
call vimwiki#base#edit_file('e', s:diary_index(idx))
|
||||
call vimwiki#base#setup_buffer_state(idx)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#goto_next_day() "{{{
|
||||
let link = ''
|
||||
let [idx, links] = s:get_position_links(expand('%:t:r'))
|
||||
|
||||
if idx == (len(links) - 1)
|
||||
return
|
||||
endif
|
||||
|
||||
if idx != -1 && idx < len(links) - 1
|
||||
let link = 'diary:'.links[idx+1]
|
||||
else
|
||||
" goto today
|
||||
let link = 'diary:'.s:diary_date_link()
|
||||
endif
|
||||
|
||||
if len(link)
|
||||
call vimwiki#base#open_link(':e ', link)
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#goto_prev_day() "{{{
|
||||
let link = ''
|
||||
let [idx, links] = s:get_position_links(expand('%:t:r'))
|
||||
|
||||
if idx == 0
|
||||
return
|
||||
endif
|
||||
|
||||
if idx > 0
|
||||
let link = 'diary:'.links[idx-1]
|
||||
else
|
||||
" goto today
|
||||
let link = 'diary:'.s:diary_date_link()
|
||||
endif
|
||||
|
||||
if len(link)
|
||||
call vimwiki#base#open_link(':e ', link)
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#generate_diary_section() "{{{
|
||||
let current_file = vimwiki#u#path_norm(expand("%:p"))
|
||||
let diary_file = vimwiki#u#path_norm(s:diary_index())
|
||||
if current_file == diary_file
|
||||
call s:delete_diary_section()
|
||||
call s:insert_diary_section()
|
||||
else
|
||||
echom "vimwiki: You can generate diary links only in a diary index page!"
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" Calendar.vim {{{
|
||||
" Callback function.
|
||||
function! vimwiki#diary#calendar_action(day, month, year, week, dir) "{{{
|
||||
let day = s:prefix_zero(a:day)
|
||||
let month = s:prefix_zero(a:month)
|
||||
|
||||
let link = a:year.'-'.month.'-'.day
|
||||
if winnr('#') == 0
|
||||
if a:dir == 'V'
|
||||
vsplit
|
||||
else
|
||||
split
|
||||
endif
|
||||
else
|
||||
wincmd p
|
||||
if !&hidden && &modified
|
||||
new
|
||||
endif
|
||||
endif
|
||||
|
||||
" Create diary note for a selected date in default wiki.
|
||||
call vimwiki#diary#make_note(1, 0, link)
|
||||
endfunction "}}}
|
||||
|
||||
" Sign function.
|
||||
function vimwiki#diary#calendar_sign(day, month, year) "{{{
|
||||
let day = s:prefix_zero(a:day)
|
||||
let month = s:prefix_zero(a:month)
|
||||
let sfile = VimwikiGet('path').VimwikiGet('diary_rel_path').
|
||||
\ a:year.'-'.month.'-'.day.VimwikiGet('ext')
|
||||
return filereadable(expand(sfile))
|
||||
endfunction "}}}
|
||||
|
||||
" Calendar.vim }}}
|
||||
|
||||
@@ -14,6 +14,15 @@ let g:loaded_vimwiki_html_auto = 1
|
||||
"}}}
|
||||
|
||||
" UTILITY "{{{
|
||||
function s:get_completion_index(sym) "{{{
|
||||
for idx in range(1, 5)
|
||||
if match(g:vimwiki_listsyms, '\C\%'.idx.'v'.a:sym) != -1
|
||||
return (idx-1)
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
function! s:root_path(subdir) "{{{
|
||||
return repeat('../', len(split(a:subdir, '[/\\]')))
|
||||
endfunction "}}}
|
||||
@@ -36,7 +45,7 @@ function! s:is_web_link(lnk) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_img_link(lnk) "{{{
|
||||
if a:lnk =~ '\.\%(png\|jpg\|gif\|jpeg\)$'
|
||||
if tolower(a:lnk) =~ '\.\%(png\|jpg\|gif\|jpeg\)$'
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
@@ -59,9 +68,14 @@ function! s:find_autoload_file(name) " {{{
|
||||
return ''
|
||||
endfunction " }}}
|
||||
|
||||
function! s:create_default_CSS(path) " {{{
|
||||
function! s:default_CSS_full_name(path) " {{{
|
||||
let path = expand(a:path)
|
||||
let css_full_name = path.VimwikiGet('css_name')
|
||||
return css_full_name
|
||||
endfunction "}}}
|
||||
|
||||
function! s:create_default_CSS(path) " {{{
|
||||
let css_full_name = s:default_CSS_full_name(a:path)
|
||||
if glob(css_full_name) == ""
|
||||
call vimwiki#base#mkdir(fnamemodify(css_full_name, ':p:h'))
|
||||
let default_css = s:find_autoload_file('style.css')
|
||||
@@ -81,8 +95,7 @@ function! s:template_full_name(name) "{{{
|
||||
endif
|
||||
|
||||
let fname = expand(VimwikiGet('template_path').
|
||||
\name.
|
||||
\VimwikiGet('template_ext'))
|
||||
\ name.VimwikiGet('template_ext'))
|
||||
|
||||
if filereadable(fname)
|
||||
return fname
|
||||
@@ -95,8 +108,8 @@ function! s:get_html_template(wikifile, template) "{{{
|
||||
" TODO: refactor it!!!
|
||||
let lines=[]
|
||||
|
||||
if a:template != ''
|
||||
let template_name = s:template_full_name(a:template)
|
||||
if template_name != ''
|
||||
try
|
||||
let lines = readfile(template_name)
|
||||
return lines
|
||||
@@ -106,27 +119,40 @@ function! s:get_html_template(wikifile, template) "{{{
|
||||
endtry
|
||||
endif
|
||||
|
||||
" if no VimwikiGet('html_template') set up or error while reading template
|
||||
" file -- use default one.
|
||||
let default_tpl = s:template_full_name('')
|
||||
|
||||
if default_tpl == ''
|
||||
let default_tpl = s:find_autoload_file('default.tpl')
|
||||
if default_tpl != ''
|
||||
let lines = readfile(default_tpl)
|
||||
endif
|
||||
|
||||
let lines = readfile(default_tpl)
|
||||
return lines
|
||||
endfunction "}}}
|
||||
|
||||
function! s:safe_html_tags(line) "{{{
|
||||
let line = substitute(a:line,'<','\<', 'g')
|
||||
let line = substitute(line,'>','\>', 'g')
|
||||
return line
|
||||
endfunction "}}}
|
||||
|
||||
function! s:safe_html(line) "{{{
|
||||
" escape & < > when producing HTML text
|
||||
" uses variables s:lt_pattern, s:gt_pattern that are
|
||||
" set in vimwiki#html#Wiki2HTML() according to g:vimwiki_valid_html_tags
|
||||
"" htmlize symbols: < > &
|
||||
|
||||
let line = substitute(a:line, '&', '\&', 'g')
|
||||
" the following depends on g:vimwiki_valid_html_tags
|
||||
let line = substitute(line,s:lt_pattern,'\<', 'g')
|
||||
let line = substitute(line,s:gt_pattern,'\>', 'g')
|
||||
|
||||
let tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
let line = substitute(line,'<\%(/\?\%('
|
||||
\.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!',
|
||||
\'\<', 'g')
|
||||
let line = substitute(line,'\%(</\?\%('
|
||||
\.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>',
|
||||
\'\>', 'g')
|
||||
"let tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
"let line = substitute(line,'<\%(/\?\%('
|
||||
" \.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!',
|
||||
" \'\<', 'g')
|
||||
"let line = substitute(line,'\%(</\?\%('
|
||||
" \.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>',
|
||||
" \'\>', 'g')
|
||||
return line
|
||||
endfunction "}}}
|
||||
|
||||
@@ -140,8 +166,8 @@ function! s:delete_html_files(path) "{{{
|
||||
|
||||
" delete if there is no corresponding wiki file
|
||||
let subdir = vimwiki#base#subdir(VimwikiGet('path_html'), fname)
|
||||
let wikifile = VimwikiGet("path").subdir.
|
||||
\fnamemodify(fname, ":t:r").VimwikiGet("ext")
|
||||
let wikifile = VimwikiGet('path').subdir.
|
||||
\fnamemodify(fname, ":t:r").VimwikiGet('ext')
|
||||
if filereadable(wikifile)
|
||||
continue
|
||||
endif
|
||||
@@ -182,12 +208,6 @@ function! s:save_vimwiki_buffer() "{{{
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:trim(string) "{{{
|
||||
let res = substitute(a:string, '^\s\+', '', '')
|
||||
let res = substitute(res, '\s\+$', '', '')
|
||||
return res
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_html_toc(toc_list) "{{{
|
||||
" toc_list is list of [level, header_text, header_id]
|
||||
" ex: [[1, "Header", "toc1"], [2, "Header2", "toc2"], ...]
|
||||
@@ -265,8 +285,7 @@ function! s:is_html_uptodate(wikifile) "{{{
|
||||
endif
|
||||
|
||||
let wikifile = fnamemodify(a:wikifile, ":p")
|
||||
let subdir = vimwiki#base#subdir(VimwikiGet('path'), wikifile)
|
||||
let htmlfile = expand(VimwikiGet('path_html').subdir.
|
||||
let htmlfile = expand(VimwikiGet('path_html').VimwikiGet('subdir').
|
||||
\fnamemodify(wikifile, ":t:r").".html")
|
||||
|
||||
if getftime(wikifile) <= getftime(htmlfile) && tpl_time <= getftime(htmlfile)
|
||||
@@ -299,6 +318,11 @@ endfunction "}}}
|
||||
"}}}
|
||||
|
||||
" INLINE TAGS "{{{
|
||||
function! s:tag_eqin(value) "{{{
|
||||
" mathJAX wants \( \) for inline maths
|
||||
return '\('.s:mid(a:value, 1).'\)'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:tag_em(value) "{{{
|
||||
return '<em>'.s:mid(a:value, 1).'</em>'
|
||||
endfunction "}}}
|
||||
@@ -324,141 +348,113 @@ function! s:tag_sub(value) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:tag_code(value) "{{{
|
||||
return '<code>'.s:mid(a:value, 1).'</code>'
|
||||
return '<code>'.s:safe_html_tags(s:mid(a:value, 1)).'</code>'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:tag_pre(value) "{{{
|
||||
return '<code>'.s:mid(a:value, 3).'</code>'
|
||||
"function! s:tag_pre(value) "{{{
|
||||
" return '<code>'.s:mid(a:value, 3).'</code>'
|
||||
"endfunction "}}}
|
||||
|
||||
"FIXME dead code?
|
||||
"function! s:tag_math(value) "{{{
|
||||
" return '\['.s:mid(a:value, 3).'\]'
|
||||
"endfunction "}}}
|
||||
|
||||
|
||||
"{{{ v2.0 links
|
||||
" match n-th ARG within {{URL[|ARG1|ARG2|...]}} " {{{
|
||||
" *c,d,e),...
|
||||
function! vimwiki#html#incl_match_arg(nn_index)
|
||||
let rx = g:vimwiki_rxWikiInclPrefix. g:vimwiki_rxWikiInclUrl
|
||||
let rx = rx. repeat(g:vimwiki_rxWikiInclSeparator. g:vimwiki_rxWikiInclArg, a:nn_index-1)
|
||||
if a:nn_index > 0
|
||||
let rx = rx. g:vimwiki_rxWikiInclSeparator. '\zs'. g:vimwiki_rxWikiInclArg. '\ze'
|
||||
endif
|
||||
let rx = rx. g:vimwiki_rxWikiInclArgs. g:vimwiki_rxWikiInclSuffix
|
||||
return rx
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
function! vimwiki#html#linkify_link(src, descr) "{{{
|
||||
let src_str = ' href="'.a:src.'"'
|
||||
let descr = substitute(a:descr,'^\s*\(.*\)\s*$','\1','')
|
||||
let descr = (descr == "" ? a:src : descr)
|
||||
let descr_str = (descr =~ g:vimwiki_rxWikiIncl
|
||||
\ ? s:tag_wikiincl(descr)
|
||||
\ : descr)
|
||||
return '<a'.src_str.'>'.descr_str.'</a>'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:tag_internal_link(value) "{{{
|
||||
" Make <a href="This is a link">This is a link</a>
|
||||
" from [[This is a link]]
|
||||
" Make <a href="link">This is a link</a>
|
||||
" from [[link|This is a link]]
|
||||
" Make <a href="link">This is a link</a>
|
||||
" from [[link][This is a link]]
|
||||
" TODO: rename function -- it makes not only internal links.
|
||||
" TODO: refactor it.
|
||||
|
||||
function! s:linkify(src, caption, style) "{{{
|
||||
if a:style == ''
|
||||
let style_str = ''
|
||||
else
|
||||
let style_str = ' style="'.a:style.'"'
|
||||
endif
|
||||
|
||||
if s:is_img_link(a:caption)
|
||||
let link = '<a href="'.a:src.'"><img src="'.a:caption.'"'.style_str.' />'.
|
||||
\ '</a>'
|
||||
elseif vimwiki#base#is_non_wiki_link(a:src)
|
||||
let link = '<a href="'.a:src.'">'.a:caption.'</a>'
|
||||
elseif s:is_img_link(a:src)
|
||||
let link = '<img src="'.a:src.'" alt="'.a:caption.'"'. style_str.' />'
|
||||
elseif vimwiki#base#is_link_to_dir(a:src)
|
||||
if g:vimwiki_dir_link == ''
|
||||
let link = '<a href="'.vimwiki#base#safe_link(a:src).'">'.a:caption.'</a>'
|
||||
else
|
||||
let link = '<a href="'.vimwiki#base#safe_link(a:src).
|
||||
\ g:vimwiki_dir_link.'.html">'.a:caption.'</a>'
|
||||
endif
|
||||
else
|
||||
let link = '<a href="'.vimwiki#base#safe_link(a:src).
|
||||
\ '.html">'.a:caption.'</a>'
|
||||
endif
|
||||
|
||||
return link
|
||||
function! vimwiki#html#linkify_image(src, descr, verbatim_str) "{{{
|
||||
let src_str = ' src="'.a:src.'"'
|
||||
let descr_str = (a:descr != '' ? ' alt="'.a:descr.'"' : '')
|
||||
let verbatim_str = (a:verbatim_str != '' ? ' '.a:verbatim_str : '')
|
||||
return '<img'.src_str.descr_str.verbatim_str.' />'
|
||||
endfunction "}}}
|
||||
|
||||
let value = s:mid(a:value, 2)
|
||||
function! s:tag_weblink(value) "{{{
|
||||
" Weblink Template -> <a href="url">descr</a>
|
||||
let str = a:value
|
||||
let url = matchstr(str, g:vimwiki_rxWeblinkMatchUrl)
|
||||
let descr = matchstr(str, g:vimwiki_rxWeblinkMatchDescr)
|
||||
let line = vimwiki#html#linkify_link(url, descr)
|
||||
return line
|
||||
endfunction "}}}
|
||||
|
||||
let line = ''
|
||||
if value =~ '|'
|
||||
let link_parts = split(value, "|", 1)
|
||||
else
|
||||
let link_parts = split(value, "][", 1)
|
||||
function! s:tag_wikiincl(value) "{{{
|
||||
" {{imgurl|arg1|arg2}} -> ???
|
||||
" {{imgurl}} -> <img src="imgurl"/>
|
||||
" {{imgurl|descr|style="A"}} -> <img src="imgurl" alt="descr" style="A" />
|
||||
" {{imgurl|descr|class="B"}} -> <img src="imgurl" alt="descr" class="B" />
|
||||
let str = a:value
|
||||
" custom transclusions
|
||||
let line = VimwikiWikiIncludeHandler(str)
|
||||
" otherwise, assume image transclusion
|
||||
if line == ''
|
||||
let url_0 = matchstr(str, g:vimwiki_rxWikiInclMatchUrl)
|
||||
let descr = matchstr(str, vimwiki#html#incl_match_arg(1))
|
||||
let verbatim_str = matchstr(str, vimwiki#html#incl_match_arg(2))
|
||||
" resolve url
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
\ vimwiki#base#resolve_scheme(url_0, 1)
|
||||
" generate html output
|
||||
" TODO: migrate non-essential debugging messages into g:VimwikiLog
|
||||
if g:vimwiki_debug > 1
|
||||
echom '{{idx='.idx.', scheme='.scheme.', path='.path.', subdir='.subdir.', lnk='.lnk.', ext='.ext.'}}'
|
||||
endif
|
||||
|
||||
|
||||
if len(link_parts) > 1
|
||||
if len(link_parts) < 3
|
||||
let style = ""
|
||||
else
|
||||
let style = link_parts[2]
|
||||
endif
|
||||
|
||||
let line = s:linkify(link_parts[0], link_parts[1], style)
|
||||
|
||||
else
|
||||
let line = s:linkify(value, value, '')
|
||||
let url = escape(url, '#')
|
||||
let line = vimwiki#html#linkify_image(url, descr, verbatim_str)
|
||||
return line
|
||||
endif
|
||||
return line
|
||||
endfunction "}}}
|
||||
|
||||
function! s:tag_external_link(value) "{{{
|
||||
"" Make <a href="link">link desc</a>
|
||||
"" from [link link desc]
|
||||
function! s:tag_wikilink(value) "{{{
|
||||
" [[url]] -> <a href="url.html">url</a>
|
||||
" [[url|descr]] -> <a href="url.html">descr</a>
|
||||
" [[url|{{...}}]] -> <a href="url.html"> ... </a>
|
||||
" [[fileurl.ext|descr]] -> <a href="fileurl.ext">descr</a>
|
||||
" [[dirurl/|descr]] -> <a href="dirurl/index.html">descr</a>
|
||||
let str = a:value
|
||||
let url = matchstr(str, g:vimwiki_rxWikiLinkMatchUrl)
|
||||
let descr = matchstr(str, g:vimwiki_rxWikiLinkMatchDescr)
|
||||
let descr = (substitute(descr,'^\s*\(.*\)\s*$','\1','') != '' ? descr : url)
|
||||
|
||||
let value = s:mid(a:value, 1)
|
||||
" resolve url
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
\ vimwiki#base#resolve_scheme(url, 1)
|
||||
|
||||
let line = ''
|
||||
if s:is_web_link(value)
|
||||
let lnkElements = split(value)
|
||||
let head = lnkElements[0]
|
||||
let rest = join(lnkElements[1:])
|
||||
if rest==""
|
||||
let rest=head
|
||||
endif
|
||||
if s:is_img_link(rest)
|
||||
if rest!=head
|
||||
let line = '<a href="'.head.'"><img src="'.rest.'" /></a>'
|
||||
else
|
||||
let line = '<img src="'.rest.'" />'
|
||||
endif
|
||||
else
|
||||
let line = '<a href="'.head.'">'.rest.'</a>'
|
||||
endif
|
||||
elseif s:is_img_link(value)
|
||||
let line = '<img src="'.value.'" />'
|
||||
else
|
||||
" [alskfj sfsf] shouldn't be a link. So return it as it was --
|
||||
" enclosed in [...]
|
||||
let line = '['.value.']'
|
||||
" generate html output
|
||||
" TODO: migrate non-essential debugging messages into g:VimwikiLog
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[[idx='.idx.', scheme='.scheme.', path='.path.', subdir='.subdir.', lnk='.lnk.', ext='.ext.']]'
|
||||
endif
|
||||
let url = escape(url, '#')
|
||||
let line = vimwiki#html#linkify_link(url, descr)
|
||||
return line
|
||||
endfunction "}}}
|
||||
"}}} v1.3 links
|
||||
|
||||
function! s:tag_wikiword_link(value) "{{{
|
||||
" Make <a href="WikiWord">WikiWord</a> from WikiWord
|
||||
if a:value[0] == '!'
|
||||
return a:value[1:]
|
||||
elseif g:vimwiki_camel_case
|
||||
let line = '<a href="'.a:value.'.html">'.a:value.'</a>'
|
||||
return line
|
||||
else
|
||||
return a:value
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:tag_barebone_link(value) "{{{
|
||||
"" Make <a href="http://habamax.ru">http://habamax.ru</a>
|
||||
"" from http://habamax.ru
|
||||
|
||||
if s:is_img_link(a:value)
|
||||
let line = '<img src="'.a:value.'" />'
|
||||
else
|
||||
let line = '<a href="'.a:value.'">'.a:value.'</a>'
|
||||
endif
|
||||
return line
|
||||
endfunction "}}}
|
||||
|
||||
function! s:tag_no_wikiword_link(value) "{{{
|
||||
if a:value[0] == '!'
|
||||
return a:value[1:]
|
||||
else
|
||||
return a:value
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:tag_remove_internal_link(value) "{{{
|
||||
let value = s:mid(a:value, 2)
|
||||
@@ -508,10 +504,16 @@ endfunction "}}}
|
||||
function! s:make_tag(line, regexp, func) "{{{
|
||||
" Make tags for a given matched regexp.
|
||||
" Exclude preformatted text and href links.
|
||||
" FIXME
|
||||
let patt_splitter = '\(`[^`]\+`\)\|'.
|
||||
\ '\('.g:vimwiki_rxPreStart.'.\+'.g:vimwiki_rxPreEnd.'\)\|'.
|
||||
\ '\(<a href.\{-}</a>\)\|'.
|
||||
\ '\(<img src.\{-}/>\)\|'.
|
||||
\ '\('.g:vimwiki_rxEqIn.'\)'
|
||||
|
||||
let patt_splitter = '\(`[^`]\+`\)\|\({{{.\+}}}\)\|'.
|
||||
\ '\(<a href.\{-}</a>\)\|\(<img src.\{-}/>\)'
|
||||
if '`[^`]\+`' == a:regexp || '{{{.\+}}}' == a:regexp
|
||||
"FIXME FIXME !!! these can easily occur on the same line!
|
||||
"XXX {{{ }}} ??? obsolete
|
||||
if '`[^`]\+`' == a:regexp || '{{{.\+}}}' == a:regexp || g:vimwiki_rxEqIn == a:regexp
|
||||
let res_line = s:subst_func(a:line, a:regexp, a:func)
|
||||
else
|
||||
let pos = 0
|
||||
@@ -541,7 +543,6 @@ endfunction " }}}
|
||||
|
||||
function! s:process_tags_typefaces(line) "{{{
|
||||
let line = a:line
|
||||
let line = s:make_tag(line, g:vimwiki_rxNoWikiWord, 's:tag_no_wikiword_link')
|
||||
let line = s:make_tag(line, g:vimwiki_rxItalic, 's:tag_em')
|
||||
let line = s:make_tag(line, g:vimwiki_rxBold, 's:tag_strong')
|
||||
let line = s:make_tag(line, g:vimwiki_rxTodo, 's:tag_todo')
|
||||
@@ -549,15 +550,15 @@ function! s:process_tags_typefaces(line) "{{{
|
||||
let line = s:make_tag(line, g:vimwiki_rxSuperScript, 's:tag_super')
|
||||
let line = s:make_tag(line, g:vimwiki_rxSubScript, 's:tag_sub')
|
||||
let line = s:make_tag(line, g:vimwiki_rxCode, 's:tag_code')
|
||||
let line = s:make_tag(line, g:vimwiki_rxEqIn, 's:tag_eqin')
|
||||
return line
|
||||
endfunction " }}}
|
||||
|
||||
function! s:process_tags_links(line) " {{{
|
||||
let line = a:line
|
||||
let line = s:make_tag(line, '\[\[.\{-}\]\]', 's:tag_internal_link')
|
||||
let line = s:make_tag(line, '\[.\{-}\]', 's:tag_external_link')
|
||||
let line = s:make_tag(line, g:vimwiki_rxWeblink, 's:tag_barebone_link')
|
||||
let line = s:make_tag(line, g:vimwiki_rxWikiWord, 's:tag_wikiword_link')
|
||||
let line = s:make_tag(line, g:vimwiki_rxWikiLink, 's:tag_wikilink')
|
||||
let line = s:make_tag(line, g:vimwiki_rxWikiIncl, 's:tag_wikiincl')
|
||||
let line = s:make_tag(line, g:vimwiki_rxWeblink, 's:tag_weblink')
|
||||
return line
|
||||
endfunction " }}}
|
||||
|
||||
@@ -577,6 +578,14 @@ function! s:close_tag_pre(pre, ldest) "{{{
|
||||
return a:pre
|
||||
endfunction "}}}
|
||||
|
||||
function! s:close_tag_math(math, ldest) "{{{
|
||||
if a:math[0]
|
||||
call insert(a:ldest, "\\\]")
|
||||
return 0
|
||||
endif
|
||||
return a:math
|
||||
endfunction "}}}
|
||||
|
||||
function! s:close_tag_quote(quote, ldest) "{{{
|
||||
if a:quote
|
||||
call insert(a:ldest, "</blockquote>")
|
||||
@@ -745,11 +754,15 @@ endfunction! "}}}
|
||||
|
||||
function! s:process_tag_pre(line, pre) "{{{
|
||||
" pre is the list of [is_in_pre, indent_of_pre]
|
||||
"XXX always outputs a single line or empty list!
|
||||
let lines = []
|
||||
let pre = a:pre
|
||||
let processed = 0
|
||||
if !pre[0] && a:line =~ '^\s*{{{[^\(}}}\)]*\s*$'
|
||||
"XXX huh?
|
||||
"if !pre[0] && a:line =~ '^\s*{{{[^\(}}}\)]*\s*$'
|
||||
if !pre[0] && a:line =~ '^\s*{{{'
|
||||
let class = matchstr(a:line, '{{{\zs.*$')
|
||||
"FIXME class cannot contain arbitrary strings
|
||||
let class = substitute(class, '\s\+$', '', 'g')
|
||||
if class != ""
|
||||
call add(lines, "<pre ".class.">")
|
||||
@@ -764,11 +777,48 @@ function! s:process_tag_pre(line, pre) "{{{
|
||||
let processed = 1
|
||||
elseif pre[0]
|
||||
let processed = 1
|
||||
call add(lines, substitute(a:line, '^\s\{'.pre[1].'}', '', ''))
|
||||
"XXX destroys indent in general!
|
||||
"call add(lines, substitute(a:line, '^\s\{'.pre[1].'}', '', ''))
|
||||
call add(lines, s:safe_html_tags(a:line))
|
||||
endif
|
||||
return [processed, lines, pre]
|
||||
endfunction "}}}
|
||||
|
||||
function! s:process_tag_math(line, math) "{{{
|
||||
" math is the list of [is_in_math, indent_of_math]
|
||||
let lines = []
|
||||
let math = a:math
|
||||
let processed = 0
|
||||
if !math[0] && a:line =~ '^\s*{{\$[^\(}}$\)]*\s*$'
|
||||
let class = matchstr(a:line, '{{$\zs.*$')
|
||||
"FIXME class cannot be any string!
|
||||
let class = substitute(class, '\s\+$', '', 'g')
|
||||
" Check the math placeholder (default: displaymath)
|
||||
let b:vimwiki_mathEnv = matchstr(class, '^%\zs\S\+\ze%')
|
||||
if b:vimwiki_mathEnv != ""
|
||||
call add(lines, substitute(class, '^%\(\S\+\)%','\\begin{\1}', ''))
|
||||
elseif class != ""
|
||||
call add(lines, "\\\[".class)
|
||||
else
|
||||
call add(lines, "\\\[")
|
||||
endif
|
||||
let math = [1, len(matchstr(a:line, '^\s*\ze{{\$'))]
|
||||
let processed = 1
|
||||
elseif math[0] && a:line =~ '^\s*}}\$\s*$'
|
||||
let math = [0, 0]
|
||||
if b:vimwiki_mathEnv != ""
|
||||
call add(lines, "\\end{".b:vimwiki_mathEnv."}")
|
||||
else
|
||||
call add(lines, "\\\]")
|
||||
endif
|
||||
let processed = 1
|
||||
elseif math[0]
|
||||
let processed = 1
|
||||
call add(lines, substitute(a:line, '^\s\{'.math[1].'}', '', ''))
|
||||
endif
|
||||
return [processed, lines, math]
|
||||
endfunction "}}}
|
||||
|
||||
function! s:process_tag_quote(line, quote) "{{{
|
||||
let lines = []
|
||||
let quote = a:quote
|
||||
@@ -800,7 +850,8 @@ function! s:process_tag_list(line, lists) "{{{
|
||||
if chk[1] =~ '[.*\\^$~]'
|
||||
let chk[1] ='\'.chk[1]
|
||||
endif
|
||||
let completion = match(g:vimwiki_listsyms, '\C' . chk[1])
|
||||
" let completion = match(g:vimwiki_listsyms, '\C' . chk[1])
|
||||
let completion = s:get_completion_index(chk[1])
|
||||
if completion >= 0 && completion <=4
|
||||
let st_tag = '<li class="done'.completion.'">'
|
||||
endif
|
||||
@@ -935,18 +986,9 @@ function! s:process_tag_h(line, id) "{{{
|
||||
let h_level = 0
|
||||
let h_text = ''
|
||||
let h_id = ''
|
||||
if a:line =~ g:vimwiki_rxH6
|
||||
let h_level = 6
|
||||
elseif a:line =~ g:vimwiki_rxH5
|
||||
let h_level = 5
|
||||
elseif a:line =~ g:vimwiki_rxH4
|
||||
let h_level = 4
|
||||
elseif a:line =~ g:vimwiki_rxH3
|
||||
let h_level = 3
|
||||
elseif a:line =~ g:vimwiki_rxH2
|
||||
let h_level = 2
|
||||
elseif a:line =~ g:vimwiki_rxH1
|
||||
let h_level = 1
|
||||
|
||||
if a:line =~ g:vimwiki_rxHeader
|
||||
let h_level = vimwiki#u#count_first_sym(a:line)
|
||||
endif
|
||||
if h_level > 0
|
||||
let a:id[h_level] += 1
|
||||
@@ -960,8 +1002,6 @@ function! s:process_tag_h(line, id) "{{{
|
||||
let centered = 1
|
||||
endif
|
||||
|
||||
let line = s:trim(line)
|
||||
|
||||
let h_number = ''
|
||||
for l in range(1, h_level-1)
|
||||
let h_number .= a:id[l].'.'
|
||||
@@ -978,7 +1018,8 @@ function! s:process_tag_h(line, id) "{{{
|
||||
let h_part .= '>'
|
||||
endif
|
||||
|
||||
let h_text = s:trim(strpart(line, h_level, len(line) - h_level * 2))
|
||||
let h_text = vimwiki#u#trim(matchstr(line, g:vimwiki_rxHeader))
|
||||
|
||||
if g:vimwiki_html_header_numbering
|
||||
let num = matchstr(h_number,
|
||||
\ '^\(\d.\)\{'.(g:vimwiki_html_header_numbering-1).'}\zs.*')
|
||||
@@ -1046,14 +1087,15 @@ function! s:process_tag_table(line, table) "{{{
|
||||
let lines = []
|
||||
let processed = 0
|
||||
|
||||
if a:line =~ '^\s*|[-+]\+|\s*$'
|
||||
if vimwiki#tbl#is_separator(a:line)
|
||||
call extend(table, s:table_add_row(a:table, a:line))
|
||||
let processed = 1
|
||||
elseif a:line =~ '^\s*|.\+|\s*$'
|
||||
elseif vimwiki#tbl#is_table(a:line)
|
||||
call extend(table, s:table_add_row(a:table, a:line))
|
||||
|
||||
let processed = 1
|
||||
let cells = split(a:line, '\s*|\s*', 1)[1: -2]
|
||||
" let cells = split(a:line, vimwiki#tbl#cell_splitter(), 1)[1: -2]
|
||||
let cells = vimwiki#tbl#get_cells(a:line)
|
||||
call map(cells, 's:table_empty_cell(v:val)')
|
||||
call extend(table[-1], cells)
|
||||
else
|
||||
@@ -1072,6 +1114,7 @@ function! s:parse_line(line, state) " {{{
|
||||
let state.para = a:state.para
|
||||
let state.quote = a:state.quote
|
||||
let state.pre = a:state.pre[:]
|
||||
let state.math = a:state.math[:]
|
||||
let state.table = a:state.table[:]
|
||||
let state.lists = a:state.lists[:]
|
||||
let state.deflist = a:state.deflist
|
||||
@@ -1135,6 +1178,9 @@ function! s:parse_line(line, state) " {{{
|
||||
" if processed && len(state.lists)
|
||||
" call s:close_tag_list(state.lists, lines)
|
||||
" endif
|
||||
if !processed
|
||||
let [processed, lines, state.math] = s:process_tag_math(line, state.math)
|
||||
endif
|
||||
if processed && len(state.table)
|
||||
let state.table = s:close_tag_table(state.table, lines)
|
||||
endif
|
||||
@@ -1160,6 +1206,9 @@ function! s:parse_line(line, state) " {{{
|
||||
if processed && state.pre[0]
|
||||
let state.pre = s:close_tag_pre(state.pre, lines)
|
||||
endif
|
||||
if processed && state.math[0]
|
||||
let state.math = s:close_tag_math(state.math, lines)
|
||||
endif
|
||||
if processed && len(state.table)
|
||||
let state.table = s:close_tag_table(state.table, lines)
|
||||
endif
|
||||
@@ -1183,6 +1232,7 @@ function! s:parse_line(line, state) " {{{
|
||||
call s:close_tag_list(state.lists, res_lines)
|
||||
let state.table = s:close_tag_table(state.table, res_lines)
|
||||
let state.pre = s:close_tag_pre(state.pre, res_lines)
|
||||
let state.math = s:close_tag_math(state.math, res_lines)
|
||||
let state.quote = s:close_tag_quote(state.quote, res_lines)
|
||||
let state.para = s:close_tag_para(state.para, res_lines)
|
||||
|
||||
@@ -1218,6 +1268,9 @@ function! s:parse_line(line, state) " {{{
|
||||
if processed && state.pre[0]
|
||||
let state.pre = s:close_tag_pre(state.pre, lines)
|
||||
endif
|
||||
if processed && state.math[0]
|
||||
let state.math = s:close_tag_math(state.math, lines)
|
||||
endif
|
||||
if processed && state.para
|
||||
let state.para = s:close_tag_para(state.para, lines)
|
||||
endif
|
||||
@@ -1235,6 +1288,7 @@ function! s:parse_line(line, state) " {{{
|
||||
call s:close_tag_list(state.lists, res_lines)
|
||||
let state.table = s:close_tag_table(state.table, res_lines)
|
||||
let state.pre = s:close_tag_pre(state.pre, res_lines)
|
||||
let state.math = s:close_tag_math(state.math, res_lines)
|
||||
call add(res_lines, line)
|
||||
endif
|
||||
endif
|
||||
@@ -1262,6 +1316,9 @@ function! s:parse_line(line, state) " {{{
|
||||
if processed && state.pre[0]
|
||||
let state.pre = s:close_tag_pre(state.pre, res_lines)
|
||||
endif
|
||||
if processed && state.math[0]
|
||||
let state.math = s:close_tag_math(state.math, res_lines)
|
||||
endif
|
||||
if processed && len(state.table)
|
||||
let state.table = s:close_tag_table(state.table, res_lines)
|
||||
endif
|
||||
@@ -1281,25 +1338,48 @@ function! s:parse_line(line, state) " {{{
|
||||
|
||||
endfunction " }}}
|
||||
|
||||
function! vimwiki#html#Wiki2HTML(path, wikifile) "{{{
|
||||
function! s:use_custom_wiki2html() "{{{
|
||||
let custom_wiki2html = VimwikiGet('custom_wiki2html')
|
||||
return !empty(custom_wiki2html) && s:file_exists(custom_wiki2html)
|
||||
endfunction " }}}
|
||||
|
||||
function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{
|
||||
call vimwiki#base#mkdir(a:path)
|
||||
execute '!'.VimwikiGet('custom_wiki2html'). ' '
|
||||
\ a:force. ' '.
|
||||
\ VimwikiGet('syntax'). ' '.
|
||||
\ strpart(VimwikiGet('ext'), 1). ' '.
|
||||
\ a:path. ' '.
|
||||
\ a:wikifile. ' '.
|
||||
\ s:default_CSS_full_name(a:path)
|
||||
endfunction " }}}
|
||||
|
||||
function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
|
||||
|
||||
let starttime = reltime() " start the clock
|
||||
echo 'Generating HTML ... '
|
||||
if !s:syntax_supported()
|
||||
echomsg 'vimwiki: Only vimwiki_default syntax supported!!!'
|
||||
return
|
||||
endif
|
||||
|
||||
let done = 0
|
||||
|
||||
let wikifile = fnamemodify(a:wikifile, ":p")
|
||||
let subdir = vimwiki#base#subdir(VimwikiGet('path'), wikifile)
|
||||
|
||||
let path = expand(a:path).subdir
|
||||
let path_html = expand(a:path_html).VimwikiGet('subdir')
|
||||
let htmlfile = fnamemodify(wikifile, ":t:r").'.html'
|
||||
|
||||
if s:use_custom_wiki2html()
|
||||
let force = 1
|
||||
call vimwiki#html#CustomWiki2HTML(path_html, wikifile, force)
|
||||
let done = 1
|
||||
endif
|
||||
|
||||
if s:syntax_supported() && done == 0
|
||||
let lsource = readfile(wikifile)
|
||||
let ldest = []
|
||||
|
||||
call vimwiki#base#mkdir(path)
|
||||
"if g:vimwiki_debug
|
||||
" echo 'Generating HTML ... '
|
||||
"endif
|
||||
|
||||
call vimwiki#base#mkdir(path_html)
|
||||
|
||||
" nohtml placeholder -- to skip html generation.
|
||||
let nohtml = 0
|
||||
@@ -1315,6 +1395,7 @@ function! vimwiki#html#Wiki2HTML(path, wikifile) "{{{
|
||||
let state.para = 0
|
||||
let state.quote = 0
|
||||
let state.pre = [0, 0] " [in_pre, indent_pre]
|
||||
let state.math = [0, 0] " [in_math, indent_math]
|
||||
let state.table = []
|
||||
let state.deflist = 0
|
||||
let state.lists = []
|
||||
@@ -1322,6 +1403,15 @@ function! vimwiki#html#Wiki2HTML(path, wikifile) "{{{
|
||||
let state.toc = []
|
||||
let state.toc_id = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0 }
|
||||
|
||||
" prepare constants for s:safe_html()
|
||||
let s:lt_pattern = '<'
|
||||
let s:gt_pattern = '>'
|
||||
if g:vimwiki_valid_html_tags != ''
|
||||
let tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
let s:lt_pattern = '<\%(/\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!'
|
||||
let s:gt_pattern = '\%(</\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>'
|
||||
endif
|
||||
|
||||
for line in lsource
|
||||
let oldquote = state.quote
|
||||
let [lines, state] = s:parse_line(line, state)
|
||||
@@ -1364,6 +1454,7 @@ function! vimwiki#html#Wiki2HTML(path, wikifile) "{{{
|
||||
call s:close_tag_quote(state.quote, lines)
|
||||
call s:close_tag_para(state.para, lines)
|
||||
call s:close_tag_pre(state.pre, lines)
|
||||
call s:close_tag_math(state.math, lines)
|
||||
call s:close_tag_list(state.lists, lines)
|
||||
call s:close_tag_def_list(state.deflist, lines)
|
||||
call s:close_tag_table(state.table, lines)
|
||||
@@ -1376,7 +1467,7 @@ function! vimwiki#html#Wiki2HTML(path, wikifile) "{{{
|
||||
" processing template variables (refactor to a function)
|
||||
call map(html_lines, 'substitute(v:val, "%title%", "'. title .'", "g")')
|
||||
call map(html_lines, 'substitute(v:val, "%root_path%", "'.
|
||||
\ s:root_path(subdir) .'", "g")')
|
||||
\ s:root_path(VimwikiGet('subdir')) .'", "g")')
|
||||
|
||||
let css_name = expand(VimwikiGet('css_name'))
|
||||
let css_name = substitute(css_name, '\', '/', 'g')
|
||||
@@ -1391,18 +1482,30 @@ function! vimwiki#html#Wiki2HTML(path, wikifile) "{{{
|
||||
let html_lines = s:html_insert_contents(html_lines, ldest) " %contents%
|
||||
|
||||
"" make html file.
|
||||
call writefile(html_lines, path.htmlfile)
|
||||
call writefile(html_lines, path_html.htmlfile)
|
||||
let done = 1
|
||||
|
||||
" measure the elapsed time and cut away miliseconds and smaller
|
||||
let elapsedtimestr = matchstr(reltimestr(reltime(starttime)),'\d\+\(\.\d\d\)\=')
|
||||
echon "\r".htmlfile.' written (time: '.elapsedtimestr.'s)'
|
||||
return path.htmlfile
|
||||
endif
|
||||
|
||||
if done == 0
|
||||
echomsg 'vimwiki: conversion to HTML is not supported for this syntax!!!'
|
||||
return
|
||||
endif
|
||||
|
||||
" measure the elapsed time
|
||||
let time1 = vimwiki#u#time(starttime) "XXX
|
||||
call VimwikiLog_extend('html',[htmlfile,time1])
|
||||
"if g:vimwiki_debug
|
||||
" echon "\r".htmlfile.' written (time: '.time1.'s)'
|
||||
"endif
|
||||
|
||||
return path_html.htmlfile
|
||||
endfunction "}}}
|
||||
|
||||
|
||||
function! vimwiki#html#WikiAll2HTML(path) "{{{
|
||||
if !s:syntax_supported()
|
||||
echomsg 'vimwiki: Only vimwiki_default syntax supported!!!'
|
||||
function! vimwiki#html#WikiAll2HTML(path_html) "{{{
|
||||
if !s:syntax_supported() && !s:use_custom_wiki2html()
|
||||
echomsg 'vimwiki: conversion to HTML is not supported for this syntax!!!'
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -1414,28 +1517,63 @@ function! vimwiki#html#WikiAll2HTML(path) "{{{
|
||||
exe 'buffer '.cur_buf
|
||||
let &eventignore = save_eventignore
|
||||
|
||||
let path = expand(a:path)
|
||||
call vimwiki#base#mkdir(path)
|
||||
let path_html = expand(a:path_html)
|
||||
call vimwiki#base#mkdir(path_html)
|
||||
|
||||
echomsg 'Deleting non-wiki html files...'
|
||||
call s:delete_html_files(path)
|
||||
call s:delete_html_files(path_html)
|
||||
|
||||
echomsg 'Converting wiki to html files...'
|
||||
let setting_more = &more
|
||||
setlocal nomore
|
||||
|
||||
" temporarily adjust current_subdir global state variable
|
||||
let current_subdir = VimwikiGet('subdir')
|
||||
let current_invsubdir = VimwikiGet('invsubdir')
|
||||
|
||||
let wikifiles = split(glob(VimwikiGet('path').'**/*'.VimwikiGet('ext')), '\n')
|
||||
for wikifile in wikifiles
|
||||
let wikifile = fnamemodify(wikifile, ":p")
|
||||
|
||||
" temporarily adjust 'subdir' and 'invsubdir' state variables
|
||||
let subdir = vimwiki#base#subdir(VimwikiGet('path'), wikifile)
|
||||
call VimwikiSet('subdir', subdir)
|
||||
call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir))
|
||||
|
||||
if !s:is_html_uptodate(wikifile)
|
||||
echomsg 'Processing '.wikifile
|
||||
call vimwiki#html#Wiki2HTML(path, wikifile)
|
||||
|
||||
call vimwiki#html#Wiki2HTML(path_html, wikifile)
|
||||
else
|
||||
echomsg 'Skipping '.wikifile
|
||||
endif
|
||||
endfor
|
||||
call s:create_default_CSS(path)
|
||||
" reset 'subdir' state variable
|
||||
call VimwikiSet('subdir', current_subdir)
|
||||
call VimwikiSet('invsubdir', current_invsubdir)
|
||||
|
||||
call s:create_default_CSS(path_html)
|
||||
echomsg 'Done!'
|
||||
|
||||
let &more = setting_more
|
||||
endfunction "}}}
|
||||
|
||||
function! s:file_exists(fname) "{{{
|
||||
return !empty(getftype(a:fname))
|
||||
endfunction "}}}
|
||||
|
||||
" uses VimwikiGet('path')
|
||||
function! vimwiki#html#get_wikifile_url(wikifile) "{{{
|
||||
return VimwikiGet('path_html').
|
||||
\ vimwiki#base#subdir(VimwikiGet('path'), a:wikifile).
|
||||
\ fnamemodify(a:wikifile, ":t:r").'.html'
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#html#PasteUrl(wikifile) "{{{
|
||||
execute 'r !echo file://'.vimwiki#html#get_wikifile_url(a:wikifile)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#html#CatUrl(wikifile) "{{{
|
||||
execute '!echo file://'.vimwiki#html#get_wikifile_url(a:wikifile)
|
||||
endfunction "}}}
|
||||
"}}}
|
||||
@@ -15,24 +15,36 @@ let s:rx_li_box = '\[.\?\]'
|
||||
|
||||
" Script functions {{{
|
||||
|
||||
" Get unicode string symbol at index
|
||||
function! s:str_idx(str, idx) "{{{
|
||||
" Unfortunatly vimscript cannot get symbol at index in unicode string such as
|
||||
" '✗○◐●✓'
|
||||
return matchstr(a:str, '\%'.a:idx.'v.')
|
||||
endfunction "}}}
|
||||
|
||||
" Get checkbox regexp
|
||||
function! s:rx_li_symbol(rate) "{{{
|
||||
let result = ''
|
||||
if a:rate == 100
|
||||
let result = g:vimwiki_listsyms[4]
|
||||
let result = s:str_idx(g:vimwiki_listsyms, 5)
|
||||
elseif a:rate == 0
|
||||
let result = g:vimwiki_listsyms[0]
|
||||
let result = s:str_idx(g:vimwiki_listsyms, 1)
|
||||
elseif a:rate >= 67
|
||||
let result = g:vimwiki_listsyms[3]
|
||||
let result = s:str_idx(g:vimwiki_listsyms, 4)
|
||||
elseif a:rate >= 34
|
||||
let result = g:vimwiki_listsyms[2]
|
||||
let result = s:str_idx(g:vimwiki_listsyms, 3)
|
||||
else
|
||||
let result = g:vimwiki_listsyms[1]
|
||||
let result = s:str_idx(g:vimwiki_listsyms, 2)
|
||||
endif
|
||||
|
||||
return '\['.result.'\]'
|
||||
endfunction "}}}
|
||||
|
||||
" Get blank checkbox
|
||||
function! s:blank_checkbox() "{{{
|
||||
return '['.s:str_idx(g:vimwiki_listsyms, 1).'] '
|
||||
endfunction "}}}
|
||||
|
||||
" Get regexp of the list item.
|
||||
function! s:rx_list_item() "{{{
|
||||
return '\('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)'
|
||||
@@ -46,7 +58,7 @@ endfunction "}}}
|
||||
" Get level of the list item.
|
||||
function! s:get_level(lnum) "{{{
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
let level = vimwiki#base#count_first_sym(getline(a:lnum))
|
||||
let level = vimwiki#u#count_first_sym(getline(a:lnum))
|
||||
else
|
||||
let level = indent(a:lnum)
|
||||
endif
|
||||
@@ -222,7 +234,7 @@ function! s:create_cb_list_item(lnum) "{{{
|
||||
let m = matchstr(line, s:rx_list_item())
|
||||
if m != ''
|
||||
let li_content = substitute(strpart(line, len(m)), '^\s*', '', '')
|
||||
let line = substitute(m, '\s*$', ' ', '').'[ ] '.li_content
|
||||
let line = substitute(m, '\s*$', ' ', '').s:blank_checkbox().li_content
|
||||
call setline(a:lnum, line)
|
||||
endif
|
||||
endfunction "}}}
|
||||
@@ -320,7 +332,7 @@ function! vimwiki#lst#kbd_cr() "{{{
|
||||
" This function is heavily relies on proper 'set comments' option.
|
||||
let cr = "\<CR>"
|
||||
if getline('.') =~ s:rx_cb_list_item()
|
||||
let cr .= '[ ] '
|
||||
let cr .= s:blank_checkbox()
|
||||
endif
|
||||
return cr
|
||||
endfunction "}}}
|
||||
@@ -341,11 +353,10 @@ function! vimwiki#lst#kbd_oO(cmd) "{{{
|
||||
let lnum = line('.')
|
||||
endif
|
||||
|
||||
" let line = substitute(m, '\s*$', ' ', '').'[ ] '.li_content
|
||||
let m = matchstr(line, s:rx_list_item())
|
||||
let res = ''
|
||||
if line =~ s:rx_cb_list_item()
|
||||
let res = substitute(m, '\s*$', ' ', '').'[ ] '
|
||||
let res = substitute(m, '\s*$', ' ', '').s:blank_checkbox()
|
||||
elseif line =~ s:rx_list_item()
|
||||
let res = substitute(m, '\s*$', ' ', '')
|
||||
elseif &autoindent || &smartindent
|
||||
@@ -367,3 +378,178 @@ function! vimwiki#lst#kbd_oO(cmd) "{{{
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#lst#default_symbol() "{{{
|
||||
" TODO: initialize default symbol from syntax/vimwiki_xxx.vim
|
||||
if VimwikiGet('syntax') == 'default'
|
||||
return '-'
|
||||
else
|
||||
return '*'
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function vimwiki#lst#get_list_margin() "{{{
|
||||
if VimwikiGet('list_margin') < 0
|
||||
return &sw
|
||||
else
|
||||
return VimwikiGet('list_margin')
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function s:get_list_sw() "{{{
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
return 1
|
||||
else
|
||||
return &sw
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function s:get_list_nesting_level(lnum) "{{{
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
if getline(a:lnum) !~ s:rx_list_item()
|
||||
let level = 0
|
||||
else
|
||||
let level = vimwiki#u#count_first_sym(getline(a:lnum)) - 1
|
||||
let level = level < 0 ? 0 : level
|
||||
endif
|
||||
else
|
||||
let level = indent(a:lnum)
|
||||
endif
|
||||
return level
|
||||
endfunction "}}}
|
||||
|
||||
function s:get_list_indent(lnum) "{{{
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
return indent(a:lnum)
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:compose_list_item(n_indent, n_nesting, sym_nest, sym_bullet, li_content, ...) "{{{
|
||||
if a:0
|
||||
let sep = a:1
|
||||
else
|
||||
let sep = ''
|
||||
endif
|
||||
let li_indent = repeat(' ', max([0,a:n_indent])).sep
|
||||
let li_nesting = repeat(a:sym_nest, max([0,a:n_nesting])).sep
|
||||
if len(a:sym_bullet) > 0
|
||||
let li_bullet = a:sym_bullet.' '.sep
|
||||
else
|
||||
let li_bullet = ''.sep
|
||||
endif
|
||||
return li_indent.li_nesting.li_bullet.a:li_content
|
||||
endfunction "}}}
|
||||
|
||||
function s:compose_cb_bullet(prev_cb_bullet, sym) "{{{
|
||||
return a:sym.matchstr(a:prev_cb_bullet, '\S*\zs\s\+.*')
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#lst#change_level(...) "{{{
|
||||
let default_sym = vimwiki#lst#default_symbol()
|
||||
let cmd = '>>'
|
||||
let sym = default_sym
|
||||
|
||||
" parse argument
|
||||
if a:0
|
||||
if a:1 != '<<' && a:1 != '>>'
|
||||
let cmd = '--'
|
||||
let sym = a:1
|
||||
else
|
||||
let cmd = a:1
|
||||
endif
|
||||
endif
|
||||
" is symbol valid
|
||||
if sym.' ' !~ s:rx_cb_list_item() && sym.' ' !~ s:rx_list_item()
|
||||
return
|
||||
endif
|
||||
|
||||
" parsing setup
|
||||
let lnum = line('.')
|
||||
let line = getline('.')
|
||||
|
||||
let list_margin = vimwiki#lst#get_list_margin()
|
||||
let list_sw = s:get_list_sw()
|
||||
let n_nesting = s:get_list_nesting_level(lnum)
|
||||
let n_indent = s:get_list_indent(lnum)
|
||||
|
||||
" remove indent and nesting
|
||||
let li_bullet_and_content = strpart(line, n_nesting + n_indent)
|
||||
|
||||
" list bullet and checkbox
|
||||
let cb_bullet = matchstr(li_bullet_and_content, s:rx_list_item()).
|
||||
\ matchstr(li_bullet_and_content, s:rx_cb_list_item())
|
||||
|
||||
" XXX: it could be not unicode proof --> if checkboxes are set up with unicode syms
|
||||
" content
|
||||
let li_content = strpart(li_bullet_and_content, len(cb_bullet))
|
||||
|
||||
" trim
|
||||
let cb_bullet = vimwiki#u#trim(cb_bullet)
|
||||
let li_content = vimwiki#u#trim(li_content)
|
||||
|
||||
" nesting symbol
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
if len(cb_bullet) > 0
|
||||
let sym_nest = cb_bullet[0]
|
||||
else
|
||||
let sym_nest = sym
|
||||
endif
|
||||
else
|
||||
let sym_nest = ' '
|
||||
endif
|
||||
|
||||
if g:vimwiki_debug
|
||||
echomsg "PARSE: Sw [".list_sw."]"
|
||||
echomsg s:compose_list_item(n_indent, n_nesting, sym_nest, cb_bullet, li_content, '|')
|
||||
endif
|
||||
|
||||
" change level
|
||||
if cmd == '--'
|
||||
let cb_bullet = s:compose_cb_bullet(cb_bullet, sym)
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
let sym_nest = sym
|
||||
endif
|
||||
elseif cmd == '>>'
|
||||
if cb_bullet == ''
|
||||
let cb_bullet = sym
|
||||
else
|
||||
let n_nesting = n_nesting + list_sw
|
||||
endif
|
||||
elseif cmd == '<<'
|
||||
let n_nesting = n_nesting - list_sw
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
if n_nesting < 0
|
||||
let cb_bullet = ''
|
||||
endif
|
||||
else
|
||||
if n_nesting < list_margin
|
||||
let cb_bullet = ''
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
let n_nesting = max([0, n_nesting])
|
||||
|
||||
if g:vimwiki_debug
|
||||
echomsg "SHIFT:"
|
||||
echomsg s:compose_list_item(n_indent, n_nesting, sym_nest, cb_bullet, li_content, '|')
|
||||
endif
|
||||
|
||||
" XXX: this is the code that adds the initial indent
|
||||
let add_nesting = VimwikiGet('syntax') != 'media'
|
||||
if n_indent + n_nesting*(add_nesting) < list_margin
|
||||
let n_indent = list_margin - n_nesting*(add_nesting)
|
||||
endif
|
||||
|
||||
if g:vimwiki_debug
|
||||
echomsg "INDENT:"
|
||||
echomsg s:compose_list_item(n_indent, n_nesting, sym_nest, cb_bullet, li_content, '|')
|
||||
endif
|
||||
|
||||
let line = s:compose_list_item(n_indent, n_nesting, sym_nest, cb_bullet, li_content)
|
||||
|
||||
" replace
|
||||
call setline(lnum, line)
|
||||
call cursor(lnum, match(line, '\S') + 1)
|
||||
endfunction "}}}
|
||||
111
bundle/git_vimwiki/autoload/vimwiki/markdown_base.vim
Normal file
111
bundle/git_vimwiki/autoload/vimwiki/markdown_base.vim
Normal file
@@ -0,0 +1,111 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Desc: Link functions for markdown syntax
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
|
||||
function! s:normalize_link_syntax_n() " {{{
|
||||
let lnum = line('.')
|
||||
|
||||
" try WikiIncl
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiIncl)
|
||||
if !empty(lnk)
|
||||
" NO-OP !!
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WikiIncl: ".lnk." Sub: ".lnk
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
" try WikiLink0: replace with WikiLink1
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiLink0)
|
||||
if !empty(lnk)
|
||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||
\ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr,
|
||||
\ g:vimwiki_WikiLink1Template2)
|
||||
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink0, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WikiLink: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
" try WikiLink1: replace with WikiLink0
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiLink1)
|
||||
if !empty(lnk)
|
||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||
\ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr,
|
||||
\ g:vimwiki_WikiLinkTemplate2)
|
||||
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink1, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WikiLink: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
" try Weblink
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWeblink)
|
||||
if !empty(lnk)
|
||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||
\ g:vimwiki_rxWeblinkMatchUrl, g:vimwiki_rxWeblinkMatchDescr,
|
||||
\ g:vimwiki_Weblink1Template)
|
||||
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWeblink, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WebLink: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
" try Word (any characters except separators)
|
||||
" rxWord is less permissive than rxWikiLinkUrl which is used in
|
||||
" normalize_link_syntax_v
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWord)
|
||||
if !empty(lnk)
|
||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||
\ g:vimwiki_rxWord, '',
|
||||
\ g:vimwiki_WikiLinkTemplate1)
|
||||
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "Word: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
endfunction " }}}
|
||||
|
||||
function! s:normalize_link_syntax_v() " {{{
|
||||
let lnum = line('.')
|
||||
let sel_save = &selection
|
||||
let &selection = "old"
|
||||
let rv = @"
|
||||
let rt = getregtype('"')
|
||||
let done = 0
|
||||
|
||||
try
|
||||
norm! gvy
|
||||
let visual_selection = @"
|
||||
let visual_selection = substitute(g:vimwiki_WikiLinkTemplate1, '__LinkUrl__', '\='."'".visual_selection."'", '')
|
||||
|
||||
call setreg('"', visual_selection, 'v')
|
||||
|
||||
" paste result
|
||||
norm! `>pgvd
|
||||
|
||||
finally
|
||||
call setreg('"', rv, rt)
|
||||
let &selection = sel_save
|
||||
endtry
|
||||
|
||||
endfunction " }}}
|
||||
|
||||
" normalize_link
|
||||
function! vimwiki#markdown_base#normalize_link(is_visual_mode) "{{{
|
||||
if !a:is_visual_mode
|
||||
call s:normalize_link_syntax_n()
|
||||
elseif visualmode() ==# 'v' && line("'<") == line("'>")
|
||||
" action undefined for 'line-wise' or 'multi-line' visual mode selections
|
||||
call s:normalize_link_syntax_v()
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
79
bundle/git_vimwiki/autoload/vimwiki/style.css
Normal file
79
bundle/git_vimwiki/autoload/vimwiki/style.css
Normal file
@@ -0,0 +1,79 @@
|
||||
body {font-family: Tahoma, Geneva, sans-serif; margin: 1em 2em 1em 2em; font-size: 100%; line-height: 130%;}
|
||||
h1, h2, h3, h4, h5, h6 {font-family: Trebuchet MS, Helvetica, sans-serif; font-weight: bold; line-height:100%; margin-top: 1.5em; margin-bottom: 0.5em;}
|
||||
h1 {font-size: 2.6em; color: #000000;}
|
||||
h2 {font-size: 2.2em; color: #404040;}
|
||||
h3 {font-size: 1.8em; color: #707070;}
|
||||
h4 {font-size: 1.4em; color: #909090;}
|
||||
h5 {font-size: 1.3em; color: #989898;}
|
||||
h6 {font-size: 1.2em; color: #9c9c9c;}
|
||||
p, pre, blockquote, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;}
|
||||
ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;}
|
||||
li {margin: 0.3em auto;}
|
||||
ul {margin-left: 2em; padding-left: 0.5em;}
|
||||
dt {font-weight: bold;}
|
||||
img {border: none;}
|
||||
pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;}
|
||||
blockquote {padding: 0.4em; background-color: #f6f5eb;}
|
||||
th, td {border: 1px solid #ccc; padding: 0.3em;}
|
||||
th {background-color: #f0f0f0;}
|
||||
hr {border: none; border-top: 1px solid #ccc; width: 100%;}
|
||||
del {text-decoration: line-through; color: #777777;}
|
||||
.toc li {list-style-type: none;}
|
||||
.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;}
|
||||
.justleft {text-align: left;}
|
||||
.justright {text-align: right;}
|
||||
.justcenter {text-align: center;}
|
||||
.center {margin-left: auto; margin-right: auto;}
|
||||
|
||||
/* classes for items of todo lists */
|
||||
.done0 {
|
||||
/* list-style: none; */
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .2em;
|
||||
margin-left: -2em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
.done1 {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
margin-left: -2em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
.done2 {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
margin-left: -2em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
.done3 {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
margin-left: -2em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
.done4 {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAzgAAAM4BlP6ToAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIISURBVDiNnZQ9SFtRFMd/773kpTaGJoQk1im4VDpWQcTNODhkFBcVTCNCF0NWyeDiIIiCm82QoIMIUkHUxcFBg1SEQoZszSat6cdTn1qNue92CMbEr9Sey+XC/Z/zu+f8h6ukUil3sVg0+M+4cFxk42/jH2wAqqqKSCSiPQdwcHHAnDHH9s/tN1h8V28ETdP+eU8fT9Nt62ancYdIPvJNtsu87bmjrJlrTDVM4RROJs1JrHPrD4Bar7A6cpc54iKOaTdJXCUI2UMVrQZ0Js7YPN18ECKkYNQcJe/OE/4dZsw7VqNXQMvHy3QZXQypQ6ycrtwDjf8aJ+PNEDSCzLpn7+m2pD8ZKHlKarYhy6XjEoCYGcN95qansQeA3fNdki+SaJZGTMQIOoL3W/Z89rxv+tokubNajlvk/vm+LFpF2XnUKZHI0I+QrI7Dw0OZTqdzUkpsM7mZTyfy5OPGyw1tK7AFSvmB/Ks8w8YwbUYbe6/3QEKv0vugfxWPnMLJun+d/kI/WLdizpNjMbAIKrhMF4OuwadBALqqs+RfInwUvuNi+fBd+wjogfogAFVRmffO02q01mZZ0HHdgXIzdz0QQLPezIQygX6llxNKKgOFARYCC49CqhoHIUTlss/Vx2phlYwjw8j1CAlfAiwQiJpiy7o1VHnsG5FISkoJu7Q/2YmmaV+i0ei7v38L2CBguSi5AAAAAElFTkSuQmCC);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
margin-left: -2em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;
|
||||
-webkit-border-radius: 1px;
|
||||
-moz-border-radius: 1px;
|
||||
border-radius: 1px;
|
||||
-moz-background-clip: padding;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
padding: 0px 3px;
|
||||
display: inline-block;
|
||||
color: #52595d;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
" Vimwiki autoload plugin file
|
||||
" Desc: Tables
|
||||
" | Easily | manageable | text | tables | ! |
|
||||
" |--------+------------+-------+--------+---------|
|
||||
" |--------|------------|-------|--------|---------|
|
||||
" | Have | fun! | Drink | tea | Period. |
|
||||
"
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
@@ -16,6 +16,8 @@ let g:loaded_vimwiki_tbl_auto = 1
|
||||
"}}}
|
||||
|
||||
let s:textwidth = &tw
|
||||
let s:rxSep = g:vimwiki_rxTableSep
|
||||
|
||||
|
||||
" Misc functions {{{
|
||||
function! s:wide_len(str) "{{{
|
||||
@@ -40,21 +42,37 @@ function! s:wide_len(str) "{{{
|
||||
return ret
|
||||
endfunction "}}}
|
||||
|
||||
function! s:cell_splitter() "{{{
|
||||
return '\s*'.s:rxSep.'\s*'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:sep_splitter() "{{{
|
||||
return '-'.s:rxSep.'-'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_table(line) "{{{
|
||||
return a:line =~ '^\s*\%(|[^|]\+\)\+|\s*$' || s:is_separator(a:line)
|
||||
return s:is_separator(a:line) || (a:line !~ s:rxSep.s:rxSep && a:line =~ '^\s*'.s:rxSep.'.\+'.s:rxSep.'\s*$')
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_separator(line) "{{{
|
||||
return a:line =~ '^\s*[|+]\s*--[-|+]\+'
|
||||
return a:line =~ '^\s*'.s:rxSep.'\(--\+'.s:rxSep.'\)\+\s*$'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_separator_tail(line) "{{{
|
||||
return a:line =~ '^\{-1}\%(\s*\|-*\)\%('.s:rxSep.'-\+\)\+'.s:rxSep.'\s*$'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_last_column(lnum, cnum) "{{{
|
||||
return strpart(getline(a:lnum), a:cnum - 1) =~ '^[^|]*|\s*$'
|
||||
let line = strpart(getline(a:lnum), a:cnum - 1)
|
||||
"echomsg "DEBUG is_last_column> ".(line =~ s:rxSep.'\s*$' && line !~ s:rxSep.'.*'.s:rxSep.'\s*$')
|
||||
return line =~ s:rxSep.'\s*$' && line !~ s:rxSep.'.*'.s:rxSep.'\s*$'
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_first_column(lnum, cnum) "{{{
|
||||
let line = strpart(getline(a:lnum), 0, a:cnum - 1)
|
||||
return line =~ '^\s*|[^|]*$' || line =~ '^\s*$'
|
||||
"echomsg "DEBUG is_first_column> ".(line =~ '^\s*'.s:rxSep && line !~ '^\s*'.s:rxSep.'.*'.s:rxSep)
|
||||
return line =~ '^\s*$' || (line =~ '^\s*'.s:rxSep && line !~ '^\s*'.s:rxSep.'.*'.s:rxSep)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:count_separators_up(lnum) "{{{
|
||||
@@ -82,11 +100,10 @@ function! s:count_separators_down(lnum) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:create_empty_row(cols) "{{{
|
||||
let first_cell = "| |"
|
||||
let cell = " |"
|
||||
let row = first_cell
|
||||
let row = s:rxSep
|
||||
let cell = " ".s:rxSep
|
||||
|
||||
for c in range(a:cols - 1)
|
||||
for c in range(a:cols)
|
||||
let row .= cell
|
||||
endfor
|
||||
|
||||
@@ -94,36 +111,71 @@ function! s:create_empty_row(cols) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:create_row_sep(cols) "{{{
|
||||
let first_cell = "|---+"
|
||||
let cell = "---+"
|
||||
let last_cell = "---|"
|
||||
let row = s:rxSep
|
||||
let cell = "---".s:rxSep
|
||||
|
||||
if a:cols < 2
|
||||
return "|---|"
|
||||
endif
|
||||
|
||||
let row = first_cell
|
||||
|
||||
for c in range(a:cols - 2)
|
||||
for c in range(a:cols)
|
||||
let row .= cell
|
||||
endfor
|
||||
|
||||
let row .= last_cell
|
||||
|
||||
return row
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_values(line) "{{{
|
||||
return split(a:line, '\s*|\s*', 1)[1:-2]
|
||||
function! vimwiki#tbl#get_cells(line) "{{{
|
||||
let result = []
|
||||
let cell = ''
|
||||
let quote = ''
|
||||
let state = 'NONE'
|
||||
|
||||
" 'Simple' FSM
|
||||
for idx in range(strlen(a:line))
|
||||
" The only way I know Vim can do Unicode...
|
||||
let ch = a:line[idx]
|
||||
if state == 'NONE'
|
||||
if ch == '|'
|
||||
let state = 'CELL'
|
||||
endif
|
||||
elseif state == 'CELL'
|
||||
if ch == '[' || ch == '{'
|
||||
let state = 'BEFORE_QUOTE_START'
|
||||
let quote = ch
|
||||
elseif ch == '|'
|
||||
call add(result, vimwiki#u#trim(cell))
|
||||
let cell = ""
|
||||
else
|
||||
let cell .= ch
|
||||
endif
|
||||
elseif state == 'BEFORE_QUOTE_START'
|
||||
if ch == '[' || ch == '{'
|
||||
let state = 'QUOTE'
|
||||
let quote .= ch
|
||||
else
|
||||
let state = 'CELL'
|
||||
let cell .= quote.ch
|
||||
let quote = ''
|
||||
endif
|
||||
elseif state == 'QUOTE'
|
||||
if ch == ']' || ch == '}'
|
||||
let state = 'BEFORE_QUOTE_END'
|
||||
endif
|
||||
let quote .= ch
|
||||
elseif state == 'BEFORE_QUOTE_END'
|
||||
if ch == ']' || ch == '}'
|
||||
let state = 'CELL'
|
||||
endif
|
||||
let cell .= quote.ch
|
||||
let quote = ''
|
||||
endif
|
||||
endfor
|
||||
|
||||
if cell.quote != ''
|
||||
call add(result, vimwiki#u#trim(cell.quote, '|'))
|
||||
endif
|
||||
return result
|
||||
endfunction "}}}
|
||||
|
||||
function! s:col_count(lnum) "{{{
|
||||
let line = getline(a:lnum)
|
||||
if !s:is_separator(line)
|
||||
return len(split(line, '\s*|\s*', 1)[1:-2])
|
||||
else
|
||||
return len(split(line, '-+-', 1))
|
||||
endif
|
||||
return len(vimwiki#tbl#get_cells(getline(a:lnum)))
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_indent(lnum) "{{{
|
||||
@@ -155,7 +207,7 @@ function! s:get_rows(lnum) "{{{
|
||||
let lower_rows = []
|
||||
|
||||
let lnum = a:lnum - 1
|
||||
while lnum > 1
|
||||
while lnum >= 1
|
||||
let line = getline(lnum)
|
||||
if s:is_table(line)
|
||||
call add(upper_rows, [lnum, line])
|
||||
@@ -186,7 +238,7 @@ function! s:get_cell_max_lens(lnum) "{{{
|
||||
if s:is_separator(row)
|
||||
continue
|
||||
endif
|
||||
let cells = s:get_values(row)
|
||||
let cells = vimwiki#tbl#get_cells(row)
|
||||
for idx in range(len(cells))
|
||||
let value = cells[idx]
|
||||
if has_key(max_lens, idx)
|
||||
@@ -219,17 +271,13 @@ function! s:cur_column() "{{{
|
||||
if !s:is_table(line)
|
||||
return -1
|
||||
endif
|
||||
if s:is_separator(line)
|
||||
let sep = '[+|]'
|
||||
else
|
||||
let sep = '|'
|
||||
endif
|
||||
" TODO: do we need conditional: if s:is_separator(line)
|
||||
|
||||
let curs_pos = col('.')
|
||||
let mpos = match(line, '|', 0)
|
||||
let mpos = match(line, s:rxSep, 0)
|
||||
let col = -1
|
||||
while mpos < curs_pos && mpos != -1
|
||||
let mpos = match(line, sep, mpos+1)
|
||||
let mpos = match(line, s:rxSep, mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
endif
|
||||
@@ -253,8 +301,8 @@ function! s:fmt_cell(cell, max_len) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:fmt_row(line, max_lens, col1, col2) "{{{
|
||||
let new_line = '|'
|
||||
let cells = s:get_values(a:line)
|
||||
let new_line = s:rxSep
|
||||
let cells = vimwiki#tbl#get_cells(a:line)
|
||||
for idx in range(len(cells))
|
||||
if idx == a:col1
|
||||
let idx = a:col2
|
||||
@@ -262,12 +310,12 @@ function! s:fmt_row(line, max_lens, col1, col2) "{{{
|
||||
let idx = a:col1
|
||||
endif
|
||||
let value = cells[idx]
|
||||
let new_line .= s:fmt_cell(value, a:max_lens[idx]).'|'
|
||||
let new_line .= s:fmt_cell(value, a:max_lens[idx]).s:rxSep
|
||||
endfor
|
||||
|
||||
let idx = len(cells)
|
||||
while idx < len(a:max_lens)
|
||||
let new_line .= s:fmt_cell('', a:max_lens[idx]).'|'
|
||||
let new_line .= s:fmt_cell('', a:max_lens[idx]).s:rxSep
|
||||
let idx += 1
|
||||
endwhile
|
||||
return new_line
|
||||
@@ -282,17 +330,16 @@ function! s:fmt_cell_sep(max_len) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:fmt_sep(max_lens, col1, col2) "{{{
|
||||
let sep = '|'
|
||||
let new_line = s:rxSep
|
||||
for idx in range(len(a:max_lens))
|
||||
if idx == a:col1
|
||||
let idx = a:col2
|
||||
elseif idx == a:col2
|
||||
let idx = a:col1
|
||||
endif
|
||||
let sep .= s:fmt_cell_sep(a:max_lens[idx]).'+'
|
||||
let new_line .= s:fmt_cell_sep(a:max_lens[idx]).s:rxSep
|
||||
endfor
|
||||
let sep = substitute(sep, '+$', '|', '')
|
||||
return sep
|
||||
return new_line
|
||||
endfunction "}}}
|
||||
"}}}
|
||||
|
||||
@@ -300,41 +347,94 @@ endfunction "}}}
|
||||
function! s:kbd_create_new_row(cols, goto_first) "{{{
|
||||
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
|
||||
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
|
||||
let cmd .= "\<ESC>0"
|
||||
if a:goto_first
|
||||
let cmd .= "\<ESC>0:call search('|', 'c', line('.'))\<CR>la"
|
||||
let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'c', line('.'))\<CR>"
|
||||
else
|
||||
let cmd .= "0".(col('.')-1)."lT|a"
|
||||
let cmd .= (col('.')-1)."l"
|
||||
let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
endif
|
||||
let cmd .= "a"
|
||||
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_next_row() "{{{
|
||||
let cmd = "\<ESC>jt|T|a"
|
||||
let cmd = "\<ESC>j"
|
||||
let cmd .= ":call search('.\\(".s:rxSep."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= "a"
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_prev_row() "{{{
|
||||
let cmd = "\<ESC>jt|T|a"
|
||||
let cmd = "\<ESC>k"
|
||||
let cmd .= ":call search('.\\(".s:rxSep."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= "a"
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_next_col(last) "{{{
|
||||
if a:last
|
||||
" Used in s:kbd_goto_next_col
|
||||
function! vimwiki#tbl#goto_next_col() "{{{
|
||||
let curcol = virtcol('.')
|
||||
let lnum = line('.')
|
||||
let newcol = s:get_indent(lnum)
|
||||
let max_lens = s:get_cell_max_lens(lnum)
|
||||
for cell_len in values(max_lens)
|
||||
if newcol >= curcol-1
|
||||
break
|
||||
endif
|
||||
let newcol += cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
|
||||
endfor
|
||||
let newcol += 2 " +2 == 1 separator + 1 space |<space
|
||||
call vimwiki#u#cursor(lnum, newcol)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_next_col(jumpdown) "{{{
|
||||
let cmd = "\<ESC>"
|
||||
if a:jumpdown
|
||||
let seps = s:count_separators_down(line('.'))
|
||||
let cmd = "\<ESC>".seps."j0:call search('|', 'c', line('.'))\<CR>la"
|
||||
else
|
||||
let cmd = "\<ESC>:call search('|', 'c', line('.'))\<CR>la"
|
||||
let cmd .= seps."j0"
|
||||
endif
|
||||
let cmd .= ":call vimwiki#tbl#goto_next_col()\<CR>a"
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_prev_col(first) "{{{
|
||||
if a:first
|
||||
let seps = s:count_separators_up(line('.'))
|
||||
let cmd = "\<ESC>".seps."k$:call search('|', 'b', line('.'))\<CR>la"
|
||||
else
|
||||
let cmd = "\<ESC>2F|la"
|
||||
" Used in s:kbd_goto_prev_col
|
||||
function! vimwiki#tbl#goto_prev_col() "{{{
|
||||
let curcol = virtcol('.')
|
||||
let lnum = line('.')
|
||||
let newcol = s:get_indent(lnum)
|
||||
let max_lens = s:get_cell_max_lens(lnum)
|
||||
let prev_cell_len = 0
|
||||
echom string(max_lens)
|
||||
for cell_len in values(max_lens)
|
||||
let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
|
||||
if newcol + delta > curcol-1
|
||||
let newcol -= (prev_cell_len + 3) " +3 == 2 spaces + 1 separator |<space>...<space>
|
||||
break
|
||||
elseif newcol + delta == curcol-1
|
||||
break
|
||||
endif
|
||||
let prev_cell_len = cell_len
|
||||
let newcol += delta
|
||||
endfor
|
||||
let newcol += 2 " +2 == 1 separator + 1 space |<space
|
||||
call vimwiki#u#cursor(lnum, newcol)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_prev_col(jumpup) "{{{
|
||||
let cmd = "\<ESC>"
|
||||
if a:jumpup
|
||||
let seps = s:count_separators_up(line('.'))
|
||||
let cmd .= seps."k"
|
||||
let cmd .= "$"
|
||||
endif
|
||||
let cmd .= ":call vimwiki#tbl#goto_prev_col()\<CR>a"
|
||||
" let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'b', line('.'))\<CR>"
|
||||
" let cmd .= "a"
|
||||
"echomsg "DEBUG kbd_goto_prev_col> ".cmd
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
|
||||
@@ -348,7 +448,7 @@ function! vimwiki#tbl#kbd_cr() "{{{
|
||||
endif
|
||||
|
||||
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
|
||||
let cols = len(s:get_values(getline(lnum)))
|
||||
let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
|
||||
return s:kbd_create_new_row(cols, 0)
|
||||
else
|
||||
return s:kbd_goto_next_row()
|
||||
@@ -362,11 +462,13 @@ function! vimwiki#tbl#kbd_tab() "{{{
|
||||
endif
|
||||
|
||||
let last = s:is_last_column(lnum, col('.'))
|
||||
if last && !s:is_table(getline(lnum+1))
|
||||
let cols = len(s:get_values(getline(lnum)))
|
||||
let is_sep = s:is_separator_tail(getline(lnum))
|
||||
"echomsg "DEBUG kbd_tab> last=".last.", is_sep=".is_sep
|
||||
if (is_sep || last) && !s:is_table(getline(lnum+1))
|
||||
let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
|
||||
return s:kbd_create_new_row(cols, 1)
|
||||
endif
|
||||
return s:kbd_goto_next_col(last)
|
||||
return s:kbd_goto_next_col(is_sep || last)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#kbd_shift_tab() "{{{
|
||||
@@ -376,10 +478,12 @@ function! vimwiki#tbl#kbd_shift_tab() "{{{
|
||||
endif
|
||||
|
||||
let first = s:is_first_column(lnum, col('.'))
|
||||
if first && !s:is_table(getline(lnum-1))
|
||||
let is_sep = s:is_separator_tail(getline(lnum))
|
||||
"echomsg "DEBUG kbd_tab> ".first
|
||||
if (is_sep || first) && !s:is_table(getline(lnum-1))
|
||||
return ""
|
||||
endif
|
||||
return s:kbd_goto_prev_col(first)
|
||||
return s:kbd_goto_prev_col(is_sep || first)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#format(lnum, ...) "{{{
|
||||
@@ -462,7 +566,12 @@ endfunction "}}}
|
||||
" TODO: move_column_left and move_column_right are good candidates to be
|
||||
" refactored.
|
||||
function! vimwiki#tbl#move_column_left() "{{{
|
||||
if !s:is_table(getline('.'))
|
||||
|
||||
"echomsg "DEBUG move_column_left: "
|
||||
|
||||
let line = getline('.')
|
||||
|
||||
if !s:is_table(line)
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -474,16 +583,28 @@ function! vimwiki#tbl#move_column_left() "{{{
|
||||
if cur_col > 0
|
||||
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
|
||||
call cursor(line('.'), 1)
|
||||
if !s:is_separator(getline('.'))
|
||||
call search('\%(|[^|]\+\)\{'.(cur_col-1).'}| .', 'eW')
|
||||
|
||||
let sep = '\('.s:rxSep.'\).\zs'
|
||||
let mpos = -1
|
||||
let col = -1
|
||||
while col < cur_col-1
|
||||
let mpos = match(line, sep, mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
else
|
||||
call search('|\%([^+]\++\)\{'.(cur_col-1).'}--', 'eW')
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
endif
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#move_column_right() "{{{
|
||||
if !s:is_table(getline('.'))
|
||||
|
||||
let line = getline('.')
|
||||
|
||||
if !s:is_table(line)
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -495,16 +616,41 @@ function! vimwiki#tbl#move_column_right() "{{{
|
||||
if cur_col < s:col_count(line('.'))-1
|
||||
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
|
||||
call cursor(line('.'), 1)
|
||||
if !s:is_separator(getline('.'))
|
||||
call search('\%(|[^|]\+\)\{'.(cur_col+1).'}| .', 'eW')
|
||||
|
||||
let sep = '\('.s:rxSep.'\).\zs'
|
||||
let mpos = -1
|
||||
let col = -1
|
||||
while col < cur_col+1
|
||||
let mpos = match(line, sep, mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
else
|
||||
call search('|\%([^+]\++\)\{'.(cur_col+1).'}--', 'eW')
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
endif
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#get_rows(lnum) "{{{
|
||||
return s:get_rows(a:lnum)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#is_table(line) "{{{
|
||||
return s:is_table(a:line)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#is_separator(line) "{{{
|
||||
return s:is_separator(a:line)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#cell_splitter() "{{{
|
||||
return s:cell_splitter()
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#sep_splitter() "{{{
|
||||
return s:sep_splitter()
|
||||
endfunction "}}}
|
||||
|
||||
"}}}
|
||||
77
bundle/git_vimwiki/autoload/vimwiki/u.vim
Normal file
77
bundle/git_vimwiki/autoload/vimwiki/u.vim
Normal file
@@ -0,0 +1,77 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Utility functions
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
function! vimwiki#u#trim(string, ...) "{{{
|
||||
let chars = ''
|
||||
if a:0 > 0
|
||||
let chars = a:1
|
||||
endif
|
||||
let res = substitute(a:string, '^[[:space:]'.chars.']\+', '', '')
|
||||
let res = substitute(res, '[[:space:]'.chars.']\+$', '', '')
|
||||
return res
|
||||
endfunction "}}}
|
||||
|
||||
|
||||
" Builtin cursor doesn't work right with unicode characters.
|
||||
function! vimwiki#u#cursor(lnum, cnum) "{{{
|
||||
exe a:lnum
|
||||
exe 'normal! 0'.a:cnum.'|'
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#u#is_windows() "{{{
|
||||
return has("win32") || has("win64") || has("win95") || has("win16")
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#u#chomp_slash(str) "{{{
|
||||
return substitute(a:str, '[/\\]\+$', '', '')
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#u#time(starttime) "{{{
|
||||
" measure the elapsed time and cut away miliseconds and smaller
|
||||
return matchstr(reltimestr(reltime(a:starttime)),'\d\+\(\.\d\d\)\=')
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#u#path_norm(path) "{{{
|
||||
" /-slashes
|
||||
let path = substitute(a:path, '\', '/', 'g')
|
||||
" treat multiple consecutive slashes as one path separator
|
||||
let path = substitute(path, '/\+', '/', 'g')
|
||||
" ensure that we are not fooled by a symbolic link
|
||||
return resolve(path)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#u#is_link_to_dir(link) "{{{
|
||||
" Check if link is to a directory.
|
||||
" It should be ended with \ or /.
|
||||
if a:link =~ '.\+[/\\]$'
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
endfunction " }}}
|
||||
|
||||
function! vimwiki#u#count_first_sym(line) "{{{
|
||||
let first_sym = matchstr(a:line, '\S')
|
||||
return len(matchstr(a:line, first_sym.'\+'))
|
||||
endfunction "}}}
|
||||
|
||||
" return longest common path prefix of 2 given paths.
|
||||
" '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki'
|
||||
function! vimwiki#u#path_common_pfx(path1, path2) "{{{
|
||||
let p1 = split(a:path1, '[/\\]', 1)
|
||||
let p2 = split(a:path2, '[/\\]', 1)
|
||||
|
||||
let idx = 0
|
||||
let minlen = min([len(p1), len(p2)])
|
||||
while (idx < minlen) && (p1[idx] ==? p2[idx])
|
||||
let idx = idx + 1
|
||||
endwhile
|
||||
if idx == 0
|
||||
return ''
|
||||
else
|
||||
return join(p1[: idx-1], '/')
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,13 +35,17 @@ setlocal isfname-=[,]
|
||||
|
||||
" Autocreate list items {{{
|
||||
" for list items, and list items with checkboxes
|
||||
setlocal formatoptions+=tnro
|
||||
setlocal formatoptions-=cq
|
||||
if VimwikiGet('syntax') == 'default'
|
||||
setl comments=b:*,b:#,b:-
|
||||
setl formatlistpat=^\\s*[*#-]\\s*
|
||||
elseif VimwikiGet('syntax') == 'markdown'
|
||||
setlocal comments=fb:*,fb:-,fb:+,nb:> commentstring=\ >\ %s
|
||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+j
|
||||
else
|
||||
setl comments=n:*,n:#
|
||||
endif
|
||||
setlocal formatoptions=tnro
|
||||
|
||||
if !empty(&langmap)
|
||||
" Valid only if langmap is a comma separated pairs of chars
|
||||
@@ -64,23 +68,15 @@ function! VimwikiFoldLevel(lnum) "{{{
|
||||
|
||||
" Header folding...
|
||||
if line =~ g:vimwiki_rxHeader
|
||||
let n = vimwiki#base#count_first_sym(line)
|
||||
let n = vimwiki#u#count_first_sym(line)
|
||||
return '>'.n
|
||||
endif
|
||||
|
||||
if g:vimwiki_fold_trailing_empty_lines == 0 && line =~ '^\s*$'
|
||||
let nnline = getline(nextnonblank(a:lnum + 1))
|
||||
else
|
||||
let nnline = getline(a:lnum + 1)
|
||||
endif
|
||||
if nnline =~ g:vimwiki_rxHeader
|
||||
let n = vimwiki#base#count_first_sym(nnline)
|
||||
return '<'.n
|
||||
endif
|
||||
let base_level = s:get_base_level(a:lnum)
|
||||
|
||||
" List item folding...
|
||||
if g:vimwiki_fold_lists
|
||||
let base_level = s:get_base_level(a:lnum)
|
||||
let nnline = getline(a:lnum + 1)
|
||||
|
||||
let rx_list_item = '\('.
|
||||
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
|
||||
@@ -95,6 +91,10 @@ function! VimwikiFoldLevel(lnum) "{{{
|
||||
|
||||
if leveln > level
|
||||
return ">".(base_level+leveln-adj)
|
||||
" check if multilined list item
|
||||
elseif (nnum-a:lnum) > 1
|
||||
\ && nline =~ rx_list_item && nnline !~ '^\s*$'
|
||||
return ">".(base_level+level+1-adj)
|
||||
else
|
||||
return (base_level+level-adj)
|
||||
endif
|
||||
@@ -102,34 +102,23 @@ function! VimwikiFoldLevel(lnum) "{{{
|
||||
" process multilined list items
|
||||
let [pnum, pline] = s:find_backward(rx_list_item, a:lnum)
|
||||
if pline =~ rx_list_item
|
||||
if indent(a:lnum) > indent(pnum)
|
||||
if indent(a:lnum) >= indent(pnum) && line !~ '^\s*$'
|
||||
let level = s:get_li_level(pnum)
|
||||
let adj = s:get_li_level(s:get_start_list(rx_list_item, pnum))
|
||||
|
||||
let [nnum, nline] = s:find_forward(rx_list_item, a:lnum)
|
||||
if nline =~ rx_list_item
|
||||
let leveln = s:get_li_level(nnum)
|
||||
if leveln > level
|
||||
return (base_level+leveln-adj)
|
||||
return (base_level+level+1-adj)
|
||||
endif
|
||||
endif
|
||||
|
||||
return (base_level+level-adj)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return base_level
|
||||
endif
|
||||
|
||||
return -1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_base_level(lnum) "{{{
|
||||
let lnum = a:lnum - 1
|
||||
while lnum > 0
|
||||
if getline(lnum) =~ g:vimwiki_rxHeader
|
||||
return vimwiki#base#count_first_sym(getline(lnum))
|
||||
return vimwiki#u#count_first_sym(getline(lnum))
|
||||
endif
|
||||
let lnum -= 1
|
||||
endwhile
|
||||
@@ -169,7 +158,7 @@ endfunction "}}}
|
||||
|
||||
function! s:get_li_level(lnum) "{{{
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
let level = vimwiki#base#count_first_sym(getline(a:lnum))
|
||||
let level = vimwiki#u#count_first_sym(getline(a:lnum))
|
||||
else
|
||||
let level = (indent(a:lnum) / &sw)
|
||||
endif
|
||||
@@ -198,11 +187,15 @@ endfunction "}}}
|
||||
|
||||
" COMMANDS {{{
|
||||
command! -buffer Vimwiki2HTML
|
||||
\ w <bar> call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ silent w <bar>
|
||||
\ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ expand('%'))
|
||||
\<bar>
|
||||
\ if res != '' | echo 'Vimwiki: HTML conversion is done.' | endif
|
||||
command! -buffer Vimwiki2HTMLBrowse
|
||||
\ w <bar> call VimwikiWeblinkHandler(
|
||||
\ vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ silent w <bar>
|
||||
\ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
|
||||
\ expand(VimwikiGet('path_html')),
|
||||
\ expand('%')))
|
||||
command! -buffer VimwikiAll2HTML
|
||||
\ call vimwiki#html#WikiAll2HTML(expand(VimwikiGet('path_html')))
|
||||
@@ -216,12 +209,17 @@ command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link()
|
||||
command! -buffer VimwikiSplitLink call vimwiki#base#follow_link('split')
|
||||
command! -buffer VimwikiVSplitLink call vimwiki#base#follow_link('vsplit')
|
||||
|
||||
command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(<f-args>)
|
||||
|
||||
command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tabnew')
|
||||
|
||||
command! -buffer -range VimwikiToggleListItem call vimwiki#lst#ToggleListItem(<line1>, <line2>)
|
||||
|
||||
command! -buffer VimwikiGenerateLinks call vimwiki#base#generate_links()
|
||||
|
||||
command! -buffer -nargs=0 VimwikiBacklinks call vimwiki#base#backlinks()
|
||||
command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
|
||||
|
||||
exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep <args> '.
|
||||
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
|
||||
|
||||
@@ -230,6 +228,10 @@ exe 'command! -buffer -nargs=* VWS lvimgrep <args> '.
|
||||
|
||||
command! -buffer -nargs=1 VimwikiGoto call vimwiki#base#goto("<args>")
|
||||
|
||||
|
||||
" list commands
|
||||
command! -buffer -nargs=* VimwikiListChangeLevel call vimwiki#lst#change_level(<f-args>)
|
||||
|
||||
" table commands
|
||||
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
|
||||
command! -buffer VimwikiTableAlignQ call vimwiki#tbl#align_or_cmd('gqq')
|
||||
@@ -247,7 +249,7 @@ command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day()
|
||||
if g:vimwiki_use_mouse
|
||||
nmap <buffer> <S-LeftMouse> <NOP>
|
||||
nmap <buffer> <C-LeftMouse> <NOP>
|
||||
nnoremap <silent><buffer> <2-LeftMouse> :VimwikiFollowLink<CR>
|
||||
nnoremap <silent><buffer> <2-LeftMouse> :call vimwiki#base#follow_link("nosplit", "\<lt>2-LeftMouse>")<CR>
|
||||
nnoremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR>
|
||||
nnoremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR>
|
||||
nnoremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR>
|
||||
@@ -284,6 +286,24 @@ endif
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiVSplitLink :VimwikiVSplitLink<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiNormalizeLink')
|
||||
nmap <silent><buffer> + <Plug>VimwikiNormalizeLink
|
||||
endif
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiNormalizeLink :VimwikiNormalizeLink 0<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiNormalizeLinkVisual')
|
||||
vmap <silent><buffer> + <Plug>VimwikiNormalizeLinkVisual
|
||||
endif
|
||||
vnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiNormalizeLinkVisual :<C-U>VimwikiNormalizeLink 1<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiNormalizeLinkVisualCR')
|
||||
vmap <silent><buffer> <CR> <Plug>VimwikiNormalizeLinkVisualCR
|
||||
endif
|
||||
vnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiNormalizeLinkVisualCR :<C-U>VimwikiNormalizeLink 1<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiTabnewLink')
|
||||
nmap <silent><buffer> <D-CR> <Plug>VimwikiTabnewLink
|
||||
nmap <silent><buffer> <C-S-CR> <Plug>VimwikiTabnewLink
|
||||
@@ -345,7 +365,7 @@ nnoremap <silent><script><buffer>
|
||||
|
||||
function! s:CR() "{{{
|
||||
let res = vimwiki#lst#kbd_cr()
|
||||
if res == "\<CR>" && g:vimwiki_table_auto_fmt
|
||||
if res == "\<CR>" && g:vimwiki_table_mappings
|
||||
let res = vimwiki#tbl#kbd_cr()
|
||||
endif
|
||||
return res
|
||||
@@ -357,9 +377,25 @@ inoremap <buffer> <expr> <CR> <SID>CR()
|
||||
" List mappings
|
||||
nnoremap <buffer> o :<C-U>call vimwiki#lst#kbd_oO('o')<CR>
|
||||
nnoremap <buffer> O :<C-U>call vimwiki#lst#kbd_oO('O')<CR>
|
||||
nnoremap <buffer> gll :VimwikiListChangeLevel <<<CR>
|
||||
nnoremap <buffer> glm :VimwikiListChangeLevel >><CR>
|
||||
nnoremap <buffer> gl* :VimwikiListChangeLevel *<CR>
|
||||
nnoremap <buffer> gl8 :VimwikiListChangeLevel *<CR>
|
||||
if VimwikiGet('syntax') == 'default'
|
||||
nnoremap <buffer> gl- :VimwikiListChangeLevel -<CR>
|
||||
nnoremap <buffer> gl# :VimwikiListChangeLevel #<CR>
|
||||
nnoremap <buffer> gl3 :VimwikiListChangeLevel #<CR>
|
||||
elseif VimwikiGet('syntax') == 'markdown'
|
||||
nnoremap <buffer> gl- :VimwikiListChangeLevel -<CR>
|
||||
nnoremap <buffer> gl1 :VimwikiListChangeLevel 1.<CR>
|
||||
elseif VimwikiGet('syntax') == 'media'
|
||||
nnoremap <buffer> gl# :VimwikiListChangeLevel #<CR>
|
||||
nnoremap <buffer> gl3 :VimwikiListChangeLevel #<CR>
|
||||
endif
|
||||
|
||||
|
||||
" Table mappings
|
||||
if g:vimwiki_table_auto_fmt
|
||||
if g:vimwiki_table_mappings
|
||||
inoremap <expr> <buffer> <Tab> vimwiki#tbl#kbd_tab()
|
||||
inoremap <expr> <buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab()
|
||||
endif
|
||||
@@ -377,8 +413,6 @@ endif
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiTableMoveColumnRight :VimwikiTableMoveColumnRight<CR>
|
||||
|
||||
" Misc mappings
|
||||
inoremap <buffer> <S-CR> <br /><CR>
|
||||
|
||||
|
||||
" Text objects {{{
|
||||
@@ -400,8 +434,18 @@ vnoremap <silent><buffer> ac :<C-U>call vimwiki#base#TO_table_col(0, 1)<CR>
|
||||
onoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 0)<CR>
|
||||
vnoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 1)<CR>
|
||||
|
||||
nnoremap <silent><buffer> = :call vimwiki#base#AddHeaderLevel()<CR>
|
||||
nnoremap <silent><buffer> - :call vimwiki#base#RemoveHeaderLevel()<CR>
|
||||
if !hasmapto('<Plug>VimwikiAddHeaderLevel')
|
||||
nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
|
||||
endif
|
||||
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :
|
||||
\<C-U>call vimwiki#base#AddHeaderLevel()<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiRemoveHeaderLevel')
|
||||
nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
|
||||
endif
|
||||
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
|
||||
\<C-U>call vimwiki#base#RemoveHeaderLevel()<CR>
|
||||
|
||||
|
||||
" }}}
|
||||
|
||||
@@ -411,8 +455,21 @@ nnoremap <silent><buffer> - :call vimwiki#base#RemoveHeaderLevel()<CR>
|
||||
if VimwikiGet('auto_export')
|
||||
" Automatically generate HTML on page write.
|
||||
augroup vimwiki
|
||||
au BufWritePost <buffer> Vimwiki2HTML
|
||||
au BufWritePost <buffer>
|
||||
\ call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ expand('%'))
|
||||
augroup END
|
||||
endif
|
||||
|
||||
" AUTOCOMMANDS }}}
|
||||
|
||||
" PASTE, CAT URL {{{
|
||||
" html commands
|
||||
command! -buffer VimwikiPasteUrl call vimwiki#html#PasteUrl(expand('%:p'))
|
||||
command! -buffer VimwikiCatUrl call vimwiki#html#CatUrl(expand('%:p'))
|
||||
" }}}
|
||||
|
||||
" DEBUGGING {{{
|
||||
command! VimwikiPrintWikiState call vimwiki#base#print_wiki_state()
|
||||
command! VimwikiReadLocalOptions call vimwiki#base#read_wiki_options(1)
|
||||
" }}}
|
||||
552
bundle/git_vimwiki/plugin/vimwiki.vim
Normal file
552
bundle/git_vimwiki/plugin/vimwiki.vim
Normal file
@@ -0,0 +1,552 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki plugin file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
|
||||
|
||||
if exists("loaded_vimwiki") || &cp
|
||||
finish
|
||||
endif
|
||||
let loaded_vimwiki = 1
|
||||
|
||||
let s:old_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Logging and performance instrumentation "{{{
|
||||
let g:VimwikiLog = {}
|
||||
let g:VimwikiLog.path = 0 " # of calls to VimwikiGet with path or path_html
|
||||
let g:VimwikiLog.path_html = 0 " # of calls to path_html()
|
||||
let g:VimwikiLog.normalize_path = 0 " # of calls to normalize_path()
|
||||
let g:VimwikiLog.subdir = 0 " # of calls to vimwiki#base#subdir()
|
||||
let g:VimwikiLog.timing = [] " various timing measurements
|
||||
let g:VimwikiLog.html = [] " html conversion timing
|
||||
function! VimwikiLog_extend(what,...) "{{{
|
||||
call extend(g:VimwikiLog[a:what],a:000)
|
||||
endfunction "}}}
|
||||
"}}}
|
||||
|
||||
" HELPER functions {{{
|
||||
function! s:default(varname, value) "{{{
|
||||
if !exists('g:vimwiki_'.a:varname)
|
||||
let g:vimwiki_{a:varname} = a:value
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:find_wiki(path) "{{{
|
||||
" XXX: find_wiki() does not (yet) take into consideration the ext
|
||||
let path = vimwiki#u#path_norm(vimwiki#u#chomp_slash(a:path))
|
||||
let idx = 0
|
||||
while idx < len(g:vimwiki_list)
|
||||
let idx_path = expand(VimwikiGet('path', idx))
|
||||
let idx_path = vimwiki#u#path_norm(vimwiki#u#chomp_slash(idx_path))
|
||||
if vimwiki#u#path_common_pfx(idx_path, path) == idx_path
|
||||
return idx
|
||||
endif
|
||||
let idx += 1
|
||||
endwhile
|
||||
return -1
|
||||
" an orphan page has been detected
|
||||
endfunction "}}}
|
||||
|
||||
|
||||
function! s:vimwiki_idx() " {{{
|
||||
if exists('b:vimwiki_idx')
|
||||
return b:vimwiki_idx
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction " }}}
|
||||
|
||||
function! s:setup_buffer_leave() "{{{
|
||||
if g:vimwiki_debug ==3
|
||||
echom "Setup_buffer_leave g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
if &filetype == 'vimwiki'
|
||||
" cache global vars of current state XXX: SLOW!?
|
||||
call vimwiki#base#cache_buffer_state()
|
||||
endif
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_buffer_leave g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
|
||||
" Set up menu
|
||||
if g:vimwiki_menu != ""
|
||||
exe 'nmenu disable '.g:vimwiki_menu.'.Table'
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:setup_filetype() "{{{
|
||||
if g:vimwiki_debug ==3
|
||||
echom "Setup_filetype g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
let time0 = reltime() " start the clock "XXX
|
||||
" Find what wiki current buffer belongs to.
|
||||
let path = expand('%:p:h')
|
||||
" XXX: find_wiki() does not (yet) take into consideration the ext
|
||||
let idx = s:find_wiki(path)
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
|
||||
if idx == -1 && g:vimwiki_global_ext == 0
|
||||
return
|
||||
endif
|
||||
"XXX when idx = -1? (an orphan page has been detected)
|
||||
|
||||
"TODO: refactor (same code in setup_buffer_enter)
|
||||
" The buffer's file is not in the path and user *does* want his wiki
|
||||
" extension(s) to be global -- Add new wiki.
|
||||
if idx == -1
|
||||
let ext = '.'.expand('%:e')
|
||||
" lookup syntax using g:vimwiki_ext2syntax
|
||||
if has_key(g:vimwiki_ext2syntax, ext)
|
||||
let syn = g:vimwiki_ext2syntax[ext]
|
||||
else
|
||||
let syn = s:vimwiki_defaults.syntax
|
||||
endif
|
||||
call add(g:vimwiki_list, {'path': path, 'ext': ext, 'syntax': syn, 'temp': 1})
|
||||
let idx = len(g:vimwiki_list) - 1
|
||||
endif
|
||||
call vimwiki#base#validate_wiki_options(idx)
|
||||
" initialize and cache global vars of current state
|
||||
call vimwiki#base#setup_buffer_state(idx)
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." (reset_wiki_state) b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
|
||||
unlet! b:vimwiki_fs_rescan
|
||||
set filetype=vimwiki
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." (set ft=vimwiki) b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
let time1 = vimwiki#u#time(time0) "XXX
|
||||
call VimwikiLog_extend('timing',['plugin:setup_filetype:time1',time1])
|
||||
endfunction "}}}
|
||||
|
||||
function! s:setup_buffer_enter() "{{{
|
||||
if g:vimwiki_debug ==3
|
||||
echom "Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
let time0 = reltime() " start the clock "XXX
|
||||
if !vimwiki#base#recall_buffer_state()
|
||||
" Find what wiki current buffer belongs to.
|
||||
" If wiki does not exist in g:vimwiki_list -- add new wiki there with
|
||||
" buffer's path and ext.
|
||||
" Else set g:vimwiki_current_idx to that wiki index.
|
||||
let path = expand('%:p:h')
|
||||
" XXX: find_wiki() does not (yet) take into consideration the ext
|
||||
let idx = s:find_wiki(path)
|
||||
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
" The buffer's file is not in the path and user *does NOT* want his wiki
|
||||
" extension to be global -- Do not add new wiki.
|
||||
if idx == -1 && g:vimwiki_global_ext == 0
|
||||
return
|
||||
endif
|
||||
|
||||
"TODO: refactor (same code in setup_filetype)
|
||||
" The buffer's file is not in the path and user *does* want his wiki
|
||||
" extension(s) to be global -- Add new wiki.
|
||||
if idx == -1
|
||||
let ext = '.'.expand('%:e')
|
||||
" lookup syntax using g:vimwiki_ext2syntax
|
||||
if has_key(g:vimwiki_ext2syntax, ext)
|
||||
let syn = g:vimwiki_ext2syntax[ext]
|
||||
else
|
||||
let syn = s:vimwiki_defaults.syntax
|
||||
endif
|
||||
call add(g:vimwiki_list, {'path': path, 'ext': ext, 'syntax': syn, 'temp': 1})
|
||||
let idx = len(g:vimwiki_list) - 1
|
||||
endif
|
||||
call vimwiki#base#validate_wiki_options(idx)
|
||||
" initialize and cache global vars of current state
|
||||
call vimwiki#base#setup_buffer_state(idx)
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." (reset_wiki_state) b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
" If you have
|
||||
" au GUIEnter * VimwikiIndex
|
||||
" Then change it to
|
||||
" au GUIEnter * nested VimwikiIndex
|
||||
if &filetype == ''
|
||||
set filetype=vimwiki
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." (set ft vimwiki) b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
elseif &syntax == 'vimwiki'
|
||||
" to force a rescan of the filesystem which may have changed
|
||||
" and update VimwikiLinks syntax group that depends on it;
|
||||
" b:vimwiki_fs_rescan indicates that setup_filetype() has not been run
|
||||
if exists("b:vimwiki_fs_rescan") && VimwikiGet('maxhi')
|
||||
set syntax=vimwiki
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." (set syntax=vimwiki) b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
endif
|
||||
let b:vimwiki_fs_rescan = 1
|
||||
endif
|
||||
let time1 = vimwiki#u#time(time0) "XXX
|
||||
|
||||
" Settings foldmethod, foldexpr and foldtext are local to window. Thus in a
|
||||
" new tab with the same buffer folding is reset to vim defaults. So we
|
||||
" insist vimwiki folding here.
|
||||
if g:vimwiki_folding == 1 && &fdm != 'expr'
|
||||
setlocal fdm=expr
|
||||
setlocal foldexpr=VimwikiFoldLevel(v:lnum)
|
||||
setlocal foldtext=VimwikiFoldText()
|
||||
endif
|
||||
|
||||
" And conceal level too.
|
||||
if g:vimwiki_conceallevel && exists("+conceallevel")
|
||||
let &conceallevel = g:vimwiki_conceallevel
|
||||
endif
|
||||
|
||||
" Set up menu
|
||||
if g:vimwiki_menu != ""
|
||||
exe 'nmenu enable '.g:vimwiki_menu.'.Table'
|
||||
endif
|
||||
"let time2 = vimwiki#u#time(time0) "XXX
|
||||
call VimwikiLog_extend('timing',['plugin:setup_buffer_enter:time1',time1])
|
||||
endfunction "}}}
|
||||
|
||||
function! s:setup_buffer_reenter() "{{{
|
||||
if g:vimwiki_debug ==3
|
||||
echom "Setup_buffer_reenter g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
if !vimwiki#base#recall_buffer_state()
|
||||
" Do not repeat work of s:setup_buffer_enter() and s:setup_filetype()
|
||||
" Once should be enough ...
|
||||
endif
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_buffer_reenter g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:setup_cleared_syntax() "{{{ highlight groups that get cleared
|
||||
" on colorscheme change because they are not linked to Vim-predefined groups
|
||||
hi def VimwikiBold term=bold cterm=bold gui=bold
|
||||
hi def VimwikiItalic term=italic cterm=italic gui=italic
|
||||
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
|
||||
hi def VimwikiUnderline gui=underline
|
||||
if g:vimwiki_hl_headers == 1
|
||||
for i in range(1,6)
|
||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='.g:vimwiki_hcolor_guifg_{&bg}[i-1].' gui=bold ctermfg='.g:vimwiki_hcolor_ctermfg_{&bg}[i-1].' term=bold cterm=bold'
|
||||
endfor
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" OPTION get/set functions {{{
|
||||
" return complete list of options
|
||||
function! VimwikiGetOptionNames() "{{{
|
||||
return keys(s:vimwiki_defaults)
|
||||
endfunction "}}}
|
||||
|
||||
function! VimwikiGetOptions(...) "{{{
|
||||
let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1
|
||||
let option_dict = {}
|
||||
for kk in keys(s:vimwiki_defaults)
|
||||
let option_dict[kk] = VimwikiGet(kk, idx)
|
||||
endfor
|
||||
return option_dict
|
||||
endfunction "}}}
|
||||
|
||||
" Return value of option for current wiki or if second parameter exists for
|
||||
" wiki with a given index.
|
||||
" If the option is not found, it is assumed to have been previously cached in a
|
||||
" buffer local dictionary, that acts as a cache.
|
||||
" If the option is not found in the buffer local dictionary, an error is thrown
|
||||
function! VimwikiGet(option, ...) "{{{
|
||||
let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1
|
||||
|
||||
if has_key(g:vimwiki_list[idx], a:option)
|
||||
let val = g:vimwiki_list[idx][a:option]
|
||||
elseif has_key(s:vimwiki_defaults, a:option)
|
||||
let val = s:vimwiki_defaults[a:option]
|
||||
let g:vimwiki_list[idx][a:option] = val
|
||||
else
|
||||
let val = b:vimwiki_list[a:option]
|
||||
endif
|
||||
|
||||
" XXX no call to vimwiki#base here or else the whole autoload/base gets loaded!
|
||||
return val
|
||||
endfunction "}}}
|
||||
|
||||
" Set option for current wiki or if third parameter exists for
|
||||
" wiki with a given index.
|
||||
" If the option is not found or recognized (i.e. does not exist in
|
||||
" s:vimwiki_defaults), it is saved in a buffer local dictionary, that acts
|
||||
" as a cache.
|
||||
" If the option is not found in the buffer local dictionary, an error is thrown
|
||||
function! VimwikiSet(option, value, ...) "{{{
|
||||
let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1
|
||||
|
||||
if has_key(s:vimwiki_defaults, a:option) ||
|
||||
\ has_key(g:vimwiki_list[idx], a:option)
|
||||
let g:vimwiki_list[idx][a:option] = a:value
|
||||
elseif exists('b:vimwiki_list')
|
||||
let b:vimwiki_list[a:option] = a:value
|
||||
else
|
||||
let b:vimwiki_list = {}
|
||||
let b:vimwiki_list[a:option] = a:value
|
||||
endif
|
||||
|
||||
endfunction "}}}
|
||||
" }}}
|
||||
|
||||
" }}}
|
||||
|
||||
" CALLBACK functions "{{{
|
||||
" User can redefine it.
|
||||
if !exists("*VimwikiLinkHandler") "{{{
|
||||
function VimwikiLinkHandler(url)
|
||||
return 0
|
||||
endfunction
|
||||
endif "}}}
|
||||
|
||||
if !exists("*VimwikiWikiIncludeHandler") "{{{
|
||||
function! VimwikiWikiIncludeHandler(value) "{{{
|
||||
" Return the empty string when unable to process link
|
||||
return ''
|
||||
endfunction "}}}
|
||||
endif "}}}
|
||||
" CALLBACK }}}
|
||||
|
||||
" DEFAULT wiki {{{
|
||||
let s:vimwiki_defaults = {}
|
||||
let s:vimwiki_defaults.path = '~/vimwiki/'
|
||||
let s:vimwiki_defaults.path_html = '' " '' is replaced by derived path.'_html/'
|
||||
let s:vimwiki_defaults.css_name = 'style.css'
|
||||
let s:vimwiki_defaults.index = 'index'
|
||||
let s:vimwiki_defaults.ext = '.wiki'
|
||||
let s:vimwiki_defaults.maxhi = 0
|
||||
let s:vimwiki_defaults.syntax = 'default'
|
||||
|
||||
let s:vimwiki_defaults.template_path = ''
|
||||
let s:vimwiki_defaults.template_default = ''
|
||||
let s:vimwiki_defaults.template_ext = ''
|
||||
|
||||
let s:vimwiki_defaults.nested_syntaxes = {}
|
||||
let s:vimwiki_defaults.auto_export = 0
|
||||
" is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki
|
||||
" file.
|
||||
let s:vimwiki_defaults.temp = 0
|
||||
|
||||
" diary
|
||||
let s:vimwiki_defaults.diary_rel_path = 'diary/'
|
||||
let s:vimwiki_defaults.diary_index = 'diary'
|
||||
let s:vimwiki_defaults.diary_header = 'Diary'
|
||||
let s:vimwiki_defaults.diary_sort = 'desc'
|
||||
|
||||
" Do not change this! Will wait till vim become more datetime awareable.
|
||||
let s:vimwiki_defaults.diary_link_fmt = '%Y-%m-%d'
|
||||
|
||||
" NEW! in v2.0
|
||||
" custom_wiki2html
|
||||
let s:vimwiki_defaults.custom_wiki2html = ''
|
||||
"
|
||||
let s:vimwiki_defaults.list_margin = -1
|
||||
"}}}
|
||||
|
||||
" DEFAULT options {{{
|
||||
call s:default('list', [s:vimwiki_defaults])
|
||||
call s:default('auto_checkbox', 1)
|
||||
call s:default('use_mouse', 0)
|
||||
call s:default('folding', 0)
|
||||
call s:default('fold_trailing_empty_lines', 0)
|
||||
call s:default('fold_lists', 0)
|
||||
call s:default('menu', 'Vimwiki')
|
||||
call s:default('global_ext', 1)
|
||||
call s:default('ext2syntax', {'.md': 'markdown'}) " syntax map keyed on extension
|
||||
call s:default('hl_headers', 0)
|
||||
call s:default('hl_cb_checked', 0)
|
||||
call s:default('list_ignore_newline', 1)
|
||||
call s:default('listsyms', ' .oOX')
|
||||
call s:default('use_calendar', 1)
|
||||
call s:default('table_mappings', 1)
|
||||
call s:default('table_auto_fmt', 1)
|
||||
call s:default('w32_dir_enc', '')
|
||||
call s:default('CJK_length', 0)
|
||||
call s:default('dir_link', '')
|
||||
call s:default('valid_html_tags', 'b,i,s,u,sub,sup,kbd,br,hr,div,center,strong,em')
|
||||
call s:default('user_htmls', '')
|
||||
|
||||
call s:default('html_header_numbering', 0)
|
||||
call s:default('html_header_numbering_sym', '')
|
||||
call s:default('conceallevel', 2)
|
||||
call s:default('url_mingain', 12)
|
||||
call s:default('url_maxsave', 15)
|
||||
call s:default('debug', 0)
|
||||
|
||||
call s:default('diary_months',
|
||||
\ {
|
||||
\ 1: 'January', 2: 'February', 3: 'March',
|
||||
\ 4: 'April', 5: 'May', 6: 'June',
|
||||
\ 7: 'July', 8: 'August', 9: 'September',
|
||||
\ 10: 'October', 11: 'November', 12: 'December'
|
||||
\ })
|
||||
|
||||
|
||||
call s:default('current_idx', 0)
|
||||
|
||||
" Scheme regexes should be defined even if syntax file is not loaded yet
|
||||
" cause users should be able to <leader>w<leader>w without opening any
|
||||
" vimwiki file first
|
||||
" Scheme regexes {{{
|
||||
call s:default('schemes', 'wiki\d\+,diary,local')
|
||||
call s:default('web_schemes1', 'http,https,file,ftp,gopher,telnet,nntp,ldap,'.
|
||||
\ 'rsync,imap,pop,irc,ircs,cvs,svn,svn+ssh,git,ssh,fish,sftp')
|
||||
call s:default('web_schemes2', 'mailto,news,xmpp,sip,sips,doi,urn,tel')
|
||||
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes2, '\s*,\s*'), '\|').
|
||||
\ '\)'
|
||||
|
||||
call s:default('rxSchemeUrl', rxSchemes.':.*')
|
||||
call s:default('rxSchemeUrlMatchScheme', '\zs'.rxSchemes.'\ze:.*')
|
||||
call s:default('rxSchemeUrlMatchUrl', rxSchemes.':\zs.*\ze')
|
||||
" scheme regexes }}}
|
||||
"}}}
|
||||
|
||||
" AUTOCOMMANDS for all known wiki extensions {{{
|
||||
" Getting all extensions that different wikis could have
|
||||
let extensions = {}
|
||||
for wiki in g:vimwiki_list
|
||||
if has_key(wiki, 'ext')
|
||||
let extensions[wiki.ext] = 1
|
||||
else
|
||||
let extensions['.wiki'] = 1
|
||||
endif
|
||||
endfor
|
||||
" append map g:vimwiki_ext2syntax
|
||||
for ext in keys(g:vimwiki_ext2syntax)
|
||||
let extensions[ext] = 1
|
||||
endfor
|
||||
|
||||
augroup filetypedetect
|
||||
" clear FlexWiki's stuff
|
||||
au! * *.wiki
|
||||
augroup end
|
||||
|
||||
augroup vimwiki
|
||||
autocmd!
|
||||
for ext in keys(extensions)
|
||||
exe 'autocmd BufEnter *'.ext.' call s:setup_buffer_reenter()'
|
||||
exe 'autocmd BufWinEnter *'.ext.' call s:setup_buffer_enter()'
|
||||
exe 'autocmd BufLeave,BufHidden *'.ext.' call s:setup_buffer_leave()'
|
||||
exe 'autocmd BufNewFile,BufRead, *'.ext.' call s:setup_filetype()'
|
||||
exe 'autocmd ColorScheme *'.ext.' call s:setup_cleared_syntax()'
|
||||
" Format tables when exit from insert mode. Do not use textwidth to
|
||||
" autowrap tables.
|
||||
if g:vimwiki_table_auto_fmt
|
||||
exe 'autocmd InsertLeave *'.ext.' call vimwiki#tbl#format(line("."))'
|
||||
exe 'autocmd InsertEnter *'.ext.' call vimwiki#tbl#reset_tw(line("."))'
|
||||
endif
|
||||
endfor
|
||||
augroup END
|
||||
"}}}
|
||||
|
||||
" COMMANDS {{{
|
||||
command! VimwikiUISelect call vimwiki#base#ui_select()
|
||||
" XXX: why not using <count> instead of v:count1?
|
||||
" See Issue 324.
|
||||
command! -count=1 VimwikiIndex
|
||||
\ call vimwiki#base#goto_index(v:count1)
|
||||
command! -count=1 VimwikiTabIndex
|
||||
\ call vimwiki#base#goto_index(v:count1, 1)
|
||||
|
||||
command! -count=1 VimwikiDiaryIndex
|
||||
\ call vimwiki#diary#goto_diary_index(v:count1)
|
||||
command! -count=1 VimwikiMakeDiaryNote
|
||||
\ call vimwiki#diary#make_note(v:count1)
|
||||
command! -count=1 VimwikiTabMakeDiaryNote
|
||||
\ call vimwiki#diary#make_note(v:count1, 1)
|
||||
|
||||
command! VimwikiDiaryGenerateLinks
|
||||
\ call vimwiki#diary#generate_diary_section()
|
||||
"}}}
|
||||
|
||||
" MAPPINGS {{{
|
||||
if !hasmapto('<Plug>VimwikiIndex')
|
||||
nmap <silent><unique> <Leader>ww <Plug>VimwikiIndex
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiTabIndex')
|
||||
nmap <silent><unique> <Leader>wt <Plug>VimwikiTabIndex
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiUISelect')
|
||||
nmap <silent><unique> <Leader>ws <Plug>VimwikiUISelect
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiUISelect :VimwikiUISelect<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiDiaryIndex')
|
||||
nmap <silent><unique> <Leader>wi <Plug>VimwikiDiaryIndex
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiDiaryIndex :VimwikiDiaryIndex<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiDiaryGenerateLinks')
|
||||
nmap <silent><unique> <Leader>w<Leader>i <Plug>VimwikiDiaryGenerateLinks
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiDiaryGenerateLinks :VimwikiDiaryGenerateLinks<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiMakeDiaryNote')
|
||||
nmap <silent><unique> <Leader>w<Leader>w <Plug>VimwikiMakeDiaryNote
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiTabMakeDiaryNote')
|
||||
nmap <silent><unique> <Leader>w<Leader>t <Plug>VimwikiTabMakeDiaryNote
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote
|
||||
\ :VimwikiTabMakeDiaryNote<CR>
|
||||
|
||||
"}}}
|
||||
|
||||
" MENU {{{
|
||||
function! s:build_menu(topmenu)
|
||||
let idx = 0
|
||||
while idx < len(g:vimwiki_list)
|
||||
let norm_path = fnamemodify(VimwikiGet('path', idx), ':h:t')
|
||||
let norm_path = escape(norm_path, '\ \.')
|
||||
execute 'menu '.a:topmenu.'.Open\ index.'.norm_path.
|
||||
\ ' :call vimwiki#base#goto_index('.(idx + 1).')<CR>'
|
||||
execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.norm_path.
|
||||
\ ' :call vimwiki#diary#make_note('.(idx + 1).')<CR>'
|
||||
let idx += 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! s:build_table_menu(topmenu)
|
||||
exe 'menu '.a:topmenu.'.-Sep- :'
|
||||
exe 'menu '.a:topmenu.'.Table.Create\ (enter\ cols\ rows) :VimwikiTable '
|
||||
exe 'nmenu '.a:topmenu.'.Table.Format<tab>gqq gqq'
|
||||
exe 'nmenu '.a:topmenu.'.Table.Move\ column\ left<tab><A-Left> :VimwikiTableMoveColumnLeft<CR>'
|
||||
exe 'nmenu '.a:topmenu.'.Table.Move\ column\ right<tab><A-Right> :VimwikiTableMoveColumnRight<CR>'
|
||||
exe 'nmenu disable '.a:topmenu.'.Table'
|
||||
endfunction
|
||||
|
||||
"XXX make sure anything below does not cause autoload/base to be loaded
|
||||
if !empty(g:vimwiki_menu)
|
||||
call s:build_menu(g:vimwiki_menu)
|
||||
call s:build_table_menu(g:vimwiki_menu)
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" CALENDAR Hook "{{{
|
||||
if g:vimwiki_use_calendar
|
||||
let g:calendar_action = 'vimwiki#diary#calendar_action'
|
||||
let g:calendar_sign = 'vimwiki#diary#calendar_sign'
|
||||
endif
|
||||
"}}}
|
||||
|
||||
|
||||
let &cpo = s:old_cpo
|
||||
598
bundle/git_vimwiki/syntax/vimwiki.vim
Normal file
598
bundle/git_vimwiki/syntax/vimwiki.vim
Normal file
@@ -0,0 +1,598 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" Quit if syntax file is already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
"TODO do nothing if ...? (?)
|
||||
let starttime = reltime() " start the clock
|
||||
if VimwikiGet('maxhi')
|
||||
let b:existing_wikifiles = vimwiki#base#get_links('*'.VimwikiGet('ext'))
|
||||
let b:existing_wikidirs = vimwiki#base#get_links('*/')
|
||||
endif
|
||||
let timescans = vimwiki#u#time(starttime) "XXX
|
||||
"let b:xxx = 1
|
||||
"TODO ? update wikilink syntax group here if really needed (?) for :e and such
|
||||
"if VimwikiGet('maxhi')
|
||||
" ...
|
||||
"endif
|
||||
|
||||
" LINKS: assume this is common to all syntaxes "{{{
|
||||
|
||||
" LINKS: WebLinks {{{
|
||||
" match URL for common protocols;
|
||||
" see http://en.wikipedia.org/wiki/URI_scheme http://tools.ietf.org/html/rfc3986
|
||||
let g:vimwiki_rxWebProtocols = ''.
|
||||
\ '\%('.
|
||||
\ '\%('.
|
||||
\ '\%('.join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').'\):'.
|
||||
\ '\%(//\)'.
|
||||
\ '\)'.
|
||||
\ '\|'.
|
||||
\ '\%('.join(split(g:vimwiki_web_schemes2, '\s*,\s*'), '\|').'\):'.
|
||||
\ '\)'
|
||||
"
|
||||
let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
|
||||
\ '\S\{-1,}'. '\%(([^ \t()]*)\)\='
|
||||
" }}}
|
||||
|
||||
" }}}
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
|
||||
" -------------------------------------------------------------------------
|
||||
let time0 = vimwiki#u#time(starttime) "XXX
|
||||
|
||||
|
||||
" LINKS: setup of larger regexes {{{
|
||||
|
||||
" LINKS: setup wikilink regexps {{{
|
||||
let g:vimwiki_rxWikiLinkPrefix = '[['
|
||||
let g:vimwiki_rxWikiLinkSuffix = ']]'
|
||||
let g:vimwiki_rxWikiLinkSeparator = '|'
|
||||
" [[URL]]
|
||||
let g:vimwiki_WikiLinkTemplate1 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLinkSuffix
|
||||
" [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_WikiLinkTemplate2 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLinkSeparator. '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiLinkSuffix
|
||||
"
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\]'
|
||||
|
||||
let g:vimwiki_rxWikiLinkPrefix = escape(g:vimwiki_rxWikiLinkPrefix, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkSuffix = escape(g:vimwiki_rxWikiLinkSuffix, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkSeparator = escape(g:vimwiki_rxWikiLinkSeparator, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkUrl = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLinkDescr = valid_chars.'\{-}'
|
||||
|
||||
let g:vimwiki_rxWord = '[^[:blank:]()\\]\+'
|
||||
|
||||
"
|
||||
" [[URL]], or [[URL|DESCRIPTION]]
|
||||
" a) match [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLink = g:vimwiki_rxWikiLinkPrefix.
|
||||
\ g:vimwiki_rxWikiLinkUrl.'\%('.g:vimwiki_rxWikiLinkSeparator.
|
||||
\ g:vimwiki_rxWikiLinkDescr.'\)\?'.g:vimwiki_rxWikiLinkSuffix
|
||||
" b) match URL within [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLinkMatchUrl = g:vimwiki_rxWikiLinkPrefix.
|
||||
\ '\zs'. g:vimwiki_rxWikiLinkUrl.'\ze\%('. g:vimwiki_rxWikiLinkSeparator.
|
||||
\ g:vimwiki_rxWikiLinkDescr.'\)\?'.g:vimwiki_rxWikiLinkSuffix
|
||||
" c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLinkMatchDescr = g:vimwiki_rxWikiLinkPrefix.
|
||||
\ g:vimwiki_rxWikiLinkUrl.g:vimwiki_rxWikiLinkSeparator.'\%('.
|
||||
\ '\zs'. g:vimwiki_rxWikiLinkDescr. '\ze\)\?'. g:vimwiki_rxWikiLinkSuffix
|
||||
" }}}
|
||||
|
||||
" LINKS: Syntax helper {{{
|
||||
let g:vimwiki_rxWikiLinkPrefix1 = g:vimwiki_rxWikiLinkPrefix.
|
||||
\ g:vimwiki_rxWikiLinkUrl.g:vimwiki_rxWikiLinkSeparator
|
||||
let g:vimwiki_rxWikiLinkSuffix1 = g:vimwiki_rxWikiLinkSuffix
|
||||
" }}}
|
||||
|
||||
|
||||
" LINKS: setup of wikiincl regexps {{{
|
||||
let g:vimwiki_rxWikiInclPrefix = '{{'
|
||||
let g:vimwiki_rxWikiInclSuffix = '}}'
|
||||
let g:vimwiki_rxWikiInclSeparator = '|'
|
||||
"
|
||||
" '{{__LinkUrl__}}'
|
||||
let g:vimwiki_WikiInclTemplate1 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiInclSuffix
|
||||
" '{{__LinkUrl____LinkDescription__}}'
|
||||
let g:vimwiki_WikiInclTemplate2 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
\ '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiInclSuffix
|
||||
|
||||
let g:vimwiki_rxWikiInclPrefix = escape(g:vimwiki_rxWikiInclPrefix, magic_chars)
|
||||
let g:vimwiki_rxWikiInclSuffix = escape(g:vimwiki_rxWikiInclSuffix, magic_chars)
|
||||
let g:vimwiki_rxWikiInclSeparator = escape(g:vimwiki_rxWikiInclSeparator, magic_chars)
|
||||
let g:vimwiki_rxWikiInclUrl = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclArg = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclArgs = '\%('. g:vimwiki_rxWikiInclSeparator. g:vimwiki_rxWikiInclArg. '\)'.'\{-}'
|
||||
"
|
||||
"
|
||||
" *. {{URL}[{...}]} - i.e. {{URL}}, {{URL|ARG1}}, {{URL|ARG1|ARG2}}, etc.
|
||||
" *a) match {{URL}[{...}]}
|
||||
let g:vimwiki_rxWikiIncl = g:vimwiki_rxWikiInclPrefix.
|
||||
\ g:vimwiki_rxWikiInclUrl.
|
||||
\ g:vimwiki_rxWikiInclArgs. g:vimwiki_rxWikiInclSuffix
|
||||
" *b) match URL within {{URL}[{...}]}
|
||||
let g:vimwiki_rxWikiInclMatchUrl = g:vimwiki_rxWikiInclPrefix.
|
||||
\ '\zs'. g:vimwiki_rxWikiInclUrl. '\ze'.
|
||||
\ g:vimwiki_rxWikiInclArgs. g:vimwiki_rxWikiInclSuffix
|
||||
" }}}
|
||||
|
||||
" LINKS: Syntax helper {{{
|
||||
let g:vimwiki_rxWikiInclPrefix1 = g:vimwiki_rxWikiInclPrefix.
|
||||
\ g:vimwiki_rxWikiInclUrl.g:vimwiki_rxWikiInclSeparator
|
||||
let g:vimwiki_rxWikiInclSuffix1 = g:vimwiki_rxWikiInclArgs.
|
||||
\ g:vimwiki_rxWikiInclSuffix
|
||||
" }}}
|
||||
|
||||
" LINKS: Setup weblink regexps {{{
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||
" let g:vimwiki_rxWeblink = '[\["(|]\@<!'. g:vimwiki_rxWeblinkUrl .
|
||||
" \ '\%([),:;.!?]\=\%([ \t]\|$\)\)\@='
|
||||
" Maxim:
|
||||
" Simplify free-standing links: URL starts with non(letter|digit)scheme till
|
||||
" the whitespace.
|
||||
" Stuart, could you check it with markdown templated links? [](http://...), as
|
||||
" the last bracket is the part of URL now?
|
||||
let g:vimwiki_rxWeblink = '[[:alnum:]]\@<!'. g:vimwiki_rxWeblinkUrl . '\S*'
|
||||
" 0a) match URL within URL
|
||||
let g:vimwiki_rxWeblinkMatchUrl = g:vimwiki_rxWeblink
|
||||
" 0b) match DESCRIPTION within URL
|
||||
let g:vimwiki_rxWeblinkMatchDescr = ''
|
||||
" }}}
|
||||
|
||||
|
||||
" LINKS: Setup anylink regexps {{{
|
||||
let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
||||
\ g:vimwiki_rxWikiIncl.'\|'.g:vimwiki_rxWeblink
|
||||
" }}}
|
||||
|
||||
|
||||
" }}} end of Links
|
||||
|
||||
" LINKS: highlighting is complicated due to "nonexistent" links feature {{{
|
||||
function! s:add_target_syntax_ON(target, type) " {{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[vimwiki_debug] syntax target > '.a:target
|
||||
endif
|
||||
let prefix0 = 'syntax match '.a:type.' `'
|
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match '.a:type.'T `'
|
||||
let suffix1 = '` display contained'
|
||||
execute prefix0. a:target. suffix0
|
||||
execute prefix1. a:target. suffix1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:add_target_syntax_OFF(target) " {{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[vimwiki_debug] syntax target > '.a:target
|
||||
endif
|
||||
let prefix0 = 'syntax match VimwikiNoExistsLink `'
|
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar'
|
||||
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
|
||||
let suffix1 = '` display contained'
|
||||
execute prefix0. a:target. suffix0
|
||||
execute prefix1. a:target. suffix1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:highlight_existing_links() "{{{
|
||||
" Wikilink
|
||||
" Conditional highlighting that depends on the existence of a wiki file or
|
||||
" directory is only available for *schemeless* wiki links
|
||||
" Links are set up upon BufEnter (see plugin/...)
|
||||
let safe_links = vimwiki#base#file_pattern(b:existing_wikifiles)
|
||||
" Wikilink Dirs set up upon BufEnter (see plugin/...)
|
||||
let safe_dirs = vimwiki#base#file_pattern(b:existing_wikidirs)
|
||||
|
||||
" match [[URL]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
\ safe_links, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match [[URL|DESCRIPTION]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ safe_links, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
|
||||
" match {{URL}}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate1,
|
||||
\ safe_links, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match {{URL|...}}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate2,
|
||||
\ safe_links, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match [[DIRURL]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
\ safe_dirs, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match [[DIRURL|DESCRIPTION]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ safe_dirs, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
endfunction "}}}
|
||||
|
||||
|
||||
" use max highlighting - could be quite slow if there are too many wikifiles
|
||||
if VimwikiGet('maxhi')
|
||||
" WikiLink
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink)
|
||||
" WikiIncl
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiIncl)
|
||||
|
||||
" Subsequently, links verified on vimwiki's path are highlighted as existing
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
call s:highlight_existing_links()
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
else
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
" Wikilink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink, 'VimwikiLink')
|
||||
" WikiIncl
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiIncl, 'VimwikiLink')
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
endif
|
||||
|
||||
" Weblink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWeblink, 'VimwikiLink')
|
||||
|
||||
" WikiLink
|
||||
" All remaining schemes are highlighted automatically
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
||||
\ '\):'
|
||||
|
||||
" a) match [[nonwiki-scheme-URL]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLinkUrl, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" b) match [[nonwiki-scheme-URL|DESCRIPTION]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLinkUrl, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
|
||||
" a) match {{nonwiki-scheme-URL}}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate1,
|
||||
\ rxSchemes.g:vimwiki_rxWikiInclUrl, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" b) match {{nonwiki-scheme-URL}[{...}]}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate2,
|
||||
\ rxSchemes.g:vimwiki_rxWikiInclUrl, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
|
||||
" }}}
|
||||
|
||||
|
||||
" generic headers "{{{
|
||||
if g:vimwiki_symH
|
||||
"" symmetric
|
||||
for i in range(1,6)
|
||||
let g:vimwiki_rxH{i}_Template = repeat(g:vimwiki_rxH, i).' __Header__ '.repeat(g:vimwiki_rxH, i)
|
||||
let g:vimwiki_rxH{i} = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{'.i.'}\s*$'
|
||||
endfor
|
||||
let g:vimwiki_rxHeader = '^\s*\('.g:vimwiki_rxH.'\{1,6}\)\zs[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']\ze\1\s*$'
|
||||
else
|
||||
" asymmetric
|
||||
for i in range(1,6)
|
||||
let g:vimwiki_rxH{i}_Template = repeat(g:vimwiki_rxH, i).' __Header__'
|
||||
let g:vimwiki_rxH{i} = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
endfor
|
||||
let g:vimwiki_rxHeader = '^\s*\('.g:vimwiki_rxH.'\{1,6}\)\zs[^'.g:vimwiki_rxH.'].*\ze$'
|
||||
endif
|
||||
|
||||
" Header levels, 1-6
|
||||
for i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.i.' /'.g:vimwiki_rxH{i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,@Spell'
|
||||
endfor
|
||||
|
||||
" }}}
|
||||
|
||||
" concealed chars " {{{
|
||||
if exists("+conceallevel")
|
||||
syntax conceal on
|
||||
endif
|
||||
|
||||
syntax spell toplevel
|
||||
|
||||
if g:vimwiki_debug > 1
|
||||
echom 'WikiLink Prefix: '.g:vimwiki_rxWikiLinkPrefix1
|
||||
echom 'WikiLink Suffix: '.g:vimwiki_rxWikiLinkSuffix1
|
||||
echom 'WikiIncl Prefix: '.g:vimwiki_rxWikiInclPrefix1
|
||||
echom 'WikiIncl Suffix: '.g:vimwiki_rxWikiInclSuffix1
|
||||
endif
|
||||
|
||||
" VimwikiLinkChar is for syntax markers (and also URL when a description
|
||||
" is present) and may be concealed
|
||||
let options = ' contained transparent contains=NONE'
|
||||
" conceal wikilinks
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkPrefix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkSuffix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkPrefix1.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkSuffix1.'/'.options
|
||||
|
||||
" conceal wikiincls
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix1.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix1.'/'.options
|
||||
|
||||
" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
|
||||
execute 'syn match VimwikiLinkRest contained `\%(///\=[^/ \t]\+/\)\zs\S\{'
|
||||
\.g:vimwiki_url_mingain.',}\ze\%([/#?]\w\|\S\{'
|
||||
\.g:vimwiki_url_maxsave.'}\)` cchar=~ '.options
|
||||
|
||||
execute 'syn match VimwikiEqInChar contained /'.g:vimwiki_char_eqin.'/'
|
||||
execute 'syn match VimwikiBoldChar contained /'.g:vimwiki_char_bold.'/'
|
||||
execute 'syn match VimwikiItalicChar contained /'.g:vimwiki_char_italic.'/'
|
||||
execute 'syn match VimwikiBoldItalicChar contained /'.g:vimwiki_char_bolditalic.'/'
|
||||
execute 'syn match VimwikiItalicBoldChar contained /'.g:vimwiki_char_italicbold.'/'
|
||||
execute 'syn match VimwikiCodeChar contained /'.g:vimwiki_char_code.'/'
|
||||
execute 'syn match VimwikiDelTextChar contained /'.g:vimwiki_char_deltext.'/'
|
||||
execute 'syn match VimwikiSuperScript contained /'.g:vimwiki_char_superscript.'/'
|
||||
execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/'
|
||||
if exists("+conceallevel")
|
||||
syntax conceal off
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" non concealed chars " {{{
|
||||
execute 'syn match VimwikiHeaderChar contained /\%(^\s*'.g:vimwiki_rxH.'\+\)\|\%('.g:vimwiki_rxH.'\+\s*$\)/'
|
||||
execute 'syn match VimwikiEqInCharT contained /'.g:vimwiki_char_eqin.'/'
|
||||
execute 'syn match VimwikiBoldCharT contained /'.g:vimwiki_char_bold.'/'
|
||||
execute 'syn match VimwikiItalicCharT contained /'.g:vimwiki_char_italic.'/'
|
||||
execute 'syn match VimwikiBoldItalicCharT contained /'.g:vimwiki_char_bolditalic.'/'
|
||||
execute 'syn match VimwikiItalicBoldCharT contained /'.g:vimwiki_char_italicbold.'/'
|
||||
execute 'syn match VimwikiCodeCharT contained /'.g:vimwiki_char_code.'/'
|
||||
execute 'syn match VimwikiDelTextCharT contained /'.g:vimwiki_char_deltext.'/'
|
||||
execute 'syn match VimwikiSuperScriptT contained /'.g:vimwiki_char_superscript.'/'
|
||||
execute 'syn match VimwikiSubScriptT contained /'.g:vimwiki_char_subscript.'/'
|
||||
|
||||
" Emoticons
|
||||
"syntax match VimwikiEmoticons /\%((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/
|
||||
|
||||
let g:vimwiki_rxTodo = '\C\%(TODO:\|DONE:\|STARTED:\|FIXME:\|FIXED:\|XXX:\)'
|
||||
execute 'syntax match VimwikiTodo /'. g:vimwiki_rxTodo .'/'
|
||||
" }}}
|
||||
|
||||
" main syntax groups {{{
|
||||
|
||||
" Tables
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ transparent contains=VimwikiCellSeparator,
|
||||
\ VimwikiLinkT,
|
||||
\ VimwikiNoExistsLinkT,
|
||||
\ VimwikiEmoticons,
|
||||
\ VimwikiTodo,
|
||||
\ VimwikiBoldT,
|
||||
\ VimwikiItalicT,
|
||||
\ VimwikiBoldItalicT,
|
||||
\ VimwikiItalicBoldT,
|
||||
\ VimwikiDelTextT,
|
||||
\ VimwikiSuperScriptT,
|
||||
\ VimwikiSubScriptT,
|
||||
\ VimwikiCodeT,
|
||||
\ VimwikiEqInT,
|
||||
\ @Spell
|
||||
syntax match VimwikiCellSeparator
|
||||
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||
|
||||
" List items
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListBullet.'/'
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListNumber.'/'
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
|
||||
" List item checkbox
|
||||
"syntax match VimwikiCheckBox /\[.\?\]/
|
||||
let g:vimwiki_rxCheckBox = '\s*\[['.g:vimwiki_listsyms.']\?\]\s'
|
||||
" Todo lists have a checkbox
|
||||
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListBullet.g:vimwiki_rxCheckBox.'/'
|
||||
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListNumber.g:vimwiki_rxCheckBox.'/'
|
||||
if g:vimwiki_hl_cb_checked
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListBullet.'\s*\['.g:vimwiki_listsyms[4].'\]\s.*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListNumber.'\s*\['.g:vimwiki_listsyms[4].'\]\s.*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
endif
|
||||
|
||||
execute 'syntax match VimwikiEqIn /'.g:vimwiki_rxEqIn.'/ contains=VimwikiEqInChar'
|
||||
execute 'syntax match VimwikiEqInT /'.g:vimwiki_rxEqIn.'/ contained contains=VimwikiEqInCharT'
|
||||
|
||||
execute 'syntax match VimwikiBold /'.g:vimwiki_rxBold.'/ contains=VimwikiBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiBoldT /'.g:vimwiki_rxBold.'/ contained contains=VimwikiBoldCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiItalic /'.g:vimwiki_rxItalic.'/ contains=VimwikiItalicChar,@Spell'
|
||||
execute 'syntax match VimwikiItalicT /'.g:vimwiki_rxItalic.'/ contained contains=VimwikiItalicCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiBoldItalic /'.g:vimwiki_rxBoldItalic.'/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiBoldItalicT /'.g:vimwiki_rxBoldItalic.'/ contained contains=VimwikiBoldItalicChatT,VimwikiItalicBoldCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiItalicBold /'.g:vimwiki_rxItalicBold.'/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiItalicBoldT /'.g:vimwiki_rxItalicBold.'/ contained contains=VimwikiBoldItalicCharT,VimsikiItalicBoldCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiDelText /'.g:vimwiki_rxDelText.'/ contains=VimwikiDelTextChar,@Spell'
|
||||
execute 'syntax match VimwikiDelTextT /'.g:vimwiki_rxDelText.'/ contained contains=VimwikiDelTextChar,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiSuperScript /'.g:vimwiki_rxSuperScript.'/ contains=VimwikiSuperScriptChar,@Spell'
|
||||
execute 'syntax match VimwikiSuperScriptT /'.g:vimwiki_rxSuperScript.'/ contained contains=VimwikiSuperScriptCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiSubScript /'.g:vimwiki_rxSubScript.'/ contains=VimwikiSubScriptChar,@Spell'
|
||||
execute 'syntax match VimwikiSubScriptT /'.g:vimwiki_rxSubScript.'/ contained contains=VimwikiSubScriptCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiCode /'.g:vimwiki_rxCode.'/ contains=VimwikiCodeChar'
|
||||
execute 'syntax match VimwikiCodeT /'.g:vimwiki_rxCode.'/ contained contains=VimwikiCodeCharT'
|
||||
|
||||
" <hr> horizontal rule
|
||||
execute 'syntax match VimwikiHR /'.g:vimwiki_rxHR.'/'
|
||||
|
||||
execute 'syntax region VimwikiPre start=/^\s*'.g:vimwiki_rxPreStart.
|
||||
\ '/ end=/^\s*'.g:vimwiki_rxPreEnd.'\s*$/ contains=@Spell'
|
||||
|
||||
execute 'syntax region VimwikiMath start=/^\s*'.g:vimwiki_rxMathStart.
|
||||
\ '/ end=/^\s*'.g:vimwiki_rxMathEnd.'\s*$/ contains=@Spell'
|
||||
|
||||
|
||||
" placeholders
|
||||
syntax match VimwikiPlaceholder /^\s*%toc\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam
|
||||
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
|
||||
syntax match VimwikiPlaceholder /^\s*%title\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam
|
||||
syntax match VimwikiPlaceholder /^\s*%template\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam
|
||||
syntax match VimwikiPlaceholderParam /\s.*/ contained
|
||||
|
||||
" html tags
|
||||
if g:vimwiki_valid_html_tags != ''
|
||||
let html_tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
||||
execute 'syntax match VimwikiBold #\c<b>.\{-}</b># contains=VimwikiHTMLTag'
|
||||
execute 'syntax match VimwikiItalic #\c<i>.\{-}</i># contains=VimwikiHTMLTag'
|
||||
execute 'syntax match VimwikiUnderline #\c<u>.\{-}</u># contains=VimwikiHTMLTag'
|
||||
|
||||
execute 'syntax match VimwikiComment /'.g:vimwiki_rxComment.'/ contains=@Spell'
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" header groups highlighting "{{{
|
||||
|
||||
if g:vimwiki_hl_headers == 0
|
||||
" Strangely in default colorscheme Title group is not set to bold for cterm...
|
||||
if !exists("g:colors_name")
|
||||
hi Title cterm=bold
|
||||
endif
|
||||
for i in range(1,6)
|
||||
execute 'hi def link VimwikiHeader'.i.' Title'
|
||||
endfor
|
||||
else
|
||||
" default colors when headers of different levels are highlighted differently
|
||||
" not making it yet another option; needed by ColorScheme autocommand
|
||||
let g:vimwiki_hcolor_guifg_light = ['#aa5858','#507030','#1030a0','#103040','#505050','#636363']
|
||||
let g:vimwiki_hcolor_ctermfg_light = ['DarkRed','DarkGreen','DarkBlue','Black','Black','Black']
|
||||
let g:vimwiki_hcolor_guifg_dark = ['#e08090','#80e090','#6090e0','#c0c0f0','#e0e0f0','#f0f0f0']
|
||||
let g:vimwiki_hcolor_ctermfg_dark = ['Red','Green','Blue','White','White','White']
|
||||
for i in range(1,6)
|
||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='.g:vimwiki_hcolor_guifg_{&bg}[i-1].' gui=bold ctermfg='.g:vimwiki_hcolor_ctermfg_{&bg}[i-1].' term=bold cterm=bold'
|
||||
endfor
|
||||
endif
|
||||
"}}}
|
||||
|
||||
|
||||
" syntax group highlighting "{{{
|
||||
|
||||
hi def link VimwikiMarkers Normal
|
||||
|
||||
hi def link VimwikiEqIn Number
|
||||
hi def link VimwikiEqInT VimwikiEqIn
|
||||
|
||||
hi def VimwikiBold term=bold cterm=bold gui=bold
|
||||
hi def link VimwikiBoldT VimwikiBold
|
||||
|
||||
hi def VimwikiItalic term=italic cterm=italic gui=italic
|
||||
hi def link VimwikiItalicT VimwikiItalic
|
||||
|
||||
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
|
||||
hi def link VimwikiItalicBold VimwikiBoldItalic
|
||||
hi def link VimwikiBoldItalicT VimwikiBoldItalic
|
||||
hi def link VimwikiItalicBoldT VimwikiBoldItalic
|
||||
|
||||
hi def VimwikiUnderline gui=underline
|
||||
|
||||
hi def link VimwikiCode PreProc
|
||||
hi def link VimwikiCodeT VimwikiCode
|
||||
|
||||
hi def link VimwikiPre PreProc
|
||||
hi def link VimwikiPreT VimwikiPre
|
||||
|
||||
hi def link VimwikiMath Number
|
||||
hi def link VimwikiMathT VimwikiMath
|
||||
|
||||
hi def link VimwikiNoExistsLink SpellBad
|
||||
hi def link VimwikiNoExistsLinkT VimwikiNoExistsLink
|
||||
|
||||
hi def link VimwikiLink Underlined
|
||||
hi def link VimwikiLinkT VimwikiLink
|
||||
|
||||
hi def link VimwikiList Identifier
|
||||
hi def link VimwikiListTodo VimwikiList
|
||||
"hi def link VimwikiCheckBox VimwikiList
|
||||
hi def link VimwikiCheckBoxDone Comment
|
||||
hi def link VimwikiEmoticons Character
|
||||
hi def link VimwikiHR Identifier
|
||||
|
||||
hi def link VimwikiDelText Constant
|
||||
hi def link VimwikiDelTextT VimwikiDelText
|
||||
|
||||
hi def link VimwikiSuperScript Number
|
||||
hi def link VimwikiSuperScriptT VimwikiSuperScript
|
||||
|
||||
hi def link VimwikiSubScript Number
|
||||
hi def link VimwikiSubScriptT VimwikiSubScript
|
||||
|
||||
hi def link VimwikiTodo Todo
|
||||
hi def link VimwikiComment Comment
|
||||
|
||||
hi def link VimwikiPlaceholder SpecialKey
|
||||
hi def link VimwikiPlaceholderParam String
|
||||
hi def link VimwikiHTMLtag SpecialKey
|
||||
|
||||
hi def link VimwikiEqInChar VimwikiMarkers
|
||||
hi def link VimwikiCellSeparator VimwikiMarkers
|
||||
hi def link VimwikiBoldChar VimwikiMarkers
|
||||
hi def link VimwikiItalicChar VimwikiMarkers
|
||||
hi def link VimwikiBoldItalicChar VimwikiMarkers
|
||||
hi def link VimwikiItalicBoldChar VimwikiMarkers
|
||||
hi def link VimwikiDelTextChar VimwikiMarkers
|
||||
hi def link VimwikiSuperScriptChar VimwikiMarkers
|
||||
hi def link VimwikiSubScriptChar VimwikiMarkers
|
||||
hi def link VimwikiCodeChar VimwikiMarkers
|
||||
hi def link VimwikiHeaderChar VimwikiMarkers
|
||||
|
||||
hi def link VimwikiEqInCharT VimwikiMarkers
|
||||
hi def link VimwikiBoldCharT VimwikiMarkers
|
||||
hi def link VimwikiItalicCharT VimwikiMarkers
|
||||
hi def link VimwikiBoldItalicCharT VimwikiMarkers
|
||||
hi def link VimwikiItalicBoldCharT VimwikiMarkers
|
||||
hi def link VimwikiDelTextCharT VimwikiMarkers
|
||||
hi def link VimwikiSuperScriptCharT VimwikiMarkers
|
||||
hi def link VimwikiSubScriptCharT VimwikiMarkers
|
||||
hi def link VimwikiCodeCharT VimwikiMarkers
|
||||
hi def link VimwikiHeaderCharT VimwikiMarkers
|
||||
hi def link VimwikiLinkCharT VimwikiLinkT
|
||||
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
|
||||
"}}}
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
" Load syntax-specific functionality
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'_custom.vim'
|
||||
" -------------------------------------------------------------------------
|
||||
|
||||
let b:current_syntax="vimwiki"
|
||||
|
||||
" EMBEDDED syntax setup "{{{
|
||||
let nested = VimwikiGet('nested_syntaxes')
|
||||
if !empty(nested)
|
||||
for [hl_syntax, vim_syntax] in items(nested)
|
||||
call vimwiki#base#nested_syntax(vim_syntax,
|
||||
\ '^\s*'.g:vimwiki_rxPreStart.'\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
|
||||
\ '^\s*'.g:vimwiki_rxPreEnd, 'VimwikiPre')
|
||||
" call vimwiki#base#nested_syntax(vim_syntax,
|
||||
" \ '^\s*{{\$\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
" \ hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
|
||||
" \ '^\s*}}\$', 'VimwikiMath')
|
||||
endfor
|
||||
endif
|
||||
"}}}
|
||||
|
||||
let timeend = vimwiki#u#time(starttime) "XXX
|
||||
call VimwikiLog_extend('timing',['syntax:scans',timescans],['syntax:regexloaded',time0],['syntax:beforeHLexisting',time01],['syntax:afterHLexisting',time02],['syntax:end',timeend])
|
||||
@@ -4,6 +4,13 @@
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" placeholder for math environments
|
||||
let b:vimwiki_mathEnv = ""
|
||||
|
||||
" text: $ equation_inline $
|
||||
let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
|
||||
let g:vimwiki_char_eqin = '\$'
|
||||
|
||||
" text: *strong*
|
||||
" let g:vimwiki_rxBold = '\*[^*]\+\*'
|
||||
let g:vimwiki_rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
@@ -53,27 +60,20 @@ let g:vimwiki_char_superscript = '^'
|
||||
let g:vimwiki_rxSubScript = ',,[^,`]\+,,'
|
||||
let g:vimwiki_char_subscript = ',,'
|
||||
|
||||
" Header levels, 1-6
|
||||
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$'
|
||||
let g:vimwiki_rxH2 = '^\s*=\{2}[^=]\+.*[^=]\+=\{2}\s*$'
|
||||
let g:vimwiki_rxH3 = '^\s*=\{3}[^=]\+.*[^=]\+=\{3}\s*$'
|
||||
let g:vimwiki_rxH4 = '^\s*=\{4}[^=]\+.*[^=]\+=\{4}\s*$'
|
||||
let g:vimwiki_rxH5 = '^\s*=\{5}[^=]\+.*[^=]\+=\{5}\s*$'
|
||||
let g:vimwiki_rxH6 = '^\s*=\{6}[^=]\+.*[^=]\+=\{6}\s*$'
|
||||
let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH2.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH3.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH4.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH5.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH6.'\)'
|
||||
" generic headers
|
||||
let g:vimwiki_rxH = '='
|
||||
let g:vimwiki_symH = 1
|
||||
|
||||
|
||||
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)'
|
||||
|
||||
" <hr>, horizontal rule
|
||||
let g:vimwiki_rxHR = '^----.*$'
|
||||
let g:vimwiki_rxHR = '^-----*$'
|
||||
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let g:vimwiki_rxTableSep = '|'
|
||||
|
||||
" List items start with optional whitespace(s) then '* ' or '# '
|
||||
let g:vimwiki_rxListBullet = '^\s*\%(\*\|-\)\s'
|
||||
let g:vimwiki_rxListBullet = '^\s*[*-]\s'
|
||||
let g:vimwiki_rxListNumber = '^\s*#\s'
|
||||
|
||||
let g:vimwiki_rxListDefine = '::\(\s\|$\)'
|
||||
@@ -82,4 +82,8 @@ let g:vimwiki_rxListDefine = '::\(\s\|$\)'
|
||||
let g:vimwiki_rxPreStart = '{{{'
|
||||
let g:vimwiki_rxPreEnd = '}}}'
|
||||
|
||||
" Math block
|
||||
let g:vimwiki_rxMathStart = '{{\$'
|
||||
let g:vimwiki_rxMathEnd = '}}\$'
|
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$'
|
||||
89
bundle/git_vimwiki/syntax/vimwiki_markdown.vim
Normal file
89
bundle/git_vimwiki/syntax/vimwiki_markdown.vim
Normal file
@@ -0,0 +1,89 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Default syntax
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" placeholder for math environments
|
||||
let b:vimwiki_mathEnv = ""
|
||||
|
||||
" text: $ equation_inline $
|
||||
let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
|
||||
let g:vimwiki_char_eqin = '\$'
|
||||
|
||||
" text: *strong*
|
||||
" let g:vimwiki_rxBold = '\*[^*]\+\*'
|
||||
let g:vimwiki_rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'\*'.
|
||||
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
|
||||
\'\*'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let g:vimwiki_char_bold = '*'
|
||||
|
||||
" text: _emphasis_
|
||||
" let g:vimwiki_rxItalic = '_[^_]\+_'
|
||||
let g:vimwiki_rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'_'.
|
||||
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
|
||||
\'_'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let g:vimwiki_char_italic = '_'
|
||||
|
||||
" text: *_bold italic_* or _*italic bold*_
|
||||
let g:vimwiki_rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'\*_'.
|
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
|
||||
\'_\*'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let g:vimwiki_char_bolditalic = '\*_'
|
||||
|
||||
let g:vimwiki_rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'_\*'.
|
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
|
||||
\'\*_'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let g:vimwiki_char_italicbold = '_\*'
|
||||
|
||||
" text: `code`
|
||||
let g:vimwiki_rxCode = '`[^`]\+`'
|
||||
let g:vimwiki_char_code = '`'
|
||||
|
||||
" text: ~~deleted text~~
|
||||
let g:vimwiki_rxDelText = '\~\~[^~`]\+\~\~'
|
||||
let g:vimwiki_char_deltext = '\~\~'
|
||||
|
||||
" text: ^superscript^
|
||||
let g:vimwiki_rxSuperScript = '\^[^^`]\+\^'
|
||||
let g:vimwiki_char_superscript = '^'
|
||||
|
||||
" text: ,,subscript,,
|
||||
let g:vimwiki_rxSubScript = ',,[^,`]\+,,'
|
||||
let g:vimwiki_char_subscript = ',,'
|
||||
|
||||
" generic headers
|
||||
let g:vimwiki_rxH = '#'
|
||||
let g:vimwiki_symH = 0
|
||||
|
||||
|
||||
|
||||
" <hr>, horizontal rule
|
||||
let g:vimwiki_rxHR = '^-----*$'
|
||||
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let g:vimwiki_rxTableSep = '|'
|
||||
|
||||
" List items start with optional whitespace(s) then '* ' or '1. ', '2. ', etc.
|
||||
let g:vimwiki_rxListBullet = '^\s*[*+-]\s'
|
||||
let g:vimwiki_rxListNumber = '^\s*[0-9]\+\.\s'
|
||||
|
||||
let g:vimwiki_rxListDefine = '::\%(\s\|$\)'
|
||||
|
||||
" Preformatted text
|
||||
let g:vimwiki_rxPreStart = '```'
|
||||
let g:vimwiki_rxPreEnd = '```'
|
||||
|
||||
" Math block
|
||||
let g:vimwiki_rxMathStart = '{{\$'
|
||||
let g:vimwiki_rxMathEnd = '}}\$'
|
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$'
|
||||
367
bundle/git_vimwiki/syntax/vimwiki_markdown_custom.vim
Normal file
367
bundle/git_vimwiki/syntax/vimwiki_markdown_custom.vim
Normal file
@@ -0,0 +1,367 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Author: Stuart Andrews <stu.andrews@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" LINKS: assume this is common to all syntaxes "{{{
|
||||
|
||||
" }}}
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
" LINKS: setup of larger regexes {{{
|
||||
|
||||
" LINKS: setup wikilink0 regexps {{{
|
||||
" 0. [[URL]], or [[URL|DESCRIPTION]]
|
||||
|
||||
" 0a) match [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLink0 = g:vimwiki_rxWikiLink
|
||||
" 0b) match URL within [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLink0MatchUrl = g:vimwiki_rxWikiLinkMatchUrl
|
||||
" 0c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLink0MatchDescr = g:vimwiki_rxWikiLinkMatchDescr
|
||||
" }}}
|
||||
|
||||
" LINKS: setup wikilink1 regexps {{{
|
||||
" 1. [URL][], or [DESCRIPTION][URL]
|
||||
|
||||
let g:vimwiki_rxWikiLink1Prefix = '['
|
||||
let g:vimwiki_rxWikiLink1Suffix = ']'
|
||||
let g:vimwiki_rxWikiLink1Separator = ']['
|
||||
|
||||
" [URL][]
|
||||
let g:vimwiki_WikiLink1Template1 = g:vimwiki_rxWikiLink1Prefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLink1Separator. g:vimwiki_rxWikiLink1Suffix
|
||||
" [DESCRIPTION][URL]
|
||||
let g:vimwiki_WikiLink1Template2 = g:vimwiki_rxWikiLink1Prefix . '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLink1Suffix
|
||||
"
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\\[\]]'
|
||||
|
||||
let g:vimwiki_rxWikiLink1Prefix = escape(g:vimwiki_rxWikiLink1Prefix, magic_chars)
|
||||
let g:vimwiki_rxWikiLink1Suffix = escape(g:vimwiki_rxWikiLink1Suffix, magic_chars)
|
||||
let g:vimwiki_rxWikiLink1Separator = escape(g:vimwiki_rxWikiLink1Separator, magic_chars)
|
||||
let g:vimwiki_rxWikiLink1Url = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLink1Descr = valid_chars.'\{-}'
|
||||
|
||||
let g:vimwiki_rxWikiLink1InvalidPrefix = '[\]\[]\@<!'
|
||||
let g:vimwiki_rxWikiLink1InvalidSuffix = '[\]\[]\@!'
|
||||
let g:vimwiki_rxWikiLink1Prefix = g:vimwiki_rxWikiLink1InvalidPrefix.
|
||||
\ g:vimwiki_rxWikiLink1Prefix
|
||||
let g:vimwiki_rxWikiLink1Suffix = g:vimwiki_rxWikiLink1Suffix.
|
||||
\ g:vimwiki_rxWikiLink1InvalidSuffix
|
||||
|
||||
"
|
||||
" 1. [URL][], [DESCRIPTION][URL]
|
||||
" 1a) match [URL][], [DESCRIPTION][URL]
|
||||
let g:vimwiki_rxWikiLink1 = g:vimwiki_rxWikiLink1Prefix.
|
||||
\ g:vimwiki_rxWikiLink1Url. g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Suffix.
|
||||
\ '\|'. g:vimwiki_rxWikiLink1Prefix.
|
||||
\ g:vimwiki_rxWikiLink1Descr.g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Url.g:vimwiki_rxWikiLink1Suffix
|
||||
" 1b) match URL within [URL][], [DESCRIPTION][URL]
|
||||
let g:vimwiki_rxWikiLink1MatchUrl = g:vimwiki_rxWikiLink1Prefix.
|
||||
\ '\zs'. g:vimwiki_rxWikiLink1Url. '\ze'. g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Suffix.
|
||||
\ '\|'. g:vimwiki_rxWikiLink1Prefix.
|
||||
\ g:vimwiki_rxWikiLink1Descr. g:vimwiki_rxWikiLink1Separator.
|
||||
\ '\zs'. g:vimwiki_rxWikiLink1Url. '\ze'. g:vimwiki_rxWikiLink1Suffix
|
||||
" 1c) match DESCRIPTION within [DESCRIPTION][URL]
|
||||
let g:vimwiki_rxWikiLink1MatchDescr = g:vimwiki_rxWikiLink1Prefix.
|
||||
\ '\zs'. g:vimwiki_rxWikiLink1Descr.'\ze'. g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Url.g:vimwiki_rxWikiLink1Suffix
|
||||
" }}}
|
||||
|
||||
" LINKS: Syntax helper {{{
|
||||
let g:vimwiki_rxWikiLink1Prefix1 = g:vimwiki_rxWikiLink1Prefix
|
||||
let g:vimwiki_rxWikiLink1Suffix1 = g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Url.g:vimwiki_rxWikiLink1Suffix
|
||||
" }}}
|
||||
|
||||
" *. ANY wikilink {{{
|
||||
" *a) match ANY wikilink
|
||||
let g:vimwiki_rxWikiLink = ''.
|
||||
\ g:vimwiki_rxWikiLink0.'\|'.
|
||||
\ g:vimwiki_rxWikiLink1
|
||||
" *b) match URL within ANY wikilink
|
||||
let g:vimwiki_rxWikiLinkMatchUrl = ''.
|
||||
\ g:vimwiki_rxWikiLink0MatchUrl.'\|'.
|
||||
\ g:vimwiki_rxWikiLink1MatchUrl
|
||||
" *c) match DESCRIPTION within ANY wikilink
|
||||
let g:vimwiki_rxWikiLinkMatchDescr = ''.
|
||||
\ g:vimwiki_rxWikiLink0MatchDescr.'\|'.
|
||||
\ g:vimwiki_rxWikiLink1MatchDescr
|
||||
" }}}
|
||||
|
||||
|
||||
" LINKS: setup of wikiincl regexps {{{
|
||||
" }}}
|
||||
|
||||
" LINKS: Syntax helper {{{
|
||||
" }}}
|
||||
|
||||
" LINKS: Setup weblink0 regexps {{{
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||
let g:vimwiki_rxWeblink0 = g:vimwiki_rxWeblink
|
||||
" 0a) match URL within URL
|
||||
let g:vimwiki_rxWeblinkMatchUrl0 = g:vimwiki_rxWeblinkMatchUrl
|
||||
" 0b) match DESCRIPTION within URL
|
||||
let g:vimwiki_rxWeblinkMatchDescr0 = g:vimwiki_rxWeblinkMatchDescr
|
||||
" }}}
|
||||
|
||||
" LINKS: Setup weblink1 regexps {{{
|
||||
let g:vimwiki_rxWeblink1Prefix = '['
|
||||
let g:vimwiki_rxWeblink1Suffix = ')'
|
||||
let g:vimwiki_rxWeblink1Separator = ']('
|
||||
" [DESCRIPTION](URL)
|
||||
let g:vimwiki_Weblink1Template = g:vimwiki_rxWeblink1Prefix . '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWeblink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWeblink1Suffix
|
||||
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\]'
|
||||
|
||||
let g:vimwiki_rxWeblink1Prefix = escape(g:vimwiki_rxWeblink1Prefix, magic_chars)
|
||||
let g:vimwiki_rxWeblink1Suffix = escape(g:vimwiki_rxWeblink1Suffix, magic_chars)
|
||||
let g:vimwiki_rxWeblink1Separator = escape(g:vimwiki_rxWeblink1Separator, magic_chars)
|
||||
let g:vimwiki_rxWeblink1Url = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWeblink1Descr = valid_chars.'\{-}'
|
||||
|
||||
"
|
||||
" " 2012-02-04 TODO not starting with [[ or ][ ? ... prefix = '[\[\]]\@<!\['
|
||||
" 1. [DESCRIPTION](URL)
|
||||
" 1a) match [DESCRIPTION](URL)
|
||||
let g:vimwiki_rxWeblink1 = g:vimwiki_rxWeblink1Prefix.
|
||||
\ g:vimwiki_rxWeblink1Url.g:vimwiki_rxWeblink1Separator.
|
||||
\ g:vimwiki_rxWeblink1Descr.g:vimwiki_rxWeblink1Suffix
|
||||
" 1b) match URL within [DESCRIPTION](URL)
|
||||
let g:vimwiki_rxWeblink1MatchUrl = g:vimwiki_rxWeblink1Prefix.
|
||||
\ g:vimwiki_rxWeblink1Descr. g:vimwiki_rxWeblink1Separator.
|
||||
\ '\zs'.g:vimwiki_rxWeblink1Url.'\ze'. g:vimwiki_rxWeblink1Suffix
|
||||
" 1c) match DESCRIPTION within [DESCRIPTION](URL)
|
||||
let g:vimwiki_rxWeblink1MatchDescr = g:vimwiki_rxWeblink1Prefix.
|
||||
\ '\zs'.g:vimwiki_rxWeblink1Descr.'\ze'. g:vimwiki_rxWeblink1Separator.
|
||||
\ g:vimwiki_rxWeblink1Url. g:vimwiki_rxWeblink1Suffix
|
||||
" }}}
|
||||
|
||||
" Syntax helper {{{
|
||||
" TODO: image links too !!
|
||||
" let g:vimwiki_rxWeblink1Prefix1 = '!\?'. g:vimwiki_rxWeblink1Prefix
|
||||
let g:vimwiki_rxWeblink1Prefix1 = g:vimwiki_rxWeblink1Prefix
|
||||
let g:vimwiki_rxWeblink1Suffix1 = g:vimwiki_rxWeblink1Separator.
|
||||
\ g:vimwiki_rxWeblink1Url.g:vimwiki_rxWeblink1Suffix
|
||||
" }}}
|
||||
|
||||
" *. ANY weblink {{{
|
||||
" *a) match ANY weblink
|
||||
let g:vimwiki_rxWeblink = ''.
|
||||
\ g:vimwiki_rxWeblink1.'\|'.
|
||||
\ g:vimwiki_rxWeblink0
|
||||
" *b) match URL within ANY weblink
|
||||
let g:vimwiki_rxWeblinkMatchUrl = ''.
|
||||
\ g:vimwiki_rxWeblink1MatchUrl.'\|'.
|
||||
\ g:vimwiki_rxWeblinkMatchUrl0
|
||||
" *c) match DESCRIPTION within ANY weblink
|
||||
let g:vimwiki_rxWeblinkMatchDescr = ''.
|
||||
\ g:vimwiki_rxWeblink1MatchDescr.'\|'.
|
||||
\ g:vimwiki_rxWeblinkMatchDescr0
|
||||
" }}}
|
||||
|
||||
|
||||
" LINKS: Setup anylink regexps {{{
|
||||
let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
||||
\ g:vimwiki_rxWikiIncl.'\|'.g:vimwiki_rxWeblink
|
||||
" }}}
|
||||
|
||||
|
||||
" }}} end of Links
|
||||
|
||||
" LINKS: highlighting is complicated due to "nonexistent" links feature {{{
|
||||
function! s:add_target_syntax_ON(target, type) " {{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[vimwiki_debug] syntax target > '.a:target
|
||||
endif
|
||||
let prefix0 = 'syntax match '.a:type.' `'
|
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match '.a:type.'T `'
|
||||
let suffix1 = '` display contained'
|
||||
execute prefix0. a:target. suffix0
|
||||
execute prefix1. a:target. suffix1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:add_target_syntax_OFF(target, type) " {{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[vimwiki_debug] syntax target > '.a:target
|
||||
endif
|
||||
let prefix0 = 'syntax match VimwikiNoExistsLink `'
|
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
|
||||
let suffix1 = '` display contained'
|
||||
execute prefix0. a:target. suffix0
|
||||
execute prefix1. a:target. suffix1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:wrap_wikilink1_rx(target) "{{{
|
||||
return g:vimwiki_rxWikiLink1InvalidPrefix.a:target.
|
||||
\ g:vimwiki_rxWikiLink1InvalidSuffix
|
||||
endfunction "}}}
|
||||
|
||||
function! s:highlight_existing_links() "{{{
|
||||
" Wikilink1
|
||||
" Conditional highlighting that depends on the existence of a wiki file or
|
||||
" directory is only available for *schemeless* wiki links
|
||||
" Links are set up upon BufEnter (see plugin/...)
|
||||
let safe_links = vimwiki#base#file_pattern(b:existing_wikifiles)
|
||||
" Wikilink1 Dirs set up upon BufEnter (see plugin/...)
|
||||
let safe_dirs = vimwiki#base#file_pattern(b:existing_wikidirs)
|
||||
|
||||
" match [URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1,
|
||||
\ safe_links, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" match [DESCRIPTION][URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2,
|
||||
\ safe_links, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
|
||||
" match [DIRURL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1,
|
||||
\ safe_dirs, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" match [DESCRIPTION][DIRURL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2,
|
||||
\ safe_dirs, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
endfunction "}}}
|
||||
|
||||
|
||||
" use max highlighting - could be quite slow if there are too many wikifiles
|
||||
if VimwikiGet('maxhi')
|
||||
" WikiLink
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
|
||||
|
||||
" Subsequently, links verified on vimwiki's path are highlighted as existing
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
call s:highlight_existing_links()
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
else
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
" Wikilink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
endif
|
||||
|
||||
" Weblink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWeblink1, 'VimwikiWeblink1')
|
||||
|
||||
" WikiLink
|
||||
" All remaining schemes are highlighted automatically
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
||||
\ '\):'
|
||||
|
||||
" a) match [nonwiki-scheme-URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" b) match [DESCRIPTION][nonwiki-scheme-URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" }}}
|
||||
|
||||
|
||||
" generic headers "{{{
|
||||
|
||||
" Header levels, 1-6
|
||||
for i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.i.' /'.g:vimwiki_rxH{i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||
endfor
|
||||
|
||||
" }}}
|
||||
|
||||
" concealed chars " {{{
|
||||
if exists("+conceallevel")
|
||||
syntax conceal on
|
||||
endif
|
||||
|
||||
syntax spell toplevel
|
||||
|
||||
if g:vimwiki_debug > 1
|
||||
echom 'WikiLink1 Prefix: '.g:vimwiki_rxWikiLink1Prefix1
|
||||
echom 'WikiLink1 Suffix: '.g:vimwiki_rxWikiLink1Suffix1
|
||||
echom 'Weblink1 Prefix: '.g:vimwiki_rxWeblink1Prefix1
|
||||
echom 'Weblink1 Suffix: '.g:vimwiki_rxWeblink1Suffix1
|
||||
endif
|
||||
|
||||
" VimwikiWikiLink1Char is for syntax markers (and also URL when a description
|
||||
" is present) and may be concealed
|
||||
let options = ' contained transparent contains=NONE'
|
||||
" conceal wikilink1
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix1.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix1.'/'.options
|
||||
|
||||
" conceal weblink1
|
||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Prefix1.'"'.options
|
||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Suffix1.'"'.options
|
||||
|
||||
if exists("+conceallevel")
|
||||
syntax conceal off
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" non concealed chars " {{{
|
||||
" }}}
|
||||
|
||||
" main syntax groups {{{
|
||||
|
||||
" Tables
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ transparent contains=VimwikiCellSeparator,
|
||||
\ VimwikiLinkT,
|
||||
\ VimwikiWeblink1T,
|
||||
\ VimwikiWikiLink1T,
|
||||
\ VimwikiNoExistsLinkT,
|
||||
\ VimwikiEmoticons,
|
||||
\ VimwikiTodo,
|
||||
\ VimwikiBoldT,
|
||||
\ VimwikiItalicT,
|
||||
\ VimwikiBoldItalicT,
|
||||
\ VimwikiItalicBoldT,
|
||||
\ VimwikiDelTextT,
|
||||
\ VimwikiSuperScriptT,
|
||||
\ VimwikiSubScriptT,
|
||||
\ VimwikiCodeT,
|
||||
\ VimwikiEqInT,
|
||||
\ @Spell
|
||||
|
||||
" }}}
|
||||
|
||||
" header groups highlighting "{{{
|
||||
"}}}
|
||||
|
||||
|
||||
" syntax group highlighting "{{{
|
||||
hi def link VimwikiWeblink1 VimwikiLink
|
||||
hi def link VimwikiWeblink1T VimwikiLink
|
||||
|
||||
hi def link VimwikiWikiLink1 VimwikiLink
|
||||
hi def link VimwikiWikiLink1T VimwikiLink
|
||||
"}}}
|
||||
|
||||
|
||||
|
||||
" EMBEDDED syntax setup "{{{
|
||||
"}}}
|
||||
"
|
||||
@@ -4,6 +4,13 @@
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" placeholder for math environments
|
||||
let b:vimwiki_mathEnv = ""
|
||||
|
||||
" text: $ equation_inline $
|
||||
let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
|
||||
let g:vimwiki_char_eqin = '\$'
|
||||
|
||||
" text: '''strong'''
|
||||
let g:vimwiki_rxBold = "'''[^']\\+'''"
|
||||
let g:vimwiki_char_bold = "'''"
|
||||
@@ -34,31 +41,22 @@ let g:vimwiki_char_superscript = '^'
|
||||
let g:vimwiki_rxSubScript = ',,[^,]\+,,'
|
||||
let g:vimwiki_char_subscript = ',,'
|
||||
|
||||
" Header levels, 1-6
|
||||
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$'
|
||||
let g:vimwiki_rxH2 = '^\s*=\{2}[^=]\+.*[^=]\+=\{2}\s*$'
|
||||
let g:vimwiki_rxH3 = '^\s*=\{3}[^=]\+.*[^=]\+=\{3}\s*$'
|
||||
let g:vimwiki_rxH4 = '^\s*=\{4}[^=]\+.*[^=]\+=\{4}\s*$'
|
||||
let g:vimwiki_rxH5 = '^\s*=\{5}[^=]\+.*[^=]\+=\{5}\s*$'
|
||||
let g:vimwiki_rxH6 = '^\s*=\{6}[^=]\+.*[^=]\+=\{6}\s*$'
|
||||
let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH2.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH3.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH4.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH5.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH6.'\)'
|
||||
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)'
|
||||
" generic headers
|
||||
let g:vimwiki_rxH = '='
|
||||
let g:vimwiki_symH = 1
|
||||
|
||||
|
||||
|
||||
" <hr>, horizontal rule
|
||||
let g:vimwiki_rxHR = '^----.*$'
|
||||
let g:vimwiki_rxHR = '^-----*$'
|
||||
|
||||
" Tables. Each line starts and ends with '||'; each cell is separated by '||'
|
||||
let g:vimwiki_rxTable = '||'
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let g:vimwiki_rxTableSep = '|'
|
||||
|
||||
" Bulleted list items start with whitespace(s), then '*'
|
||||
" highlight only bullets and digits.
|
||||
let g:vimwiki_rxListBullet = '^\s*\*\+\([^*]*$\)\@='
|
||||
let g:vimwiki_rxListNumber = '^\s*#\+'
|
||||
let g:vimwiki_rxListBullet = '^\s*\*\+\s\%([^*]*$\)\@='
|
||||
let g:vimwiki_rxListNumber = '^\s*#\+\s'
|
||||
|
||||
let g:vimwiki_rxListDefine = '^\%(;\|:\)\s'
|
||||
|
||||
@@ -66,4 +64,8 @@ let g:vimwiki_rxListDefine = '^\%(;\|:\)\s'
|
||||
let g:vimwiki_rxPreStart = '<pre>'
|
||||
let g:vimwiki_rxPreEnd = '<\/pre>'
|
||||
|
||||
" Math block
|
||||
let g:vimwiki_rxMathStart = '{{\$'
|
||||
let g:vimwiki_rxMathEnd = '}}\$'
|
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$'
|
||||
@@ -46,6 +46,9 @@ endif"}}}
|
||||
if !exists("g:gundo_prefer_python3")"{{{
|
||||
let g:gundo_prefer_python3 = 0
|
||||
endif"}}}
|
||||
if !exists("g:gundo_auto_preview")"{{{
|
||||
let g:gundo_auto_preview = 1
|
||||
endif"}}}
|
||||
|
||||
let s:has_supported_python = 0
|
||||
if g:gundo_prefer_python3 && has('python3')"{{{
|
||||
@@ -111,6 +114,7 @@ function! s:GundoMapGraph()"{{{
|
||||
nnoremap <script> <silent> <buffer> gg gg:call <sid>GundoMove(1)<CR>
|
||||
nnoremap <script> <silent> <buffer> P :call <sid>GundoPlayTo()<CR>
|
||||
nnoremap <script> <silent> <buffer> p :call <sid>GundoRenderChangePreview()<CR>
|
||||
nnoremap <script> <silent> <buffer> r :call <sid>GundoRenderPreview()<CR>
|
||||
nnoremap <script> <silent> <buffer> q :call <sid>GundoClose()<CR>
|
||||
cabbrev <script> <silent> <buffer> q call <sid>GundoClose()
|
||||
cabbrev <script> <silent> <buffer> quit call <sid>GundoClose()
|
||||
@@ -318,11 +322,17 @@ function! s:GundoToggle()"{{{
|
||||
endfunction"}}}
|
||||
|
||||
function! s:GundoShow()"{{{
|
||||
if !s:GundoIsVisible()
|
||||
let g:gundo_target_n = bufnr('')
|
||||
let g:gundo_target_f = @%
|
||||
call s:GundoOpen()
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:GundoHide()"{{{
|
||||
if s:GundoIsVisible()
|
||||
call s:GundoClose()
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
"}}}
|
||||
@@ -377,7 +387,9 @@ function! s:GundoMove(direction) range"{{{
|
||||
call cursor(0, idx2 + 1)
|
||||
endif
|
||||
|
||||
if g:gundo_auto_preview == 1
|
||||
call s:GundoRenderPreview()
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
"}}}
|
||||
@@ -436,6 +448,14 @@ function! gundo#GundoToggle()"{{{
|
||||
call s:GundoToggle()
|
||||
endfunction"}}}
|
||||
|
||||
function! gundo#GundoShow()"{{{
|
||||
call s:GundoShow()
|
||||
endfunction"}}}
|
||||
|
||||
function! gundo#GundoHide()"{{{
|
||||
call s:GundoHide()
|
||||
endfunction"}}}
|
||||
|
||||
function! gundo#GundoRenderGraph()"{{{
|
||||
call s:GundoRenderGraph()
|
||||
endfunction"}}}
|
||||
|
||||
@@ -5,9 +5,9 @@ Making Vim's undo tree usable by humans.
|
||||
==============================================================================
|
||||
CONTENTS *Gundo-contents*
|
||||
|
||||
1. Intro .......................... |GundoIntro|
|
||||
2. Usage .......................... |GundoUsage|
|
||||
3. Configuration .................. |GundoConfig|
|
||||
1. Intro ........................... |GundoIntro|
|
||||
2. Usage ........................... |GundoUsage|
|
||||
3. Configuration ................... |GundoConfig|
|
||||
3.1 gundo_width ............... |gundo_width|
|
||||
3.2 gundo_preview_height ...... |gundo_preview_height|
|
||||
3.3 gundo_preview_bottom ...... |gundo_preview_bottom|
|
||||
@@ -19,11 +19,12 @@ CONTENTS *Gundo-contents*
|
||||
3.8 gundo_close_on_revert ..... |gundo_close_on_revert|
|
||||
3.9 gundo_preview_statusline .. |gundo_preview_statusline|
|
||||
gundo_tree_statusline ..... |gundo_tree_statusline|
|
||||
4. License ........................ |GundoLicense|
|
||||
5. Bugs ........................... |GundoBugs|
|
||||
6. Contributing ................... |GundoContributing|
|
||||
7. Changelog ...................... |GundoChangelog|
|
||||
8. Credits ........................ |GundoCredits|
|
||||
3.10 gundo_auto_preview ........ |gundo_auto_preview|
|
||||
4. License ......................... |GundoLicense|
|
||||
5. Bugs ............................ |GundoBugs|
|
||||
6. Contributing .................... |GundoContributing|
|
||||
7. Changelog ....................... |GundoChangelog|
|
||||
8. Credits ......................... |GundoCredits|
|
||||
|
||||
==============================================================================
|
||||
1. Intro *GundoIntro*
|
||||
@@ -206,6 +207,15 @@ Set these to a string to display it as the status line for each Gundo window.
|
||||
|
||||
Default: unset (windows use the default statusline)
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.10 g:gundo_auto_preview *gundo_auto_preview*
|
||||
|
||||
Set this to 0 to disable automatically rendering preview diffs as you move
|
||||
through the undo tree (you can still render a specific diff with r). This can
|
||||
be useful on large files and undo trees to speed up Gundo.
|
||||
|
||||
Default: 1 (automatically preview diffs)
|
||||
|
||||
==============================================================================
|
||||
4. License *GundoLicense*
|
||||
|
||||
@@ -228,7 +238,10 @@ GitHub: http://github.com/sjl/gundo.vim/
|
||||
|
||||
==============================================================================
|
||||
7. Changelog *GundoChangelog*
|
||||
|
||||
v2.4.0
|
||||
* Add auto preview option.
|
||||
* Add 'r' mapping to preview current state.
|
||||
* Add public gundo#GundoShow() and gundo#GundoHide() functions.
|
||||
v2.3.0
|
||||
* Add statusline configuration.
|
||||
v2.2.2
|
||||
|
||||
@@ -10,8 +10,13 @@
|
||||
" Dependencies:
|
||||
" - SearchSpecial.vim autoload script (optional, for improved search messages).
|
||||
"
|
||||
" Version: 2.6.2
|
||||
" Version: 2.6.4
|
||||
" Changes:
|
||||
" 23-Apr-2012, Ingo Karkat + fanhe
|
||||
" - Force case via \c / \C instead of temporarily unsetting 'smartcase'.
|
||||
" - Allow to override 'ignorecase' setting via g:mwIgnoreCase. Thanks to fanhe
|
||||
" for the idea and sending a patch.
|
||||
"
|
||||
" 26-Mar-2012, Ingo Karkat
|
||||
" - ENH: When a [count] exceeding the number of available mark groups is given,
|
||||
" a summary of marks is given and the user is asked to select a mark group.
|
||||
@@ -215,6 +220,9 @@ endif
|
||||
function! s:EscapeText( text )
|
||||
return substitute( escape(a:text, '\' . '^$.*[~'), "\n", '\\n', 'ge' )
|
||||
endfunction
|
||||
function! s:IsIgnoreCase( expr )
|
||||
return ((exists('g:mwIgnoreCase') ? g:mwIgnoreCase : &ignorecase) && a:expr !~# '\\\@<!\\C')
|
||||
endfunction
|
||||
" Mark the current word, like the built-in star command.
|
||||
" If the cursor is on an existing mark, remove it.
|
||||
function! mark#MarkCurrentWord( groupNum )
|
||||
@@ -300,7 +308,7 @@ function! s:MarkMatch( indices, expr )
|
||||
" 'ignorecase' and 'smartcase' settings.
|
||||
" Make the match according to the 'ignorecase' setting, like the star command.
|
||||
" (But honor an explicit case-sensitive regexp via the /\C/ atom.)
|
||||
let l:expr = ((&ignorecase && a:expr !~# '\\\@<!\\C') ? '\c' . a:expr : a:expr)
|
||||
let l:expr = (s:IsIgnoreCase(a:expr) ? '\c' : '') . a:expr
|
||||
|
||||
" To avoid an arbitrary ordering of highlightings, we assign a different
|
||||
" priority based on the highlight group, and ensure that the highest
|
||||
@@ -561,11 +569,12 @@ function! mark#CurrentMark()
|
||||
let i = s:markNum - 1
|
||||
while i >= 0
|
||||
if ! empty(s:pattern[i])
|
||||
let matchPattern = (s:IsIgnoreCase(s:pattern[i]) ? '\c' : '\C') . s:pattern[i]
|
||||
" Note: col() is 1-based, all other indexes zero-based!
|
||||
let start = 0
|
||||
while start >= 0 && start < strlen(line) && start < col('.')
|
||||
let b = match(line, s:pattern[i], start)
|
||||
let e = matchend(line, s:pattern[i], start)
|
||||
let b = match(line, matchPattern, start)
|
||||
let e = matchend(line, matchPattern, start)
|
||||
if b < col('.') && col('.') <= e
|
||||
return [s:pattern[i], [line('.'), (b + 1)], i]
|
||||
endif
|
||||
@@ -617,8 +626,9 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType )
|
||||
" result from the *-command-alike mappings should not obey 'smartcase' (like
|
||||
" the * command itself), anyway. If the :Mark command wants to support
|
||||
" 'smartcase', it'd have to emulate that into the regular expression.
|
||||
let l:save_smartcase = &smartcase
|
||||
set nosmartcase
|
||||
" Instead of temporarily unsetting 'smartcase', we force the correct
|
||||
" case-matching behavior through \c / \C.
|
||||
let l:searchPattern = (s:IsIgnoreCase(a:pattern) ? '\c' : '\C') . a:pattern
|
||||
|
||||
let l:count = v:count1
|
||||
let l:isWrapped = 0
|
||||
@@ -628,7 +638,7 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType )
|
||||
let [l:prevLine, l:prevCol] = [line('.'), col('.')]
|
||||
|
||||
" Search for next match, 'wrapscan' applies.
|
||||
let [l:line, l:col] = searchpos( a:pattern, (a:isBackward ? 'b' : '') )
|
||||
let [l:line, l:col] = searchpos( l:searchPattern, (a:isBackward ? 'b' : '') )
|
||||
|
||||
"****D echomsg '****' a:isBackward string([l:line, l:col]) string(a:currentMarkPosition) l:count
|
||||
if a:isBackward && l:line > 0 && [l:line, l:col] == a:currentMarkPosition && l:count == v:count1
|
||||
@@ -674,7 +684,6 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType )
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
let &smartcase = l:save_smartcase
|
||||
|
||||
" We're not stuck when the search wrapped around and landed on the current
|
||||
" mark; that's why we exclude a possible wrap-around via v:count1 == 1.
|
||||
|
||||
@@ -263,6 +263,12 @@ To turn off the automatic persistence of marks across Vim sessions: >
|
||||
let g:mwAutoSaveMarks = 0
|
||||
You can still explicitly save marks via |:MarkSave|.
|
||||
|
||||
*g:mwIgnoreCase*
|
||||
If you have set 'ignorecase', but want marks to be case-insensitive, you can
|
||||
override the default behavior of using 'ignorecase' by setting: >
|
||||
let g:mwIgnoreCase = 0
|
||||
<
|
||||
|
||||
*mark-mappings*
|
||||
You can use different mappings by mapping to the <Plug>Mark... mappings (use
|
||||
":map <Plug>Mark" to list them all) before this plugin is sourced.
|
||||
@@ -318,6 +324,10 @@ http://vim.wikia.com/wiki/Highlight_multiple_words:
|
||||
==============================================================================
|
||||
HISTORY *mark-history*
|
||||
|
||||
2.6.4 23-Apr-2012
|
||||
- Allow to override 'ignorecase' setting via g:mwIgnoreCase. Thanks to fanhe
|
||||
for the idea and sending a patch.
|
||||
|
||||
2.6.3 27-Mar-2012
|
||||
- ENH: Allow choosing of palette and limiting of default mark highlight groups
|
||||
via g:mwDefaultHighlightingPalette and g:mwDefaultHighlightingNum.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,286 +0,0 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Desc: Handle diary notes
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" Load only once {{{
|
||||
if exists("g:loaded_vimwiki_diary_auto") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimwiki_diary_auto = 1
|
||||
"}}}
|
||||
|
||||
function! s:prefix_zero(num) "{{{
|
||||
if a:num < 10
|
||||
return '0'.a:num
|
||||
endif
|
||||
return a:num
|
||||
endfunction "}}}
|
||||
|
||||
function! s:desc(d1, d2) "{{{
|
||||
return a:d1 == a:d2 ? 0 : a:d1 < a:d2 ? 1 : -1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_date_link(fmt) "{{{
|
||||
return strftime(a:fmt)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:link_exists(lines, link) "{{{
|
||||
let link_exists = 0
|
||||
for line in a:lines
|
||||
if line =~ escape(a:link, '[]\')
|
||||
let link_exists = 1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
return link_exists
|
||||
endfunction "}}}
|
||||
|
||||
function! s:diary_path() "{{{
|
||||
return VimwikiGet('path').VimwikiGet('diary_rel_path')
|
||||
endfunction "}}}
|
||||
|
||||
function! s:diary_index() "{{{
|
||||
return s:diary_path().VimwikiGet('diary_index').VimwikiGet('ext')
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_diary_range(lines, header) "{{{
|
||||
let rx = '\[\[\d\{4}-\d\d-\d\d\]\]'
|
||||
let idx = 0
|
||||
let ln_start = -1
|
||||
let ln_end = -1
|
||||
for line in a:lines
|
||||
if ln_start != -1
|
||||
if line =~ '^\s*\(=\)\+.*\1\s*$' || (line !~ rx && line !~ '^\s*$')
|
||||
break
|
||||
endif
|
||||
endif
|
||||
if line =~ '^\s*\(=\)\+\s*'.a:header.'\s*\1\s*$'
|
||||
let ln_start = idx + 1
|
||||
endif
|
||||
let idx += 1
|
||||
endfor
|
||||
|
||||
let ln_end = idx
|
||||
return [ln_start, ln_end]
|
||||
endfunction "}}}
|
||||
|
||||
function! s:diary_date_link() "{{{
|
||||
return s:get_date_link(VimwikiGet('diary_link_fmt'))
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_file_contents(file_name) "{{{
|
||||
let lines = []
|
||||
let bufnr = bufnr(expand(a:file_name))
|
||||
if bufnr != -1
|
||||
let lines = getbufline(bufnr, 1, '$')
|
||||
else
|
||||
try
|
||||
let lines = readfile(expand(a:file_name))
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
return [lines, bufnr]
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_links() "{{{
|
||||
let rx = '\d\{4}-\d\d-\d\d'
|
||||
let s_links = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').
|
||||
\ '*'.VimwikiGet('ext'))
|
||||
|
||||
let s_links = substitute(s_links, '\'.VimwikiGet('ext'), "", "g")
|
||||
let links = split(s_links, '\n')
|
||||
|
||||
" remove backup files (.wiki~)
|
||||
call filter(links, 'v:val !~ ''.*\~$''')
|
||||
|
||||
" remove paths
|
||||
call map(links, 'fnamemodify(v:val, ":t")')
|
||||
|
||||
call filter(links, 'v:val =~ "'.escape(rx, '\').'"')
|
||||
return links
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_position_links(link) "{{{
|
||||
let idx = -1
|
||||
let links = []
|
||||
if a:link =~ '\d\{4}-\d\d-\d\d'
|
||||
let links = s:get_links()
|
||||
" include 'today' into links
|
||||
if index(links, s:diary_date_link()) == -1
|
||||
call add(links, s:diary_date_link())
|
||||
endif
|
||||
call sort(links)
|
||||
let idx = index(links, a:link)
|
||||
endif
|
||||
return [idx, links]
|
||||
endfunction "}}}
|
||||
|
||||
function! s:format_links(links) "{{{
|
||||
let lines = []
|
||||
let line = '| '
|
||||
let idx = 0
|
||||
let trigger = 0
|
||||
while idx < len(a:links)
|
||||
if idx/VimwikiGet('diary_link_count') > trigger
|
||||
let trigger = idx/VimwikiGet('diary_link_count')
|
||||
call add(lines, substitute(line, '\s\+$', '', ''))
|
||||
let line = '| '
|
||||
endif
|
||||
let line .= a:links[idx].' | '
|
||||
let idx += 1
|
||||
endwhile
|
||||
call add(lines, substitute(line, '\s\+$', '', ''))
|
||||
call extend(lines, [''])
|
||||
|
||||
return lines
|
||||
endfunction "}}}
|
||||
|
||||
function! s:add_link(page, header, link) "{{{
|
||||
let [lines, bufnr] = s:get_file_contents(a:page)
|
||||
|
||||
let [ln_start, ln_end] = s:get_diary_range(lines, a:header)
|
||||
|
||||
let link = '[['.a:link.']]'
|
||||
|
||||
let link_exists = s:link_exists(lines[ln_start : ln_end], link)
|
||||
|
||||
if !link_exists
|
||||
|
||||
if ln_start == -1
|
||||
call insert(lines, '= '.a:header.' =')
|
||||
let ln_start = 1
|
||||
let ln_end = 1
|
||||
endif
|
||||
|
||||
" removing 'old' links
|
||||
let idx = ln_end - ln_start
|
||||
while idx > 0
|
||||
call remove(lines, ln_start)
|
||||
let idx -= 1
|
||||
endwhile
|
||||
|
||||
" get all diary links from filesystem
|
||||
let links = s:get_links()
|
||||
call map(links, '"[[".v:val."]]"')
|
||||
|
||||
" add current link
|
||||
if index(links, link) == -1
|
||||
call add(links, link)
|
||||
endif
|
||||
|
||||
let links = sort(links, 's:desc')
|
||||
call extend(lines, s:format_links(links), ln_start)
|
||||
|
||||
if bufnr != -1
|
||||
exe 'buffer '.bufnr
|
||||
if !&readonly
|
||||
1,$delete _
|
||||
call append(1, lines)
|
||||
1,1delete _
|
||||
endif
|
||||
else
|
||||
call writefile(lines, expand(a:page))
|
||||
endif
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:make_date_link(...) "{{{
|
||||
if a:0
|
||||
let link = a:1
|
||||
else
|
||||
let link = s:diary_date_link()
|
||||
endif
|
||||
let header = VimwikiGet('diary_header')
|
||||
call s:add_link(s:diary_index(), header, link)
|
||||
return VimwikiGet('diary_rel_path').link
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#make_note(index, ...) "{{{
|
||||
call vimwiki#base#select(a:index)
|
||||
call vimwiki#base#mkdir(VimwikiGet('path').VimwikiGet('diary_rel_path'))
|
||||
if a:0
|
||||
let link = s:make_date_link(a:1)
|
||||
else
|
||||
let link = s:make_date_link()
|
||||
endif
|
||||
call vimwiki#base#open_link(':e ', link, s:diary_index())
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#goto_index(index) "{{{
|
||||
call vimwiki#base#select(a:index)
|
||||
call vimwiki#base#edit_file(':e', s:diary_index())
|
||||
endfunction "}}}
|
||||
|
||||
" Calendar.vim callback function.
|
||||
function! vimwiki#diary#calendar_action(day, month, year, week, dir) "{{{
|
||||
let day = s:prefix_zero(a:day)
|
||||
let month = s:prefix_zero(a:month)
|
||||
|
||||
let link = a:year.'-'.month.'-'.day
|
||||
if winnr('#') == 0
|
||||
if a:dir == 'V'
|
||||
vsplit
|
||||
else
|
||||
split
|
||||
endif
|
||||
else
|
||||
wincmd p
|
||||
if !&hidden && &modified
|
||||
new
|
||||
endif
|
||||
endif
|
||||
|
||||
" Create diary note for a selected date in default wiki.
|
||||
call vimwiki#diary#make_note(1, link)
|
||||
endfunction "}}}
|
||||
|
||||
" Calendar.vim sign function.
|
||||
function vimwiki#diary#calendar_sign(day, month, year) "{{{
|
||||
let day = s:prefix_zero(a:day)
|
||||
let month = s:prefix_zero(a:month)
|
||||
let sfile = VimwikiGet('path').VimwikiGet('diary_rel_path').
|
||||
\ a:year.'-'.month.'-'.day.VimwikiGet('ext')
|
||||
return filereadable(expand(sfile))
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#goto_next_day() "{{{
|
||||
let link = ''
|
||||
let [idx, links] = s:get_position_links(expand('%:t:r'))
|
||||
|
||||
if idx == (len(links) - 1)
|
||||
return
|
||||
endif
|
||||
|
||||
if idx != -1 && idx < len(links) - 1
|
||||
let link = VimwikiGet('diary_rel_path').links[idx+1]
|
||||
else
|
||||
" goto today
|
||||
let link = VimwikiGet('diary_rel_path').s:diary_date_link()
|
||||
endif
|
||||
|
||||
if len(link)
|
||||
call vimwiki#base#open_link(':e ', link)
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#goto_prev_day() "{{{
|
||||
let link = ''
|
||||
let [idx, links] = s:get_position_links(expand('%:t:r'))
|
||||
|
||||
if idx == 0
|
||||
return
|
||||
endif
|
||||
|
||||
if idx > 0
|
||||
let link = VimwikiGet('diary_rel_path').links[idx-1]
|
||||
else
|
||||
" goto today
|
||||
let link = VimwikiGet('diary_rel_path').s:diary_date_link()
|
||||
endif
|
||||
|
||||
if len(link)
|
||||
call vimwiki#base#open_link(':e ', link)
|
||||
endif
|
||||
endfunction "}}}
|
||||
@@ -1,39 +0,0 @@
|
||||
body {font-family: Tahoma, Geneva, sans-serif; margin: 1em 2em 1em 2em; font-size: 100%; line-height: 130%;}
|
||||
h1, h2, h3, h4, h5, h6 {font-family: Trebuchet MS, Helvetica, sans-serif; font-weight: bold; line-height:100%; margin-top: 1.5em; margin-bottom: 0.5em;}
|
||||
h1 {font-size: 2.6em; color: #000000;}
|
||||
h2 {font-size: 2.2em; color: #404040;}
|
||||
h3 {font-size: 1.8em; color: #707070;}
|
||||
h4 {font-size: 1.4em; color: #909090;}
|
||||
h5 {font-size: 1.3em; color: #989898;}
|
||||
h6 {font-size: 1.2em; color: #9c9c9c;}
|
||||
p, pre, blockquote, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;}
|
||||
ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;}
|
||||
li {margin: 0.3em auto;}
|
||||
ul {margin-left: 2em; padding-left: 0.5em;}
|
||||
dt {font-weight: bold;}
|
||||
img {border: none;}
|
||||
pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;}
|
||||
blockquote {padding: 0.4em; background-color: #f6f5eb;}
|
||||
th, td {border: 1px solid #ccc; padding: 0.3em;}
|
||||
th {background-color: #f0f0f0;}
|
||||
hr {border: none; border-top: 1px solid #ccc; width: 100%;}
|
||||
del {text-decoration: line-through; color: #777777;}
|
||||
.toc li {list-style-type: none;}
|
||||
.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;}
|
||||
.justleft {text-align: left;}
|
||||
.justright {text-align: right;}
|
||||
.justcenter {text-align: center;}
|
||||
.center {margin-left: auto; margin-right: auto;}
|
||||
/* classes for items of todo lists */
|
||||
.done0:before {content: "\2592\2592\2592\2592"; color: SkyBlue;}
|
||||
.done1:before {content: "\2588\2592\2592\2592"; color: SkyBlue;}
|
||||
.done2:before {content: "\2588\2588\2592\2592"; color: SkyBlue;}
|
||||
.done3:before {content: "\2588\2588\2588\2592"; color: SkyBlue;}
|
||||
.done4:before {content: "\2588\2588\2588\2588"; color: SkyBlue;}
|
||||
/* comment the next four or five lines out *
|
||||
* if you do not want color-coded todo lists */
|
||||
.done0 {color: #c00000;}
|
||||
.done1 {color: #c08000;}
|
||||
.done2 {color: #80a000;}
|
||||
.done3 {color: #00c000;}
|
||||
.done4 {color: #7f7f7f; text-decoration: line-through;}
|
||||
@@ -1,445 +0,0 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki plugin file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
|
||||
|
||||
if exists("loaded_vimwiki") || &cp
|
||||
finish
|
||||
endif
|
||||
let loaded_vimwiki = 1
|
||||
|
||||
let s:old_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" HELPER functions {{{
|
||||
function! s:default(varname, value) "{{{
|
||||
if !exists('g:vimwiki_'.a:varname)
|
||||
let g:vimwiki_{a:varname} = a:value
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" return longest common path prefix of 2 given paths.
|
||||
" '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki'
|
||||
function! s:path_common_pfx(path1, path2) "{{{
|
||||
let p1 = split(a:path1, '[/\\]', 1)
|
||||
let p2 = split(a:path2, '[/\\]', 1)
|
||||
|
||||
let idx = 0
|
||||
let minlen = min([len(p1), len(p2)])
|
||||
while (idx < minlen) && (p1[idx] ==? p2[idx])
|
||||
let idx = idx + 1
|
||||
endwhile
|
||||
if idx == 0
|
||||
return ''
|
||||
else
|
||||
return join(p1[: idx-1], '/')
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:find_wiki(path) "{{{
|
||||
let idx = 0
|
||||
while idx < len(g:vimwiki_list)
|
||||
let path = vimwiki#base#chomp_slash(expand(VimwikiGet('path', idx)))
|
||||
let path = vimwiki#base#path_norm(path)
|
||||
if s:path_common_pfx(path, a:path) == path
|
||||
return idx
|
||||
endif
|
||||
let idx += 1
|
||||
endwhile
|
||||
return -1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:setup_buffer_leave()"{{{
|
||||
if &filetype == 'vimwiki' && !exists("b:vimwiki_idx")
|
||||
let b:vimwiki_idx = g:vimwiki_current_idx
|
||||
endif
|
||||
|
||||
" Set up menu
|
||||
if g:vimwiki_menu != ""
|
||||
exe 'nmenu disable '.g:vimwiki_menu.'.Table'
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:setup_filetype() "{{{
|
||||
" Find what wiki current buffer belongs to.
|
||||
let path = expand('%:p:h')
|
||||
let ext = '.'.expand('%:e')
|
||||
let idx = s:find_wiki(path)
|
||||
|
||||
if idx == -1 && g:vimwiki_global_ext == 0
|
||||
return
|
||||
endif
|
||||
|
||||
set filetype=vimwiki
|
||||
endfunction "}}}
|
||||
|
||||
function! s:setup_buffer_enter() "{{{
|
||||
if exists("b:vimwiki_idx")
|
||||
let g:vimwiki_current_idx = b:vimwiki_idx
|
||||
else
|
||||
" Find what wiki current buffer belongs to.
|
||||
" If wiki does not exist in g:vimwiki_list -- add new wiki there with
|
||||
" buffer's path and ext.
|
||||
" Else set g:vimwiki_current_idx to that wiki index.
|
||||
let path = expand('%:p:h')
|
||||
let ext = '.'.expand('%:e')
|
||||
let idx = s:find_wiki(path)
|
||||
|
||||
" The buffer's file is not in the path and user do not want his wiki
|
||||
" extension to be global -- do not add new wiki.
|
||||
if idx == -1 && g:vimwiki_global_ext == 0
|
||||
return
|
||||
endif
|
||||
|
||||
if idx == -1
|
||||
call add(g:vimwiki_list, {'path': path, 'ext': ext, 'temp': 1})
|
||||
let g:vimwiki_current_idx = len(g:vimwiki_list) - 1
|
||||
else
|
||||
let g:vimwiki_current_idx = idx
|
||||
endif
|
||||
|
||||
let b:vimwiki_idx = g:vimwiki_current_idx
|
||||
endif
|
||||
|
||||
" If you have
|
||||
" au GUIEnter * VimwikiIndex
|
||||
" Then change it to
|
||||
" au GUIEnter * nested VimwikiIndex
|
||||
if &filetype == ''
|
||||
set filetype=vimwiki
|
||||
endif
|
||||
|
||||
" Update existed/non-existed links highlighting.
|
||||
call vimwiki#base#highlight_links()
|
||||
|
||||
" Settings foldmethod, foldexpr and foldtext are local to window. Thus in a
|
||||
" new tab with the same buffer folding is reset to vim defaults. So we
|
||||
" insist vimwiki folding here.
|
||||
if g:vimwiki_folding == 1 && &fdm != 'expr'
|
||||
setlocal fdm=expr
|
||||
setlocal foldexpr=VimwikiFoldLevel(v:lnum)
|
||||
setlocal foldtext=VimwikiFoldText()
|
||||
endif
|
||||
|
||||
" And conceal level too.
|
||||
if g:vimwiki_conceallevel && exists("+conceallevel")
|
||||
let &conceallevel = g:vimwiki_conceallevel
|
||||
endif
|
||||
|
||||
" Set up menu
|
||||
if g:vimwiki_menu != ""
|
||||
exe 'nmenu enable '.g:vimwiki_menu.'.Table'
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" OPTION get/set functions {{{
|
||||
" return value of option for current wiki or if second parameter exists for
|
||||
" wiki with a given index.
|
||||
function! VimwikiGet(option, ...) "{{{
|
||||
if a:0 == 0
|
||||
let idx = g:vimwiki_current_idx
|
||||
else
|
||||
let idx = a:1
|
||||
endif
|
||||
if !has_key(g:vimwiki_list[idx], a:option) &&
|
||||
\ has_key(s:vimwiki_defaults, a:option)
|
||||
if a:option == 'path_html'
|
||||
let g:vimwiki_list[idx][a:option] =
|
||||
\VimwikiGet('path', idx)[:-2].'_html/'
|
||||
else
|
||||
let g:vimwiki_list[idx][a:option] =
|
||||
\s:vimwiki_defaults[a:option]
|
||||
endif
|
||||
endif
|
||||
|
||||
" if path's ending is not a / or \
|
||||
" then add it
|
||||
if a:option == 'path' || a:option == 'path_html'
|
||||
let p = g:vimwiki_list[idx][a:option]
|
||||
" resolve doesn't work quite right with symlinks ended with / or \
|
||||
let p = substitute(p, '[/\\]\+$', '', '')
|
||||
let p = resolve(expand(p))
|
||||
let g:vimwiki_list[idx][a:option] = p.'/'
|
||||
endif
|
||||
|
||||
return g:vimwiki_list[idx][a:option]
|
||||
endfunction "}}}
|
||||
|
||||
" set option for current wiki or if third parameter exists for
|
||||
" wiki with a given index.
|
||||
function! VimwikiSet(option, value, ...) "{{{
|
||||
if a:0 == 0
|
||||
let idx = g:vimwiki_current_idx
|
||||
else
|
||||
let idx = a:1
|
||||
endif
|
||||
let g:vimwiki_list[idx][a:option] = a:value
|
||||
endfunction "}}}
|
||||
" }}}
|
||||
|
||||
" }}}
|
||||
|
||||
" CALLBACK function "{{{
|
||||
" User can redefine it.
|
||||
if !exists("*VimwikiWeblinkHandler") "{{{
|
||||
function VimwikiWeblinkHandler(weblink)
|
||||
for browser in g:vimwiki_browsers
|
||||
if executable(browser)
|
||||
if has("win32")
|
||||
execute '!start "'.browser.'" "' . a:weblink . '"'
|
||||
else
|
||||
execute '!'.browser.' "' . a:weblink . '"'
|
||||
endif
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
endif "}}}
|
||||
" CALLBACK }}}
|
||||
|
||||
" DEFAULT wiki {{{
|
||||
let s:vimwiki_defaults = {}
|
||||
let s:vimwiki_defaults.path = '~/vimwiki/'
|
||||
let s:vimwiki_defaults.path_html = '~/vimwiki_html/'
|
||||
let s:vimwiki_defaults.css_name = 'style.css'
|
||||
let s:vimwiki_defaults.index = 'index'
|
||||
let s:vimwiki_defaults.ext = '.wiki'
|
||||
let s:vimwiki_defaults.maxhi = 1
|
||||
let s:vimwiki_defaults.syntax = 'default'
|
||||
|
||||
let s:vimwiki_defaults.template_path = '~/vimwiki/templates/'
|
||||
let s:vimwiki_defaults.template_default = 'default'
|
||||
let s:vimwiki_defaults.template_ext = '.html'
|
||||
|
||||
let s:vimwiki_defaults.nested_syntaxes = {}
|
||||
let s:vimwiki_defaults.auto_export = 0
|
||||
" is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki
|
||||
" file.
|
||||
let s:vimwiki_defaults.temp = 0
|
||||
|
||||
" diary
|
||||
let s:vimwiki_defaults.diary_rel_path = 'diary/'
|
||||
let s:vimwiki_defaults.diary_index = 'diary'
|
||||
let s:vimwiki_defaults.diary_header = 'Diary'
|
||||
|
||||
" Do not change this! Will wait till vim become more datetime awareable.
|
||||
let s:vimwiki_defaults.diary_link_fmt = '%Y-%m-%d'
|
||||
|
||||
let s:vimwiki_defaults.diary_link_count = 4
|
||||
|
||||
"}}}
|
||||
|
||||
" DEFAULT options {{{
|
||||
call s:default('list', [s:vimwiki_defaults])
|
||||
if &encoding == 'utf-8'
|
||||
call s:default('upper', 'A-Z\u0410-\u042f')
|
||||
call s:default('lower', 'a-z\u0430-\u044f')
|
||||
else
|
||||
call s:default('upper', 'A-Z')
|
||||
call s:default('lower', 'a-z')
|
||||
endif
|
||||
call s:default('other', '0-9')
|
||||
call s:default('stripsym', '_')
|
||||
call s:default('badsyms', '')
|
||||
call s:default('auto_checkbox', 1)
|
||||
call s:default('use_mouse', 0)
|
||||
call s:default('folding', 0)
|
||||
call s:default('fold_trailing_empty_lines', 0)
|
||||
call s:default('fold_lists', 0)
|
||||
call s:default('menu', 'Vimwiki')
|
||||
call s:default('global_ext', 1)
|
||||
call s:default('hl_headers', 0)
|
||||
call s:default('hl_cb_checked', 0)
|
||||
call s:default('camel_case', 1)
|
||||
call s:default('list_ignore_newline', 1)
|
||||
call s:default('listsyms', ' .oOX')
|
||||
if has("win32")
|
||||
call s:default('browsers',
|
||||
\ [
|
||||
\ expand('~').'\Local Settings\Application Data\Google\Chrome\Application\chrome.exe',
|
||||
\ 'C:\Program Files\Opera\opera.exe',
|
||||
\ 'C:\Program Files\Mozilla Firefox\firefox.exe',
|
||||
\ 'C:\Program Files\Internet Explorer\iexplore.exe',
|
||||
\ ])
|
||||
else
|
||||
call s:default('browsers',
|
||||
\ [
|
||||
\ 'chromium-browser',
|
||||
\ 'opera',
|
||||
\ 'firefox',
|
||||
\ 'konqueror',
|
||||
\ ])
|
||||
endif
|
||||
|
||||
call s:default('use_calendar', 1)
|
||||
call s:default('table_auto_fmt', 1)
|
||||
call s:default('w32_dir_enc', '')
|
||||
call s:default('CJK_length', 0)
|
||||
call s:default('dir_link', '')
|
||||
call s:default('file_exts', 'pdf,txt,doc,rtf,xls,php,zip,rar,7z,html,gz')
|
||||
call s:default('valid_html_tags', 'b,i,s,u,sub,sup,kbd,br,hr,div,center,strong,em')
|
||||
call s:default('user_htmls', '')
|
||||
|
||||
call s:default('html_header_numbering', 0)
|
||||
call s:default('html_header_numbering_sym', '')
|
||||
call s:default('conceallevel', 3)
|
||||
|
||||
call s:default('current_idx', 0)
|
||||
|
||||
let upp = g:vimwiki_upper
|
||||
let low = g:vimwiki_lower
|
||||
let oth = g:vimwiki_other
|
||||
let nup = low.oth
|
||||
let nlo = upp.oth
|
||||
let any = upp.nup
|
||||
|
||||
let wword = '\C\<['.upp.']['.nlo.']*['.low.']['.nup.']*['.upp.']['.any.']*\>'
|
||||
let g:vimwiki_rxWikiWord = '!\@<!'.wword
|
||||
let g:vimwiki_rxNoWikiWord = '!'.wword
|
||||
|
||||
let g:vimwiki_rxWikiLink1 = '\[\[[^\]]\+\]\]'
|
||||
let g:vimwiki_rxWikiLink2 = '\[\[[^\]]\+\]\[[^\]]\+\]\]'
|
||||
if g:vimwiki_camel_case
|
||||
let g:vimwiki_rxWikiLink = g:vimwiki_rxWikiWord.'\|'.
|
||||
\ g:vimwiki_rxWikiLink1.'\|'.g:vimwiki_rxWikiLink2
|
||||
else
|
||||
let g:vimwiki_rxWikiLink = g:vimwiki_rxWikiLink1.'\|'.g:vimwiki_rxWikiLink2
|
||||
endif
|
||||
let g:vimwiki_rxWeblink = '\%("[^"(]\+\((\([^)]\+\))\)\?":\)\?'.
|
||||
\'\%('.
|
||||
\'\%('.
|
||||
\'\%(https\?\|ftp\|gopher\|telnet\|file\|notes\|ms-help\):'.
|
||||
\'\%(\%(//\)\|\%(\\\\\)\)'.
|
||||
\'\)'.
|
||||
\'\|\%(mailto:\)'.
|
||||
\'\)'.
|
||||
\'\+\S\+'.
|
||||
\'[().,?\]]\@<!'
|
||||
"}}}
|
||||
|
||||
" AUTOCOMMANDS for all known wiki extensions {{{
|
||||
" Getting all extensions that different wikies could have
|
||||
let extensions = {}
|
||||
for wiki in g:vimwiki_list
|
||||
if has_key(wiki, 'ext')
|
||||
let extensions[wiki.ext] = 1
|
||||
else
|
||||
let extensions['.wiki'] = 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
augroup filetypedetect
|
||||
" clear FlexWiki's stuff
|
||||
au! * *.wiki
|
||||
augroup end
|
||||
|
||||
augroup vimwiki
|
||||
autocmd!
|
||||
for ext in keys(extensions)
|
||||
exe 'autocmd BufWinEnter *'.ext.' call s:setup_buffer_enter()'
|
||||
exe 'autocmd BufLeave,BufHidden *'.ext.' call s:setup_buffer_leave()'
|
||||
exe 'autocmd BufNewFile,BufRead, *'.ext.' call s:setup_filetype()'
|
||||
|
||||
" ColorScheme could have or could have not a
|
||||
" VimwikiHeader1..VimwikiHeader6 highlight groups. We need to refresh
|
||||
" syntax after colorscheme change.
|
||||
exe 'autocmd ColorScheme *'.ext.' syntax enable'.
|
||||
\ ' | call vimwiki#base#highlight_links()'
|
||||
|
||||
" Format tables when exit from insert mode. Do not use textwidth to
|
||||
" autowrap tables.
|
||||
if g:vimwiki_table_auto_fmt
|
||||
exe 'autocmd InsertLeave *'.ext.' call vimwiki#tbl#format(line("."))'
|
||||
exe 'autocmd InsertEnter *'.ext.' call vimwiki#tbl#reset_tw(line("."))'
|
||||
endif
|
||||
endfor
|
||||
augroup END
|
||||
"}}}
|
||||
|
||||
" COMMANDS {{{
|
||||
command! VimwikiUISelect call vimwiki#base#ui_select()
|
||||
command! -count VimwikiIndex
|
||||
\ call vimwiki#base#goto_index(v:count1)
|
||||
command! -count VimwikiTabIndex tabedit <bar>
|
||||
\ call vimwiki#base#goto_index(v:count1)
|
||||
|
||||
command! -count VimwikiDiaryIndex
|
||||
\ call vimwiki#diary#goto_index(v:count1)
|
||||
command! -count VimwikiMakeDiaryNote
|
||||
\ call vimwiki#diary#make_note(v:count1)
|
||||
command! -count VimwikiTabMakeDiaryNote tabedit <bar>
|
||||
\ call vimwiki#diary#make_note(v:count1)
|
||||
"}}}
|
||||
|
||||
" MAPPINGS {{{
|
||||
if !hasmapto('<Plug>VimwikiIndex')
|
||||
nmap <silent><unique> <Leader>ww <Plug>VimwikiIndex
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiTabIndex')
|
||||
nmap <silent><unique> <Leader>wt <Plug>VimwikiTabIndex
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiUISelect')
|
||||
nmap <silent><unique> <Leader>ws <Plug>VimwikiUISelect
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiUISelect :VimwikiUISelect<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiDiaryIndex')
|
||||
nmap <silent><unique> <Leader>wi <Plug>VimwikiDiaryIndex
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiDiaryIndex :VimwikiDiaryIndex<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiMakeDiaryNote')
|
||||
nmap <silent><unique> <Leader>w<Leader>w <Plug>VimwikiMakeDiaryNote
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiTabMakeDiaryNote')
|
||||
nmap <silent><unique> <Leader>w<Leader>t <Plug>VimwikiTabMakeDiaryNote
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote
|
||||
\ :VimwikiTabMakeDiaryNote<CR>
|
||||
|
||||
"}}}
|
||||
|
||||
" MENU {{{
|
||||
function! s:build_menu(topmenu)
|
||||
let idx = 0
|
||||
while idx < len(g:vimwiki_list)
|
||||
let norm_path = fnamemodify(VimwikiGet('path', idx), ':h:t')
|
||||
let norm_path = escape(norm_path, '\ \.')
|
||||
execute 'menu '.a:topmenu.'.Open\ index.'.norm_path.
|
||||
\ ' :call vimwiki#base#goto_index('.(idx + 1).')<CR>'
|
||||
execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.norm_path.
|
||||
\ ' :call vimwiki#diary#make_note('.(idx + 1).')<CR>'
|
||||
let idx += 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! s:build_table_menu(topmenu)
|
||||
exe 'menu '.a:topmenu.'.-Sep- :'
|
||||
exe 'menu '.a:topmenu.'.Table.Create\ (enter\ cols\ rows) :VimwikiTable '
|
||||
exe 'nmenu '.a:topmenu.'.Table.Format<tab>gqq gqq'
|
||||
exe 'nmenu '.a:topmenu.'.Table.Move\ column\ left<tab><A-Left> :VimwikiTableMoveColumnLeft<CR>'
|
||||
exe 'nmenu '.a:topmenu.'.Table.Move\ column\ right<tab><A-Right> :VimwikiTableMoveColumnRight<CR>'
|
||||
exe 'nmenu disable '.a:topmenu.'.Table'
|
||||
endfunction
|
||||
|
||||
if !empty(g:vimwiki_menu)
|
||||
call s:build_menu(g:vimwiki_menu)
|
||||
call s:build_table_menu(g:vimwiki_menu)
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" CALENDAR Hook "{{{
|
||||
if g:vimwiki_use_calendar
|
||||
let g:calendar_action = 'vimwiki#diary#calendar_action'
|
||||
let g:calendar_sign = 'vimwiki#diary#calendar_sign'
|
||||
endif
|
||||
"}}}
|
||||
|
||||
let &cpo = s:old_cpo
|
||||
@@ -1,261 +0,0 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" Quit if syntax file is already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Links highlighting is controlled by vimwiki#base#highlight_links() function.
|
||||
" It is called from setup_buffer_enter() function in the BufEnter autocommand.
|
||||
|
||||
" Load concrete Wiki syntax
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
|
||||
|
||||
" Concealed chars
|
||||
if exists("+conceallevel")
|
||||
syntax conceal on
|
||||
endif
|
||||
|
||||
syntax spell toplevel
|
||||
|
||||
syn match VimwikiLinkChar contained /\[\[/
|
||||
syn match VimwikiLinkChar contained /\]\]/
|
||||
syn match VimwikiLinkChar contained /\[\[[^\[\]\|]\{-}|\ze.\{-}]]/
|
||||
syn match VimwikiLinkChar contained /\[\[[^\[\]\|]\{-}]\[\ze.\{-}]]/
|
||||
|
||||
syn match VimwikiNoLinkChar contained /\[\[/
|
||||
syn match VimwikiNoLinkChar contained /\]\]/
|
||||
syn match VimwikiNoLinkChar contained /\[\[[^\[\]\|]\{-}|\ze.*]]/
|
||||
syn match VimwikiNoLinkChar contained /\[\[[^\[\]\|]\{-}]\[\ze.*]]/
|
||||
|
||||
execute 'syn match VimwikiBoldChar contained /'.g:vimwiki_char_bold.'/'
|
||||
execute 'syn match VimwikiItalicChar contained /'.g:vimwiki_char_italic.'/'
|
||||
execute 'syn match VimwikiBoldItalicChar contained /'.g:vimwiki_char_bolditalic.'/'
|
||||
execute 'syn match VimwikiItalicBoldChar contained /'.g:vimwiki_char_italicbold.'/'
|
||||
execute 'syn match VimwikiCodeChar contained /'.g:vimwiki_char_code.'/'
|
||||
execute 'syn match VimwikiDelTextChar contained /'.g:vimwiki_char_deltext.'/'
|
||||
execute 'syn match VimwikiSuperScript contained /'.g:vimwiki_char_superscript.'/'
|
||||
execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/'
|
||||
if exists("+conceallevel")
|
||||
syntax conceal off
|
||||
endif
|
||||
|
||||
" Non concealed chars
|
||||
syn match VimwikiHeaderChar contained /\%(^\s*=\+\)\|\%(=\+\s*$\)/
|
||||
execute 'syn match VimwikiBoldCharT contained /'.g:vimwiki_char_bold.'/'
|
||||
execute 'syn match VimwikiItalicCharT contained /'.g:vimwiki_char_italic.'/'
|
||||
execute 'syn match VimwikiBoldItalicCharT contained /'.g:vimwiki_char_bolditalic.'/'
|
||||
execute 'syn match VimwikiItalicBoldCharT contained /'.g:vimwiki_char_italicbold.'/'
|
||||
execute 'syn match VimwikiCodeCharT contained /'.g:vimwiki_char_code.'/'
|
||||
execute 'syn match VimwikiDelTextCharT contained /'.g:vimwiki_char_deltext.'/'
|
||||
execute 'syn match VimwikiSuperScriptT contained /'.g:vimwiki_char_superscript.'/'
|
||||
execute 'syn match VimwikiSubScriptT contained /'.g:vimwiki_char_subscript.'/'
|
||||
|
||||
|
||||
" Emoticons
|
||||
syntax match VimwikiEmoticons /\%((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/
|
||||
|
||||
let g:vimwiki_rxTodo = '\C\%(TODO:\|DONE:\|STARTED:\|FIXME:\|FIXED:\|XXX:\)'
|
||||
execute 'syntax match VimwikiTodo /'. g:vimwiki_rxTodo .'/'
|
||||
|
||||
|
||||
" Tables
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ transparent contains=VimwikiCellSeparator,VimwikiLinkT,
|
||||
\ VimwikiNoExistsLinkT,VimwikiEmoticons,VimwikiTodo,
|
||||
\ VimwikiBoldT,VimwikiItalicT,VimwikiBoldItalicT,VimwikiItalicBoldT,
|
||||
\ VimwikiDelTextT,VimwikiSuperScriptT,VimwikiSubScriptT,VimwikiCodeT,
|
||||
\ @Spell
|
||||
syntax match VimwikiCellSeparator
|
||||
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||
|
||||
" List items
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListBullet.'/'
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListNumber.'/'
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
|
||||
|
||||
execute 'syntax match VimwikiBold /'.g:vimwiki_rxBold.'/ contains=VimwikiBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiBoldT /'.g:vimwiki_rxBold.'/ contained contains=VimwikiBoldCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiItalic /'.g:vimwiki_rxItalic.'/ contains=VimwikiItalicChar,@Spell'
|
||||
execute 'syntax match VimwikiItalicT /'.g:vimwiki_rxItalic.'/ contained contains=VimwikiItalicCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiBoldItalic /'.g:vimwiki_rxBoldItalic.'/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiBoldItalicT /'.g:vimwiki_rxBoldItalic.'/ contained contains=VimwikiBoldItalicChatT,VimwikiItalicBoldCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiItalicBold /'.g:vimwiki_rxItalicBold.'/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiItalicBoldT /'.g:vimwiki_rxItalicBold.'/ contained contains=VimwikiBoldItalicCharT,VimsikiItalicBoldCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiDelText /'.g:vimwiki_rxDelText.'/ contains=VimwikiDelTextChar,@Spell'
|
||||
execute 'syntax match VimwikiDelTextT /'.g:vimwiki_rxDelText.'/ contained contains=VimwikiDelTextChar,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiSuperScript /'.g:vimwiki_rxSuperScript.'/ contains=VimwikiSuperScriptChar,@Spell'
|
||||
execute 'syntax match VimwikiSuperScriptT /'.g:vimwiki_rxSuperScript.'/ contained contains=VimwikiSuperScriptCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiSubScript /'.g:vimwiki_rxSubScript.'/ contains=VimwikiSubScriptChar,@Spell'
|
||||
execute 'syntax match VimwikiSubScriptT /'.g:vimwiki_rxSubScript.'/ contained contains=VimwikiSubScriptCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiCode /'.g:vimwiki_rxCode.'/ contains=VimwikiCodeChar'
|
||||
execute 'syntax match VimwikiCodeT /'.g:vimwiki_rxCode.'/ contained contains=VimwikiCodeCharT'
|
||||
|
||||
|
||||
" <hr> horizontal rule
|
||||
execute 'syntax match VimwikiHR /'.g:vimwiki_rxHR.'/'
|
||||
|
||||
execute 'syntax region VimwikiPre start=/^\s*'.g:vimwiki_rxPreStart.
|
||||
\ '/ end=/^\s*'.g:vimwiki_rxPreEnd.'\s*$/ contains=@Spell'
|
||||
|
||||
" List item checkbox
|
||||
syntax match VimwikiCheckBox /\[.\?\]/
|
||||
if g:vimwiki_hl_cb_checked
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListBullet.'\s*\['.g:vimwiki_listsyms[4].'\].*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListNumber.'\s*\['.g:vimwiki_listsyms[4].'\].*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
endif
|
||||
|
||||
" placeholders
|
||||
syntax match VimwikiPlaceholder /^\s*%toc\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam
|
||||
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
|
||||
syntax match VimwikiPlaceholder /^\s*%title\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam
|
||||
syntax match VimwikiPlaceholder /^\s*%template\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam
|
||||
syntax match VimwikiPlaceholderParam /\s.*/ contained
|
||||
|
||||
" html tags
|
||||
let html_tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
||||
execute 'syntax match VimwikiBold #\c<b>.\{-}</b># contains=VimwikiHTMLTag'
|
||||
execute 'syntax match VimwikiItalic #\c<i>.\{-}</i># contains=VimwikiHTMLTag'
|
||||
execute 'syntax match VimwikiUnderline #\c<u>.\{-}</u># contains=VimwikiHTMLTag'
|
||||
|
||||
execute 'syntax match VimwikiComment /'.g:vimwiki_rxComment.'/ contains=@Spell'
|
||||
|
||||
" Header levels, 1-6
|
||||
execute 'syntax match VimwikiHeader1 /'.g:vimwiki_rxH1.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader2 /'.g:vimwiki_rxH2.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader3 /'.g:vimwiki_rxH3.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader4 /'.g:vimwiki_rxH4.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader5 /'.g:vimwiki_rxH5.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader6 /'.g:vimwiki_rxH6.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
|
||||
" group names "{{{
|
||||
|
||||
if g:vimwiki_hl_headers == 0
|
||||
hi link VimwikiHeader1 Title
|
||||
hi link VimwikiHeader2 Title
|
||||
hi link VimwikiHeader3 Title
|
||||
hi link VimwikiHeader4 Title
|
||||
hi link VimwikiHeader5 Title
|
||||
hi link VimwikiHeader6 Title
|
||||
else
|
||||
if &background == 'light'
|
||||
hi def VimwikiHeader1 guibg=bg guifg=#aa5858 gui=bold ctermfg=DarkRed term=bold cterm=bold
|
||||
hi def VimwikiHeader2 guibg=bg guifg=#507030 gui=bold ctermfg=DarkGreen term=bold cterm=bold
|
||||
hi def VimwikiHeader3 guibg=bg guifg=#1030a0 gui=bold ctermfg=DarkBlue term=bold cterm=bold
|
||||
hi def VimwikiHeader4 guibg=bg guifg=#103040 gui=bold ctermfg=Black term=bold cterm=bold
|
||||
hi def VimwikiHeader5 guibg=bg guifg=#505050 gui=bold ctermfg=Black term=bold cterm=bold
|
||||
hi def VimwikiHeader6 guibg=bg guifg=#636363 gui=bold ctermfg=Black term=bold cterm=bold
|
||||
else
|
||||
hi def VimwikiHeader1 guibg=bg guifg=#e08090 gui=bold ctermfg=Red term=bold cterm=bold
|
||||
hi def VimwikiHeader2 guibg=bg guifg=#80e090 gui=bold ctermfg=Green term=bold cterm=bold
|
||||
hi def VimwikiHeader3 guibg=bg guifg=#6090e0 gui=bold ctermfg=Blue term=bold cterm=bold
|
||||
hi def VimwikiHeader4 guibg=bg guifg=#c0c0f0 gui=bold ctermfg=White term=bold cterm=bold
|
||||
hi def VimwikiHeader5 guibg=bg guifg=#e0e0f0 gui=bold ctermfg=White term=bold cterm=bold
|
||||
hi def VimwikiHeader6 guibg=bg guifg=#f0f0f0 gui=bold ctermfg=White term=bold cterm=bold
|
||||
endif
|
||||
endif
|
||||
|
||||
hi def link VimwikiMarkers Normal
|
||||
|
||||
hi def VimwikiBold term=bold cterm=bold gui=bold
|
||||
hi def link VimwikiBoldT VimwikiBold
|
||||
|
||||
hi def VimwikiItalic term=italic cterm=italic gui=italic
|
||||
hi def link VimwikiItalicT VimwikiItalic
|
||||
|
||||
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
|
||||
hi def link VimwikiItalicBold VimwikiBoldItalic
|
||||
hi def link VimwikiBoldItalicT VimwikiBoldItalic
|
||||
hi def link VimwikiItalicBoldT VimwikiBoldItalic
|
||||
|
||||
hi def VimwikiUnderline gui=underline
|
||||
|
||||
hi def link VimwikiCode PreProc
|
||||
hi def link VimwikiCodeT VimwikiCode
|
||||
|
||||
hi def link VimwikiPre PreProc
|
||||
hi def link VimwikiPreT VimwikiPre
|
||||
|
||||
hi def link VimwikiNoExistsLink SpellBad
|
||||
hi def link VimwikiNoExistsLinkT VimwikiNoExistsLink
|
||||
|
||||
hi def link VimwikiLink Underlined
|
||||
hi def link VimwikiLinkT VimwikiLink
|
||||
|
||||
hi def link VimwikiList Identifier
|
||||
hi def link VimwikiCheckBox VimwikiList
|
||||
hi def link VimwikiCheckBoxDone Comment
|
||||
hi def link VimwikiEmoticons Character
|
||||
|
||||
hi def link VimwikiDelText Constant
|
||||
hi def link VimwikiDelTextT VimwikiDelText
|
||||
|
||||
hi def link VimwikiSuperScript Number
|
||||
hi def link VimwikiSuperScriptT VimwikiSuperScript
|
||||
|
||||
hi def link VimwikiSubScript Number
|
||||
hi def link VimwikiSubScriptT VimwikiSubScript
|
||||
|
||||
hi def link VimwikiTodo Todo
|
||||
hi def link VimwikiComment Comment
|
||||
|
||||
hi def link VimwikiPlaceholder SpecialKey
|
||||
hi def link VimwikiPlaceholderParam String
|
||||
hi def link VimwikiHTMLtag SpecialKey
|
||||
|
||||
hi def link VimwikiCellSeparator VimwikiMarkers
|
||||
hi def link VimwikiBoldChar VimwikiMarkers
|
||||
hi def link VimwikiItalicChar VimwikiMarkers
|
||||
hi def link VimwikiBoldItalicChar VimwikiMarkers
|
||||
hi def link VimwikiItalicBoldChar VimwikiMarkers
|
||||
hi def link VimwikiDelTextChar VimwikiMarkers
|
||||
hi def link VimwikiSuperScriptChar VimwikiMarkers
|
||||
hi def link VimwikiSubScriptChar VimwikiMarkers
|
||||
hi def link VimwikiCodeChar VimwikiMarkers
|
||||
hi def link VimwikiHeaderChar VimwikiMarkers
|
||||
hi def link VimwikiLinkChar VimwikiLink
|
||||
hi def link VimwikiNoLinkChar VimwikiNoExistsLink
|
||||
|
||||
hi def link VimwikiBoldCharT VimwikiMarkers
|
||||
hi def link VimwikiItalicCharT VimwikiMarkers
|
||||
hi def link VimwikiBoldItalicCharT VimwikiMarkers
|
||||
hi def link VimwikiItalicBoldCharT VimwikiMarkers
|
||||
hi def link VimwikiDelTextCharT VimwikiMarkers
|
||||
hi def link VimwikiSuperScriptCharT VimwikiMarkers
|
||||
hi def link VimwikiSubScriptCharT VimwikiMarkers
|
||||
hi def link VimwikiCodeCharT VimwikiMarkers
|
||||
hi def link VimwikiHeaderCharT VimwikiMarkers
|
||||
hi def link VimwikiLinkCharT VimwikiLinkT
|
||||
hi def link VimwikiNoLinkCharT VimwikiNoExistsLinkT
|
||||
"}}}
|
||||
|
||||
let b:current_syntax="vimwiki"
|
||||
|
||||
" EMBEDDED syntax setup "{{{
|
||||
let nested = VimwikiGet('nested_syntaxes')
|
||||
if !empty(nested)
|
||||
for [hl_syntax, vim_syntax] in items(nested)
|
||||
call vimwiki#base#nested_syntax(vim_syntax,
|
||||
\ '^\s*{{{\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
|
||||
\ '^\s*}}}', 'VimwikiPre')
|
||||
endfor
|
||||
endif
|
||||
"}}}
|
||||
243
syntax/kickass.vim
Normal file
243
syntax/kickass.vim
Normal file
@@ -0,0 +1,243 @@
|
||||
" Vim syntax file
|
||||
" Language: Assembler, KickAssembler
|
||||
" Maintainer: Roman 'gryf' Dobosz <gryf_esm@o2.pl>
|
||||
" Last Change: 2012-06-03
|
||||
" Version: 0.1
|
||||
"
|
||||
" To install this file place it in ~/.vim/syntax (*nix/Mac) or in
|
||||
" $VIMRUNTIME/syntax on Windows and issue command:
|
||||
"
|
||||
" :set filetype=kickass
|
||||
"
|
||||
" You can also add to your vimrc file autocommand:
|
||||
"
|
||||
" autocmd BufRead *.asm set filetype=kickass
|
||||
"
|
||||
" From now on, all files with extension 'asm' will have brand new kickass
|
||||
" syntax.
|
||||
"
|
||||
" Enjoy.
|
||||
|
||||
syn clear
|
||||
syn case ignore
|
||||
|
||||
syn region asmString start=+"+ end=+"+
|
||||
syn region asmSString start=+'+ end=+'+ contains=@Spell
|
||||
|
||||
syn keyword asm6502Mnemonics adc and asl bit brk clc cld cli clv cmp cpx cpy
|
||||
syn keyword asm6502Mnemonics dec dex dey eor inc inx iny lda ldx ldy lsr nop
|
||||
syn keyword asm6502Mnemonics ora pha php pla plp rol ror sbc sec sed sei sta
|
||||
syn keyword asm6502Mnemonics stx sty tax tay tsx txa txs tya
|
||||
|
||||
syn keyword asmDtvMnemonics bra sac sir
|
||||
|
||||
syn match asm6502Index ",\s*[xy]" contains=asm6502Mnemonics,asmDtvMnemonics
|
||||
|
||||
syn keyword asm6502Jumps bcc bcs beq bmi bne bpl bvc bvs jmp jsr rti rts
|
||||
|
||||
syn keyword asm6510Illegal slo rla sre rra sax lax dcp isc anc asr arr sbx
|
||||
syn keyword asm6510Illegal dop top jam
|
||||
|
||||
syn match asmMacroCall ":[a-z_][a-z0-9_]*"
|
||||
|
||||
syn region asmString start=+"+ skip=+\\"+ end=+"+ contains=@Spell
|
||||
syn region asmSString start=+'+ skip=+\\'+ end=+'+ contains=@Spell
|
||||
|
||||
"syn match asmLabel "[\^\s]\!\?\<[a-z0-9_]*\>[:+-]\?[\s$]" kurwa!!!!!!!!
|
||||
syn match asmLabel "^\!\?\<[a-z0-9_]*\>:"
|
||||
"syn match line "asmLabel2
|
||||
|
||||
syn keyword asmTodo TODO FIXME XXX TBD NOTE WARNING BUG
|
||||
syn match asmLineComment "\/\/.*" contains=@Spell,asmTodo
|
||||
syn region asmComment start="/\*" end="\*/" contains=@Spell,asmTodo
|
||||
|
||||
syn match decNumber "\<\d\+\>"
|
||||
syn match hexNumber "\$\x\+\>"
|
||||
syn match binNumber "%[01]\+\>"
|
||||
syn match asmImmediate "#\$\x\+\>"
|
||||
syn match asmImmediate "#\d\+\>"
|
||||
syn match asmImmediate "<\$\x\+\>"
|
||||
syn match asmImmediate "<\d\+\>"
|
||||
syn match asmImmediate ">\$\x\+\>"
|
||||
syn match asmImmediate ">\d\+\>"
|
||||
syn match asmImmediate "#<\$\x\+\>"
|
||||
syn match asmImmediate "#<\d\+\>"
|
||||
syn match asmImmediate "#>\$\x\+\>"
|
||||
syn match asmImmediate "#>\d\+\>"
|
||||
|
||||
" memory and data directives
|
||||
syn match kickAssDirectives "\.\<pc\>"
|
||||
syn match kickAssDirectives "\.\<align\>"
|
||||
syn match kickAssDirectives "\.\<byte\>"
|
||||
syn match kickAssDirectives "\.\<word\>"
|
||||
syn match kickAssDirectives "\.\<dword\>"
|
||||
syn match kickAssDirectives "\.\<text\>"
|
||||
syn match kickAssDirectives "\.\<fill\>"
|
||||
syn match kickAssDirectives "\.\<pseudopc\>"
|
||||
|
||||
" import directive
|
||||
syn match kickAssDirectives "\.\<import\>"
|
||||
|
||||
" console output
|
||||
syn match kickAssDirectives "\.\<print\>"
|
||||
syn match kickAssDirectives "\.\<printnow\>"
|
||||
syn match kickAssDirectives "\.\<error\>"
|
||||
|
||||
" elements of script language
|
||||
syn match kickAssDirectives "\.\<eval\>"
|
||||
|
||||
syn match kickAssDirectives "\.\<var\>"
|
||||
syn match kickAssDirectives "\.\<const\>"
|
||||
syn match kickAssDirectives "\.\<enum\>"
|
||||
syn match kickAssDirectives "\.\<label\>"
|
||||
|
||||
|
||||
syn match kickAssDirectives ":\<BasicUpstart\>"
|
||||
syn match kickAssDirectives "\.\<add\>"
|
||||
syn match kickAssDirectives "\.\<assert\>"
|
||||
syn match kickAssDirectives "\.\<asserterror\>"
|
||||
syn match kickAssDirectives "\.\<define\>"
|
||||
syn match kickAssDirectives "\.\<filenamespace\>"
|
||||
syn match kickAssDirectives "\.\<for\>"
|
||||
syn match kickAssDirectives "\.\<function\>" nextgroup=asmDefName skipwhite
|
||||
syn match kickAssDirectives "\.\<if\>"
|
||||
syn match kickAssDirectives "\.\<macro\>" nextgroup=asmDefName skipwhite
|
||||
syn match kickAssDirectives "\.\<namespace\>"
|
||||
syn match kickAssDirectives "\.\<pseudocommand\>"
|
||||
syn match kickAssDirectives "\.\<return\>"
|
||||
syn match kickAssDirectives "\.\<struct\>"
|
||||
syn match kickAssDirectives "\<else\>"
|
||||
syn match kickAssDirectives "\<LoadSid\>"
|
||||
syn match kickAssDirectives "\<LoadPicture\>"
|
||||
syn match kickAssDirectives "\<createFile\>"
|
||||
|
||||
syn keyword kickAssColors BLACK WHITE RED CYAN PURPLE GREEN BLUE YELLOW ORANGE
|
||||
syn keyword kickAssColors BROWN LIGHT_RED DARK_GRAY GRAY LIGHT_GREEN LIGHT_BLUE
|
||||
syn keyword kickAssColors LIGHT_GRAY
|
||||
|
||||
syn keyword kickAssConstants BD_C64FILE BF_BITMAP_SINGLECOLOR BF_KOALA BF_FLI
|
||||
|
||||
syn match asmDefName "[a-zA-Z_][a-zA-Z0-9_]*" display contained
|
||||
|
||||
syn match kickAssFunctions "\<LoadBinary\>" display contained
|
||||
syn match kickAssFunctions "\<LoadPicture\>" display contained
|
||||
syn match kickAssFunctions "\<LoadSid\>" display contained
|
||||
syn match kickAssFunctions "\<Matrix\>" display contained
|
||||
syn match kickAssFunctions "\<RotationMatrix\>" display contained
|
||||
syn match kickAssFunctions "\<ScaleMatrix\>" display contained
|
||||
syn match kickAssFunctions "\<PerspectiveMatrix\>" display contained
|
||||
syn match kickAssFunctions "\<MoveMatrix\>" display contained
|
||||
syn match kickAssFunctions "\<writeln\>" display contained
|
||||
|
||||
" generic/common methods (same name, different but similar behaviour -
|
||||
" depending on context)
|
||||
syn match kickAssFunctions "\.\<size\>" display contained
|
||||
syn match kickAssFunctions "\.\<get\>" display contained
|
||||
syn match kickAssFunctions "\.\<remove\>" display contained
|
||||
|
||||
" string methods
|
||||
syn match kickAssFunctions "\.\<string\>" display contained
|
||||
|
||||
syn match kickAssFunctions "\.\<charAt\>" display contained
|
||||
syn match kickAssFunctions "\.\<substring\>" display contained
|
||||
syn match kickAssFunctions "\.\<asBoolean\>" display contained
|
||||
syn match kickAssFunctions "\.\<asNumber\>" display contained
|
||||
|
||||
syn match kickAssFunctions "\<toBinaryString\>" display contained
|
||||
syn match kickAssFunctions "\<toHexString\>" display contained
|
||||
syn match kickAssFunctions "\<toIntString\>" display contained
|
||||
syn match kickAssFunctions "\<toOctalString\>" display contained
|
||||
|
||||
" Math
|
||||
syn keyword kickAssConstants PI E
|
||||
|
||||
syn match kickAssFunName "\<abs\>" contained
|
||||
syn match kickAssFunName "\<acos\>" display contained
|
||||
syn match kickAssFunName "\<asin\>" display contained
|
||||
syn match kickAssFunName "\<atan\>" display contained
|
||||
syn match kickAssFunName "\<atan2\>" display contained
|
||||
syn match kickAssFunName "\<cbrt\>" display contained
|
||||
syn match kickAssFunName "\<ceil\>" display contained
|
||||
syn match kickAssFunName "\<cos\>" display contained
|
||||
syn match kickAssFunName "\<cosh\>" display contained
|
||||
syn match kickAssFunName "\<exp\>" display contained
|
||||
syn match kickAssFunName "\<expml\>" display contained
|
||||
syn match kickAssFunName "\<floor\>" display contained
|
||||
syn match kickAssFunName "\<hypot\>" display contained
|
||||
syn match kickAssFunName "\<IEEEremainder\>" display contained
|
||||
syn match kickAssFunName "\<log\>" display contained
|
||||
syn match kickAssFunName "\<log10\>" display contained
|
||||
syn match kickAssFunName "\<log1p\>" display contained
|
||||
syn match kickAssFunName "\<max\>" display contained
|
||||
syn match kickAssFunName "\<min\>" display contained
|
||||
syn match kickAssFunName "\<mod\>" display contained
|
||||
syn match kickAssFunName "\<pow\>" display contained
|
||||
syn match kickAssFunName "\<random\>" display contained
|
||||
syn match kickAssFunName "\<round\>" display contained
|
||||
syn match kickAssFunName "\<signum\>" display contained
|
||||
syn match kickAssFunName "\<sin\>" display contained
|
||||
syn match kickAssFunName "\<sinh\>" display contained
|
||||
syn match kickAssFunName "\<sqrt\>" display contained
|
||||
syn match kickAssFunName "\<tan\>" display contained
|
||||
syn match kickAssFunName "\<tanh\>" display contained
|
||||
syn match kickAssFunName "\<toDegrees\>" display contained
|
||||
syn match kickAssFunName "\<toRadians\>" display contained
|
||||
|
||||
" List
|
||||
syn match kickAssFunctions "\<List\>" display contained
|
||||
" get
|
||||
syn match kickAssFunctions "\.\<set\>" display contained
|
||||
syn match kickAssFunctions "\.\<add\>" display contained
|
||||
syn match kickAssFunctions "\.\<shuffle\>" display contained
|
||||
syn match kickAssFunctions "\.\<reverse\>" display contained
|
||||
syn match kickAssFunctions "\.\<sort\>" display contained
|
||||
|
||||
" Dictionaries (hash tables)
|
||||
syn keyword kickAssFunctions Hashtable contained
|
||||
|
||||
" get
|
||||
syn match kickAssFunctions "\.\<put\>" display contained
|
||||
syn match kickAssFunctions "\.\<keys\>" display contained
|
||||
syn match kickAssFunctions "\.\<containsKey\>" display contained
|
||||
|
||||
" Vector/matrix
|
||||
syn match kickAssFunctions /\<Vector\>(/he=e-1
|
||||
" get
|
||||
syn match kickAssFunName "\<getX\>" display contained
|
||||
syn match kickAssFunName "\<getY\>" display contained
|
||||
syn match kickAssFunName "\<getZ\>" display contained
|
||||
syn match kickAssFunName "\<\X\>" display contained
|
||||
|
||||
syn region kickAssFunctionsCall start="[a-z0-9_]\." end="(" contains=kickAssFunName
|
||||
|
||||
if !exists("did_kickasm_syntax_inits")
|
||||
let did_kickasm_syntax_inits = 1
|
||||
|
||||
hi def link kickAssDirectives Special
|
||||
hi def link asm6510Illegal Debug
|
||||
hi def link asm6502Mnemonics Type
|
||||
hi def link asmDtvMnemonics Type
|
||||
hi def link asm6502Index None
|
||||
hi def link asm6502Jumps PreCondit
|
||||
hi def link asmString String
|
||||
hi def link asmSString String
|
||||
hi def link asmComment Comment
|
||||
hi def link asmLineComment Comment
|
||||
hi def link asmMacroCall Function
|
||||
hi def link asmLabel Label
|
||||
hi def link asmTodo Todo
|
||||
|
||||
hi def link asmDefName Function
|
||||
hi def link kickAssFunctions Function
|
||||
hi def link kickAssFunName Function
|
||||
hi def link kickAssColors Constant
|
||||
hi def link kickAssConstants Constant
|
||||
|
||||
hi def link asmImmediate None
|
||||
hi def link hexNumber None
|
||||
hi def link binNumber None
|
||||
hi def link decNumber None
|
||||
|
||||
endif
|
||||
|
||||
let b:current_syntax = "kickasm"
|
||||
Reference in New Issue
Block a user