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

Scripts update

Removed GetLatestVimScripts plugin (it's distributed with vim)
Added nice function for generating HTML from rst in rst/common.vim
Removd NERDtree (didn't used it at all)
Removed tasklist (same as above)
Removed eclim tools, leaved only buffer functionality
Small improvements in vimrc
This commit is contained in:
2010-08-29 19:58:17 +02:00
parent 51fd5661ec
commit 67fd7abec6
37 changed files with 1725 additions and 8138 deletions

5
.vimrc
View File

@@ -1,5 +1,4 @@
"Basic setup for all files {{{ "Basic setup for all files {{{
call system('message.py vimrc start')
set nocompatible "VIM over VI set nocompatible "VIM over VI
filetype plugin indent on "turn plugins/indent on filetype plugin indent on "turn plugins/indent on
@@ -51,7 +50,7 @@ set t_vb= "Turn beeping off
set tabstop=4 "Set tab stop to 4 set tabstop=4 "Set tab stop to 4
set updatecount=50 "After typing this many chars the swap file will be written to disk set updatecount=50 "After typing this many chars the swap file will be written to disk
set viewoptions-=options "Don't store options in view stored in ~/.vim/view dir set viewoptions-=options "Don't store options in view stored in ~/.vim/view dir
set viminfo='20,\"50 "Configure .viminfo set viminfo='20,<1000,h,f0 "Configure .viminfo
set whichwrap+=<,>,[,] "Cursor keys wrap to previous/next line set whichwrap+=<,>,[,] "Cursor keys wrap to previous/next line
set wildchar=<TAB> "Character to start wildcard expansion in the command-line set wildchar=<TAB> "Character to start wildcard expansion in the command-line
set wildmenu "Put command-line completion in an enhanced mode set wildmenu "Put command-line completion in an enhanced mode
@@ -206,7 +205,7 @@ nmap ,cn :silent call <SID>CopyFileName(1)<CR>
nmap ,cs :silent call <SID>CopyFileName(0)<CR> nmap ,cs :silent call <SID>CopyFileName(0)<CR>
"FuzzyFinder plugin. Keys for file fuf "FuzzyFinder plugin. Keys for file fuf
map <C-F> :FufFile **/<CR> map <C-F> :TlistToo!<cr>:FufFile **/<CR>
" }}} " }}}
" FUNCTIONS: usefull functions for all of th files {{{ " FUNCTIONS: usefull functions for all of th files {{{
"Sessions "Sessions

View File

@@ -1,14 +1,14 @@
ScriptID SourceID Filename ScriptID SourceID Filename
-------------------------- --------------------------
### plugins ### plugins
102 9375 DirDiff.vim 102 13435 DirDiff.vim
1658 11834 NERD_tree.vim 1658 11834 NERD_tree.vim
#2754 13139 :AutoInstall: delimitMate.vim #2754 13139 :AutoInstall: delimitMate.vim
1984 11852 fuzzyfinder.vim 1984 11852 fuzzyfinder.vim
642 8136 :AutoInstall: getscript.vim 642 8136 :AutoInstall: getscript.vim
311 7645 grep.vim 311 7645 grep.vim
2727 11120 jsbeautify.vim 2727 11120 jsbeautify.vim
2666 12423 Mark 2666 13424 Mark
2262 8944 occur.vim 2262 8944 occur.vim
910 13092 pydoc.vim 910 13092 pydoc.vim
#2421 9423 pysmell.vim #2421 9423 pysmell.vim
@@ -17,18 +17,18 @@ ScriptID SourceID Filename
1697 12566 :AutoInstall: surround.vim 1697 12566 :AutoInstall: surround.vim
#273 7701 taglist.vim # exchanged with taglisttoo #273 7701 taglist.vim # exchanged with taglisttoo
2607 10388 tasklist.vim 2607 10388 tasklist.vim
90 12743 vcscommand.vim 90 13632 vcscommand.vim
2226 12995 vimwiki.vim 2226 13667 vimwiki.vim
1334 6377 vst.vim 1334 6377 vst.vim
### colors ### colors
1975 7471 lettuce.vim 1975 7471 lettuce.vim
2536 13089 lucius.vim 2536 13588 lucius.vim
1165 3741 tolerable.vim 1165 3741 tolerable.vim
2465 11352 wombat256.vim 2465 13400 wombat256.vim
# compiler # compiler
891 10365 pylint.vim 891 10365 pylint.vim
# ftplugin # ftplugin
2441 13300 pyflakes.vim 2441 13378 pyflakes.vim
30 9196 python_fn.vim 30 9196 python_fn.vim
1542 10872 pythoncomplete.vim 1542 10872 pythoncomplete.vim
### indent ### indent

View File

@@ -10,8 +10,14 @@
" Dependencies: " Dependencies:
" - SearchSpecial.vim autoload script (optional, for improved search messages). " - SearchSpecial.vim autoload script (optional, for improved search messages).
" "
" Version: 2.3.3 " Version: 2.4.0
" Changes: " Changes:
" 13-Jul-2010, Ingo Karkat
" - ENH: The MarkSearch mappings (<Leader>[*#/?]) add the original cursor
" position to the jump list, like the built-in [/?*#nN] commands. This allows
" to use the regular jump commands for mark matches, like with regular search
" matches.
"
" 19-Feb-2010, Andy Wokula " 19-Feb-2010, Andy Wokula
" - BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results " - BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results
" in endless loop. Thanks to Andy Wokula for the patch. " in endless loop. Thanks to Andy Wokula for the patch.
@@ -386,8 +392,21 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType )
" mark; that's why we exclude a possible wrap-around via v:count1 == 1. " mark; that's why we exclude a possible wrap-around via v:count1 == 1.
let l:isStuckAtCurrentMark = ([l:line, l:col] == a:currentMarkPosition && v:count1 == 1) let l:isStuckAtCurrentMark = ([l:line, l:col] == a:currentMarkPosition && v:count1 == 1)
if l:line > 0 && ! l:isStuckAtCurrentMark if l:line > 0 && ! l:isStuckAtCurrentMark
let l:matchPosition = getpos('.')
" Open fold at the search result, like the built-in commands.
normal! zv normal! zv
" Add the original cursor position to the jump list, like the
" [/?*#nN] commands.
" Implementation: Memorize the match position, restore the view to the state
" before the search, then jump straight back to the match position. This
" also allows us to set a jump only if a match was found. (:call
" setpos("''", ...) doesn't work in Vim 7.2)
call winrestview(l:save_view)
normal! m'
call setpos('.', l:matchPosition)
if l:isWrapped if l:isWrapped
call s:WrapMessage(a:searchType, a:pattern, a:isBackward) call s:WrapMessage(a:searchType, a:pattern, a:isBackward)
else else

View File

@@ -65,7 +65,7 @@ function! vimwiki#current_subdir()"{{{
endfunction"}}} endfunction"}}}
function! vimwiki#open_link(cmd, link, ...) "{{{ function! vimwiki#open_link(cmd, link, ...) "{{{
if s:is_link_to_non_wiki_file(a:link) if vimwiki#is_non_wiki_link(a:link)
call s:edit_file(a:cmd, a:link) call s:edit_file(a:cmd, a:link)
else else
if a:0 if a:0
@@ -127,6 +127,13 @@ function! vimwiki#generate_links()"{{{
endfor endfor
endfunction " }}} endfunction " }}}
function! vimwiki#goto(key) "{{{
call s:edit_file(':e',
\ VimwikiGet('path').
\ a:key.
\ VimwikiGet('ext'))
endfunction "}}}
function! s:is_windows() "{{{ function! s:is_windows() "{{{
return has("win32") || has("win64") || has("win95") || has("win16") return has("win32") || has("win64") || has("win95") || has("win16")
endfunction "}}} endfunction "}}}
@@ -134,15 +141,21 @@ endfunction "}}}
function! s:get_links(pat) "{{{ function! s:get_links(pat) "{{{
" search all wiki files in 'path' and its subdirs. " search all wiki files in 'path' and its subdirs.
let subdir = vimwiki#current_subdir() let subdir = vimwiki#current_subdir()
let globlinks = glob(VimwikiGet('path').subdir.'**/'.a:pat)
" remove .wiki extensions " if current wiki is temporary -- was added by an arbitrary wiki file then do
let globlinks = substitute(globlinks, '\'.VimwikiGet('ext'), "", "g") " not search wiki files in subdirectories. Or it would hang the system if
" wiki file was created in $HOME or C:/ dirs.
if VimwikiGet('temp')
let search_dirs = ''
else
let search_dirs = '**/'
endif
let globlinks = glob(VimwikiGet('path').subdir.search_dirs.a:pat)
" remove extensions (and backup extensions too: .wiki~)
let globlinks = substitute(globlinks, '\'.VimwikiGet('ext').'\~\?', "", "g")
let links = split(globlinks, '\n') let links = split(globlinks, '\n')
" remove backup files (.wiki~)
call filter(links, 'v:val !~ ''.*\~$''')
" remove paths " remove paths
let rem_path = escape(expand(VimwikiGet('path')).subdir, '\') let rem_path = escape(expand(VimwikiGet('path')).subdir, '\')
call map(links, 'substitute(v:val, rem_path, "", "g")') call map(links, 'substitute(v:val, rem_path, "", "g")')
@@ -235,15 +248,15 @@ function! s:strip_word(word) "{{{
endfunction endfunction
" }}} " }}}
function! s:is_link_to_non_wiki_file(link) "{{{ function! vimwiki#is_non_wiki_link(lnk) "{{{
" Check if link is to a non-wiki file. let exts = '.\+\.\%('.
" The easiest way is to check if it has extension like .txt or .html \ join(split(g:vimwiki_file_exts, '\s*,\s*'), '\|').
if a:link =~ '\.\w\{1,4}$' \ '\)$'
if a:lnk =~ exts
return 1 return 1
endif endif
return 0 return 0
endfunction endfunction "}}}
" }}}
function! vimwiki#is_link_to_dir(link) "{{{ function! vimwiki#is_link_to_dir(link) "{{{
" Check if link is to a directory. " Check if link is to a directory.
@@ -252,8 +265,7 @@ function! vimwiki#is_link_to_dir(link) "{{{
return 1 return 1
endif endif
return 0 return 0
endfunction endfunction " }}}
" }}}
function! s:print_wiki_list() "{{{ function! s:print_wiki_list() "{{{
let idx = 0 let idx = 0
@@ -294,19 +306,23 @@ endfunction
function! s:update_wiki_links_dir(dir, old_fname, new_fname) " {{{ function! s:update_wiki_links_dir(dir, old_fname, new_fname) " {{{
let old_fname = substitute(a:old_fname, '[/\\]', '[/\\\\]', 'g') let old_fname = substitute(a:old_fname, '[/\\]', '[/\\\\]', 'g')
let new_fname = a:new_fname let new_fname = a:new_fname
let old_fname_r = old_fname
let new_fname_r = new_fname
if !s:is_wiki_word(new_fname) if !s:is_wiki_word(new_fname) && s:is_wiki_word(old_fname)
let new_fname = '[['.new_fname.']]' let new_fname_r = '[['.new_fname.']]'
endif endif
if !s:is_wiki_word(old_fname) if !s:is_wiki_word(old_fname)
let old_fname = '\[\['.vimwiki#unsafe_link(old_fname). let old_fname_r = '\[\[\zs'.vimwiki#unsafe_link(old_fname).
\ '\%(|.*\)\?\%(\]\[.*\)\?\]\]' \ '\ze\%(|.*\)\?\%(\]\[.*\)\?\]\]'
else else
let old_fname = '\<'.old_fname.'\>' let old_fname_r = '\<'.old_fname.'\>'
endif endif
let files = split(glob(VimwikiGet('path').a:dir.'*'.VimwikiGet('ext')), '\n') let files = split(glob(VimwikiGet('path').a:dir.'*'.VimwikiGet('ext')), '\n')
for fname in files for fname in files
call s:update_wiki_link(fname, old_fname, new_fname) call s:update_wiki_link(fname, old_fname_r, new_fname_r)
endfor endfor
endfunction endfunction
" }}} " }}}
@@ -348,8 +364,7 @@ function! s:update_wiki_links(old_fname, new_fname) " {{{
\ new_dir.old_fname, new_dir.new_fname) \ new_dir.old_fname, new_dir.new_fname)
let idx = idx + 1 let idx = idx + 1
endwhile endwhile
endfunction endfunction " }}}
" }}}
function! s:get_wiki_buffers() "{{{ function! s:get_wiki_buffers() "{{{
let blist = [] let blist = []
@@ -365,21 +380,58 @@ function! s:get_wiki_buffers() "{{{
let bcount = bcount + 1 let bcount = bcount + 1
endwhile endwhile
return blist return blist
endfunction endfunction " }}}
" }}}
function! s:open_wiki_buffer(item) "{{{ function! s:open_wiki_buffer(item) "{{{
call s:edit_file('e', a:item[0]) call s:edit_file('e', a:item[0])
if !empty(a:item[1]) if !empty(a:item[1])
call setbufvar(a:item[0], "vimwiki_prev_link", a:item[1]) call setbufvar(a:item[0], "vimwiki_prev_link", a:item[1])
endif endif
endfunction endfunction " }}}
" }}}
" }}} " }}}
" SYNTAX highlight {{{ " SYNTAX highlight {{{
function! vimwiki#WikiHighlightLinks() "{{{ function! vimwiki#highlight_links() "{{{
try
syntax clear VimwikiNoExistsLink
syntax clear VimwikiNoExistsLinkT
syntax clear VimwikiLink
syntax clear VimwikiLinkT
catch
endtry
"" use max highlighting - could be quite slow if there are too many wikifiles
if VimwikiGet('maxhi')
" Every WikiWord is nonexistent
if g:vimwiki_camel_case
execute 'syntax match VimwikiNoExistsLink /'.g:vimwiki_rxWikiWord.'/ display'
execute 'syntax match VimwikiNoExistsLinkT /'.g:vimwiki_rxWikiWord.'/ display contained'
endif
execute 'syntax match VimwikiNoExistsLink /'.g:vimwiki_rxWikiLink1.'/ display contains=VimwikiNoLinkChar'
execute 'syntax match VimwikiNoExistsLink /'.g:vimwiki_rxWikiLink2.'/ display contains=VimwikiNoLinkChar'
execute 'syntax match VimwikiNoExistsLinkT /'.g:vimwiki_rxWikiLink1.'/ display contained'
execute 'syntax match VimwikiNoExistsLinkT /'.g:vimwiki_rxWikiLink2.'/ display contained'
" till we find them in vimwiki's path
call s:highlight_existed_links()
else
" A WikiWord (unqualifiedWikiName)
execute 'syntax match VimwikiLink /\<'.g:vimwiki_rxWikiWord.'\>/'
" A [[bracketed wiki word]]
execute 'syntax match VimwikiLink /'.g:vimwiki_rxWikiLink1.'/ display contains=VimwikiLinkChar'
execute 'syntax match VimwikiLink /'.g:vimwiki_rxWikiLink2.'/ display contains=VimwikiLinkChar'
execute 'syntax match VimwikiLinkT /\<'.g:vimwiki_rxWikiWord.'\>/ display contained'
execute 'syntax match VimwikiLinkT /'.g:vimwiki_rxWikiLink1.'/ display contained'
execute 'syntax match VimwikiLinkT /'.g:vimwiki_rxWikiLink2.'/ display contained'
endif
execute 'syntax match VimwikiLink `'.g:vimwiki_rxWeblink.'` display contains=@NoSpell'
endfunction "}}}
function! s:highlight_existed_links() "{{{
let links = s:get_links('*'.VimwikiGet('ext')) let links = s:get_links('*'.VimwikiGet('ext'))
" Links with subdirs should be highlighted for linux and windows separators " Links with subdirs should be highlighted for linux and windows separators
@@ -390,31 +442,116 @@ function! vimwiki#WikiHighlightLinks() "{{{
for link in links for link in links
if g:vimwiki_camel_case && if g:vimwiki_camel_case &&
\ link =~ g:vimwiki_rxWikiWord && !s:is_link_to_non_wiki_file(link) \ link =~ g:vimwiki_rxWikiWord && !vimwiki#is_non_wiki_link(link)
execute 'syntax match VimwikiLink /!\@<!\<'.link.'\>/' execute 'syntax match VimwikiLink /!\@<!\<'.link.'\>/ display'
endif endif
execute 'syntax match VimwikiLink /\[\[\<'. execute 'syntax match VimwikiLink /\[\['.
\ vimwiki#unsafe_link(link). \ escape(vimwiki#unsafe_link(link), '~&$.*').
\ '\>\%(|\+.*\)*\]\]/' \ '\%(|\+.\{-}\)\{-}\]\]/ display contains=VimwikiLinkChar'
execute 'syntax match VimwikiLink /\[\[\<'. execute 'syntax match VimwikiLink /\[\['.
\ vimwiki#unsafe_link(link). \ escape(vimwiki#unsafe_link(link), '~&$.*').
\ '\>\]\[.\+\]\]/' \ '\]\[.\{-1,}\]\]/ display contains=VimwikiLinkChar'
execute 'syntax match VimwikiLinkT /\[\['.
\ escape(vimwiki#unsafe_link(link), '~&$.*').
\ '\%(|\+.\{-}\)\{-}\]\]/ display contained'
execute 'syntax match VimwikiLinkT /\[\['.
\ escape(vimwiki#unsafe_link(link), '~&$.*').
\ '\]\[.\{-1,}\]\]/ display contained'
endfor endfor
execute 'syntax match VimwikiLink /\[\[.\+\.\%(jpg\|png\|gif\)\%(|\+.*\)*\]\]/' execute 'syntax match VimwikiLink /\[\[.\+\.\%(jpg\|png\|gif\)\%(|\+.*\)*\]\]/ display contains=VimwikiLinkChar'
execute 'syntax match VimwikiLink /\[\[.\+\.\%(jpg\|png\|gif\)\]\[.\+\]\]/' execute 'syntax match VimwikiLink /\[\[.\+\.\%(jpg\|png\|gif\)\]\[.\+\]\]/ display contains=VimwikiLinkChar'
execute 'syntax match VimwikiLinkT /\[\[.\+\.\%(jpg\|png\|gif\)\%(|\+.*\)*\]\]/ display contained'
execute 'syntax match VimwikiLinkT /\[\[.\+\.\%(jpg\|png\|gif\)\]\[.\+\]\]/ display contained'
" Issue 103: Always highlight links to non-wiki files as existed.
execute 'syntax match VimwikiLink /\[\[.\+\.\%('.
\join(split(g:vimwiki_file_exts, '\s*,\s*'), '\|').
\'\)\%(|\+.*\)*\]\]/ display contains=VimwikiLinkChar'
execute 'syntax match VimwikiLink /\[\[.\+\.\%('.
\join(split(g:vimwiki_file_exts, '\s*,\s*'), '\|').
\'\)\]\[.\+\]\]/ display contains=VimwikiLinkChar'
execute 'syntax match VimwikiLinkT /\[\[.\+\.\%('.
\join(split(g:vimwiki_file_exts, '\s*,\s*'), '\|').
\'\)\%(|\+.*\)*\]\]/ display contained'
execute 'syntax match VimwikiLinkT /\[\[.\+\.\%('.
\join(split(g:vimwiki_file_exts, '\s*,\s*'), '\|').
\'\)\]\[.\+\]\]/ display contained'
" highlight dirs " highlight dirs
let dirs = s:get_links('*/') let dirs = s:get_links('*/')
call map(dirs, 'substitute(v:val, os_p, os_p2, "g")') call map(dirs, 'substitute(v:val, os_p, os_p2, "g")')
for dir in dirs for dir in dirs
execute 'syntax match VimwikiLink /\[\[\<'. execute 'syntax match VimwikiLink /\[\['.
\ vimwiki#unsafe_link(dir). \ escape(vimwiki#unsafe_link(dir), '~&$.*').
\ '\>[/\\]*\%(|\+.*\)*\]\]/' \ '[/\\]*\%(|\+.*\)*\]\]/ display contains=VimwikiLinkChar'
endfor execute 'syntax match VimwikiLink /\[\['.
endfunction \ escape(vimwiki#unsafe_link(dir), '~&$.*').
" }}} \ '[/\\]*\%(\]\[\+.*\)*\]\]/ display contains=VimwikiLinkChar'
function! vimwiki#hl_exists(hl)"{{{ execute 'syntax match VimwikiLinkT /\[\['.
\ escape(vimwiki#unsafe_link(dir), '~&$.*').
\ '[/\\]*\%(|\+.*\)*\]\]/ display contained'
execute 'syntax match VimwikiLinkT /\[\['.
\ escape(vimwiki#unsafe_link(dir), '~&$.*').
\ '[/\\]*\%(\]\[\+.*\)*\]\]/ display contained'
endfor
endfunction "}}}
function! vimwiki#setup_colors() "{{{
function! s:set_visible_ignore_color() "{{{
if !exists("g:colors_name") || g:colors_name == 'default'
if &background == 'light'
hi VimwikiIgnore guifg=#d0d0d0
else
hi VimwikiIgnore guifg=#505050
endif
else
hi link VimwikiIgnore Normal
endif
endfunction "}}}
let hlfg_ignore = vimwiki#get_hl_param('Ignore', 'guifg')
let hlbg_normal = vimwiki#get_hl_param('Normal', 'guibg')
if hlfg_ignore == 'bg' || hlfg_ignore == hlbg_normal
call s:set_visible_ignore_color()
else
hi link VimwikiIgnore Ignore
endif
if g:vimwiki_hl_headers == 0
hi def link VimwikiHeader Title
return
endif
if &background == 'light'
hi def VimwikiHeader1 guibg=bg guifg=#aa5858 gui=bold ctermfg=DarkRed
hi def VimwikiHeader2 guibg=bg guifg=#507030 gui=bold ctermfg=DarkGreen
hi def VimwikiHeader3 guibg=bg guifg=#1030a0 gui=bold ctermfg=DarkBlue
hi def VimwikiHeader4 guibg=bg guifg=#103040 gui=bold ctermfg=Black
hi def VimwikiHeader5 guibg=bg guifg=#505050 gui=bold ctermfg=Black
hi def VimwikiHeader6 guibg=bg guifg=#636363 gui=bold ctermfg=Black
else
hi def VimwikiHeader1 guibg=bg guifg=#e08090 gui=bold ctermfg=Red
hi def VimwikiHeader2 guibg=bg guifg=#80e090 gui=bold ctermfg=Green
hi def VimwikiHeader3 guibg=bg guifg=#6090e0 gui=bold ctermfg=Blue
hi def VimwikiHeader4 guibg=bg guifg=#c0c0f0 gui=bold ctermfg=White
hi def VimwikiHeader5 guibg=bg guifg=#e0e0f0 gui=bold ctermfg=White
hi def VimwikiHeader6 guibg=bg guifg=#f0f0f0 gui=bold ctermfg=White
endif
endfunction "}}}
function vimwiki#get_hl_param(hgroup, hparam) "{{{
redir => hlstatus
exe "silent hi ".a:hgroup
redir END
return matchstr(hlstatus, a:hparam.'\s*=\s*\zs\S\+')
endfunction "}}}
function! vimwiki#hl_exists(hl) "{{{
if !hlexists(a:hl) if !hlexists(a:hl)
return 0 return 0
endif endif
@@ -454,26 +591,38 @@ function! vimwiki#nested_syntax(filetype, start, end, textSnipHl) abort "{{{
else else
unlet b:current_syntax unlet b:current_syntax
endif endif
execute 'syntax region textSnip'.ft.' execute 'syntax region textSnip'.ft.
\ matchgroup='.a:textSnipHl.' \ ' matchgroup='.a:textSnipHl.
\ start="'.a:start.'" end="'.a:end.'" \ ' start="'.a:start.'" end="'.a:end.'"'.
\ contains=@'.group \ ' contains=@'.group.' keepend'
" A workaround to Issue 115: Nested Perl syntax highlighting differs from
" regular one.
" Perl syntax file has perlFunctionName which is usually has no effect due to
" 'contained' flag. Now we have 'syntax include' that makes all the groups
" included as 'contained' into specific group.
" Here perlFunctionName (with quite an angry regexp "\h\w*[^:]") clashes with
" the rest syntax rules as now it has effect being really 'contained'.
" Clear it!
if ft =~ 'perl'
syntax clear perlFunctionName
endif
endfunction "}}} endfunction "}}}
"}}} "}}}
" WIKI functions {{{ " WIKI functions {{{
function! vimwiki#WikiNextWord() "{{{ function! vimwiki#find_next_link() "{{{
call s:search_word(g:vimwiki_rxWikiLink.'\|'.g:vimwiki_rxWeblink, '') call s:search_word(g:vimwiki_rxWikiLink.'\|'.g:vimwiki_rxWeblink, '')
endfunction endfunction
" }}} " }}}
function! vimwiki#WikiPrevWord() "{{{ function! vimwiki#find_prev_link() "{{{
call s:search_word(g:vimwiki_rxWikiLink.'\|'.g:vimwiki_rxWeblink, 'b') call s:search_word(g:vimwiki_rxWikiLink.'\|'.g:vimwiki_rxWeblink, 'b')
endfunction endfunction
" }}} " }}}
function! vimwiki#WikiFollowWord(split) "{{{ function! vimwiki#follow_link(split) "{{{
if a:split == "split" if a:split == "split"
let cmd = ":split " let cmd = ":split "
elseif a:split == "vsplit" elseif a:split == "vsplit"
@@ -486,7 +635,7 @@ function! vimwiki#WikiFollowWord(split) "{{{
if link == "" if link == ""
let weblink = s:strip_word(s:get_word_at_cursor(g:vimwiki_rxWeblink)) let weblink = s:strip_word(s:get_word_at_cursor(g:vimwiki_rxWeblink))
if weblink != "" if weblink != ""
call VimwikiWeblinkHandler(weblink) call VimwikiWeblinkHandler(escape(weblink, '#'))
else else
execute "normal! \n" execute "normal! \n"
endif endif
@@ -496,20 +645,18 @@ function! vimwiki#WikiFollowWord(split) "{{{
let subdir = vimwiki#current_subdir() let subdir = vimwiki#current_subdir()
call vimwiki#open_link(cmd, subdir.link) call vimwiki#open_link(cmd, subdir.link)
endfunction endfunction " }}}
" }}}
function! vimwiki#WikiGoBackWord() "{{{ function! vimwiki#go_back_link() "{{{
if exists("b:vimwiki_prev_link") if exists("b:vimwiki_prev_link")
" go back to saved WikiWord " go back to saved WikiWord
let prev_word = b:vimwiki_prev_link let prev_word = b:vimwiki_prev_link
execute ":e ".substitute(prev_word[0], '\s', '\\\0', 'g') execute ":e ".substitute(prev_word[0], '\s', '\\\0', 'g')
call setpos('.', prev_word[1]) call setpos('.', prev_word[1])
endif endif
endfunction endfunction " }}}
" }}}
function! vimwiki#WikiGoHome(index) "{{{ function! vimwiki#goto_index(index) "{{{
call vimwiki#select(a:index) call vimwiki#select(a:index)
call vimwiki#mkdir(VimwikiGet('path')) call vimwiki#mkdir(VimwikiGet('path'))
@@ -517,17 +664,15 @@ function! vimwiki#WikiGoHome(index) "{{{
execute ':e '.fnameescape( execute ':e '.fnameescape(
\ VimwikiGet('path').VimwikiGet('index').VimwikiGet('ext')) \ VimwikiGet('path').VimwikiGet('index').VimwikiGet('ext'))
catch /E37/ " catch 'No write since last change' error catch /E37/ " catch 'No write since last change' error
" this is really unsecure!!! execute ':split '.
execute ':'.VimwikiGet('gohome').' '.
\ VimwikiGet('path'). \ VimwikiGet('path').
\ VimwikiGet('index'). \ VimwikiGet('index').
\ VimwikiGet('ext') \ VimwikiGet('ext')
catch /E325/ " catch 'ATTENTION' error (:h E325) catch /E325/ " catch 'ATTENTION' error (:h E325)
endtry endtry
endfunction endfunction "}}}
"}}}
function! vimwiki#WikiDeleteWord() "{{{ function! vimwiki#delete_link() "{{{
"" file system funcs "" file system funcs
"" Delete WikiWord you are in from filesystem "" Delete WikiWord you are in from filesystem
let val = input('Delete ['.expand('%').'] (y/n)? ', "") let val = input('Delete ['.expand('%').'] (y/n)? ', "")
@@ -547,10 +692,9 @@ function! vimwiki#WikiDeleteWord() "{{{
if expand('%:p') != "" if expand('%:p') != ""
execute "e" execute "e"
endif endif
endfunction endfunction "}}}
"}}}
function! vimwiki#WikiRenameWord() "{{{ function! vimwiki#rename_link() "{{{
"" Rename WikiWord, update all links to renamed WikiWord "" Rename WikiWord, update all links to renamed WikiWord
let subdir = vimwiki#current_subdir() let subdir = vimwiki#current_subdir()
let old_fname = subdir.expand('%:t') let old_fname = subdir.expand('%:t')
@@ -575,18 +719,17 @@ function! vimwiki#WikiRenameWord() "{{{
return return
endif endif
let new_link = subdir.new_link
" check new_fname - it should be 'good', not empty " check new_fname - it should be 'good', not empty
if substitute(new_link, '\s', '', 'g') == '' if substitute(new_link, '\s', '', 'g') == ''
echomsg 'vimwiki: Cannot rename to an empty filename!' echomsg 'vimwiki: Cannot rename to an empty filename!'
return return
endif endif
if s:is_link_to_non_wiki_file(new_link) if vimwiki#is_non_wiki_link(new_link)
echomsg 'vimwiki: Cannot rename to a filename with extension (ie .txt .html)!' echomsg 'vimwiki: Cannot rename to a filename with extension (ie .txt .html)!'
return return
endif endif
let new_link = subdir.new_link
let new_link = s:strip_word(new_link) let new_link = s:strip_word(new_link)
let new_fname = VimwikiGet('path').s:filename(new_link).VimwikiGet('ext') let new_fname = VimwikiGet('path').s:filename(new_link).VimwikiGet('ext')
@@ -649,16 +792,15 @@ function! vimwiki#WikiRenameWord() "{{{
echomsg old_fname." is renamed to ".new_fname echomsg old_fname." is renamed to ".new_fname
let &more = setting_more let &more = setting_more
endfunction endfunction " }}}
" }}}
function! vimwiki#WikiUISelect()"{{{ function! vimwiki#ui_select()"{{{
call s:print_wiki_list() call s:print_wiki_list()
let idx = input("Select Wiki (specify number): ") let idx = input("Select Wiki (specify number): ")
if idx == "" if idx == ""
return return
endif endif
call vimwiki#WikiGoHome(idx) call vimwiki#goto_index(idx)
endfunction endfunction
"}}} "}}}

View File

@@ -62,7 +62,7 @@ function! s:get_diary_range(lines, header) "{{{
let idx += 1 let idx += 1
endfor endfor
let ln_end = idx - 1 let ln_end = idx
return [ln_start, ln_end] return [ln_start, ln_end]
endfunction "}}} endfunction "}}}
@@ -99,10 +99,24 @@ function! s:get_links() "{{{
call map(links, 'fnamemodify(v:val, ":t")') call map(links, 'fnamemodify(v:val, ":t")')
call filter(links, 'v:val =~ "'.escape(rx, '\').'"') call filter(links, 'v:val =~ "'.escape(rx, '\').'"')
call map(links, '"[[".v:val."]]"')
return links return links
endfunction "}}} 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) "{{{ function! s:format_links(links) "{{{
let lines = [] let lines = []
let line = '| ' let line = '| '
@@ -137,6 +151,7 @@ function! s:add_link(page, header, link) "{{{
if ln_start == -1 if ln_start == -1
call insert(lines, '= '.a:header.' =') call insert(lines, '= '.a:header.' =')
let ln_start = 1 let ln_start = 1
let ln_end = 1
endif endif
" removing 'old' links " removing 'old' links
@@ -148,6 +163,7 @@ function! s:add_link(page, header, link) "{{{
" get all diary links from filesystem " get all diary links from filesystem
let links = s:get_links() let links = s:get_links()
call map(links, '"[[".v:val."]]"')
" add current link " add current link
if index(links, link) == -1 if index(links, link) == -1
@@ -192,7 +208,7 @@ function! vimwiki_diary#make_note(index, ...) "{{{
call vimwiki#open_link(':e ', link, s:diary_index()) call vimwiki#open_link(':e ', link, s:diary_index())
endfunction "}}} endfunction "}}}
" Calendar.vim callback and sign functions. " Calendar.vim callback function.
function! vimwiki_diary#calendar_action(day, month, year, week, dir) "{{{ function! vimwiki_diary#calendar_action(day, month, year, week, dir) "{{{
let day = s:prefix_zero(a:day) let day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month) let month = s:prefix_zero(a:month)
@@ -213,8 +229,9 @@ function! vimwiki_diary#calendar_action(day, month, year, week, dir) "{{{
" Create diary note for a selected date in default wiki. " Create diary note for a selected date in default wiki.
call vimwiki_diary#make_note(1, link) call vimwiki_diary#make_note(1, link)
endfunction endfunction "}}}
" Calendar.vim sign function.
function vimwiki_diary#calendar_sign(day, month, year) "{{{ function vimwiki_diary#calendar_sign(day, month, year) "{{{
let day = s:prefix_zero(a:day) let day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month) let month = s:prefix_zero(a:month)
@@ -222,3 +239,43 @@ function vimwiki_diary#calendar_sign(day, month, year) "{{{
\ a:year.'-'.month.'-'.day.VimwikiGet('ext') \ a:year.'-'.month.'-'.day.VimwikiGet('ext')
return filereadable(expand(sfile)) return filereadable(expand(sfile))
endfunction "}}} 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#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#open_link(':e ', link)
endif
endfunction "}}}

View File

@@ -48,14 +48,6 @@ function! s:is_img_link(lnk) "{{{
return 0 return 0
endfunction "}}} endfunction "}}}
function! s:is_non_wiki_link(lnk) "{{{
" TODO: Add more file extensions here
if a:lnk =~ '.\+\.\%(pdf\|txt\|doc\|rtf\|xls\)$'
return 1
endif
return 0
endfunction "}}}
function! s:has_abs_path(fname) "{{{ function! s:has_abs_path(fname) "{{{
if a:fname =~ '\(^.:\)\|\(^/\)' if a:fname =~ '\(^.:\)\|\(^/\)'
return 1 return 1
@@ -102,15 +94,13 @@ function! s:create_default_CSS(path) " {{{
endif endif
endfunction "}}} endfunction "}}}
function! s:get_html_header(wikifile, subdir, charset) "{{{ function! s:get_html_header(title, subdir, charset) "{{{
let lines=[] let lines=[]
let title = fnamemodify(a:wikifile, ":t:r")
if VimwikiGet('html_header') != "" && !s:warn_html_header if VimwikiGet('html_header') != "" && !s:warn_html_header
try try
let lines = readfile(expand(VimwikiGet('html_header'))) let lines = readfile(expand(VimwikiGet('html_header')))
call map(lines, 'substitute(v:val, "%title%", "'. title .'", "g")') call map(lines, 'substitute(v:val, "%title%", "'. a:title .'", "g")')
call map(lines, 'substitute(v:val, "%root_path%", "'. call map(lines, 'substitute(v:val, "%root_path%", "'.
\ s:root_path(a:subdir) .'", "g")') \ s:root_path(a:subdir) .'", "g")')
return lines return lines
@@ -134,7 +124,7 @@ function! s:get_html_header(wikifile, subdir, charset) "{{{
call add(lines, '<head>') call add(lines, '<head>')
call add(lines, '<link rel="Stylesheet" type="text/css" href="'. call add(lines, '<link rel="Stylesheet" type="text/css" href="'.
\ css_name.'" />') \ css_name.'" />')
call add(lines, '<title>'.title.'</title>') call add(lines, '<title>'.a:title.'</title>')
call add(lines, '<meta http-equiv="Content-Type" content="text/html;'. call add(lines, '<meta http-equiv="Content-Type" content="text/html;'.
\ ' charset='.a:charset.'" />') \ ' charset='.a:charset.'" />')
call add(lines, '</head>') call add(lines, '</head>')
@@ -171,11 +161,13 @@ function! s:safe_html(line) "{{{
let line = substitute(a:line, '&', '\&amp;', 'g') let line = substitute(a:line, '&', '\&amp;', 'g')
" let line = substitute(line, '<', '\&lt;', 'g') let tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
" let line = substitute(line, '>', '\&gt;', 'g') let line = substitute(line,'<\%(/\?\%('
" XXX: I believe there should be a much nicer way to do it. \.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!',
let line = substitute(line, '<\(br\|hr\)\@!', '\&lt;', 'g') \'\&lt;', 'g')
let line = substitute(line, '\(\(br\|hr\)\s*/\?\)\@<!>', '\&gt;', 'g') let line = substitute(line,'\%(</\?\%('
\.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>',
\'\&gt;', 'g')
return line return line
endfunction "}}} endfunction "}}}
@@ -299,23 +291,36 @@ function! s:get_html_toc(toc_list) "{{{
return toc return toc
endfunction "}}} endfunction "}}}
" insert placeholder's contents into dest. " insert toc into dest.
function! s:process_placeholders(dest, placeholders, type, ins_content) "{{{ function! s:process_toc(dest, placeholders, toc) "{{{
if !empty(a:placeholders) if !empty(a:placeholders)
for [placeholder, row, idx] in a:placeholders for [placeholder, row, idx] in a:placeholders
let [type, param] = placeholder let [type, param] = placeholder
if type == a:type if type == 'toc'
let ins_content = a:ins_content[:] let toc = a:toc[:]
if !empty(param) if !empty(param)
call insert(ins_content, '<h1>'.param.'</h1>') call insert(toc, '<h1>'.param.'</h1>')
endif endif
let shift = idx * len(ins_content) let shift = idx * len(toc)
call extend(a:dest, ins_content, row + shift) call extend(a:dest, toc, row + shift)
endif endif
endfor endfor
endif endif
endfunction "}}} endfunction "}}}
" get title.
function! s:process_title(placeholders, default_title) "{{{
if !empty(a:placeholders)
for [placeholder, row, idx] in a:placeholders
let [type, param] = placeholder
if type == 'title' && !empty(param)
return param
endif
endfor
endif
return a:default_title
endfunction "}}}
"}}} "}}}
" INLINE TAGS "{{{ " INLINE TAGS "{{{
@@ -371,7 +376,7 @@ function! s:tag_internal_link(value) "{{{
if s:is_img_link(a:caption) if s:is_img_link(a:caption)
let link = '<a href="'.a:src.'"><img src="'.a:caption.'"'.style_str.' />'. let link = '<a href="'.a:src.'"><img src="'.a:caption.'"'.style_str.' />'.
\ '</a>' \ '</a>'
elseif s:is_non_wiki_link(a:src) elseif vimwiki#is_non_wiki_link(a:src)
let link = '<a href="'.a:src.'">'.a:caption.'</a>' let link = '<a href="'.a:src.'">'.a:caption.'</a>'
elseif s:is_img_link(a:src) elseif s:is_img_link(a:src)
let link = '<img src="'.a:src.'" alt="'.a:caption.'"'. style_str.' />' let link = '<img src="'.a:src.'" alt="'.a:caption.'"'. style_str.' />'
@@ -592,8 +597,8 @@ endfunction " }}}
" BLOCK TAGS {{{ " BLOCK TAGS {{{
function! s:close_tag_pre(pre, ldest) "{{{ function! s:close_tag_pre(pre, ldest) "{{{
if a:pre if a:pre[0]
call insert(a:ldest, "</pre></code>") call insert(a:ldest, "</pre>")
return 0 return 0
endif endif
return a:pre return a:pre
@@ -671,8 +676,8 @@ endfunction "}}}
function! s:close_tag_list(lists, ldest) "{{{ function! s:close_tag_list(lists, ldest) "{{{
while len(a:lists) while len(a:lists)
let item = remove(a:lists, -1) let item = remove(a:lists, 0)
call add(a:ldest, item[0]) call insert(a:ldest, item[0])
endwhile endwhile
endfunction! "}}} endfunction! "}}}
@@ -685,10 +690,11 @@ function! s:close_tag_def_list(deflist, ldest) "{{{
endfunction! "}}} endfunction! "}}}
function! s:process_tag_pre(line, pre) "{{{ function! s:process_tag_pre(line, pre) "{{{
" pre is the list of [is_in_pre, indent_of_pre]
let lines = [] let lines = []
let pre = a:pre let pre = a:pre
let processed = 0 let processed = 0
if !pre && a:line =~ '{{{[^\(}}}\)]*\s*$' if !pre[0] && a:line =~ '^\s*{{{[^\(}}}\)]*\s*$'
let class = matchstr(a:line, '{{{\zs.*$') let class = matchstr(a:line, '{{{\zs.*$')
let class = substitute(class, '\s\+$', '', 'g') let class = substitute(class, '\s\+$', '', 'g')
if class != "" if class != ""
@@ -696,15 +702,15 @@ function! s:process_tag_pre(line, pre) "{{{
else else
call add(lines, "<pre>") call add(lines, "<pre>")
endif endif
let pre = 1 let pre = [1, len(matchstr(a:line, '^\s*\ze{{{'))]
let processed = 1 let processed = 1
elseif pre && a:line =~ '^}}}\s*$' elseif pre[0] && a:line =~ '^\s*}}}\s*$'
let pre = 0 let pre = [0, 0]
call add(lines, "</pre>") call add(lines, "</pre>")
let processed = 1 let processed = 1
elseif pre elseif pre[0]
let processed = 1 let processed = 1
call add(lines, a:line) call add(lines, substitute(a:line, '^\s\{'.pre[1].'}', '', ''))
endif endif
return [processed, lines, pre] return [processed, lines, pre]
endfunction "}}} endfunction "}}}
@@ -713,7 +719,6 @@ function! s:process_tag_quote(line, quote) "{{{
let lines = [] let lines = []
let quote = a:quote let quote = a:quote
let processed = 0 let processed = 0
" if a:line =~ '^\s\{4,}[^[:blank:]*#]'
if a:line =~ '^\s\{4,}\S' if a:line =~ '^\s\{4,}\S'
if !quote if !quote
call add(lines, "<blockquote>") call add(lines, "<blockquote>")
@@ -721,9 +726,6 @@ function! s:process_tag_quote(line, quote) "{{{
endif endif
let processed = 1 let processed = 1
call add(lines, substitute(a:line, '^\s*', '', '')) call add(lines, substitute(a:line, '^\s*', '', ''))
elseif quote && a:line =~ '^\s*$'
let processed = 1
call add(lines, a:line)
elseif quote elseif quote
call add(lines, "</blockquote>") call add(lines, "</blockquote>")
let quote = 0 let quote = 0
@@ -987,12 +989,14 @@ endfunction "}}}
"}}} "}}}
" }}}
" WIKI2HTML "{{{ " WIKI2HTML "{{{
function! s:parse_line(line, state) " {{{ function! s:parse_line(line, state) " {{{
let state = {} let state = {}
let state.para = a:state.para let state.para = a:state.para
let state.quote = a:state.quote let state.quote = a:state.quote
let state.pre = a:state.pre let state.pre = a:state.pre[:]
let state.table = a:state.table[:] let state.table = a:state.table[:]
let state.lists = a:state.lists[:] let state.lists = a:state.lists[:]
let state.deflist = a:state.deflist let state.deflist = a:state.deflist
@@ -1014,6 +1018,15 @@ function! s:parse_line(line, state) " {{{
endif endif
endif endif
" title -- placeholder
if !processed
if line =~ '^\s*%title'
let processed = 1
let param = matchstr(line, '^\s*%title\s\zs.*')
let state.placeholder = ['title', param]
endif
endif
" toc -- placeholder "{{{ " toc -- placeholder "{{{
if !processed if !processed
if line =~ '^\s*%toc' if line =~ '^\s*%toc'
@@ -1027,9 +1040,10 @@ function! s:parse_line(line, state) " {{{
" pres "{{{ " pres "{{{
if !processed if !processed
let [processed, lines, state.pre] = s:process_tag_pre(line, state.pre) let [processed, lines, state.pre] = s:process_tag_pre(line, state.pre)
if processed && len(state.lists) " pre is just fine to be in the list -- do not close list item here.
call s:close_tag_list(state.lists, lines) " if processed && len(state.lists)
endif " call s:close_tag_list(state.lists, lines)
" endif
if processed && len(state.table) if processed && len(state.table)
let state.table = s:close_tag_table(state.table, lines) let state.table = s:close_tag_table(state.table, lines)
endif endif
@@ -1052,7 +1066,7 @@ function! s:parse_line(line, state) " {{{
if processed && state.quote if processed && state.quote
let state.quote = s:close_tag_quote(state.quote, lines) let state.quote = s:close_tag_quote(state.quote, lines)
endif endif
if processed && state.pre if processed && state.pre[0]
let state.pre = s:close_tag_pre(state.pre, lines) let state.pre = s:close_tag_pre(state.pre, lines)
endif endif
if processed && len(state.table) if processed && len(state.table)
@@ -1109,7 +1123,7 @@ function! s:parse_line(line, state) " {{{
if processed && len(state.table) if processed && len(state.table)
let state.table = s:close_tag_table(state.table, lines) let state.table = s:close_tag_table(state.table, lines)
endif endif
if processed && state.pre if processed && state.pre[0]
let state.pre = s:close_tag_pre(state.pre, lines) let state.pre = s:close_tag_pre(state.pre, lines)
endif endif
if processed && state.para if processed && state.para
@@ -1153,7 +1167,7 @@ function! s:parse_line(line, state) " {{{
if processed && state.quote if processed && state.quote
let state.quote = s:close_tag_quote(state.quote, res_lines) let state.quote = s:close_tag_quote(state.quote, res_lines)
endif endif
if processed && state.pre if processed && state.pre[0]
let state.pre = s:close_tag_pre(state.pre, res_lines) let state.pre = s:close_tag_pre(state.pre, res_lines)
endif endif
if processed && len(state.table) if processed && len(state.table)
@@ -1186,7 +1200,7 @@ function! vimwiki_html#Wiki2HTML(path, wikifile) "{{{
let subdir = vimwiki#subdir(VimwikiGet('path'), wikifile) let subdir = vimwiki#subdir(VimwikiGet('path'), wikifile)
let lsource = s:remove_comments(readfile(wikifile)) let lsource = s:remove_comments(readfile(wikifile))
let ldest = s:get_html_header(wikifile, subdir, &fileencoding) let ldest = []
let path = expand(a:path).subdir let path = expand(a:path).subdir
call vimwiki#mkdir(path) call vimwiki#mkdir(path)
@@ -1201,7 +1215,7 @@ function! vimwiki_html#Wiki2HTML(path, wikifile) "{{{
let state = {} let state = {}
let state.para = 0 let state.para = 0
let state.quote = 0 let state.quote = 0
let state.pre = 0 let state.pre = [0, 0] " [in_pre, indent_pre]
let state.table = [] let state.table = []
let state.deflist = 0 let state.deflist = 0
let state.lists = [] let state.lists = []
@@ -1236,8 +1250,7 @@ function! vimwiki_html#Wiki2HTML(path, wikifile) "{{{
if !nohtml if !nohtml
let toc = s:get_html_toc(state.toc) let toc = s:get_html_toc(state.toc)
call s:process_placeholders(ldest, placeholders, 'toc', toc) call s:process_toc(ldest, placeholders, toc)
call s:remove_blank_lines(ldest) call s:remove_blank_lines(ldest)
"" process end of file "" process end of file
@@ -1251,6 +1264,8 @@ function! vimwiki_html#Wiki2HTML(path, wikifile) "{{{
call s:close_tag_table(state.table, lines) call s:close_tag_table(state.table, lines)
call extend(ldest, lines) call extend(ldest, lines)
let title = s:process_title(placeholders, fnamemodify(a:wikifile, ":t:r"))
call extend(ldest, s:get_html_header(title, subdir, &fileencoding), 0)
call extend(ldest, s:get_html_footer()) call extend(ldest, s:get_html_footer())
"" make html file. "" make html file.
@@ -1266,9 +1281,12 @@ function! vimwiki_html#WikiAll2HTML(path) "{{{
endif endif
echomsg 'Saving vimwiki files...' echomsg 'Saving vimwiki files...'
let save_eventignore = &eventignore
let &eventignore = "all"
let cur_buf = bufname('%') let cur_buf = bufname('%')
bufdo call s:save_vimwiki_buffer() bufdo call s:save_vimwiki_buffer()
exe 'buffer '.cur_buf exe 'buffer '.cur_buf
let &eventignore = save_eventignore
let path = expand(a:path) let path = expand(a:path)
call vimwiki#mkdir(path) call vimwiki#mkdir(path)

View File

@@ -40,7 +40,6 @@ endfunction "}}}
" Get regexp of the list item with checkbox. " Get regexp of the list item with checkbox.
function! s:rx_cb_list_item() "{{{ function! s:rx_cb_list_item() "{{{
" return s:rx_list_item().'\s*\zs\[.\?\]'
return s:rx_list_item().'\s*\zs\[.\?\]' return s:rx_list_item().'\s*\zs\[.\?\]'
endfunction "}}} endfunction "}}}
@@ -182,9 +181,7 @@ function! s:get_sibling_items(lnum) "{{{
let lnum = a:lnum let lnum = a:lnum
let ind = s:get_level(lnum) let ind = s:get_level(lnum)
while s:get_level(lnum) >= ind && while lnum != 0 && s:get_level(lnum) >= ind
\ lnum != 0
if s:get_level(lnum) == ind && s:is_cb_list_item(lnum) if s:get_level(lnum) == ind && s:is_cb_list_item(lnum)
call add(result, lnum) call add(result, lnum)
endif endif
@@ -192,9 +189,7 @@ function! s:get_sibling_items(lnum) "{{{
endwhile endwhile
let lnum = s:prev_list_item(a:lnum) let lnum = s:prev_list_item(a:lnum)
while s:get_level(lnum) >= ind && while lnum != 0 && s:get_level(lnum) >= ind
\ lnum != 0
if s:get_level(lnum) == ind && s:is_cb_list_item(lnum) if s:get_level(lnum) == ind && s:is_cb_list_item(lnum)
call add(result, lnum) call add(result, lnum)
endif endif
@@ -227,7 +222,7 @@ function! s:create_cb_list_item(lnum) "{{{
let m = matchstr(line, s:rx_list_item()) let m = matchstr(line, s:rx_list_item())
if m != '' if m != ''
let li_content = substitute(strpart(line, len(m)), '^\s*', '', '') let li_content = substitute(strpart(line, len(m)), '^\s*', '', '')
let line = m.'[ ] '.li_content let line = substitute(m, '\s*$', ' ', '').'[ ] '.li_content
call setline(a:lnum, line) call setline(a:lnum, line)
endif endif
endfunction "}}} endfunction "}}}
@@ -321,7 +316,7 @@ function! vimwiki_lst#ToggleListItem(line1, line2) "{{{
endfunction "}}} endfunction "}}}
function! vimwiki_lst#insertCR() "{{{ function! vimwiki_lst#kbd_cr() "{{{
" This function is heavily relies on proper 'set comments' option. " This function is heavily relies on proper 'set comments' option.
let cr = "\<CR>" let cr = "\<CR>"
if getline('.') =~ s:rx_cb_list_item() if getline('.') =~ s:rx_cb_list_item()
@@ -330,7 +325,7 @@ function! vimwiki_lst#insertCR() "{{{
return cr return cr
endfunction "}}} endfunction "}}}
function! vimwiki_lst#insertOo(cmd) "{{{ function! vimwiki_lst#kbd_oO(cmd) "{{{
" cmd should be 'o' or 'O' " cmd should be 'o' or 'O'
let beg_lnum = foldclosed('.') let beg_lnum = foldclosed('.')
@@ -343,11 +338,13 @@ function! vimwiki_lst#insertOo(cmd) "{{{
let lnum = line('.') let lnum = line('.')
endif endif
" let line = substitute(m, '\s*$', ' ', '').'[ ] '.li_content
let m = matchstr(line, s:rx_list_item())
let res = '' let res = ''
if line =~ s:rx_cb_list_item() if line =~ s:rx_cb_list_item()
let res = matchstr(line, s:rx_list_item()).'[ ] ' let res = substitute(m, '\s*$', ' ', '').'[ ] '
elseif line =~ s:rx_list_item() elseif line =~ s:rx_list_item()
let res = matchstr(line, s:rx_list_item()) let res = substitute(m, '\s*$', ' ', '')
elseif &autoindent || &smartindent elseif &autoindent || &smartindent
let res = matchstr(line, '^\s*') let res = matchstr(line, '^\s*')
endif endif

View File

@@ -19,6 +19,12 @@ let s:textwidth = &tw
" Misc functions {{{ " Misc functions {{{
function! s:wide_len(str) "{{{ function! s:wide_len(str) "{{{
" vim73 has new function that gives correct string width.
if exists("*strdisplaywidth")
return strdisplaywidth(a:str)
endif
" get str display width in vim ver < 7.2
if !g:vimwiki_CJK_length if !g:vimwiki_CJK_length
let ret = strlen(substitute(a:str, '.', 'x', 'g')) let ret = strlen(substitute(a:str, '.', 'x', 'g'))
else else

View File

@@ -259,6 +259,9 @@ hi WarningMsg ctermfg=173 cterm=none
" current match in the wildmenu completion " current match in the wildmenu completion
hi WildMenu guifg=#cae682 guibg=#363946 gui=bold,underline hi WildMenu guifg=#cae682 guibg=#363946 gui=bold,underline
hi WildMenu ctermfg=16 ctermbg=186 cterm=bold hi WildMenu ctermfg=16 ctermbg=186 cterm=bold
" color column highlighting
hi ColorColumn guifg=NONE guibg=#403630 gui=none
hi ColorColumn ctermfg=NONE ctermbg=94 cterm=none
" Diff " Diff
@@ -274,7 +277,7 @@ hi DiffDelete guifg=#6c6661 guibg=#3c3631 gui=none
hi DiffDelete ctermfg=fg ctermbg=58 cterm=none hi DiffDelete ctermfg=fg ctermbg=58 cterm=none
" changed text within line " changed text within line
hi DiffText guifg=#f05060 guibg=#4a343a gui=bold hi DiffText guifg=#f05060 guibg=#4a343a gui=bold
hi DiffText ctermfg=203 ctermbg=52 cterm=bold hi DiffText ctermfg=203 ctermbg=52 cterm=bold
" Folds " Folds
@@ -347,3 +350,4 @@ hi Visual ctermfg=NONE ctermbg=24
" visual mode selection when vim is not owning the selection (x11 only) " visual mode selection when vim is not owning the selection (x11 only)
hi VisualNOS guifg=fg gui=underline hi VisualNOS guifg=fg gui=underline
hi VisualNOS ctermfg=fg cterm=underline hi VisualNOS ctermfg=fg cterm=underline

View File

@@ -282,7 +282,7 @@ call <SID>X("WarningMsg", "ff0000", "", "")
call <SID>X("Number", "e5786d", "", "none") call <SID>X("Number", "e5786d", "", "none")
call <SID>X("Constant", "e5786d", "", "none") call <SID>X("Constant", "e5786d", "", "none")
call <SID>X("String", "95e454", "", s:italic) call <SID>X("String", "95e454", "", s:italic)
call <SID>X("Comment", "c0bc6c", "", s:italic) call <SID>X("Comment", "99968b", "", s:italic)
call <SID>X("Identifier", "caeb82", "", "none") call <SID>X("Identifier", "caeb82", "", "none")
call <SID>X("Keyword", "87afff", "", "none") call <SID>X("Keyword", "87afff", "", "none")
call <SID>X("Statement", "87afff", "", "none") call <SID>X("Statement", "87afff", "", "none")

File diff suppressed because it is too large Load Diff

View File

@@ -44,7 +44,7 @@ RELATED WORKS *
============================================================================== ==============================================================================
USAGE *mark-usage* USAGE *mark-usage*
Highlighting: HIGHLIGHTING *mark-highlighting*
<Leader>m Mark or unmark the word under the cursor, similar to <Leader>m Mark or unmark the word under the cursor, similar to
the |star| command. the |star| command.
@@ -61,7 +61,8 @@ Highlighting:
'smartcase' setting, only 'ignorecase'. 'smartcase' setting, only 'ignorecase'.
:Mark Clear all marks. :Mark Clear all marks.
Searching:
SEARCHING *mark-searching*
[count]* [count]# [count]* [count]#
[count]<Leader>* [count]<Leader># [count]<Leader>* [count]<Leader>#
@@ -91,6 +92,9 @@ Searching:
mark (like the built-in search), but to the previous mark (like the built-in search), but to the previous
mark. The entire mark text is treated as one entity. mark. The entire mark text is treated as one entity.
You can use Vim's |jumplist| to go back to previous
mark matches and the position before a mark search.
============================================================================== ==============================================================================
INSTALLATION *mark-installation* INSTALLATION *mark-installation*
@@ -150,10 +154,23 @@ http://vim.wikia.com/wiki/Highlight_multiple_words:
- Allow to specify the highlight group number via :Mark [n] {regexp} - Allow to specify the highlight group number via :Mark [n] {regexp}
- Use keys 1-9 on the numeric keypad to toggle a highlight group number. - Use keys 1-9 on the numeric keypad to toggle a highlight group number.
- Persist the patterns in a uppercase global variable across Vim sessions. - Persist the patterns in a uppercase global variable across Vim sessions.
(Request from Mun Johl, 16-Apr-2010.)
Can be somewhat emulated by placing something like this in |vimrc|: >
runtime plugin/mark.vim
Mark foo
Mark bar
< or defining a custom command a la: >
command -bar MyMarks execute "Mark foo" | execute "Mark bar"
============================================================================== ==============================================================================
HISTORY *mark-history* HISTORY *mark-history*
2.4.0 13-Jul-2010
- ENH: The MarkSearch mappings (<Leader>[*#/?]) add the original cursor
position to the jump list, like the built-in [/?*#nN] commands. This allows
to use the regular jump commands for mark matches, like with regular search
matches.
2.3.3 19-Feb-2010 2.3.3 19-Feb-2010
- BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results - BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results
in endless loop. Thanks to Andy Wokula for the patch. in endless loop. Thanks to Andy Wokula for the patch.

View File

@@ -1,414 +0,0 @@
*pi_getscript.txt* For Vim version 7.0. Last change: 2008 Jan 07
>
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr.
<
Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
(remove NOSPAM from the email address)
*GetLatestVimScripts-copyright*
Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *glvs-copyright*
The VIM LICENSE applies to getscript.vim and
pi_getscript.txt (see |copyright|) except use
"getscript" instead of "Vim". No warranty, express or implied.
Use At-Your-Own-Risk.
Getscript is a plugin that simplifies retrieval of the latest versions of the
scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will
then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
get the latest versions of scripts listed therein from http://vim.sf.net/.
==============================================================================
1. Contents *glvs-contents* *glvs* *getscript*
*GetLatestVimScripts*
1. Contents........................................: |glvs-contents|
2. GetLatestVimScripts -- Getting Started..........: |glvs-install|
3. GetLatestVimScripts Usage.......................: |glvs-usage|
4. GetLatestVimScripts Data File...................: |glvs-data|
5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins|
6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall|
7. GetLatestViMScripts Options.....................: |glvs-options|
8. GetLatestVimScripts Algorithm...................: |glvs-alg|
9. GetLatestVimScripts History.....................: |glvs-hist|
==============================================================================
2. GetLatestVimScripts -- Getting Started *getscript-start*
*getlatestvimscripts-install*
VERSION FROM VIM DISTRIBUTION *glvs-dist-install*
Vim 7.0 does not include the GetLatestVimScripts.dist file which
serves as an example and a template. So, you'll need to create
your own! See |GetLatestVimScripts_dat|.
VERSION FROM VIM SF NET *glvs-install*
NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist
file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for
the first time.
The GetLatestVimScripts.dist file serves as an example and a template for your
own personal list. Feel free to remove all the scripts mentioned within it;
the "important" part of it is the first two lines.
Your computer needs to have wget for GetLatestVimScripts to do its work.
1. if compressed: gunzip getscript.vba.gz
2. Unix:
vim getscript.vba
:so %
:q
cd ~/.vim/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(edit GetLatestVimScripts.dat to install your own personal
list of desired plugins -- see |GetLatestVimScripts_dat|)
3. Windows:
vim getscript.vba
:so %
:q
cd **path-to-vimfiles**/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(edit GetLatestVimScripts.dat to install your own personal
list of desired plugins -- see |GetLatestVimScripts_dat|)
==============================================================================
3. GetLatestVimScripts Usage *glvs-usage* *:GLVS*
Unless its been defined elsewhere, >
:GLVS
will invoke GetLatestVimScripts(). If some other plugin has defined that
command, then you may type
>
:GetLatestVimScripts
<
The script will attempt to update and, if permitted, will automatically
install scripts from http://vim.sourceforge.net/. To do so it will peruse a
file,
>
.vim/GetLatest/GetLatestVimScripts.dat (unix)
<
or >
..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
directory (see |glvs-plugins|).
Scripts which have been downloaded will appear in the
~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows)
subdirectory. GetLatestVimScripts will attempt to automatically
install them if you have the following line in your <.vimrc>: >
let g:GetLatestVimScripts_allowautoinstall=1
The <GetLatestVimScripts.dat> file will be automatically be updated to
reflect the latest version of script(s) so downloaded.
(also see |glvs-options|)
==============================================================================
4. GetLatestVimScripts Data File *getscript-data* *glvs-data*
*:GetLatestVimScripts_dat*
The data file <GetLatestVimScripts.dat> must have for its first two lines
the following text:
>
ScriptID SourceID Filename
--------------------------
<
Following those two lines are three columns; the first two are numeric
followed by a text column. The GetLatest/GetLatestVimScripts.dist file
contains an example of such a data file. Anything following a #... is
ignored, so you may embed comments in the file.
The first number on each line gives the script's ScriptID. When you're about
to use a web browser to look at scripts on http://vim.sf.net/, just before you
click on the script's link, you'll see a line resembling
http://vim.sourceforge.net/scripts/script.php?script_id=40
The "40" happens to be a ScriptID that GetLatestVimScripts needs to
download the associated page.
The second number on each line gives the script's SourceID. The SourceID
records the count of uploaded scripts as determined by vim.sf.net; hence it
serves to indicate "when" a script was uploaded. Setting the SourceID to 1
insures that GetLatestVimScripts will assume that the script it has is
out-of-date.
The SourceID is extracted by GetLatestVimScripts from the script's page on
vim.sf.net; whenever its greater than the one stored in the
GetLatestVimScripts.dat file, the script will be downloaded
(see |GetLatestVimScripts_dat|).
If your script's author has included a special comment line in his/her plugin,
the plugin itself will be used by GetLatestVimScripts to build your
<GetLatestVimScripts.dat> file, including any dependencies on other scripts it
may have. As an example, consider: >
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
This comment line tells getscript.vim to check vimscript #884 and that the
script is automatically installable. Getscript will also use this line to
help build the GetLatestVimScripts.dat file, by including a line such as: >
884 1 AutoAlign.vim
<
in it an AutoAlign.vim line isn't already in GetLatestVimScripts.dat file.
See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a
comprehensive ability to keep your plugins up-to-date!
*GetLatestVimScripts_dat*
As an example of a <GetLatestVimScripts.dat> file:
>
ScriptID SourceID Filename
--------------------------
294 1 Align.vim
120 2 decho.vim
40 3 DrawIt.tar.gz
451 4 EasyAccents.vim
195 5 engspchk.vim
642 6 GetLatestVimScripts.vim
489 7 Manpageview.vim
<
Note: the first two lines are required, but essentially act as comments.
==============================================================================
5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins*
If a plugin author includes the following comment anywhere in their plugin,
GetLatestVimScripts will find it and use it to automatically build the user's
GetLatestVimScripts.dat files:
>
src_id
v
" GetLatestVimScripts: ### ### yourscriptname
^
scriptid
<
As an author, you should include such a line in to refer to your own script
plus any additional lines describing any plugin dependencies it may have.
Same format, of course!
If your command is auto-installable (see |glvs-autoinstall|), and most scripts
are, then you may include :AutoInstall: at the start of "yourscriptname".
GetLatestVimScripts commands for those scripts are then appended, if not
already present, to the user's GetLatest/GetLatestVimScripts.dat file. Its a
relatively painless way to automate the acquisition of any scripts your
plugins depend upon.
Now, as an author, you probably don't want GetLatestVimScripts to download
your own scripts for you yourself, thereby overwriting your not-yet-released
hard work. GetLatestVimScripts provides a solution for this: put
>
0 0 yourscriptname
<
into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip
examining the "yourscriptname" scripts for those GetLatestVimScripts comment
lines. As a result, those lines won't be inadvertently installed into your
<GetLatestVimScripts.dat> file and subsequently used to download your own
scripts. This is especially important to do if you've included the
:AutoInstall: option.
Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
as you've used in your GetLatestVimScripts comment!
==============================================================================
6. GetLatestVimScripts AutoInstall *getscript-autoinstall*
*glvs-autoinstall*
GetLatestVimScripts now supports "AutoInstall". Not all scripts are
supportive of auto-install, as they may have special things you need to do to
install them (please refer to the script's "install" directions). On the
other hand, most scripts will be auto-installable.
To let GetLatestVimScripts do an autoinstall, the data file's comment field
should begin with (surrounding blanks are ignored): >
:AutoInstall:
<
Both colons are needed, and it should begin the comment (yourscriptname)
field.
One may prevent any autoinstalling by putting the following line in your
<.vimrc>: >
let g:GetLatestVimScripts_allowautoinstall= 0
<
With :AutoInstall: enabled, as it is by default, files which end with
---.tar.bz2 : decompressed & untarred in .vim/ directory
---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
---.vim.bz2 : decompressed & moved into .vim/plugin directory
---.tar.gz : decompressed & untarred in .vim/ directory
---.vba.gz : decompressed in .vim/ directory, then vimball handles it
---.vim.gz : decompressed & moved into .vim/plugin directory
---.vba : unzipped in .vim/ directory
---.vim : moved to .vim/plugin directory
---.zip : unzipped in .vim/ directory
and which merely need to have their components placed by the untar/gunzip or
move-to-plugin-directory process should be auto-installable. Vimballs, of
course, should always be auto-installable.
When is a script not auto-installable? Let me give an example:
.vim/after/syntax/blockhl.vim
The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
available at:
http://vim.sourceforge.net/scripts/script.php?script_id=104
Currently, vim's after/syntax only supports by-filetype scripts (in
blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would
possibly overwrite the current user's after/syntax/c.vim file.
In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
allow a after/syntax/c/ directory:
http://vim.sourceforge.net/scripts/script.php?script_id=1023
The script allows multiple syntax files to exist separately in the
after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an
appropriate tarball for auto-install because of the potential for the
after/syntax/c.vim contained in it to overwrite a user's c.vim.
==============================================================================
7. GetLatestVimScripts Options *glvs-options*
>
g:GetLatestVimScripts_wget
< default= "wget"
This variable holds the name of the command for obtaining
scripts.
>
g:GetLatestVimScripts_options
< default= "-q -O"
This variable holds the options to be used with the
g:GetLatestVimScripts_wget command.
>
g:getLatestVimScripts_allowautoinstall
< default= 1
This variable indicates whether GetLatestVimScripts is allowed
to attempt to automatically install scripts. Note that it
doesn't understand vimballs (yet). Furthermore, the plugin
author has to have explicitly indicated that his/her plugin
is automatically installable.
==============================================================================
8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
The Vim sourceforge page dynamically creates a page by keying off of the
so-called script-id. Within the webpage of
http://vim.sourceforge.net/scripts/script.php?script_id=40
is a line specifying the latest source-id (src_id). The source identifier
numbers are always increasing, hence if the src_id is greater than the one
recorded for the script in GetLatestVimScripts then it's time to download a
newer copy of that script.
GetLatestVimScripts will then download the script and update its internal
database of script ids, source ids, and scriptnames.
The AutoInstall process will:
Move the file from GetLatest/ to the following directory
Unix : $HOME/.vim
Windows: $HOME\vimfiles
if the downloaded file ends with ".bz2"
bunzip2 it
else if the downloaded file ends with ".gz"
gunzip it
if the resulting file ends with ".zip"
unzip it
else if the resulting file ends with ".tar"
tar -oxvf it
else if the resulting file ends with ".vim"
move it to the plugin subdirectory
==============================================================================
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
v29 Jan 07, 2008 : * Bram M pointed out that cpo is a global option and that
getscriptPlugin.vim was setting it but not restoring it.
v28 Jan 02, 2008 : * improved shell quoting character handling, cygwin
interface, register-a bypass
Oct 29, 2007 * Bill McCarthy suggested a change to getscript that avoids
creating pop-up windows
v24 Apr 16, 2007 : * removed save&restore of the fo option during script
loading
v23 Nov 03, 2006 : * ignores comments (#...)
* handles vimballs
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
available
v21 May 01, 2006 : * now takes advantage of autoloading.
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
unzip needs the -o flag to overwrite.
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
script! Fixed.
v18 Mar 21, 2005 : * bugfix to automatic database construction
* bugfix - nowrapscan caused an error
(tnx to David Green for the fix)
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
:AutoInstall:s, even though its o/s is windows
Apr 01, 2005 * when downloading errors occurred, GLVS was
terminating early. It now just goes on to trying
the next script (after trying three times to
download a script description page)
Apr 20, 2005 * bugfix - when a failure to download occurred,
GetLatestVimScripts would stop early and claim that
everything was current. Fixed.
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
defaults to 1, can be used to prevent all
:AutoInstall:
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
* fixed bug with :AutoInstall: use of helptags
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
always preventing downloads (just usually). Fixed.
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
s:dotvim. Fixed.
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
is zero. Useful for script authors; that way their
own GetLatestVimScripts activity won't overwrite
their scripts.
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
was intended only for testing. Removed, now works.
* :AutoInstall: implemented
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
* :GetLatestVimScripts command
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
now holds scripts that need updating
v10 Apr 19, 2004 : * moved history from script to doc
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
double quotes ("") whereas other systems will use
single quotes ('') around the urls in calls via wget
v8 Dec 01, 2003 : makes three tries at downloading
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
not found in downloaded webpage
Uses t_ti, t_te, and rs to make progress visible
v6 Aug 06, 2003 : final status messages now display summary of work
( "Downloaded someqty scripts" or
"Everything was current")
Now GetLatestVimScripts is careful about downloading
GetLatestVimScripts.vim itself!
(goes to <NEW_GetLatestVimScripts.vim>)
v5 Aug 04, 2003 : missing an endif near bottom
v4 Jun 17, 2003 : redraw! just before each "considering" message
v3 May 27, 2003 : Protects downloaded files from errant shell
expansions with single quotes: '...'
v2 May 14, 2003 : extracts name of item to be obtained from the
script file. Uses it instead of comment field
for output filename; comment is used in the
"considering..." line and is now just a comment!
* Fixed a bug: a string-of-numbers is not the
same as a number, so I added zero to them
and they became numbers. Fixes comparison.
==============================================================================
vim:tw=78:ts=8:ft=help:fdm=marker

View File

@@ -81,8 +81,6 @@
:FufTag fuf.txt /*:FufTag* :FufTag fuf.txt /*:FufTag*
:FufTagWithCursorWord fuf.txt /*:FufTagWithCursorWord* :FufTagWithCursorWord fuf.txt /*:FufTagWithCursorWord*
:FufTaggedFile fuf.txt /*:FufTaggedFile* :FufTaggedFile fuf.txt /*:FufTaggedFile*
:GLVS pi_getscript.txt /*:GLVS*
:GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat*
:Mark mark.txt /*:Mark* :Mark mark.txt /*:Mark*
:NERDTree NERD_tree.txt /*:NERDTree* :NERDTree NERD_tree.txt /*:NERDTree*
:NERDTreeClose NERD_tree.txt /*:NERDTreeClose* :NERDTreeClose NERD_tree.txt /*:NERDTreeClose*
@@ -110,31 +108,31 @@
:VWS vimwiki.txt /*:VWS* :VWS vimwiki.txt /*:VWS*
:Vimwiki2HTML vimwiki.txt /*:Vimwiki2HTML* :Vimwiki2HTML vimwiki.txt /*:Vimwiki2HTML*
:VimwikiAll2HTML vimwiki.txt /*:VimwikiAll2HTML* :VimwikiAll2HTML vimwiki.txt /*:VimwikiAll2HTML*
:VimwikiDeleteWord vimwiki.txt /*:VimwikiDeleteWord* :VimwikiDeleteLink vimwiki.txt /*:VimwikiDeleteLink*
:VimwikiFollowWord vimwiki.txt /*:VimwikiFollowWord* :VimwikiDiaryNextDay vimwiki.txt /*:VimwikiDiaryNextDay*
:VimwikiDiaryPrevDay vimwiki.txt /*:VimwikiDiaryPrevDay*
:VimwikiFollowLink vimwiki.txt /*:VimwikiFollowLink*
:VimwikiGenerateLinks vimwiki.txt /*:VimwikiGenerateLinks* :VimwikiGenerateLinks vimwiki.txt /*:VimwikiGenerateLinks*
:VimwikiGoBackWord vimwiki.txt /*:VimwikiGoBackWord* :VimwikiGoBackLink vimwiki.txt /*:VimwikiGoBackLink*
:VimwikiGoHome vimwiki.txt /*:VimwikiGoHome* :VimwikiGoto vimwiki.txt /*:VimwikiGoto*
:VimwikiIndex vimwiki.txt /*:VimwikiIndex*
:VimwikiMakeDiaryNote vimwiki.txt /*:VimwikiMakeDiaryNote* :VimwikiMakeDiaryNote vimwiki.txt /*:VimwikiMakeDiaryNote*
:VimwikiNextWord vimwiki.txt /*:VimwikiNextWord* :VimwikiNextLink vimwiki.txt /*:VimwikiNextLink*
:VimwikiPrevWord vimwiki.txt /*:VimwikiPrevWord* :VimwikiPrevLink vimwiki.txt /*:VimwikiPrevLink*
:VimwikiRenameWord vimwiki.txt /*:VimwikiRenameWord* :VimwikiRenameLink vimwiki.txt /*:VimwikiRenameLink*
:VimwikiSearch vimwiki.txt /*:VimwikiSearch* :VimwikiSearch vimwiki.txt /*:VimwikiSearch*
:VimwikiSplitWord vimwiki.txt /*:VimwikiSplitWord* :VimwikiSplitLink vimwiki.txt /*:VimwikiSplitLink*
:VimwikiTabGoHome vimwiki.txt /*:VimwikiTabGoHome* :VimwikiTabIndex vimwiki.txt /*:VimwikiTabIndex*
:VimwikiTabMakeDiaryNote vimwiki.txt /*:VimwikiTabMakeDiaryNote* :VimwikiTabMakeDiaryNote vimwiki.txt /*:VimwikiTabMakeDiaryNote*
:VimwikiTable vimwiki.txt /*:VimwikiTable* :VimwikiTable vimwiki.txt /*:VimwikiTable*
:VimwikiTableMoveColumnLeft vimwiki.txt /*:VimwikiTableMoveColumnLeft* :VimwikiTableMoveColumnLeft vimwiki.txt /*:VimwikiTableMoveColumnLeft*
:VimwikiTableMoveColumnRight vimwiki.txt /*:VimwikiTableMoveColumnRight* :VimwikiTableMoveColumnRight vimwiki.txt /*:VimwikiTableMoveColumnRight*
:VimwikiToggleListItem vimwiki.txt /*:VimwikiToggleListItem* :VimwikiToggleListItem vimwiki.txt /*:VimwikiToggleListItem*
:VimwikiUISelect vimwiki.txt /*:VimwikiUISelect* :VimwikiUISelect vimwiki.txt /*:VimwikiUISelect*
:VimwikiVSplitWord vimwiki.txt /*:VimwikiVSplitWord* :VimwikiVSplitLink vimwiki.txt /*:VimwikiVSplitLink*
ExtractSnips() snipMate.txt /*ExtractSnips()* ExtractSnips() snipMate.txt /*ExtractSnips()*
ExtractSnipsFile() snipMate.txt /*ExtractSnipsFile()* ExtractSnipsFile() snipMate.txt /*ExtractSnipsFile()*
Filename() snipMate.txt /*Filename()* Filename() snipMate.txt /*Filename()*
GetLatestVimScripts pi_getscript.txt /*GetLatestVimScripts*
GetLatestVimScripts-copyright pi_getscript.txt /*GetLatestVimScripts-copyright*
GetLatestVimScripts_dat pi_getscript.txt /*GetLatestVimScripts_dat*
NERDTree NERD_tree.txt /*NERDTree* NERDTree NERD_tree.txt /*NERDTree*
NERDTree-? NERD_tree.txt /*NERDTree-?* NERDTree-? NERD_tree.txt /*NERDTree-?*
NERDTree-A NERD_tree.txt /*NERDTree-A* NERDTree-A NERD_tree.txt /*NERDTree-A*
@@ -383,7 +381,9 @@ g:vimwiki_auto_checkbox vimwiki.txt /*g:vimwiki_auto_checkbox*
g:vimwiki_badsyms vimwiki.txt /*g:vimwiki_badsyms* g:vimwiki_badsyms vimwiki.txt /*g:vimwiki_badsyms*
g:vimwiki_browsers vimwiki.txt /*g:vimwiki_browsers* g:vimwiki_browsers vimwiki.txt /*g:vimwiki_browsers*
g:vimwiki_camel_case vimwiki.txt /*g:vimwiki_camel_case* g:vimwiki_camel_case vimwiki.txt /*g:vimwiki_camel_case*
g:vimwiki_conceallevel vimwiki.txt /*g:vimwiki_conceallevel*
g:vimwiki_dir_link vimwiki.txt /*g:vimwiki_dir_link* g:vimwiki_dir_link vimwiki.txt /*g:vimwiki_dir_link*
g:vimwiki_file_exts vimwiki.txt /*g:vimwiki_file_exts*
g:vimwiki_fold_lists vimwiki.txt /*g:vimwiki_fold_lists* g:vimwiki_fold_lists vimwiki.txt /*g:vimwiki_fold_lists*
g:vimwiki_fold_trailing_empty_lines vimwiki.txt /*g:vimwiki_fold_trailing_empty_lines* g:vimwiki_fold_trailing_empty_lines vimwiki.txt /*g:vimwiki_fold_trailing_empty_lines*
g:vimwiki_folding vimwiki.txt /*g:vimwiki_folding* g:vimwiki_folding vimwiki.txt /*g:vimwiki_folding*
@@ -402,27 +402,8 @@ g:vimwiki_table_auto_fmt vimwiki.txt /*g:vimwiki_table_auto_fmt*
g:vimwiki_upper vimwiki.txt /*g:vimwiki_upper* g:vimwiki_upper vimwiki.txt /*g:vimwiki_upper*
g:vimwiki_use_calendar vimwiki.txt /*g:vimwiki_use_calendar* g:vimwiki_use_calendar vimwiki.txt /*g:vimwiki_use_calendar*
g:vimwiki_use_mouse vimwiki.txt /*g:vimwiki_use_mouse* g:vimwiki_use_mouse vimwiki.txt /*g:vimwiki_use_mouse*
g:vimwiki_valid_html_tags vimwiki.txt /*g:vimwiki_valid_html_tags*
g:vimwiki_w32_dir_enc vimwiki.txt /*g:vimwiki_w32_dir_enc* g:vimwiki_w32_dir_enc vimwiki.txt /*g:vimwiki_w32_dir_enc*
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
getscript pi_getscript.txt /*getscript*
getscript-autoinstall pi_getscript.txt /*getscript-autoinstall*
getscript-data pi_getscript.txt /*getscript-data*
getscript-history pi_getscript.txt /*getscript-history*
getscript-plugins pi_getscript.txt /*getscript-plugins*
getscript-start pi_getscript.txt /*getscript-start*
glvs pi_getscript.txt /*glvs*
glvs-alg pi_getscript.txt /*glvs-alg*
glvs-algorithm pi_getscript.txt /*glvs-algorithm*
glvs-autoinstall pi_getscript.txt /*glvs-autoinstall*
glvs-contents pi_getscript.txt /*glvs-contents*
glvs-copyright pi_getscript.txt /*glvs-copyright*
glvs-data pi_getscript.txt /*glvs-data*
glvs-dist-install pi_getscript.txt /*glvs-dist-install*
glvs-hist pi_getscript.txt /*glvs-hist*
glvs-install pi_getscript.txt /*glvs-install*
glvs-options pi_getscript.txt /*glvs-options*
glvs-plugins pi_getscript.txt /*glvs-plugins*
glvs-usage pi_getscript.txt /*glvs-usage*
i_CTRL-G_S surround.txt /*i_CTRL-G_S* i_CTRL-G_S surround.txt /*i_CTRL-G_S*
i_CTRL-G_s surround.txt /*i_CTRL-G_s* i_CTRL-G_s surround.txt /*i_CTRL-G_s*
i_CTRL-R_<Tab> snipMate.txt /*i_CTRL-R_<Tab>* i_CTRL-R_<Tab> snipMate.txt /*i_CTRL-R_<Tab>*
@@ -430,18 +411,19 @@ list-snippets snipMate.txt /*list-snippets*
mark-configuration mark.txt /*mark-configuration* mark-configuration mark.txt /*mark-configuration*
mark-dependencies mark.txt /*mark-dependencies* mark-dependencies mark.txt /*mark-dependencies*
mark-description mark.txt /*mark-description* mark-description mark.txt /*mark-description*
mark-highlighting mark.txt /*mark-highlighting*
mark-history mark.txt /*mark-history* mark-history mark.txt /*mark-history*
mark-ideas mark.txt /*mark-ideas* mark-ideas mark.txt /*mark-ideas*
mark-installation mark.txt /*mark-installation* mark-installation mark.txt /*mark-installation*
mark-integration mark.txt /*mark-integration* mark-integration mark.txt /*mark-integration*
mark-known-problems mark.txt /*mark-known-problems* mark-known-problems mark.txt /*mark-known-problems*
mark-limitations mark.txt /*mark-limitations* mark-limitations mark.txt /*mark-limitations*
mark-searching mark.txt /*mark-searching*
mark-todo mark.txt /*mark-todo* mark-todo mark.txt /*mark-todo*
mark-usage mark.txt /*mark-usage* mark-usage mark.txt /*mark-usage*
mark.txt mark.txt /*mark.txt* mark.txt mark.txt /*mark.txt*
mark.vim mark.txt /*mark.vim* mark.vim mark.txt /*mark.vim*
multi_snip snipMate.txt /*multi_snip* multi_snip snipMate.txt /*multi_snip*
pi_getscript.txt pi_getscript.txt /*pi_getscript.txt*
project project.txt /*project* project project.txt /*project*
project-adding-mappings project.txt /*project-adding-mappings* project-adding-mappings project.txt /*project-adding-mappings*
project-example project.txt /*project-example* project-example project.txt /*project-example*
@@ -540,7 +522,6 @@ vimwiki-option-diary_index vimwiki.txt /*vimwiki-option-diary_index*
vimwiki-option-diary_link_count vimwiki.txt /*vimwiki-option-diary_link_count* vimwiki-option-diary_link_count vimwiki.txt /*vimwiki-option-diary_link_count*
vimwiki-option-diary_rel_path vimwiki.txt /*vimwiki-option-diary_rel_path* vimwiki-option-diary_rel_path vimwiki.txt /*vimwiki-option-diary_rel_path*
vimwiki-option-ext vimwiki.txt /*vimwiki-option-ext* vimwiki-option-ext vimwiki.txt /*vimwiki-option-ext*
vimwiki-option-gohome vimwiki.txt /*vimwiki-option-gohome*
vimwiki-option-html_footer vimwiki.txt /*vimwiki-option-html_footer* vimwiki-option-html_footer vimwiki.txt /*vimwiki-option-html_footer*
vimwiki-option-html_header vimwiki.txt /*vimwiki-option-html_header* vimwiki-option-html_header vimwiki.txt /*vimwiki-option-html_header*
vimwiki-option-index vimwiki.txt /*vimwiki-option-index* vimwiki-option-index vimwiki.txt /*vimwiki-option-index*
@@ -567,6 +548,7 @@ vimwiki-table-of-contents vimwiki.txt /*vimwiki-table-of-contents*
vimwiki-tables vimwiki.txt /*vimwiki-tables* vimwiki-tables vimwiki.txt /*vimwiki-tables*
vimwiki-temporary-wiki vimwiki.txt /*vimwiki-temporary-wiki* vimwiki-temporary-wiki vimwiki.txt /*vimwiki-temporary-wiki*
vimwiki-text-objects vimwiki.txt /*vimwiki-text-objects* vimwiki-text-objects vimwiki.txt /*vimwiki-text-objects*
vimwiki-title vimwiki.txt /*vimwiki-title*
vimwiki-toc vimwiki.txt /*vimwiki-toc* vimwiki-toc vimwiki.txt /*vimwiki-toc*
vimwiki-todo-lists vimwiki.txt /*vimwiki-todo-lists* vimwiki-todo-lists vimwiki.txt /*vimwiki-todo-lists*
vimwiki.txt vimwiki.txt /*vimwiki.txt* vimwiki.txt vimwiki.txt /*vimwiki.txt*
@@ -575,7 +557,9 @@ vimwiki_<A-Left> vimwiki.txt /*vimwiki_<A-Left>*
vimwiki_<A-Right> vimwiki.txt /*vimwiki_<A-Right>* vimwiki_<A-Right> vimwiki.txt /*vimwiki_<A-Right>*
vimwiki_<Backspace> vimwiki.txt /*vimwiki_<Backspace>* vimwiki_<Backspace> vimwiki.txt /*vimwiki_<Backspace>*
vimwiki_<C-CR> vimwiki.txt /*vimwiki_<C-CR>* vimwiki_<C-CR> vimwiki.txt /*vimwiki_<C-CR>*
vimwiki_<C-Down> vimwiki.txt /*vimwiki_<C-Down>*
vimwiki_<C-Space> vimwiki.txt /*vimwiki_<C-Space>* vimwiki_<C-Space> vimwiki.txt /*vimwiki_<C-Space>*
vimwiki_<C-Up> vimwiki.txt /*vimwiki_<C-Up>*
vimwiki_<CR> vimwiki.txt /*vimwiki_<CR>* vimwiki_<CR> vimwiki.txt /*vimwiki_<CR>*
vimwiki_<Leader>wd vimwiki.txt /*vimwiki_<Leader>wd* vimwiki_<Leader>wd vimwiki.txt /*vimwiki_<Leader>wd*
vimwiki_<Leader>wr vimwiki.txt /*vimwiki_<Leader>wr* vimwiki_<Leader>wr vimwiki.txt /*vimwiki_<Leader>wr*

View File

@@ -9,7 +9,7 @@
|___| |___| |_| |_||__| |__||___| |___| |_||___| ~ |___| |___| |_| |_||__| |__||___| |___| |_||___| ~
Version: 1.0 Version: 1.1
============================================================================== ==============================================================================
CONTENTS *vimwiki-contents* CONTENTS *vimwiki-contents*
@@ -97,7 +97,7 @@ There are global and local mappings in vimwiki.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
3.1. Global mappings *vimwiki-global-mappings* 3.1. Global mappings *vimwiki-global-mappings*
[count]<Leader>ww or <Plug>VimwikiGoHome [count]<Leader>ww or <Plug>VimwikiIndex
Open index file of the [count]'s wiki. Open index file of the [count]'s wiki.
<Leader>ww opens first wiki from |g:vimwiki_list|. <Leader>ww opens first wiki from |g:vimwiki_list|.
@@ -106,12 +106,12 @@ There are global and local mappings in vimwiki.
3<Leader>ww opens third wiki from |g:vimwiki_list|. 3<Leader>ww opens third wiki from |g:vimwiki_list|.
etc. etc.
To remap: > To remap: >
:map <Leader>w <Plug>VimwikiGoHome :map <Leader>w <Plug>VimwikiIndex
< <
See also|:VimwikiGoHome| See also |:VimwikiIndex|
[count]<Leader>wt or <Plug>VimwikiTabGoHome [count]<Leader>wt or <Plug>VimwikiTabIndex
Open index file of the [count]'s wiki in a new tab. Open index file of the [count]'s wiki in a new tab.
<Leader>wt tabopens first wiki from |g:vimwiki_list|. <Leader>wt tabopens first wiki from |g:vimwiki_list|.
@@ -120,9 +120,9 @@ See also|:VimwikiGoHome|
3<Leader>wt tabopens third wiki from |g:vimwiki_list|. 3<Leader>wt tabopens third wiki from |g:vimwiki_list|.
etc. etc.
To remap: > To remap: >
:map <Leader>t <Plug>VimwikiTabGoHome :map <Leader>t <Plug>VimwikiTabIndex
< <
See also|:VimwikiTabGoHome| See also |:VimwikiTabIndex|
<Leader>ws or <Plug>VimwikiUISelect <Leader>ws or <Plug>VimwikiUISelect
@@ -174,56 +174,56 @@ See also|:VimwikiTabMakeDiaryNote|
NORMAL MODE *vimwiki-local-mappings* NORMAL MODE *vimwiki-local-mappings*
*vimwiki_<CR>* *vimwiki_<CR>*
<CR> Follow/Create WikiWord. <CR> Follow/Create wiki link.
Maps to|:VimwikiFollowWord|. Maps to |:VimwikiFollowLink|.
To remap: > To remap: >
:map <Leader>wf <Plug>VimwikiFollowWord :map <Leader>wf <Plug>VimwikiFollowLink
< <
*vimwiki_<S-CR>* *vimwiki_<S-CR>*
<S-CR> Split and follow/create WikiWord <S-CR> Split and follow/create wiki link.
Maps to|:VimwikiSplitWord|. Maps to |:VimwikiSplitLink|.
To remap: > To remap: >
:map <Leader>we <Plug>VimwikiSplitWord :map <Leader>we <Plug>VimwikiSplitLink
< <
*vimwiki_<C-CR>* *vimwiki_<C-CR>*
<C-CR> Vertical split and follow/create WikiWord <C-CR> Vertical split and follow/create wiki link.
Maps to|:VimwikiVSplitWord|. Maps to |:VimwikiVSplitLink|.
To remap: > To remap: >
:map <Leader>wq <Plug>VimwikiVSplitWord :map <Leader>wq <Plug>VimwikiVSplitLink
< <
*vimwiki_<Backspace>* *vimwiki_<Backspace>*
<Backspace> Go back to previous WikiWord <Backspace> Go back to previous wiki link
Maps to|:VimwikiGoBackWord|. Maps to |:VimwikiGoBackLink|.
To remap: > To remap: >
:map <Leader>wb <Plug>VimwikiGoBackWord :map <Leader>wb <Plug>VimwikiGoBackLink
< <
*vimwiki_<Tab>* *vimwiki_<Tab>*
<Tab> Find next WikiWord <Tab> Find next wiki link.
Maps to|:VimwikiNextWord|. Maps to |:VimwikiNextLink|.
To remap: > To remap: >
:map <Leader>wn <Plug>VimwikiNextWord :map <Leader>wn <Plug>VimwikiNextLink
< <
*vimwiki_<S-Tab>* *vimwiki_<S-Tab>*
<S-Tab> Find previous WikiWord <S-Tab> Find previous wiki link.
Maps to|:VimwikiPrevWord|. Maps to |:VimwikiPrevLink|.
To remap: > To remap: >
:map <Leader>wp <Plug>VimwikiPrevWord :map <Leader>wp <Plug>VimwikiPrevLink
< <
*vimwiki_<Leader>wd* *vimwiki_<Leader>wd*
<Leader>wd Delete WikiWord you are in. <Leader>wd Delete wiki link you are in.
Maps to|:VimwikiDeleteWord|. Maps to |:VimwikiDeleteLink|.
To remap: > To remap: >
:map <Leader>dd <Plug>VimwikiDeleteWord :map <Leader>dd <Plug>VimwikiDeleteLink
< <
*vimwiki_<Leader>wr* *vimwiki_<Leader>wr*
<Leader>wr Rename WikiWord you are in. <Leader>wr Rename wiki link you are in.
Maps to|:VimwikiRenameWord|. Maps to |:VimwikiRenameLink|.
To remap: > To remap: >
:map <Leader>rr <Plug>VimwikiRenameWord :map <Leader>rr <Plug>VimwikiRenameLink
< <
*vimwiki_<C-Space>* *vimwiki_<C-Space>*
<C-Space> Toggle list item on/off (checked/unchecked) <C-Space> Toggle list item on/off (checked/unchecked)
Maps to|:VimwikiToggleListItem|. Maps to |:VimwikiToggleListItem|.
To remap: > To remap: >
:map <leader>tt <Plug>VimwikiToggleListItem :map <leader>tt <Plug>VimwikiToggleListItem
< See |vimwiki-todo-lists|. < See |vimwiki-todo-lists|.
@@ -250,16 +250,23 @@ gww reformat it.
<A-Right> Move current table column to the right. <A-Right> Move current table column to the right.
See |:VimwikiTableMoveColumnRight| See |:VimwikiTableMoveColumnRight|
*vimwiki_<C-Up>*
<C-Up> Open previous day diary link if available.
See |:VimwikiDiaryPrevDay|
*vimwiki_<C-Down>*
<C-Down> Open next day diary link if available.
See |:VimwikiDiaryNextDay|
Works only if |g:vimwiki_use_mouse| is set to 1. Works only if |g:vimwiki_use_mouse| is set to 1.
<2-LeftMouse> Follow/Create WikiWord <2-LeftMouse> Follow/Create wiki link.
<S-2-LeftMouse> Split and follow/create WikiWord <S-2-LeftMouse> Split and follow/create wiki link.
<C-2-LeftMouse> Vertical split and follow/create WikiWord <C-2-LeftMouse> Vertical split and follow/create wiki link.
<RightMouse><LeftMouse> Go back to previous WikiWord <RightMouse><LeftMouse> Go back to previous wiki link.
Note: <2-LeftMouse> is just left double click. Note: <2-LeftMouse> is just left double click.
@@ -298,10 +305,10 @@ ic Inner column in a table.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.1. Global Commands *vimwiki-global-commands* 4.1. Global Commands *vimwiki-global-commands*
*:VimwikiGoHome* *:VimwikiIndex*
Open index file of the current wiki. Open index file of the current wiki.
*:VimwikiTabGoHome* *:VimwikiTabIndex*
Open index file of the current wiki in a new tab. Open index file of the current wiki in a new tab.
*:VimwikiUISelect* *:VimwikiUISelect*
@@ -316,36 +323,40 @@ ic Inner column in a table.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.2. Local commands *vimwiki-local-commands* 4.2. Local commands *vimwiki-local-commands*
*:VimwikiFollowWord* *:VimwikiFollowLink*
Follow/create WikiWord. Follow/create wiki link..
*:VimwikiGoBackWord* *:VimwikiGoBackLink*
Go back to previous WikiWord you come from. Go back to previous wiki link. you come from.
*:VimwikiSplitWord* *:VimwikiSplitLink*
Split and follow/create WikiWord. Split and follow/create wiki link..
*:VimwikiVSplitWord* *:VimwikiVSplitLink*
Vertical split and follow/create WikiWord. Vertical split and follow/create wiki link..
*:VimwikiNextWord* *:VimwikiNextLink*
Find next WikiWord. Find next wiki link..
*:VimwikiPrevWord* *:VimwikiPrevLink*
Find previous WikiWord. Find previous wiki link..
*:VimwikiGoto*
Goto link provided by an argument. For example: >
:VimwikiGoto HelloWorld
< opens opens/creates HelloWorld wiki page.
*:VimwikiDeleteLink*
Delete wiki link. you are in.
*:VimwikiDeleteWord* *:VimwikiRenameLink*
Delete WikiWord you are in. Rename wiki link. you are in.
*:VimwikiRenameWord*
Rename WikiWord you are in.
*:Vimwiki2HTML* *:Vimwiki2HTML*
@@ -405,6 +416,13 @@ ic Inner column in a table.
*:VimwikiGenerateLinks* *:VimwikiGenerateLinks*
Insert all available links into current buffer. Insert all available links into current buffer.
*:VimwikiDiaryNextDay*
Open next day diary link if available.
Mapped to <C-Down>.
*:VimwikiDiaryPrevDay*
Open previous day diary link if available.
Mapped to <C-Up>.
============================================================================== ==============================================================================
@@ -768,6 +786,18 @@ or >
%toc Whatever %toc Whatever
------------------------------------------------------------------------------
%title Title of the page *vimwiki-title*
When you htmlize your wiki page you have default title which is the filename
of the page.
Place >
%title My books
into your wiki page if you want another title.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
%nohtml *vimwiki-nohtml* %nohtml *vimwiki-nohtml*
@@ -1063,7 +1093,7 @@ This header.tpl could look like: >
<div class="contents"> <div class="contents">
where where
%title% is replaced by a wiki page name %title% is replaced by a wiki page name or by a |vimwiki-title|
%root_path% is replaced by a count of ../ for pages buried in subdirs: %root_path% is replaced by a count of ../ for pages buried in subdirs:
if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] then if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] then
%root_path% is replaced by '../../../'. %root_path% is replaced by '../../../'.
@@ -1100,19 +1130,6 @@ or even >
\ 'css_name': 'css/main.css'}] \ 'css_name': 'css/main.css'}]
< <
*vimwiki-option-gohome*
------------------------------------------------------------------------------
Key Default value Values~
gohome split split, vsplit, tabe
Description~
This option controls the way |:VimwikiGoHome| command works.
For instance you have 'No write since last change' buffer. After <Leader>ww
(or :VimwikiGoHome) vimwiki index file will be splitted with it. Or vertically
splitted. Or opened in a new tab.
Ex: >
let g:vimwiki_list = [{'path': '~/my_site/', 'gohome': 'vsplit'}]
<
*vimwiki-option-maxhi* *vimwiki-option-maxhi*
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
@@ -1120,11 +1137,11 @@ Key Default value Values~
maxhi 1 0, 1 maxhi 1 0, 1
Description~ Description~
Non-existent WikiWord highlighting could be quite slow and if you don't want Non-existent wiki links highlighting could be quite slow and if you don't want
it set maxhi to 0: > it set maxhi to 0: >
let g:vimwiki_list = [{'path': '~/my_site/', 'maxhi': 0}] let g:vimwiki_list = [{'path': '~/my_site/', 'maxhi': 0}]
This disables filesystem checks for WikiWords. This disables filesystem checks for wiki links.
*vimwiki-option-nested_syntaxes* *vimwiki-option-nested_syntaxes*
@@ -1478,6 +1495,9 @@ Value Description~
Default: 0 Default: 0
Note: Vim73 has new function |strdisplaywidth|, so for Vim73 users this option
is obsolete.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:vimwiki_dir_link* *g:vimwiki_dir_link*
@@ -1558,6 +1578,42 @@ headers would look like: >
Default: '' (empty) Default: '' (empty)
------------------------------------------------------------------------------
*g:vimwiki_file_exts*
Comma separated list of file extensions.
Consider you have the following link: [[my_script.php][my script]].
If there is 'php' extension in g:vimwiki_file_exts this link would be htmlized
to <a href="my_script.php">my script</a>.
Otherwise it would be <a href="my_script.php.html">my script</a> (note .html)
Default: 'pdf,txt,doc,rtf,xls,php,zip,rar,7z,html,gz'
------------------------------------------------------------------------------
*g:vimwiki_valid_html_tags*
Comma separated list of html tags that can be used in vimwiki.
Default: 'b,i,s,u,sub,sup,kbd,br,hr'
------------------------------------------------------------------------------
*g:vimwiki_conceallevel*
In vim73 |conceallevel| is local to window, thus if you open viwmiki buffer in
a new tab or window, it would be set to default value.
Vimwiki sets |conceallevel| to g:vimwiki_conceallevel everytime vimwiki buffer
is entered.
Default: 3
============================================================================== ==============================================================================
12. Help *vimwiki-help* 12. Help *vimwiki-help*
@@ -1592,6 +1648,45 @@ Maxim Kim.
============================================================================== ==============================================================================
14. Changelog *vimwiki-changelog* 14. Changelog *vimwiki-changelog*
1.1~
* NEW: Issue 57: Make it possible to have pre block inside list item.
* NEW: Issue 82: Add quick goto command. See |:VimwikiGoto|.
* NEW: Issue 83: Quick switch in diary. See |:VimwikiDiaryNextDay| and
|:VimwikiDiaryPrevDay| commands.
* FIX: Issue 84: Vimwiki rename removed the WikiWord display name.
* FIX: Issue 85: Errors if you have '~' subdirectory in a wiki directory.
* FIX: Issue 86: Existed links '[[WikiLink1|Alias1]] | [[WikiLink2]]' are
highlighted as a single link.
* FIX: Issue 88: Underline text. See |g:vimwiki_valid_html_tags|.
* FIX: Issue 92: Wikies in a subdir could be renamed to an empty file.
* FIX: Issue 93: Use alias name in html title. See |vimwiki-title|.
* FIX: Issue 94: Relative links to PHP files are broken. See
|g:vimwiki_file_exts| for details.
* FIX: Issue 96: Closing bracket at the end of weblink shouldn't be a part
of that link.
* FIX: Issue 97: Error opening weblink in a browser if it has # inside.
* FIX: Issue 99: Vim is not responing while opening arbitrary wiki file.
* FIX: Issue 100: Additional content on diary index page could be
corrupted.
* NEW: Issue 101: Customized HTML tags. See |g:vimwiki_valid_html_tags|
* NEW: Issue 102: Conceal feature usage. See |g:vimwiki_conceallevel|.
* FIX: Issue 103: Always highlight links to non-wiki files as existed.
* FIX: Issue 104: vimwiki#nested_syntax needs 'keepend' to avoid contained
language syntax eat needed '}}}'.
* FIX: Issue 105: <i_CR> on a todo list item with [ ] doesn't create new
todo list item.
* FIX: Issue 106: With MediaWiki syntax <C-Space> on a child todo list
item produce errors.
* FIX: Issue 107: With MediaWiki syntax <C-Space> on a list item creates
todo list item without space between * and [ ].
* FIX: Issue 110: Syntax highlighting doesn't work for indented codeblock.
* FIX: Issue 115: Nested Perl syntax highlighting differs from regular
one.
* MISC: Many vimwiki commands were renamed from Vimwiki.*Word to
Vimwiki.*Link. VimwikiGoHome is renamed to VimwikiIndex,
VimwikiTabGoHome to VimwikiTabIndex.
* MISC: vimwiki-option-gohome is removed.
1.0~ 1.0~
* NEW: Issue 41: Table cell and column text objects. See * NEW: Issue 41: Table cell and column text objects. See
|vimwiki-text-objects|. |vimwiki-text-objects|.

View File

@@ -159,6 +159,42 @@ if !exists("*s:WideMsg")
endfun endfun
endif endif
if !exists("*s:GetQuickFixStackCount")
function s:GetQuickFixStackCount()
let l:stack_count = 0
try
silent colder 9
catch /E380:/
endtry
try
for i in range(9)
silent cnewer
let l:stack_count = l:stack_count + 1
endfor
catch /E381:/
return l:stack_count
endtry
endfunction
endif
if !exists("*s:ActivatePyflakesQuickFixWindow")
function s:ActivatePyflakesQuickFixWindow()
try
silent colder 9 " go to the bottom of quickfix stack
catch /E380:/
endtry
if s:pyflakes_qf > 0
try
exe "silent cnewer " . s:pyflakes_qf
catch /E381:/
echoerr "Could not activate Pyflakes Quickfix Window."
endtry
endif
endfunction
endif
if !exists("*s:RunPyflakes") if !exists("*s:RunPyflakes")
function s:RunPyflakes() function s:RunPyflakes()
highlight link PyFlakes SpellBad highlight link PyFlakes SpellBad
@@ -174,6 +210,10 @@ if !exists("*s:RunPyflakes")
let b:matched = [] let b:matched = []
let b:matchedlines = {} let b:matchedlines = {}
let b:qf_list = []
let b:qf_window_count = -1
python << EOF python << EOF
for w in check(vim.current.buffer): for w in check(vim.current.buffer):
vim.command('let s:matchDict = {}') vim.command('let s:matchDict = {}')
@@ -181,6 +221,13 @@ for w in check(vim.current.buffer):
vim.command("let s:matchDict['message'] = '%s'" % vim_quote(w.message % w.message_args)) vim.command("let s:matchDict['message'] = '%s'" % vim_quote(w.message % w.message_args))
vim.command("let b:matchedlines[" + str(w.lineno) + "] = s:matchDict") vim.command("let b:matchedlines[" + str(w.lineno) + "] = s:matchDict")
vim.command("let l:qf_item = {}")
vim.command("let l:qf_item.bufnr = bufnr('%')")
vim.command("let l:qf_item.filename = expand('%')")
vim.command("let l:qf_item.lnum = %s" % str(w.lineno))
vim.command("let l:qf_item.text = '%s'" % vim_quote(w.message % w.message_args))
vim.command("let l:qf_item.type = 'E'")
if w.col is None or isinstance(w, SyntaxError): if w.col is None or isinstance(w, SyntaxError):
# without column information, just highlight the whole line # without column information, just highlight the whole line
# (minus the newline) # (minus the newline)
@@ -189,8 +236,21 @@ for w in check(vim.current.buffer):
# with a column number, highlight the first keyword there # with a column number, highlight the first keyword there
vim.command(r"let s:mID = matchadd('PyFlakes', '^\%" + str(w.lineno) + r"l\_.\{-}\zs\k\+\k\@!\%>" + str(w.col) + r"c')") vim.command(r"let s:mID = matchadd('PyFlakes', '^\%" + str(w.lineno) + r"l\_.\{-}\zs\k\+\k\@!\%>" + str(w.col) + r"c')")
vim.command("let l:qf_item.vcol = 1")
vim.command("let l:qf_item.col = %s" % str(w.col + 1))
vim.command("call add(b:matched, s:matchDict)") vim.command("call add(b:matched, s:matchDict)")
vim.command("call add(b:qf_list, l:qf_item)")
EOF EOF
if exists("s:pyflakes_qf")
" if pyflakes quickfix window is already created, reuse it
call s:ActivatePyflakesQuickFixWindow()
call setqflist(b:qf_list, 'r')
else
" one pyflakes quickfix window for all buffer
call setqflist(b:qf_list, '')
let s:pyflakes_qf = s:GetQuickFixStackCount()
endif
let b:cleared = 0 let b:cleared = 0
endfunction endfunction
end end

View File

@@ -1,16 +1,16 @@
" Some common settings for all reSt files " Some common settings for all reSt files
set textwidth=80 setlocal textwidth=80
set makeprg=rst2html.py\ %\ %.html setlocal makeprg=rst2html.py\ %\ %.html
set spell setlocal spell
set smartindent setlocal smartindent
set autoindent setlocal autoindent
set formatoptions+=w setlocal formatoptions=tcq "set VIms default
map <F5> :call Rst2Blogger()<cr> map <F5> :call <SID>Rst2Blogger()<cr>
" Simple function, that translates reSt text into html with specified format, " Simple function, that translates reSt text into html with specified format,
" suitable to copy and paste into blogger post. " suitable to copy and paste into blogger post.
fun! Rst2Blogger() fun <SID>Rst2Blogger()
python << EOF python << EOF
from docutils import core from docutils import core
from docutils.writers.html4css1 import Writer, HTMLTranslator from docutils.writers.html4css1 import Writer, HTMLTranslator
@@ -45,7 +45,7 @@ _w = Writer()
_w.translator_class = NoHeaderHTMLTranslator _w.translator_class = NoHeaderHTMLTranslator
def blogify(string): def blogify(string):
return core.publish_string(string,writer=_w) return core.publish_string(string, writer=_w)
bufcontent = "\n".join(vim.current.buffer) bufcontent = "\n".join(vim.current.buffer)
name = vim.current.buffer.name name = vim.current.buffer.name
@@ -54,16 +54,18 @@ if name.lower().endswith(".rst"):
vim.command('new') vim.command('new')
vim.current.buffer[:] = blogify(bufcontent).split("\n") vim.current.buffer[:] = blogify(bufcontent).split("\n")
vim.command('saveas %s' % name) vim.command(r'silent %s/<tt class="docutils literal">/<code>/g')
vim.command(r'silent %s/<\/tt>/<\/code>/g')
vim.command('w %s' % name)
vim.command('bd') vim.command('bd')
else: else:
print "This is not reSt file. File should have '.rst' extension." print "Ihis is not reSt file. File should have '.rst' extension."
EOF EOF
endfun endfun
" This is similar to that above, but creates full html document " This is similar to that above, but creates full html document
fun! Restify() fun <SID>Restify()
python << EOF python << EOF
from docutils import core from docutils import core
from docutils.writers.html4css1 import Writer, HTMLTranslator from docutils.writers.html4css1 import Writer, HTMLTranslator
@@ -82,10 +84,12 @@ if name.lower().endswith(".rst"):
vim.command('new') vim.command('new')
vim.current.buffer[:] = reSTify(bufcontent).split("\n") vim.current.buffer[:] = reSTify(bufcontent).split("\n")
vim.command('saveas %s' % name) vim.command(r'silent %s/<tt class="docutils literal">/<code>/g')
vim.command(r'silent %s/<\/tt>/<\/code>/g')
vim.command('w %s' % name)
vim.command('bd') vim.command('bd')
else: else:
print 'To nie jest plik reSt!' print "It's not reSt file!"
EOF EOF
endfun endfun

View File

@@ -21,6 +21,11 @@ let b:undo_ftplugin = "setlocal ".
setlocal autowriteall setlocal autowriteall
setlocal commentstring=<!--%s--> setlocal commentstring=<!--%s-->
if g:vimwiki_conceallevel && exists("+conceallevel")
let &conceallevel = g:vimwiki_conceallevel
endif
" MISC }}} " MISC }}}
" GOTO FILE: gf {{{ " GOTO FILE: gf {{{
@@ -38,32 +43,22 @@ else
endif endif
setlocal formatoptions=tnro setlocal formatoptions=tnro
inoremap <buffer> <expr> <CR> vimwiki_lst#insertCR()
nnoremap <buffer> o :call vimwiki_lst#insertOo('o')<CR>a
nnoremap <buffer> O :call vimwiki_lst#insertOo('O')<CR>a
if !empty(&langmap) if !empty(&langmap)
" Valid only if langmap is a comma separated pairs of chars " Valid only if langmap is a comma separated pairs of chars
let l_o = matchstr(&langmap, '\C,\zs.\zeo,') let l_o = matchstr(&langmap, '\C,\zs.\zeo,')
if l_o if l_o
exe 'nnoremap <buffer> '.l_o.' :call vimwiki_lst#insertOo("o")<CR>a' exe 'nnoremap <buffer> '.l_o.' :call vimwiki_lst#kbd_oO("o")<CR>a'
endif endif
let l_O = matchstr(&langmap, '\C,\zs.\zeO,') let l_O = matchstr(&langmap, '\C,\zs.\zeO,')
if l_O if l_O
exe 'nnoremap <buffer> '.l_O.' :call vimwiki_lst#insertOo("O")<CR>a' exe 'nnoremap <buffer> '.l_O.' :call vimwiki_lst#kbd_oO("O")<CR>a'
endif endif
endif endif
" COMMENTS }}} " COMMENTS }}}
" FOLDING for headers and list items using expr fold method. {{{ " FOLDING for headers and list items using expr fold method. {{{
if g:vimwiki_folding == 1
setlocal fdm=expr
setlocal foldexpr=VimwikiFoldLevel(v:lnum)
setlocal foldtext=VimwikiFoldText()
endif
function! VimwikiFoldLevel(lnum) "{{{ function! VimwikiFoldLevel(lnum) "{{{
let line = getline(a:lnum) let line = getline(a:lnum)
@@ -208,14 +203,14 @@ command! -buffer Vimwiki2HTML
command! -buffer VimwikiAll2HTML command! -buffer VimwikiAll2HTML
\ call vimwiki_html#WikiAll2HTML(expand(VimwikiGet('path_html'))) \ call vimwiki_html#WikiAll2HTML(expand(VimwikiGet('path_html')))
command! -buffer VimwikiNextWord call vimwiki#WikiNextWord() command! -buffer VimwikiNextLink call vimwiki#find_next_link()
command! -buffer VimwikiPrevWord call vimwiki#WikiPrevWord() command! -buffer VimwikiPrevLink call vimwiki#find_prev_link()
command! -buffer VimwikiDeleteWord call vimwiki#WikiDeleteWord() command! -buffer VimwikiDeleteLink call vimwiki#delete_link()
command! -buffer VimwikiRenameWord call vimwiki#WikiRenameWord() command! -buffer VimwikiRenameLink call vimwiki#rename_link()
command! -buffer VimwikiFollowWord call vimwiki#WikiFollowWord('nosplit') command! -buffer VimwikiFollowLink call vimwiki#follow_link('nosplit')
command! -buffer VimwikiGoBackWord call vimwiki#WikiGoBackWord() command! -buffer VimwikiGoBackLink call vimwiki#go_back_link()
command! -buffer VimwikiSplitWord call vimwiki#WikiFollowWord('split') command! -buffer VimwikiSplitLink call vimwiki#follow_link('split')
command! -buffer VimwikiVSplitWord call vimwiki#WikiFollowWord('vsplit') command! -buffer VimwikiVSplitLink call vimwiki#follow_link('vsplit')
command! -buffer -range VimwikiToggleListItem call vimwiki_lst#ToggleListItem(<line1>, <line2>) command! -buffer -range VimwikiToggleListItem call vimwiki_lst#ToggleListItem(<line1>, <line2>)
@@ -227,6 +222,8 @@ exe 'command! -buffer -nargs=* VimwikiSearch vimgrep <args> '.
exe 'command! -buffer -nargs=* VWS vimgrep <args> '. exe 'command! -buffer -nargs=* VWS vimgrep <args> '.
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ') \ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
command! -buffer -nargs=1 VimwikiGoto call vimwiki#goto("<args>")
" table commands " table commands
command! -buffer -nargs=* VimwikiTable call vimwiki_tbl#create(<f-args>) command! -buffer -nargs=* VimwikiTable call vimwiki_tbl#create(<f-args>)
command! -buffer VimwikiTableAlignQ call vimwiki_tbl#align_or_cmd('gqq') command! -buffer VimwikiTableAlignQ call vimwiki_tbl#align_or_cmd('gqq')
@@ -234,65 +231,69 @@ command! -buffer VimwikiTableAlignW call vimwiki_tbl#align_or_cmd('gww')
command! -buffer VimwikiTableMoveColumnLeft call vimwiki_tbl#move_column_left() command! -buffer VimwikiTableMoveColumnLeft call vimwiki_tbl#move_column_left()
command! -buffer VimwikiTableMoveColumnRight call vimwiki_tbl#move_column_right() command! -buffer VimwikiTableMoveColumnRight call vimwiki_tbl#move_column_right()
" diary commands
command! -buffer VimwikiDiaryNextDay call vimwiki_diary#goto_next_day()
command! -buffer VimwikiDiaryPrevDay call vimwiki_diary#goto_prev_day()
" COMMANDS }}} " COMMANDS }}}
" KEYBINDINGS {{{ " KEYBINDINGS {{{
if g:vimwiki_use_mouse if g:vimwiki_use_mouse
nmap <buffer> <S-LeftMouse> <NOP> nmap <buffer> <S-LeftMouse> <NOP>
nmap <buffer> <C-LeftMouse> <NOP> nmap <buffer> <C-LeftMouse> <NOP>
noremap <silent><buffer> <2-LeftMouse> :VimwikiFollowWord<CR> noremap <silent><buffer> <2-LeftMouse> :VimwikiFollowLink<CR>
noremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitWord<CR> noremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR>
noremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitWord<CR> noremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR>
noremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackWord<CR> noremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR>
endif endif
if !hasmapto('<Plug>VimwikiFollowWord') if !hasmapto('<Plug>VimwikiFollowLink')
nmap <silent><buffer> <CR> <Plug>VimwikiFollowWord nmap <silent><buffer> <CR> <Plug>VimwikiFollowLink
endif endif
noremap <silent><script><buffer> noremap <silent><script><buffer>
\ <Plug>VimwikiFollowWord :VimwikiFollowWord<CR> \ <Plug>VimwikiFollowLink :VimwikiFollowLink<CR>
if !hasmapto('<Plug>VimwikiSplitWord') if !hasmapto('<Plug>VimwikiSplitLink')
nmap <silent><buffer> <S-CR> <Plug>VimwikiSplitWord nmap <silent><buffer> <S-CR> <Plug>VimwikiSplitLink
endif endif
noremap <silent><script><buffer> noremap <silent><script><buffer>
\ <Plug>VimwikiSplitWord :VimwikiSplitWord<CR> \ <Plug>VimwikiSplitLink :VimwikiSplitLink<CR>
if !hasmapto('<Plug>VimwikiVSplitWord') if !hasmapto('<Plug>VimwikiVSplitLink')
nmap <silent><buffer> <C-CR> <Plug>VimwikiVSplitWord nmap <silent><buffer> <C-CR> <Plug>VimwikiVSplitLink
endif endif
noremap <silent><script><buffer> noremap <silent><script><buffer>
\ <Plug>VimwikiVSplitWord :VimwikiVSplitWord<CR> \ <Plug>VimwikiVSplitLink :VimwikiVSplitLink<CR>
if !hasmapto('<Plug>VimwikiGoBackWord') if !hasmapto('<Plug>VimwikiGoBackLink')
nmap <silent><buffer> <BS> <Plug>VimwikiGoBackWord nmap <silent><buffer> <BS> <Plug>VimwikiGoBackLink
endif endif
noremap <silent><script><buffer> noremap <silent><script><buffer>
\ <Plug>VimwikiGoBackWord :VimwikiGoBackWord<CR> \ <Plug>VimwikiGoBackLink :VimwikiGoBackLink<CR>
if !hasmapto('<Plug>VimwikiNextWord') if !hasmapto('<Plug>VimwikiNextLink')
nmap <silent><buffer> <TAB> <Plug>VimwikiNextWord nmap <silent><buffer> <TAB> <Plug>VimwikiNextLink
endif endif
noremap <silent><script><buffer> noremap <silent><script><buffer>
\ <Plug>VimwikiNextWord :VimwikiNextWord<CR> \ <Plug>VimwikiNextLink :VimwikiNextLink<CR>
if !hasmapto('<Plug>VimwikiPrevWord') if !hasmapto('<Plug>VimwikiPrevLink')
nmap <silent><buffer> <S-TAB> <Plug>VimwikiPrevWord nmap <silent><buffer> <S-TAB> <Plug>VimwikiPrevLink
endif endif
noremap <silent><script><buffer> noremap <silent><script><buffer>
\ <Plug>VimwikiPrevWord :VimwikiPrevWord<CR> \ <Plug>VimwikiPrevLink :VimwikiPrevLink<CR>
if !hasmapto('<Plug>VimwikiDeleteWord') if !hasmapto('<Plug>VimwikiDeleteLink')
nmap <silent><buffer> <Leader>wd <Plug>VimwikiDeleteWord nmap <silent><buffer> <Leader>wd <Plug>VimwikiDeleteLink
endif endif
noremap <silent><script><buffer> noremap <silent><script><buffer>
\ <Plug>VimwikiDeleteWord :VimwikiDeleteWord<CR> \ <Plug>VimwikiDeleteLink :VimwikiDeleteLink<CR>
if !hasmapto('<Plug>VimwikiRenameWord') if !hasmapto('<Plug>VimwikiRenameLink')
nmap <silent><buffer> <Leader>wr <Plug>VimwikiRenameWord nmap <silent><buffer> <Leader>wr <Plug>VimwikiRenameLink
endif endif
noremap <silent><script><buffer> noremap <silent><script><buffer>
\ <Plug>VimwikiRenameWord :VimwikiRenameWord<CR> \ <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>
if !hasmapto('<Plug>VimwikiToggleListItem') if !hasmapto('<Plug>VimwikiToggleListItem')
nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
@@ -304,10 +305,35 @@ endif
noremap <silent><script><buffer> noremap <silent><script><buffer>
\ <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR> \ <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
if !hasmapto('<Plug>VimwikiDiaryNextDay')
nmap <silent><buffer> <C-Down> <Plug>VimwikiDiaryNextDay
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiDiaryNextDay :VimwikiDiaryNextDay<CR>
if !hasmapto('<Plug>VimwikiDiaryPrevDay')
nmap <silent><buffer> <C-Up> <Plug>VimwikiDiaryPrevDay
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR>
function! s:CR() "{{{
let res = vimwiki_lst#kbd_cr()
if res == "\<CR>" && g:vimwiki_table_auto_fmt
let res = vimwiki_tbl#kbd_cr()
endif
return res
endfunction "}}}
" List and Table <CR> mapping
inoremap <buffer> <expr> <CR> <SID>CR()
" List mappings
nnoremap <buffer> o :call vimwiki_lst#kbd_oO('o')<CR>a
nnoremap <buffer> O :call vimwiki_lst#kbd_oO('O')<CR>a
" Table mappings " Table mappings
if g:vimwiki_table_auto_fmt if g:vimwiki_table_auto_fmt
inoremap <expr> <buffer> <CR> vimwiki_tbl#kbd_cr()
inoremap <expr> <buffer> <Tab> vimwiki_tbl#kbd_tab() inoremap <expr> <buffer> <Tab> vimwiki_tbl#kbd_tab()
inoremap <expr> <buffer> <S-Tab> vimwiki_tbl#kbd_shift_tab() inoremap <expr> <buffer> <S-Tab> vimwiki_tbl#kbd_shift_tab()
endif endif

View File

@@ -2,8 +2,8 @@
" FILE: "/home/wlee/.vim/plugin/DirDiff.vim" {{{ " FILE: "/home/wlee/.vim/plugin/DirDiff.vim" {{{
" LAST MODIFICATION: "Mon, 20 Oct 2008 09:04:59 -0500 (wlee)" " LAST MODIFICATION: "Mon, 20 Oct 2008 09:04:59 -0500 (wlee)"
" HEADER MAINTAINED BY: N/A " HEADER MAINTAINED BY: N/A
" VERSION: 1.1.2 " VERSION: 1.1.3
" (C) 2001-2006 by William Lee, <wl1012@yahoo.com> " (C) 2001-2010 by William Lee, <wl1012@yahoo.com>
" }}} " }}}
@@ -147,9 +147,12 @@
" "
" Florian Delizy for the i18n diff patch " Florian Delizy for the i18n diff patch
" Robert Webb for his sorting function " Robert Webb for his sorting function
" Wu WeiWei for his Chinese diff patch
" Salman Halim, Yosuke Kimura, and others for their suggestions " Salman Halim, Yosuke Kimura, and others for their suggestions
" "
" HISTORY: " HISTORY:
" 1.1.3 - Applied the patch to 1.1.2 by Wu WeiWei in order to make diff
" that's localized in Chinese work.
" 1.1.2 - Applied the patch to 1.1.0 instead of 1.0.2. Please do not use " 1.1.2 - Applied the patch to 1.1.0 instead of 1.0.2. Please do not use
" 1.1.1 " 1.1.1
" 1.1.1 - Make it work with filename with spaces. (Thanks to Atte Kojo) " 1.1.1 - Make it work with filename with spaces. (Thanks to Atte Kojo)
@@ -281,6 +284,11 @@ if !exists("g:DirDiffTextOnlyIn")
let g:DirDiffTextOnlyIn = "Only in " let g:DirDiffTextOnlyIn = "Only in "
endif endif
" String used for the English equivalent ": ")
if !exists("g:DirDiffTextOnlyInCenter")
let g:DirDiffTextOnlyInCenter = ": "
endif
" Set some script specific variables: " Set some script specific variables:
" "
let s:DirDiffFirstDiffLine = 6 let s:DirDiffFirstDiffLine = 6
@@ -778,11 +786,11 @@ endfunction
"Returns the source (A or B) of the "Only" line "Returns the source (A or B) of the "Only" line
function! <SID>ParseOnlySrc(line) function! <SID>ParseOnlySrc(line)
return substitute(a:line, '^.*' . s:DirDiffDiffOnlyLine . '\[\(.\)\].*:.*', '\1', '') return substitute(a:line, '^.*' . s:DirDiffDiffOnlyLine . '\[\(.\)\].*' . s:DirDiffDiffOnlyLineCenter . '.*', '\1', '')
endfunction endfunction
function! <SID>ParseOnlyFile(line) function! <SID>ParseOnlyFile(line)
let regex = '^.*' . s:DirDiffDiffOnlyLine . '\[.\]\(.*\): \(.*\)' let regex = '^.*' . s:DirDiffDiffOnlyLine . '\[.\]\(.*\)' . s:DirDiffDiffOnlyLineCenter . '\(.*\)'
let root = substitute(a:line, regex , '\1', '') let root = substitute(a:line, regex , '\1', '')
let file = root . s:sep . substitute(a:line, regex , '\2', '') let file = root . s:sep . substitute(a:line, regex , '\2', '')
return file return file
@@ -1006,6 +1014,7 @@ function! <SID>GetDiffStrings()
" what's set in the global variables " what's set in the global variables
if (g:DirDiffDynamicDiffText == 0) if (g:DirDiffDynamicDiffText == 0)
let s:DirDiffDiffOnlyLineCenter = g:DirDiffTextOnlyInCenter
let s:DirDiffDiffOnlyLine = g:DirDiffTextOnlyIn let s:DirDiffDiffOnlyLine = g:DirDiffTextOnlyIn
let s:DirDiffDifferLine = g:DirDiffTextFiles let s:DirDiffDifferLine = g:DirDiffTextFiles
let s:DirDiffDifferAndLine = g:DirDiffTextAnd let s:DirDiffDifferAndLine = g:DirDiffTextAnd
@@ -1032,7 +1041,9 @@ function! <SID>GetDiffStrings()
"echo "First line: " . getline(1) "echo "First line: " . getline(1)
"echo "tmp1: " . tmp1 "echo "tmp1: " . tmp1
"echo "tmp1rx: " . tmp1rx "echo "tmp1rx: " . tmp1rx
let s:DirDiffDiffOnlyLine = substitute( getline(1), tmp1rx . ".*$", "", '') let regex = '\(^.*\)' . tmp1rx . '\(.*\)' . "test"
let s:DirDiffDiffOnlyLine = substitute( getline(1), regex, '\1', '')
let s:DirDiffDiffOnlyLineCenter = substitute( getline(1), regex, '\2', '')
"echo "DirDiff Only: " . s:DirDiffDiffOnlyLine "echo "DirDiff Only: " . s:DirDiffDiffOnlyLine
q q
@@ -1067,4 +1078,12 @@ function! <SID>GetDiffStrings()
call <SID>Delete(tmp2) call <SID>Delete(tmp2)
call <SID>Delete(tmpdiff) call <SID>Delete(tmpdiff)
"avoid get diff text again
let g:DirDiffTextOnlyInCenter = s:DirDiffDiffOnlyLineCenter
let g:DirDiffTextOnlyIn = s:DirDiffDiffOnlyLine
let g:DirDiffTextFiles = s:DirDiffDifferLine
let g:DirDiffTextAnd = s:DirDiffDifferAndLine
let g:DirDiffTextDiffer = s:DirDiffDifferEndLine
let g:DirDiffDynamicDiffText = 0
endfunction endfunction

File diff suppressed because it is too large Load Diff

530
plugin/buffers.vim Normal file
View File

@@ -0,0 +1,530 @@
" ============================================================================
" File: buffers.vim
" Description: vim plugin that provides buffers helpers. Almost all of parts
" are taken from Eclim project <http://eclim.sourceforge.net>
" Maintainer: Roman 'gryf' Dobosz <gryf73@gmail.com>
" Last Change: 2010-08-28
" License: This program is free software: you can redistribute it and/or
" modify it under the terms of the GNU General Public License as
" published by the Free Software Foundation, either version 3 of
" the License, or (at your option) any later version.
"
" This program is distributed in the hope that it will be useful,
" but WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" GNU General Public License for more details.
"
" You should have received a copy of the GNU General Public
" License along with this program. If not, see
" <http://www.gnu.org/licenses/>.
" ============================================================================
let s:Eclim_ver = '1.6.0'
" Eclim: {{{1
" files:
" - plugin/eclim.vim (global vars)
" - plugin/common.vim (commands)
" Global Variables {{{2
if has("signs")
if !exists("g:EclimSignLevel")
let g:EclimSignLevel = 5
endif
else
let g:EclimSignLevel = 0
endif
if !exists("g:EclimInfoHighlight")
let g:EclimInfoHighlight = "Statement"
endif
if !exists("g:EclimLogLevel")
let g:EclimLogLevel = 4
endif
if !exists("g:EclimTraceHighlight")
let g:EclimTraceHighlight = "Normal"
endif
if !exists("g:EclimDebugHighlight")
let g:EclimDebugHighlight = "Normal"
endif
if !exists("g:EclimInfoHighlight")
let g:EclimInfoHighlight = "Statement"
endif
if !exists("g:EclimWarningHighlight")
let g:EclimWarningHighlight = "WarningMsg"
endif
if !exists("g:EclimErrorHighlight")
let g:EclimErrorHighlight = "Error"
endif
if !exists("g:EclimFatalHighlight")
let g:EclimFatalHighlight = "Error"
endif
if !exists("g:EclimShowCurrentError")
let g:EclimShowCurrentError = 1
endif
if !exists("g:EclimShowCurrentErrorBalloon")
let g:EclimShowCurrentErrorBalloon = 1
endif
if !exists("g:EclimOpenQFLists")
let g:EclimOpenQFLists = 1
endif
" }}}
" Command Declarations {{{2
if !exists(":Buffers")
command Buffers :call s:Buffers()
endif
" }}}
" End Eclim: }}}
" Common Buffers: {{{1
" Global Variables {{{2
if !exists('g:EclimBuffersSort')
let g:EclimBuffersSort = 'file'
endif
if !exists('g:EclimBuffersSortDirection')
let g:EclimBuffersSortDirection = 'asc'
endif
if !exists('g:EclimBuffersDefaultAction')
let g:EclimBuffersDefaultAction = 'edit'
endif
if !exists('g:EclimOnlyExclude')
let g:EclimOnlyExclude =
\ '\(NERD_tree_*\|__Tag_List__\|command-line\)'
endif
" }}}
" Buffers() eclim/autoload/eclim/common/buffers.vim {{{2
" Like, :buffers, but opens a temporary buffer.
function! s:Buffers()
redir => list
silent exec 'buffers'
redir END
let buffers = []
let filelength = 0
for entry in split(list, '\n')
let buffer = {}
let buffer.status = substitute(entry, '\s*[0-9]\+\s\+\(.\{-}\)\s\+".*', '\1', '')
let buffer.path = substitute(entry, '.\{-}"\(.\{-}\)".*', '\1', '')
let buffer.path = fnamemodify(buffer.path, ':p')
let buffer.file = fnamemodify(buffer.path, ':p:t')
let buffer.dir = fnamemodify(buffer.path, ':p:h')
exec 'let buffer.bufnr = ' . substitute(entry, '\s*\([0-9]\+\).*', '\1', '')
exec 'let buffer.lnum = ' .
\ substitute(entry, '.*"\s\+line\s\+\([0-9]\+\).*', '\1', '')
call add(buffers, buffer)
if len(buffer.file) > filelength
let filelength = len(buffer.file)
endif
endfor
if g:EclimBuffersSort != ''
call sort(buffers, 'BufferCompare')
endif
let lines = []
for buffer in buffers
call add(lines, s:BufferEntryToLine(buffer, filelength))
endfor
call TempWindow('[buffers]', lines)
let b:eclim_buffers = buffers
setlocal modifiable noreadonly
call append(line('$'), ['', '" use ? to view help'])
setlocal nomodifiable readonly
let b:eclim_buffers = buffers
" syntax
set ft=eclim_buffers
hi link BufferActive Special
hi link BufferHidden Comment
syntax match BufferActive /+\?active\s\+\(\[RO\]\)\?/
syntax match BufferHidden /+\?hidden\s\+\(\[RO\]\)\?/
syntax match Comment /^".*/
" mappings
nnoremap <silent> <buffer> <cr> :call <SID>BufferOpen2(g:EclimBuffersDefaultAction)<cr>
nnoremap <silent> <buffer> E :call <SID>BufferOpen2('edit')<cr>
nnoremap <silent> <buffer> S :call <SID>BufferOpen2('split')<cr>
nnoremap <silent> <buffer> T :call <SID>BufferOpen('tablast \| tabnew')<cr>
nnoremap <silent> <buffer> D :call <SID>BufferDelete()<cr>
" assign to buffer var to get around weird vim issue passing list containing
" a string w/ a '<' in it on execution of mapping.
let b:buffers_help = [
\ '<cr> - open buffer with default action',
\ 'E - open with :edit',
\ 'S - open in a new split window',
\ 'T - open in a new tab',
\ 'D - delete the buffer',
\ ]
nnoremap <buffer> <silent> ?
\ :call BufferHelp(b:buffers_help, 'vertical', 40)<cr>
"augroup eclim_buffers
" autocmd!
" autocmd BufAdd,BufWinEnter,BufDelete,BufWinLeave *
" \ call eclim#common#buffers#BuffersUpdate()
" autocmd BufUnload <buffer> autocmd! eclim_buffers
"augroup END
endfunction " }}}
" BufferCompare(buffer1, buffer2) eclim/autoload/eclim/common/buffers.vim {{{2
function! BufferCompare(buffer1, buffer2)
exec 'let attr1 = a:buffer1.' . g:EclimBuffersSort
exec 'let attr2 = a:buffer2.' . g:EclimBuffersSort
let compare = attr1 == attr2 ? 0 : attr1 > attr2 ? 1 : -1
if g:EclimBuffersSortDirection == 'desc'
let compare = 0 - compare
endif
return compare
endfunction " }}}
" s:BufferDelete() {{{2
function! s:BufferDelete()
let line = line('.')
if line > len(b:eclim_buffers)
return
endif
let index = line - 1
setlocal modifiable
setlocal noreadonly
exec line . ',' . line . 'delete _'
setlocal nomodifiable
setlocal readonly
let buffer = b:eclim_buffers[index]
call remove(b:eclim_buffers, index)
exec 'bd ' . buffer.bufnr
endfunction " }}}
" s:BufferEntryToLine(buffer, filelength) eclim/autoload/eclim/common/buffers.vim {{{2
function! s:BufferEntryToLine(buffer, filelength)
let line = ''
let line .= a:buffer.status =~ '+' ? '+' : ' '
let line .= a:buffer.status =~ 'a' ? 'active' : 'hidden'
let line .= a:buffer.status =~ '[-=]' ? ' [RO] ' : ' '
let line .= a:buffer.file
let pad = a:filelength - len(a:buffer.file) + 2
while pad > 0
let line .= ' '
let pad -= 1
endwhile
let line .= a:buffer.dir
return line
endfunction " }}}
" s:BufferOpen(cmd) eclim/autoload/eclim/common/buffers.vim {{{2
function! s:BufferOpen(cmd)
let line = line('.')
if line > len(b:eclim_buffers)
return
endif
let file = bufname(b:eclim_buffers[line - 1].bufnr)
let winnr = b:winnr
close
exec winnr . 'winc w'
call GoToBufferWindowOrOpen(file, a:cmd)
endfunction " }}}
" End Common Buffers: }}}
" Util: {{{1
" Script Variables eclim/autoload/eclim/util.vim {{{2
let s:buffer_write_closing_commands = '^\s*\(' .
\ 'wq\|xa\|' .
\ '\d*w[nN]\|\d*wp\|' .
\ 'ZZ' .
\ '\)'
let s:bourne_shells = ['sh', 'bash', 'dash', 'ksh', 'zsh']
let s:c_shells = ['csh', 'tcsh']
let s:show_current_error_displaying = 0
" }}}
" DelayedCommand(command, [delay]) eclim/autoload/eclim/util.vim {{{2
" Executes a delayed command. Useful in cases where one would expect an
" autocommand event (WinEnter, etc) to fire, but doesn't, or you need a
" command to execute after other autocommands have finished.
" Note: Nesting is not supported. A delayed command cannot be invoke off
" another delayed command.
function! DelayedCommand(command, ...)
let uid = fnamemodify(tempname(), ':t:r')
if &updatetime > 1
exec 'let g:eclim_updatetime_save' . uid . ' = &updatetime'
endif
exec 'let g:eclim_delayed_command' . uid . ' = a:command'
let &updatetime = len(a:000) ? a:000[0] : 1
exec 'augroup delayed_command' . uid
exec 'autocmd CursorHold * ' .
\ ' if exists("g:eclim_updatetime_save' . uid . '") | ' .
\ ' let &updatetime = g:eclim_updatetime_save' . uid . ' | ' .
\ ' unlet g:eclim_updatetime_save' . uid . ' | ' .
\ ' endif | ' .
\ ' exec g:eclim_delayed_command' . uid . ' | ' .
\ ' unlet g:eclim_delayed_command' . uid . ' | ' .
\ ' autocmd! delayed_command' . uid
exec 'augroup END'
endfunction " }}}
" EscapeBufferName(name) eclim/autoload/eclim/util.vim {{{2
" Escapes the supplied buffer name so that it can be safely used by buf*
" functions.
function! EscapeBufferName(name)
let name = a:name
" escaping the space in cygwin could lead to the dos path error message that
" cygwin throws when a dos path is referenced.
if !has('win32unix')
let name = escape(a:name, ' ')
endif
return substitute(name, '\(.\{-}\)\[\(.\{-}\)\]\(.\{-}\)', '\1[[]\2[]]\3', 'g')
endfunction " }}}
" GoToBufferWindow(buf) eclim/autoload/eclim/util.vim {{{2
" Focuses the window containing the supplied buffer name or buffer number.
" Returns 1 if the window was found, 0 otherwise.
function! GoToBufferWindow(buf)
if type(a:buf) == 0
let winnr = bufwinnr(a:buf)
else
let name = EscapeBufferName(a:buf)
let winnr = bufwinnr(bufnr('^' . name))
endif
if winnr != -1
exec winnr . "winc w"
call DelayedCommand('doautocmd WinEnter')
return 1
endif
return 0
endfunction " }}}
" GoToBufferWindowOrOpen(name, cmd) eclim/autoload/eclim/util.vim {{{2
" Gives focus to the window containing the buffer for the supplied file, or if
" none, opens the file using the supplied command.
function! GoToBufferWindowOrOpen(name, cmd)
let name = EscapeBufferName(a:name)
let winnr = bufwinnr(bufnr('^' . name))
if winnr != -1
exec winnr . "winc w"
call DelayedCommand('doautocmd WinEnter')
else
let cmd = a:cmd
" if splitting and the buffer is a unamed empty buffer, then switch to an
" edit.
if cmd == 'split' && expand('%') == '' &&
\ !&modified && line('$') == 1 && getline(1) == ''
let cmd = 'edit'
endif
silent exec cmd . ' ' . escape(Simplify(a:name), ' ')
endif
endfunction " }}}
" GoToBufferWindowRegister(buf) eclim/autoload/eclim/util.vim {{{2
" Registers the autocmd for returning the user to the supplied buffer when the
" current buffer is closed.
function! GoToBufferWindowRegister(buf)
exec 'autocmd BufWinLeave <buffer> ' .
\ 'call GoToBufferWindow("' . escape(a:buf, '\') . '") | ' .
\ 'doautocmd BufEnter'
endfunction " }}}
" Simplify(file) eclim/autoload/eclim/util.vim {{{2
" Simply the supplied file to the shortest valid name.
function! Simplify(file)
let file = a:file
" Don't run simplify on url files, it will screw them up.
if file !~ '://'
let file = simplify(file)
endif
" replace all '\' chars with '/' except those escaping spaces.
let file = substitute(file, '\\\([^[:space:]]\)', '/\1', 'g')
let cwd = substitute(getcwd(), '\', '/', 'g')
if cwd !~ '/$'
let cwd .= '/'
endif
if file =~ '^' . cwd
let file = substitute(file, '^' . cwd, '', '')
endif
return file
endfunction " }}}
" TempWindow(name, lines, [readonly]) eclim/autoload/eclim/util.vim {{{2
" Opens a temp window w/ the given name and contents which is readonly unless
" specified otherwise.
function! TempWindow(name, lines, ...)
let filename = expand('%:p')
let winnr = winnr()
call TempWindowClear(a:name)
let name = EscapeBufferName(a:name)
if bufwinnr(name) == -1
silent! noautocmd exec "botright 10sview " . escape(a:name, ' ')
let b:eclim_temp_window = 1
setlocal nowrap
setlocal winfixheight
setlocal noswapfile
setlocal nobuflisted
setlocal buftype=nofile
setlocal bufhidden=delete
else
exec bufwinnr(name) . "winc w"
endif
setlocal modifiable
setlocal noreadonly
call append(1, a:lines)
retab
silent 1,1delete _
if len(a:000) == 0 || a:000[0]
setlocal nomodified
setlocal nomodifiable
setlocal readonly
endif
silent doautocmd BufEnter
" Store filename and window number so that plugins can use it if necessary.
if filename != expand('%:p')
let b:filename = filename
let b:winnr = winnr
augroup eclim_temp_window
autocmd! BufWinLeave <buffer>
call GoToBufferWindowRegister(b:filename)
augroup END
endif
endfunction " }}}
" TempWindowClear(name) eclim/autoload/eclim/util.vim {{{2
" Clears the contents of the temp window with the given name.
function! TempWindowClear(name)
let name = EscapeBufferName(a:name)
if bufwinnr(name) != -1
let curwinnr = winnr()
exec bufwinnr(name) . "winc w"
setlocal modifiable
setlocal noreadonly
silent 1,$delete _
exec curwinnr . "winc w"
endif
endfunction " }}}
" End Util: }}}
" Eclim Help: {{{1
" BufferHelp(lines, orientation, size) eclim/autoload/eclim/help.vim {{{
" Function to display a help window for the current buffer.
function! BufferHelp(lines, orientation, size)
let orig_bufnr = bufnr('%')
let name = expand('%')
if name =~ '^\W.*\W$'
let name = name[:-2] . ' Help' . name[len(name) - 1]
else
let name .= ' Help'
endif
let bname = EscapeBufferName(name)
let orient = a:orientation == 'vertical' ? 'v' : ''
if bufwinnr(bname) != -1
exec 'bd ' . bufnr(bname)
return
endif
silent! noautocmd exec a:size . orient . "new " . escape(name, ' ')
let b:eclim_temp_window = 1
setlocal nowrap winfixheight
setlocal noswapfile nobuflisted nonumber
setlocal buftype=nofile bufhidden=delete
nnoremap <buffer> <silent> ? :bd<cr>
setlocal modifiable noreadonly
silent 1,$delete _
call append(1, a:lines)
retab
silent 1,1delete _
if len(a:000) == 0 || a:000[0]
setlocal nomodified nomodifiable readonly
endif
let help_bufnr = bufnr('%')
augroup eclim_help_buffer
autocmd! BufWinLeave <buffer>
autocmd BufWinLeave <buffer> nested autocmd! eclim_help_buffer * <buffer>
exec 'autocmd BufWinLeave <buffer> nested ' .
\ 'autocmd! eclim_help_buffer * <buffer=' . orig_bufnr . '>'
exec 'autocmd! BufWinLeave <buffer=' . orig_bufnr . '>'
exec 'autocmd BufWinLeave <buffer=' . orig_bufnr . '> nested bd ' . help_bufnr
augroup END
return help_bufnr
endfunction " }}}
" }}}
" Gryfs Mods: {{{
" s:BufferOpen2(cmd) (gryf) {{{2
function! s:BufferOpen2(cmd)
let line = line('.')
if line > len(b:eclim_buffers)
return
endif
let bufnr = b:eclim_buffers[line - 1].bufnr
let winnr = b:winnr
close
exec winnr . 'winc w'
call s:GoToBufferWindowOrOpen2(bufnr, a:cmd)
endfunction " }}}
" GoToBufferWindowOrOpen2(nr, cmd) (gryf) {{{2
" modified function GoToBufferWindowOrOpen. instead of buffer name it accepts
" buffer number.
function! s:GoToBufferWindowOrOpen2(nr, cmd)
let winnr = bufwinnr(a:nr)
if winnr != -1
exec winnr . "winc w"
call DelayedCommand('doautocmd WinEnter')
else
if a:cmd == 'edit'
silent exec 'buffer ' . a:nr
elseif a:cmd == 'split'
silent exec 'sbuffer ' . a:nr
endif
endif
endfunction " }}}
" End Gryfs Mods: }}}
" vim:ft=vim:fdm=marker

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +0,0 @@
" ---------------------------------------------------------------------
" getscriptPlugin.vim
" Author: Charles E. Campbell, Jr.
" Date: Jan 07, 2008
" Installing: :help glvs-install
" Usage: :help glvs
"
" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
"
" (Rom 15:11 WEB) Again, "Praise the Lord, all you Gentiles! Let
" all the peoples praise Him."
" ---------------------------------------------------------------------
" Initialization: {{{1
" if you're sourcing this file, surely you can't be
" expecting vim to be in its vi-compatible mode
if &cp || exists("g:loaded_getscriptPlugin")
if &verbose
echo "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
endif
finish
endif
let g:loaded_getscriptPlugin = "v29"
let s:keepcpo = &cpo
set cpo&vim
" ---------------------------------------------------------------------
" Public Interface: {{{1
com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts()
com! -nargs=0 GetScripts call getscript#GetLatestVimScripts()
silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts()
" ---------------------------------------------------------------------
" Restore Options: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo
" ---------------------------------------------------------------------
" vim: ts=8 sts=2 fdm=marker nowrap

View File

@@ -21,12 +21,13 @@
" along with this program. If not, see <http://www.gnu.org/licenses/>. " along with this program. If not, see <http://www.gnu.org/licenses/>.
" "
" }}} " }}}
" eclim version: 1.6.0
"if exists('g:taglisttoo_loaded') || if exists('g:taglisttoo_loaded') ||
" \ (exists('g:taglisttoo_disabled') && g:taglisttoo_disabled) \ (exists('g:taglisttoo_disabled') && g:taglisttoo_disabled)
" finish finish
"endif endif
"let g:taglisttoo_loaded = 1 let g:taglisttoo_loaded = 1
" Global Variables {{{ " Global Variables {{{
@@ -34,6 +35,21 @@ if !exists("g:TaglistEnabled")
let g:TaglistEnabled = 1 let g:TaglistEnabled = 1
endif endif
" always set the taglist title since eclim references it in a few places.
if !exists('g:TagList_title')
let g:TagList_title = "__Tag_List__"
endif
if !g:TaglistEnabled
finish
endif
" disable if user has taglist installed on windows since we can't hook into
" taglist to fix the windows path separators to be java compatible.
if exists('loaded_taglist') && (has('win32') || has('win64') || has('win32unix'))
finish
endif
if !exists('g:Tlist_Ctags_Cmd') if !exists('g:Tlist_Ctags_Cmd')
if executable('exuberant-ctags') if executable('exuberant-ctags')
let g:Tlist_Ctags_Cmd = 'exuberant-ctags' let g:Tlist_Ctags_Cmd = 'exuberant-ctags'
@@ -46,11 +62,6 @@ if !exists('g:Tlist_Ctags_Cmd')
endif endif
endif endif
" always set the taglist title since eclim references it in a few places.
if !exists('g:TagList_title')
let g:TagList_title = "__Tag_List__"
endif
" no ctags found, no need to continue. " no ctags found, no need to continue.
if !exists('g:Tlist_Ctags_Cmd') if !exists('g:Tlist_Ctags_Cmd')
finish finish
@@ -526,6 +537,18 @@ let s:tlist_def_html_settings = {
\ } \ }
\ } \ }
" java language
let s:tlist_format_java = 'FormatJava'
let s:tlist_def_java_settings = {
\ 'lang': 'java', 'tags': {
\ 'p': 'package',
\ 'c': 'class',
\ 'i': 'interface',
\ 'f': 'field',
\ 'm': 'method'
\ }
\ }
let s:tlist_format_javascript = 'FormatJavascript' let s:tlist_format_javascript = 'FormatJavascript'
let s:tlist_def_javascript_settings = { let s:tlist_def_javascript_settings = {
\ 'lang': 'javascript', 'tags': { \ 'lang': 'javascript', 'tags': {
@@ -715,7 +738,8 @@ function! s:AutoOpen()
let buf_num = winbufnr(i) let buf_num = winbufnr(i)
while buf_num != -1 while buf_num != -1
let filename = fnamemodify(bufname(buf_num), ':p') let filename = fnamemodify(bufname(buf_num), ':p')
if s:FileSupported(filename, getbufvar(buf_num, '&filetype')) if !getbufvar(buf_num, '&diff') &&
\ s:FileSupported(filename, getbufvar(buf_num, '&filetype'))
let open_window = 1 let open_window = 1
break break
endif endif
@@ -758,7 +782,7 @@ function! s:Taglist(...)
endif endif
if action == -1 || action == 1 if action == -1 || action == 1
call s:ProcessTags() call s:ProcessTags(1)
call s:StartAutocmds() call s:StartAutocmds()
augroup taglisttoo augroup taglisttoo
@@ -791,13 +815,17 @@ function! s:Restore()
\ 'endif') \ 'endif')
endfunction " }}} endfunction " }}}
" s:StartAutocmds() {{{ " s:StartAutocmds() eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:StartAutocmds() function! s:StartAutocmds()
augroup taglisttoo_file augroup taglisttoo_file
autocmd! autocmd!
autocmd BufEnter,BufWritePost * autocmd BufEnter *
\ if bufwinnr(g:TagList_title) != -1 | \ if bufwinnr(g:TagList_title) != -1 |
\ call s:ProcessTags() | \ call s:ProcessTags(0) |
\ endif
autocmd BufWritePost *
\ if bufwinnr(g:TagList_title) != -1 |
\ call s:ProcessTags(1) |
\ endif \ endif
" bit of a hack to re-process tags if the filetype changes after the tags " bit of a hack to re-process tags if the filetype changes after the tags
" have been processed. " have been processed.
@@ -805,7 +833,7 @@ function! s:StartAutocmds()
\ if exists('b:ft') | \ if exists('b:ft') |
\ if b:ft != &ft | \ if b:ft != &ft |
\ if bufwinnr(g:TagList_title) != -1 | \ if bufwinnr(g:TagList_title) != -1 |
\ call s:ProcessTags() | \ call s:ProcessTags(1) |
\ endif | \ endif |
\ endif | \ endif |
\ else | \ else |
@@ -818,170 +846,20 @@ function! s:StartAutocmds()
augroup END augroup END
endfunction " }}} endfunction " }}}
" s:StopAutocmds() {{{ " s:StopAutocmds() eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:StopAutocmds() function! s:StopAutocmds()
augroup taglisttoo_file augroup taglisttoo_file
autocmd! autocmd!
augroup END augroup END
endfunction " }}} endfunction " }}}
" s:ProcessTags() {{{ " s:CloseTaglist() eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:ProcessTags()
" on insert completion prevent vim's jumping back and forth from the
" completion preview window from triggering a re-processing of tags
if pumvisible()
return
endif
let filename = expand('%:p')
if filename =~ s:taglisttoo_ignore || filename == ''
return
endif
let filewin = winnr()
let tags = []
if s:FileSupported(expand('%:p'), &ft)
if exists('g:tlist_{&ft}_settings')
let settings = g:tlist_{&ft}_settings
let types = join(keys(settings.tags), '')
else
let settings = s:tlist_def_{&ft}_settings
let types = join(keys(settings.tags), '')
endif
let file = substitute(expand('%:p'), '\', '/', 'g')
" support generated file contents (like viewing a .class file via jad)
let tempfile = ''
if !filereadable(file) || &buftype == 'nofile'
let tempfile = g:EclimTempDir . '/' . fnamemodify(file, ':t')
if tolower(file) != tolower(tempfile)
let tempfile = escape(tempfile, ' ')
exec 'write! ' . tempfile
let file = tempfile
endif
endif
try
let command = g:Tlist_Ctags_Cmd_Ctags
"if eclim#EclimAvailable() && !exists('g:EclimDisabled')
" let port = eclim#client#nailgun#GetNgPort()
" let command = substitute(g:Tlist_Ctags_Cmd_Eclim, '<port>', port, '')
"endif
let command .= ' -f - --format=2 --excmd=pattern ' .
\ '--fields=nks --sort=no --language-force=<lang> ' .
\ '--<lang>-types=<types> "<file>"'
let command = substitute(command, '<lang>', settings.lang, 'g')
let command = substitute(command, '<types>', types, 'g')
let command = substitute(command, '<file>', file, '')
if (has('win32') || has('win64')) && command =~ '^"'
let command .= ' "'
endif
let response = System(command)
finally
if tempfile != ''
call delete(tempfile)
endif
endtry
if v:shell_error
call EchoError('taglist failed with error code: ' . v:shell_error)
return
endif
let results = split(response, '\n')
if len(response) == 1 && response[0] == '0'
return
endif
while len(results) && results[0] =~ 'ctags.*: Warning:'
call remove(results, 0)
endwhile
let truncated = 0
if len(results)
" for some reason, vim may truncate the output of system, leading to only
" a partial taglist.
let values = s:ParseOutputLine(results[-1])
if len(values) < 5
let truncated = 1
endif
if g:Tlist_Sort_Type == 'name'
call sort(results)
endif
for result in results
let values = s:ParseOutputLine(result)
" filter false positives found in comments.
if values[-1] =~ 'line:[0-9]\+'
exec 'let lnum = ' . substitute(values[-1], 'line:\([0-9]\+\).*', '\1', '')
let line = getline(lnum)
let col = len(line) - len(substitute(line, '^\s*', '', '')) + 1
if synIDattr(synID(lnum, col, 1), "name") =~ '\([Cc]omment\|[Ss]tring\)'
continue
endif
endif
" exit if we run into apparent bug in vim that truncates the response
" from system()
if len(values) < 5
break
endif
call add(tags, values)
endfor
endif
if exists('s:tlist_format_{&ft}')
exec 'call s:Window(settings.tags, tags, ' .
\ s:tlist_format_{&ft} . '(settings.tags, tags))'
else
call s:Window(settings.tags, tags, s:FormatDefault(settings.tags, tags))
endif
" if vim truncated the output, then add a note in the taglist indicating
" the the list has been truncated.
if truncated
setlocal modifiable
call append(line('$'), '')
call append(line('$'), 'Warning: taglist truncated.')
setlocal nomodifiable
endif
" if the file buffer is no longer in the same window it was, then find its
" new location. Occurs when taglist first opens.
if winbufnr(filewin) != bufnr(filename)
let filewin = bufwinnr(filename)
endif
if filewin != -1
exec filewin . 'winc w'
endif
else
" if the file isn't supported, then don't open the taglist window if it
" isn't open already.
let winnum = bufwinnr(g:TagList_title)
if winnum != -1
call s:Window({}, tags, [[],[]])
winc p
endif
endif
call s:ShowCurrentTag()
endfunction " }}}
" s:CloseTaglist() {{{
function! s:CloseTaglist() function! s:CloseTaglist()
close close
call s:Cleanup() call s:Cleanup()
endfunction " }}} endfunction " }}}
" s:Cleanup() {{{ " s:Cleanup() eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:Cleanup() function! s:Cleanup()
augroup taglisttoo_file augroup taglisttoo_file
autocmd! autocmd!
@@ -992,14 +870,24 @@ function! s:Cleanup()
augroup END augroup END
endfunction " }}} endfunction " }}}
" s:ProcessTags() {{{ " s:ProcessTags(on_open_or_write) eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:ProcessTags() function! s:ProcessTags(on_open_or_write)
" on insert completion prevent vim's jumping back and forth from the " on insert completion prevent vim's jumping back and forth from the
" completion preview window from triggering a re-processing of tags " completion preview window from triggering a re-processing of tags
if pumvisible() if pumvisible()
return return
endif endif
" if we are entering a buffer whose taglist list is already loaded, then
" don't do anything.
if !a:on_open_or_write
let bufnr = bufnr(g:TagList_title)
let filebuf = getbufvar(bufnr, 'taglisttoo_file_bufnr')
if filebuf == bufnr('%')
return
endif
endif
let filename = expand('%:p') let filename = expand('%:p')
if filename =~ s:taglisttoo_ignore || filename == '' if filename =~ s:taglisttoo_ignore || filename == ''
return return
@@ -1031,10 +919,6 @@ function! s:ProcessTags()
try try
let command = g:Tlist_Ctags_Cmd_Ctags let command = g:Tlist_Ctags_Cmd_Ctags
"if eclim#EclimAvailable() && !exists('g:EclimDisabled')
" let port = eclim#client#nailgun#GetNgPort()
" let command = substitute(g:Tlist_Ctags_Cmd_Eclim, '<port>', port, '')
"endif
let command .= ' -f - --format=2 --excmd=pattern ' . let command .= ' -f - --format=2 --excmd=pattern ' .
\ '--fields=nks --sort=no --language-force=<lang> ' . \ '--fields=nks --sort=no --language-force=<lang> ' .
@@ -1077,10 +961,6 @@ function! s:ProcessTags()
let truncated = 1 let truncated = 1
endif endif
if g:Tlist_Sort_Type == 'name'
call sort(results)
endif
for result in results for result in results
let values = s:ParseOutputLine(result) let values = s:ParseOutputLine(result)
@@ -1108,6 +988,10 @@ function! s:ProcessTags()
exec 'call s:Window(settings.tags, tags, ' . exec 'call s:Window(settings.tags, tags, ' .
\ s:tlist_format_{&ft} . '(settings.tags, tags))' \ s:tlist_format_{&ft} . '(settings.tags, tags))'
else else
if g:Tlist_Sort_Type == 'name'
call sort(tags)
endif
call s:Window(settings.tags, tags, s:FormatDefault(settings.tags, tags)) call s:Window(settings.tags, tags, s:FormatDefault(settings.tags, tags))
endif endif
@@ -1142,7 +1026,7 @@ function! s:ProcessTags()
call s:ShowCurrentTag() call s:ShowCurrentTag()
endfunction " }}} endfunction " }}}
" s:ParseOutputLine(line) {{{ " s:ParseOutputLine(line) eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:ParseOutputLine(line) function! s:ParseOutputLine(line)
let pre = substitute(a:line, '\(.\{-}\)\t\/\^.*', '\1', '') let pre = substitute(a:line, '\(.\{-}\)\t\/\^.*', '\1', '')
let pattern = substitute(a:line, '.\{-}\(\/\^.*\$\/;"\).*', '\1', '') let pattern = substitute(a:line, '.\{-}\(\/\^.*\$\/;"\).*', '\1', '')
@@ -1150,7 +1034,7 @@ function! s:ParseOutputLine(line)
return split(pre, '\t') + [pattern] + split(post, '\t') return split(pre, '\t') + [pattern] + split(post, '\t')
endfunction " }}} endfunction " }}}
" s:FormatDefault(types, tags) {{{ " s:FormatDefault(types, tags) eclim/autoload/eclim/taglist/taglisttoo.vim {{{
" All format functions must return a two element list containing: " All format functions must return a two element list containing:
" result[0] - A list of length len(result[1]) where each value specifies the " result[0] - A list of length len(result[1]) where each value specifies the
" tag index such that result[0][line('.') - 1] == tag index for " tag index such that result[0][line('.') - 1] == tag index for
@@ -1173,7 +1057,7 @@ function! s:FormatDefault(types, tags)
return [lines, content] return [lines, content]
endfunction " }}} endfunction " }}}
" s:JumpToTag() {{{ " s:JumpToTag() eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:JumpToTag() function! s:JumpToTag()
if line('.') > len(b:taglisttoo_content[0]) if line('.') > len(b:taglisttoo_content[0])
return return
@@ -1203,7 +1087,7 @@ function! s:JumpToTag()
" account for my plugin which removes trailing spaces from the file " account for my plugin which removes trailing spaces from the file
let pattern = escape(pattern, '.~*[]') let pattern = escape(pattern, '.~*[]')
let pattern = substitute(pattern, '\s\+\$$', '\s*$', '') let pattern = substitute(pattern, '\s\+\$$', '\\s*$', '')
if getline(lnum) =~ pattern if getline(lnum) =~ pattern
mark ' mark '
@@ -1248,7 +1132,7 @@ function! s:JumpToTag()
endif endif
endfunction " }}} endfunction " }}}
" s:Window(types, tags, content) {{{ " s:Window(types, tags, content) eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:Window(types, tags, content) function! s:Window(types, tags, content)
let filename = expand('%:t') let filename = expand('%:t')
let file_bufnr = bufnr('%') let file_bufnr = bufnr('%')
@@ -1309,7 +1193,7 @@ function! s:Window(types, tags, content)
let b:taglisttoo_file_bufnr = file_bufnr let b:taglisttoo_file_bufnr = file_bufnr
endfunction " }}} endfunction " }}}
" s:ShowCurrentTag() {{{ " s:ShowCurrentTag() eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:ShowCurrentTag() function! s:ShowCurrentTag()
if s:FileSupported(expand('%:p'), &ft) && bufwinnr(g:TagList_title) != -1 if s:FileSupported(expand('%:p'), &ft) && bufwinnr(g:TagList_title) != -1
let tags = getbufvar(g:TagList_title, 'taglisttoo_tags') let tags = getbufvar(g:TagList_title, 'taglisttoo_tags')
@@ -1350,7 +1234,7 @@ function! s:ShowCurrentTag()
endif endif
endfunction " }}} endfunction " }}}
" s:FileSupported(filename, ftype) {{{ " s:FileSupported(filename, ftype) eclim/autoload/eclim/taglist/taglisttoo.vim {{{
" Check whether tag listing is supported for the specified file " Check whether tag listing is supported for the specified file
function! s:FileSupported(filename, ftype) function! s:FileSupported(filename, ftype)
" Skip buffers with no names, buffers with filetype not set, and vimballs " Skip buffers with no names, buffers with filetype not set, and vimballs
@@ -1380,7 +1264,7 @@ function! s:FileSupported(filename, ftype)
return 1 return 1
endfunction " }}} endfunction " }}}
" s:GetTagLineNumber(tag) {{{ " s:GetTagLineNumber(tag) eclim/autoload/eclim/taglist/taglisttoo.vim {{{
function! s:GetTagLineNumber(tag) function! s:GetTagLineNumber(tag)
if len(a:tag) > 4 if len(a:tag) > 4
return substitute(a:tag[4], '.*:\(.*\)', '\1', '') return substitute(a:tag[4], '.*:\(.*\)', '\1', '')
@@ -1389,6 +1273,68 @@ function! s:GetTagLineNumber(tag)
endfunction " }}} endfunction " }}}
" FormatJava(types, tags) eclim/autoload/eclim/taglist/lang/java.vim {{{
function! FormatJava(types, tags)
let lines = []
let content = []
call add(content, expand('%:t'))
call add(lines, -1)
let package = filter(copy(a:tags), 'v:val[3] == "p"')
call s:FormatType(
\ a:tags, a:types['p'], package, lines, content, "\t")
let classes = filter(copy(a:tags), 'v:val[3] == "c"')
" sort classes alphabetically except for the primary containing class.
if len(classes) > 1 && g:Tlist_Sort_Type == 'name'
let classes = [classes[0]] + sort(classes[1:])
endif
for class in classes
call add(content, "")
call add(lines, -1)
let visibility = s:GetVisibility(class)
call add(content, "\t" . visibility . a:types['c'] . ' ' . class[0])
call add(lines, index(a:tags, class))
let fields = filter(copy(a:tags),
\ 'v:val[3] == "f" && len(v:val) > 5 && v:val[5] =~ "class:.*\\<" . class[0] . "$"')
call s:FormatType(
\ a:tags, a:types['f'], fields, lines, content, "\t\t")
let methods = filter(copy(a:tags),
\ 'v:val[3] == "m" && len(v:val) > 5 && v:val[5] =~ "class:.*\\<" . class[0] . "$"')
call s:FormatType(
\ a:tags, a:types['m'], methods, lines, content, "\t\t")
endfor
let interfaces = filter(copy(a:tags), 'v:val[3] == "i"')
if g:Tlist_Sort_Type == 'name'
call sort(interfaces)
endif
for interface in interfaces
call add(content, "")
call add(lines, -1)
let visibility = s:GetVisibility(interface)
call add(content, "\t" . visibility . a:types['i'] . ' ' . interface[0])
call add(lines, index(a:tags, interface))
let fields = filter(copy(a:tags),
\ 'v:val[3] == "f" && len(v:val) > 5 && v:val[5] =~ "interface:.*\\<" . interface[0] . "$"')
call s:FormatType(
\ a:tags, a:types['f'], fields, lines, content, "\t\t")
let methods = filter(copy(a:tags),
\ 'v:val[3] == "m" && len(v:val) > 5 && v:val[5] =~ "interface:.*\\<" . interface[0] . "$"')
call s:FormatType(
\ a:tags, a:types['m'], methods, lines, content, "\t\t")
endfor
return [lines, content]
endfunction " }}}
" FormatJavascript(types, tags) eclim/autoload/eclim/taglist/lang/javascript.vim {{{ " FormatJavascript(types, tags) eclim/autoload/eclim/taglist/lang/javascript.vim {{{
function! FormatJavascript(types, tags) function! FormatJavascript(types, tags)
let pos = getpos('.') let pos = getpos('.')
@@ -1415,13 +1361,24 @@ function! FormatJavascript(types, tags)
let object_end = searchpair('{', '', '}', 'W', 's:SkipComments()') let object_end = searchpair('{', '', '}', 'W', 's:SkipComments()')
let methods = [] let methods = []
let indexes = []
let index = 0
for fct in members for fct in members
if len(fct) > 3 if len(fct) > 3
exec 'let fct_line = ' . split(fct[4], ':')[1] exec 'let fct_line = ' . split(fct[4], ':')[1]
if fct_line > object_start && fct_line < object_end if fct_line > object_start && fct_line < object_end
call add(methods, fct) call add(methods, fct)
elseif fct_line > object_end
break
elseif fct_line < object_end
call add(indexes, index)
endif endif
endif endif
let index += 1
endfor
call reverse(indexes)
for i in indexes
call remove(members, i)
endfor endfor
let indexes = [] let indexes = []
@@ -1434,6 +1391,8 @@ function! FormatJavascript(types, tags)
call add(indexes, index) call add(indexes, index)
elseif fct_line == object_start elseif fct_line == object_start
call add(indexes, index) call add(indexes, index)
elseif fct_line > object_end
break
endif endif
endif endif
let index += 1 let index += 1
@@ -1451,7 +1410,6 @@ function! FormatJavascript(types, tags)
call filter(parent_object.methods, 'index(methods, v:val) == -1') call filter(parent_object.methods, 'index(methods, v:val) == -1')
endif endif
let object_bounds[string(object)] = [object_start, object_end] let object_bounds[string(object)] = [object_start, object_end]
call sort(methods)
call add(object_contents, {'object': object, 'methods': methods}) call add(object_contents, {'object': object, 'methods': methods})
endif endif
endfor endfor
@@ -1463,6 +1421,10 @@ function! FormatJavascript(types, tags)
\ a:tags, a:types['f'], functions, lines, content, "\t") \ a:tags, a:types['f'], functions, lines, content, "\t")
endif endif
if g:Tlist_Sort_Type == 'name'
call sort(object_contents, function('s:ObjectComparator'))
endif
for object_content in object_contents for object_content in object_contents
call add(content, "") call add(content, "")
call add(lines, -1) call add(lines, -1)
@@ -1478,14 +1440,21 @@ function! FormatJavascript(types, tags)
return [lines, content] return [lines, content]
endfunction " }}} endfunction " }}}
" s:ObjectComparator(o1, o2) eclim/autoload/eclim/taglist/lang/javascript.vim {{{
function s:ObjectComparator(o1, o2)
let n1 = a:o1['object'][0]
let n2 = a:o2['object'][0]
return n1 == n2 ? 0 : n1 > n2 ? 1 : -1
endfunction " }}}
" s:SkipComments() eclim/autoload/eclim/taglist/lang/javascript.vim {{{ " s:SkipComments() eclim/autoload/eclim/taglist/lang/javascript.vim {{{
function! s:SkipComments() function s:SkipComments()
let synname = synIDattr(synID(line('.'), col('.'), 1), "name") let synname = synIDattr(synID(line('.'), col('.'), 1), "name")
return synname =~ '\([Cc]omment\|[Ss]tring\)' return synname =~ '\([Cc]omment\|[Ss]tring\)'
endfunction " }}} endfunction " }}}
" s:GetParentObject(objects, bounds, start, end) eclim/autoload/eclim/taglist/lang/javascript.vim {{{ " s:GetParentObject(objects, bounds, start, end) eclim/autoload/eclim/taglist/lang/javascript.vim {{{
function! s:GetParentObject(objects, bounds, start, end) function s:GetParentObject(objects, bounds, start, end)
for key in keys(a:bounds) for key in keys(a:bounds)
let range = a:bounds[key] let range = a:bounds[key]
if range[0] < a:start && range[1] > a:end if range[0] < a:start && range[1] > a:end
@@ -1509,6 +1478,10 @@ endfunction " }}}
" indent: The indentation to use on the display (string). " indent: The indentation to use on the display (string).
function! s:FormatType(tags, type, values, lines, content, indent) function! s:FormatType(tags, type, values, lines, content, indent)
if len(a:values) > 0 if len(a:values) > 0
if g:Tlist_Sort_Type == 'name'
call sort(a:values)
endif
call add(a:content, a:indent . a:type) call add(a:content, a:indent . a:type)
call add(a:lines, -1) call add(a:lines, -1)
@@ -1556,6 +1529,9 @@ function! FormatPhp(types, tags)
let class_contents = [] let class_contents = []
let classes = filter(copy(a:tags), 'v:val[3] == "c"') let classes = filter(copy(a:tags), 'v:val[3] == "c"')
if g:Tlist_Sort_Type == 'name'
call sort(classes)
endif
for class in classes for class in classes
exec 'let object_start = ' . split(class[4], ':')[1] exec 'let object_start = ' . split(class[4], ':')[1]
call cursor(object_start, 1) call cursor(object_start, 1)
@@ -1585,6 +1561,9 @@ function! FormatPhp(types, tags)
let interface_contents = [] let interface_contents = []
let interfaces = filter(copy(a:tags), 'v:val[3] == "i"') let interfaces = filter(copy(a:tags), 'v:val[3] == "i"')
if g:Tlist_Sort_Type == 'name'
call sort(interfaces)
endif
for interface in interfaces for interface in interfaces
exec 'let object_start = ' . split(interface[4], ':')[1] exec 'let object_start = ' . split(interface[4], ':')[1]
call cursor(object_start, 1) call cursor(object_start, 1)
@@ -1657,6 +1636,10 @@ function! FormatPython(types, tags)
\ a:tags, a:types['f'], functions, lines, content, "\t") \ a:tags, a:types['f'], functions, lines, content, "\t")
let classes = filter(copy(a:tags), 'len(v:val) > 3 && v:val[3] == "c"') let classes = filter(copy(a:tags), 'len(v:val) > 3 && v:val[3] == "c"')
if g:Tlist_Sort_Type == 'name'
call sort(classes)
endif
for class in classes for class in classes
call add(content, "") call add(content, "")
call add(lines, -1) call add(lines, -1)
@@ -1665,10 +1648,8 @@ function! FormatPython(types, tags)
let members = filter(copy(a:tags), let members = filter(copy(a:tags),
\ 'len(v:val) > 5 && v:val[3] == "m" && v:val[5] == "class:" . class[0]') \ 'len(v:val) > 5 && v:val[3] == "m" && v:val[5] == "class:" . class[0]')
for member in members call s:FormatType(
call add(content, "\t\t" . member[0]) \ a:tags, a:types['m'], members, lines, content, "\t\t")
call add(lines, index(a:tags, member))
endfor
endfor endfor
return [lines, content] return [lines, content]
@@ -1871,13 +1852,25 @@ function! s:PreventCloseOnBufferDelete()
endif endif
endfor endfor
if winnr('$') == numtoolwindows let index = 1
let numtempwindows = 0
let tempbuffers = []
while index <= winnr('$')
let buf = winbufnr(index)
if buf != -1 && getbufvar(buf, 'eclim_temp_window') != ''
call add(tempbuffers, buf)
endif
let index += 1
endwhile
if winnr('$') == (numtoolwindows + len(tempbuffers))
let toolbuf = bufnr('%') let toolbuf = bufnr('%')
if g:VerticalToolWindowSide == 'right' if g:VerticalToolWindowSide == 'right'
vertical topleft new vertical topleft new
else else
vertical botright new vertical botright new
endif endif
setlocal noreadonly modifiable
let winnum = winnr() let winnum = winnr()
exec 'let bufnr = ' . expand('<abuf>') exec 'let bufnr = ' . expand('<abuf>')
@@ -1921,6 +1914,30 @@ function! s:PreventCloseOnBufferDelete()
exec bufwinnr(toolbuf) . 'winc w' exec bufwinnr(toolbuf) . 'winc w'
exec 'vertical resize ' . g:VerticalToolWindowWidth exec 'vertical resize ' . g:VerticalToolWindowWidth
" fix the position of the temp windows
if len(tempbuffers) > 0
for buf in tempbuffers
" open the buffer in the temp window position
botright 10new
exec 'buffer ' . buf
setlocal winfixheight
" close the old window
let winnr = winnr()
let index = 1
while index <= winnr('$')
if winbufnr(index) == buf && index != winnr
exec index . 'winc w'
close
winc p
break
endif
let index += 1
endwhile
endfor
endif
exec winnum . 'winc w' exec winnum . 'winc w'
endif endif
endfunction " }}} endfunction " }}}

View File

@@ -1,375 +0,0 @@
"------------------------------------------------------------------------------
" Name Of File: tasklist.vim
"
" Description: Vim plugin to search for a list of tokens and display a
" window with matches.
"
" Author: Juan Frias (juandfrias at gmail.com)
"
" Last Change: 2009 Apr 11
" Version: 1.0.1
"
" Copyright: Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this header
" is included with it.
"
" This script is to be distributed freely in the hope that it
" will be useful, but is provided 'as is' and without warranties
" as to performance of merchantability or any other warranties
" whether expressed or implied. Because of the various hardware
" and software environments into which this script may be put,
" no warranty of fitness for a particular purpose is offered.
"
" GOOD DATA PROCESSING PROCEDURE DICTATES THAT ANY SCRIPT BE
" THOROUGHLY TESTED WITH NON-CRITICAL DATA BEFORE RELYING ON IT.
"
" THE USER MUST ASSUME THE ENTIRE RISK OF USING THE SCRIPT.
"
" The author does not retain any liability on any damage caused
" through the use of this script.
"
" Install: 1. Read the section titled 'Options'
" 2. Setup any variables need in your vimrc file
" 3. Copy 'tasklist.vim' to your plugin directory.
"
" Mapped Keys: <Leader>t Display list.
"
" Usage: Start the script with the mapped key, a new window appears
" with the matches found, moving around the window will also
" update the position of the current document.
"
" The following keys are mapped to the results window:
"
" q - Quit, and restore original cursor position.
"
" e - Exit, and keep results window open note that
" movements on the result window will no longer be
" updated.
"
" <cr> - Quit and place the cursor on the selected line.
"
" Aknowledgments: Many thanks to Zhang Shuhan for taking the time to beta
" test and suggest many of the improvements and features
" found in the script. I don't think I would have
" implemented it wihout his help. Thanks!
"
"------------------------------------------------------------------------------
" Please send me any bugs you find, so I can keep the script up to date.
"------------------------------------------------------------------------------
" History: {{{1
"------------------------------------------------------------------------------
"
" 1.00 Initial version.
"
" User Options: {{{1
"------------------------------------------------------------------------------
"
" <Leader>t
" This is the default key map to view the task list.
" to overwrite use something like:
" map <leader>v <Plug>TaskList
" in your vimrc file
"
" g:tlWindowPosition
" This is specifies the position of the window to be opened. By
" default it will open at on top. To overwrite use:
" let g:tlWindowPosition = 1
" in your vimrc file, options are as follows:
" 0 = Open on top
" 1 = Open on the bottom
"
" g:tlTokenList
" This is the list of tokens to search for default is
" 'FIXME TODO XXX'. The results are groupped and displayed in the
" order that they appear. to overwrite use:
" let g:tlTokenList = ['TOKEN1', 'TOKEN2', 'TOKEN3']
" in your vimrc file
"
" g:tlRememberPosition
" If this is set to 1 then the script will try to get back to the
" position where it last was closed. By default it will find the line
" closest to the current cursor position.
" to overwrite use:
" let g:tlRememberPosition = 1
" in your vimrc file
"
" Global variables: {{{1
"------------------------------------------------------------------------------
" Load script once
"------------------------------------------------------------------------------
if exists("g:loaded_tasklist") || &cp
finish
endif
let g:loaded_tasklist = 1
" Set where the window opens
"------------------------------------------------------------------------------
if !exists('g:tlWindowPosition')
" 0 = Open at top
let g:tlWindowPosition = 0
endif
" Set the token list
"------------------------------------------------------------------------------
if !exists('g:tlTokenList')
" default list of tokens
let g:tlTokenList = ["FIXME", "TODO", "XXX"]
endif
" Remember position
"------------------------------------------------------------------------------
if !exists('g:tlRememberPosition')
" 0 = Donot remember, find closest match
let g:tlRememberPosition = 0
endif
" Script variables: {{{1
"------------------------------------------------------------------------------
" Function: Open Window {{{1
"--------------------------------------------------------------------------
function! s:OpenWindow(buffnr, lineno)
" Open results window and place items there.
if g:tlWindowPosition == 0
execute 'sp -TaskList_'.a:buffnr.'-'
else
execute 'botright sp -TaskList_'.a:buffnr.'-'
endif
let b:original_buffnr = a:buffnr
let b:original_line = a:lineno
set noswapfile
set modifiable
normal! "zPGddgg
set fde=getline(v:lnum)[0]=='L'
set foldmethod=expr
set foldlevel=0
normal! zR
" Resize line if too big.
let l:hits = line("$")
if l:hits < winheight(0)
sil! exe "resize ".l:hits
endif
" Clean up.
let @z = ""
set nomodified
endfunction
" Function: Search file {{{1
"--------------------------------------------------------------------------
function! s:SearchFile(hits, word)
" Search at the beginning and keep adding them to the register
let l:match_count = 0
normal! gg0
let l:max = strlen(line('$'))
let l:last_match = -1
let l:div = 0
while search(a:word, "Wc") > 0
let l:curr_line = line('.')
if l:last_match == l:curr_line
if l:curr_line == line('$')
break
endif
normal! j0
continue
endif
let l:last_match = l:curr_line
if foldlevel(l:curr_line) != 0
normal! 99zo
endif
if l:div == 0
if a:hits != 0
let @z = @z."\n"
endif
let l:div = 1
endif
normal! 0
let l:lineno = ' '.l:curr_line
let @z = @z.'Ln '.strpart(l:lineno, strlen(l:lineno) - l:max).': '
let l:text = getline(".")
let @z = @z.strpart(l:text, stridx(l:text, a:word))
let @z = @z."\n"
normal! $
let l:match_count = l:match_count + 1
endwhile
return l:match_count
endfunction
" Function: Get line number {{{1
"--------------------------------------------------------------------------
function! s:LineNumber()
let l:text = getline(".")
if strpart(l:text, 0, 5) == "File:"
return 0
endif
if strlen(l:text) == 0
return -1
endif
let l:num = matchstr(l:text, '[0-9]\+')
if l:num == ''
return -1
endif
return l:num
endfunction
" Function: Update document position {{{1
"--------------------------------------------------------------------------
function! s:UpdateDoc()
let l:line_hit = <sid>LineNumber()
match none
if l:line_hit == -1
redraw
return
endif
let l:buffnr = b:original_buffnr
exe 'match Search /\%'.line(".").'l.*/'
if line(".") < (line("$") - (winheight(0) / 2)) + 1
normal! zz
endif
execute bufwinnr(l:buffnr)." wincmd w"
match none
if l:line_hit == 0
normal! 1G
else
exe "normal! ".l:line_hit."Gzz"
exe 'match Search /\%'.line(".").'l.*/'
endif
execute bufwinnr('-TaskList_'.l:buffnr.'-')." wincmd w"
redraw
endfunction
" Function: Clean up on exit {{{1
"--------------------------------------------------------------------------
function! s:Exit(key)
call <sid>UpdateDoc()
match none
let l:original_line = b:original_line
let l:last_position = line('.')
if a:key == -1
nunmap <buffer> e
nunmap <buffer> q
nunmap <buffer> <cr>
execute bufwinnr(b:original_buffnr)." wincmd w"
else
bd!
endif
let b:last_position = l:last_position
if a:key == 0
exe "normal! ".l:original_line."G"
endif
match none
normal! zz
execute "set updatetime=".s:old_updatetime
endfunction
" Function: Check for screen update {{{1
"--------------------------------------------------------------------------
function! s:CheckForUpdate()
if stridx(expand("%:t"), '-TaskList_') == -1
return
endif
if b:selected_line != line(".")
call <sid>UpdateDoc()
let b:selected_line = line(".")
endif
endfunction
" Function: Start the search. {{{1
"--------------------------------------------------------------------------
function! s:TaskList()
let l:original_buffnr = bufnr('%')
let l:original_line = line(".")
" last position
if !exists('b:last_position')
let b:last_position = 1
endif
let l:last_position = b:last_position
" get file name
let @z = "File:".expand("%:p")."\n\n"
" search file
let l:index = 0
let l:count = 0
let l:hits = 0
while l:index < len(g:tlTokenList)
let l:search_word = g:tlTokenList[l:index]
let l:hits = s:SearchFile(l:hits, l:search_word)
let l:count = l:count + l:hits
let l:index = l:index + 1
endwhile
" Make sure we at least have one hit.
if l:count == 0
echohl Search
echo "tasklist.vim: No task information found."
echohl None
execute 'normal! '.l:original_line.'G'
return
endif
" display window
call s:OpenWindow(l:original_buffnr, l:original_line)
" restore the cursor position
if g:tlRememberPosition != 0
exec 'normal! '.l:last_position.'G'
else
normal! gg
endif
" Map exit keys
nnoremap <buffer> <silent> q :call <sid>Exit(0)<cr>
nnoremap <buffer> <silent> <cr> :call <sid>Exit(1)<cr>
nnoremap <buffer> <silent> e :call <sid>Exit(-1)<cr>
" Setup syntax highlight {{{
syntax match tasklistFileDivider /^File:.*$/
syntax match tasklistLineNumber /^Ln\s\+\d\+:/
highlight def link tasklistFileDivider Title
highlight def link tasklistLineNumber LineNr
highlight def link tasklistSearchWord Search
" }}}
" Save globals and change updatetime
let b:selected_line = line(".")
let s:old_updatetime = &updatetime
set updatetime=350
" update the doc and hook the CheckForUpdate function.
call <sid>UpdateDoc()
au! CursorHold <buffer> nested call <sid>CheckForUpdate()
endfunction
"}}}
" Command
command! TaskList call s:TaskList()
" Default key map
if !hasmapto('<Plug>TaskList')
map <unique> <Leader>T <Plug>TaskList
endif
" Key map to Command
nnoremap <unique> <script> <Plug>TaskList :TaskList<CR>
" vim:fdm=marker:tw=75:ff=unix:

View File

@@ -239,7 +239,7 @@ endfunction
" Function: s:bzrFunctions.Status(argList) {{{2 " Function: s:bzrFunctions.Status(argList) {{{2
function! s:bzrFunctions.Status(argList) function! s:bzrFunctions.Status(argList)
let options = ['-S'] let options = ['-S']
if len(a:argList) == 0 if len(a:argList) != 0
let options = a:argList let options = a:argList
endif endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {}) return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})

View File

@@ -469,7 +469,7 @@ function! s:GenerateResultBufferName(command, originalBuffer, vcsType, statusTex
let bufferName .= ' ' . fileName let bufferName .= ' ' . fileName
let counter = 0 let counter = 0
let versionedBufferName = bufferName let versionedBufferName = bufferName
while buflisted(versionedBufferName) while bufexists(versionedBufferName)
let counter += 1 let counter += 1
let versionedBufferName = bufferName . ' (' . counter . ')' let versionedBufferName = bufferName . ' (' . counter . ')'
endwhile endwhile
@@ -489,7 +489,7 @@ function! s:GenerateResultBufferNameWithExtension(command, originalBuffer, vcsTy
let bufferName .= ' ' . fileName . VCSCommandGetOption('VCSCommandResultBufferNameExtension', '.vcs') let bufferName .= ' ' . fileName . VCSCommandGetOption('VCSCommandResultBufferNameExtension', '.vcs')
let counter = 0 let counter = 0
let versionedBufferName = bufferName let versionedBufferName = bufferName
while buflisted(versionedBufferName) while bufexists(versionedBufferName)
let counter += 1 let counter += 1
let versionedBufferName = '(' . counter . ') ' . bufferName let versionedBufferName = '(' . counter . ') ' . bufferName
endwhile endwhile

View File

@@ -128,11 +128,11 @@ endfunction
" Function: s:gitFunctions.Commit(argList) {{{2 " Function: s:gitFunctions.Commit(argList) {{{2
function! s:gitFunctions.Commit(argList) function! s:gitFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {}) try
if resultBuffer == 0 return s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
catch /\m^Version control command failed.*nothing\%( added\)\? to commit/
echomsg 'No commit needed.' echomsg 'No commit needed.'
endif endtry
return resultBuffer
endfunction endfunction
" Function: s:gitFunctions.Delete() {{{2 " Function: s:gitFunctions.Delete() {{{2

View File

@@ -105,7 +105,7 @@ endfunction
" Function: s:hgFunctions.Add() {{{2 " Function: s:hgFunctions.Add() {{{2
function! s:hgFunctions.Add(argList) function! s:hgFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {}) return s:DoCommand(join(['add -v'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction endfunction
" Function: s:hgFunctions.Annotate(argList) {{{2 " Function: s:hgFunctions.Annotate(argList) {{{2
@@ -132,10 +132,7 @@ endfunction
" Function: s:hgFunctions.Commit(argList) {{{2 " Function: s:hgFunctions.Commit(argList) {{{2
function! s:hgFunctions.Commit(argList) function! s:hgFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -l "' . a:argList[0] . '"', 'commit', '', {}) return s:DoCommand('commit -v -l "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
endfunction endfunction
" Function: s:hgFunctions.Delete() {{{2 " Function: s:hgFunctions.Delete() {{{2
@@ -252,8 +249,8 @@ endfunction
" Function: s:hgFunctions.Status(argList) {{{2 " Function: s:hgFunctions.Status(argList) {{{2
function! s:hgFunctions.Status(argList) function! s:hgFunctions.Status(argList)
let options = ['-u', '-v'] let options = ['-A', '-v']
if len(a:argList) == 0 if len(a:argList) != 0
let options = a:argList let options = a:argList
endif endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {}) return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})

View File

@@ -237,7 +237,7 @@ endfunction
" Function: s:svkFunctions.Status(argList) {{{2 " Function: s:svkFunctions.Status(argList) {{{2
function! s:svkFunctions.Status(argList) function! s:svkFunctions.Status(argList)
let options = ['-v'] let options = ['-v']
if len(a:argList) == 0 if len(a:argList) != 0
let options = a:argList let options = a:argList
endif endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {}) return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})

View File

@@ -260,7 +260,7 @@ endfunction
" Function: s:svnFunctions.Status(argList) {{{2 " Function: s:svnFunctions.Status(argList) {{{2
function! s:svnFunctions.Status(argList) function! s:svnFunctions.Status(argList)
let options = ['-u', '-v'] let options = ['-u', '-v']
if len(a:argList) == 0 if len(a:argList) != 0
let options = a:argList let options = a:argList
endif endif
return s:DoCommand(join(['status --non-interactive'] + options, ' '), 'status', join(options, ' '), {}) return s:DoCommand(join(['status --non-interactive'] + options, ' '), 'status', join(options, ' '), {})

View File

@@ -72,7 +72,7 @@ function! s:setup_buffer_enter() "{{{
endif endif
if idx == -1 if idx == -1
call add(g:vimwiki_list, {'path': path, 'ext': ext}) call add(g:vimwiki_list, {'path': path, 'ext': ext, 'temp': 1})
let g:vimwiki_current_idx = len(g:vimwiki_list) - 1 let g:vimwiki_current_idx = len(g:vimwiki_list) - 1
else else
let g:vimwiki_current_idx = idx let g:vimwiki_current_idx = idx
@@ -81,52 +81,29 @@ function! s:setup_buffer_enter() "{{{
let b:vimwiki_idx = g:vimwiki_current_idx let b:vimwiki_idx = g:vimwiki_current_idx
endif endif
call s:setup_colors() " Update existed/non-existed links highlighting.
call vimwiki#highlight_links()
if &filetype != 'vimwiki'
setlocal ft=vimwiki
else
setlocal syntax=vimwiki
endif
" Settings foldmethod, foldexpr and foldtext are local to window. Thus in a " 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 " new tab with the same buffer folding is reset to vim defaults. So we
" insist vimwiki folding here. " insist vimwiki folding here.
" TODO: remove the same from ftplugin.
if g:vimwiki_folding == 1 && &fdm != 'expr' if g:vimwiki_folding == 1 && &fdm != 'expr'
setlocal fdm=expr setlocal fdm=expr
setlocal foldexpr=VimwikiFoldLevel(v:lnum) setlocal foldexpr=VimwikiFoldLevel(v:lnum)
setlocal foldtext=VimwikiFoldText() setlocal foldtext=VimwikiFoldText()
endif endif
" And conceal level too.
if g:vimwiki_conceallevel && exists("+conceallevel")
let &conceallevel = g:vimwiki_conceallevel
endif
" Set up menu " Set up menu
if g:vimwiki_menu != "" if g:vimwiki_menu != ""
exe 'nmenu enable '.g:vimwiki_menu.'.Table' exe 'nmenu enable '.g:vimwiki_menu.'.Table'
endif endif
endfunction "}}} endfunction "}}}
function! s:setup_colors()"{{{
if g:vimwiki_hl_headers == 0
return
endif
if &background == 'light'
hi def VimwikiHeader1 guibg=bg guifg=#aa5858 gui=bold ctermfg=DarkRed
hi def VimwikiHeader2 guibg=bg guifg=#309010 gui=bold ctermfg=DarkGreen
hi def VimwikiHeader3 guibg=bg guifg=#1030a0 gui=bold ctermfg=DarkBlue
hi def VimwikiHeader4 guibg=bg guifg=#103040 gui=bold ctermfg=Black
hi def VimwikiHeader5 guibg=bg guifg=#001020 gui=bold ctermfg=Black
hi def VimwikiHeader6 guibg=bg guifg=#000000 gui=bold ctermfg=Black
else
hi def VimwikiHeader1 guibg=bg guifg=#e08090 gui=bold ctermfg=Red
hi def VimwikiHeader2 guibg=bg guifg=#80e090 gui=bold ctermfg=Green
hi def VimwikiHeader3 guibg=bg guifg=#6090e0 gui=bold ctermfg=Blue
hi def VimwikiHeader4 guibg=bg guifg=#c0c0f0 gui=bold ctermfg=White
hi def VimwikiHeader5 guibg=bg guifg=#e0e0f0 gui=bold ctermfg=White
hi def VimwikiHeader6 guibg=bg guifg=#f0f0f0 gui=bold ctermfg=White
endif
endfunction"}}}
" OPTION get/set functions {{{ " OPTION get/set functions {{{
" return value of option for current wiki or if second parameter exists for " return value of option for current wiki or if second parameter exists for
" wiki with a given index. " wiki with a given index.
@@ -201,11 +178,13 @@ let s:vimwiki_defaults.index = 'index'
let s:vimwiki_defaults.ext = '.wiki' let s:vimwiki_defaults.ext = '.wiki'
let s:vimwiki_defaults.maxhi = 1 let s:vimwiki_defaults.maxhi = 1
let s:vimwiki_defaults.syntax = 'default' let s:vimwiki_defaults.syntax = 'default'
let s:vimwiki_defaults.gohome = 'split'
let s:vimwiki_defaults.html_header = '' let s:vimwiki_defaults.html_header = ''
let s:vimwiki_defaults.html_footer = '' let s:vimwiki_defaults.html_footer = ''
let s:vimwiki_defaults.nested_syntaxes = {} let s:vimwiki_defaults.nested_syntaxes = {}
let s:vimwiki_defaults.auto_export = 0 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 " diary
let s:vimwiki_defaults.diary_rel_path = 'diary/' let s:vimwiki_defaults.diary_rel_path = 'diary/'
@@ -265,9 +244,12 @@ call s:default('table_auto_fmt', 1)
call s:default('w32_dir_enc', '') call s:default('w32_dir_enc', '')
call s:default('CJK_length', 0) call s:default('CJK_length', 0)
call s:default('dir_link', '') 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')
call s:default('html_header_numbering', 0) call s:default('html_header_numbering', 0)
call s:default('html_header_numbering_sym', '') call s:default('html_header_numbering_sym', '')
call s:default('conceallevel', 3)
call s:default('current_idx', 0) call s:default('current_idx', 0)
@@ -292,7 +274,8 @@ else
endif endif
let g:vimwiki_rxWeblink = '\%("[^"(]\+\((\([^)]\+\))\)\?":\)\?'. let g:vimwiki_rxWeblink = '\%("[^"(]\+\((\([^)]\+\))\)\?":\)\?'.
\'\%(https\?\|ftp\|gopher\|telnet\|file\|notes\|ms-help\):'. \'\%(https\?\|ftp\|gopher\|telnet\|file\|notes\|ms-help\):'.
\'\%(\%(\%(//\)\|\%(\\\\\)\)\+[A-Za-z0-9:#@%/;,$~()_?+=.&\\\-]*\)' \'\%(\%(\%(//\)\|\%(\\\\\)\)\+[A-Za-z0-9:#@%/;,$~()_?+=.&\\\-]*\)'.
\'[().,?]\@<!'
"}}} "}}}
" AUTOCOMMANDS for all known wiki extensions {{{ " AUTOCOMMANDS for all known wiki extensions {{{
@@ -316,12 +299,13 @@ augroup vimwiki
for ext in keys(extensions) for ext in keys(extensions)
exe 'autocmd BufEnter *'.ext.' call s:setup_buffer_enter()' exe 'autocmd BufEnter *'.ext.' call s:setup_buffer_enter()'
exe 'autocmd BufLeave,BufHidden *'.ext.' call s:setup_buffer_leave()' exe 'autocmd BufLeave,BufHidden *'.ext.' call s:setup_buffer_leave()'
exe 'autocmd BufNewFile,BufRead, *'.ext.' setf vimwiki'
" ColorScheme could have or could have not a " ColorScheme could have or could have not a
" VimwikiHeader1..VimwikiHeader6 highlight groups. We need to refresh " VimwikiHeader1..VimwikiHeader6 highlight groups. We need to refresh
" syntax after colorscheme change. " syntax after colorscheme change.
exe 'autocmd ColorScheme *'.ext.' call s:setup_colors()'. exe 'autocmd ColorScheme *'.ext.' call vimwiki#setup_colors()'.
\ ' | set syntax=vimwiki' \ ' | call vimwiki#highlight_links()'
" Format tables when exit from insert mode. Do not use textwidth to " Format tables when exit from insert mode. Do not use textwidth to
" autowrap tables. " autowrap tables.
@@ -334,11 +318,11 @@ augroup END
"}}} "}}}
" COMMANDS {{{ " COMMANDS {{{
command! VimwikiUISelect call vimwiki#WikiUISelect() command! VimwikiUISelect call vimwiki#ui_select()
command! -count VimwikiGoHome command! -count VimwikiIndex
\ call vimwiki#WikiGoHome(v:count1) \ call vimwiki#goto_index(v:count1)
command! -count VimwikiTabGoHome tabedit <bar> command! -count VimwikiTabIndex tabedit <bar>
\ call vimwiki#WikiGoHome(v:count1) \ call vimwiki#goto_index(v:count1)
command! -count VimwikiMakeDiaryNote command! -count VimwikiMakeDiaryNote
\ call vimwiki_diary#make_note(v:count1) \ call vimwiki_diary#make_note(v:count1)
@@ -347,15 +331,15 @@ command! -count VimwikiTabMakeDiaryNote tabedit <bar>
"}}} "}}}
" MAPPINGS {{{ " MAPPINGS {{{
if !hasmapto('<Plug>VimwikiGoHome') if !hasmapto('<Plug>VimwikiIndex')
map <silent><unique> <Leader>ww <Plug>VimwikiGoHome map <silent><unique> <Leader>ww <Plug>VimwikiIndex
endif endif
noremap <unique><script> <Plug>VimwikiGoHome :VimwikiGoHome<CR> noremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR>
if !hasmapto('<Plug>VimwikiTabGoHome') if !hasmapto('<Plug>VimwikiTabIndex')
map <silent><unique> <Leader>wt <Plug>VimwikiTabGoHome map <silent><unique> <Leader>wt <Plug>VimwikiTabIndex
endif endif
noremap <unique><script> <Plug>VimwikiTabGoHome :VimwikiTabGoHome<CR> noremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR>
if !hasmapto('<Plug>VimwikiUISelect') if !hasmapto('<Plug>VimwikiUISelect')
map <silent><unique> <Leader>ws <Plug>VimwikiUISelect map <silent><unique> <Leader>ws <Plug>VimwikiUISelect
@@ -382,7 +366,7 @@ function! s:build_menu(topmenu)
let norm_path = fnamemodify(VimwikiGet('path', idx), ':h:t') let norm_path = fnamemodify(VimwikiGet('path', idx), ':h:t')
let norm_path = escape(norm_path, '\ ') let norm_path = escape(norm_path, '\ ')
execute 'menu '.a:topmenu.'.Open\ index.'.norm_path. execute 'menu '.a:topmenu.'.Open\ index.'.norm_path.
\ ' :call vimwiki#WikiGoHome('.(idx + 1).')<CR>' \ ' :call vimwiki#goto_index('.(idx + 1).')<CR>'
execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.norm_path. execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.norm_path.
\ ' :call vimwiki_diary#make_note('.(idx + 1).')<CR>' \ ' :call vimwiki_diary#make_note('.(idx + 1).')<CR>'
let idx += 1 let idx += 1

View File

@@ -50,3 +50,10 @@ snippet code
.. sourcecode:: ${1:python} .. sourcecode:: ${1:python}
${2} ${2}
snippet figure
.. figure:: ${1:image.png}
:target: $1
:alt: ${2:description}
:figclass: ${3:custclass}
$2

0
syntax/hgannotate.vim Executable file → Normal file
View File

View File

@@ -10,25 +10,49 @@ elseif exists("b:current_syntax")
finish finish
endif endif
"" use max highlighting - could be quite slow if there are too many wikifiles " Links highlighting is controlled by vimwiki#highlight_links() function.
if VimwikiGet('maxhi') " It is called from setup_buffer_enter() function in the BufEnter autocommand.
" Every WikiWord is nonexistent
if g:vimwiki_camel_case " Load concrete Wiki syntax
execute 'syntax match VimwikiNoExistsLink /'.g:vimwiki_rxWikiWord.'/' execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
endif
execute 'syntax match VimwikiNoExistsLink /'.g:vimwiki_rxWikiLink1.'/' " Concealed chars
execute 'syntax match VimwikiNoExistsLink /'.g:vimwiki_rxWikiLink2.'/' if exists("+conceallevel")
" till we find them in vimwiki's path syntax conceal on
call vimwiki#WikiHighlightLinks() endif
else syn match VimwikiLinkChar contained /\[\[/
" A WikiWord (unqualifiedWikiName) syn match VimwikiLinkChar contained /\]\]/
execute 'syntax match VimwikiLink /\<'.g:vimwiki_rxWikiWord.'\>/' syn match VimwikiLinkChar contained /\[\[[^\[\]\|]\{-}|\ze.\{-}]]/
" A [[bracketed wiki word]] syn match VimwikiLinkChar contained /\[\[[^\[\]\|]\{-}]\[\ze.\{-}]]/
execute 'syntax match VimwikiLink /'.g:vimwiki_rxWikiLink1.'/'
execute 'syntax match VimwikiLink /'.g:vimwiki_rxWikiLink2.'/' 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 endif
execute 'syntax match VimwikiLink `'.g:vimwiki_rxWeblink.'`' " 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 " Emoticons
syntax match VimwikiEmoticons /\%((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/ syntax match VimwikiEmoticons /\%((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/
@@ -36,16 +60,14 @@ syntax match VimwikiEmoticons /\%((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/
let g:vimwiki_rxTodo = '\C\%(TODO:\|DONE:\|STARTED:\|FIXME:\|FIXED:\|XXX:\)' let g:vimwiki_rxTodo = '\C\%(TODO:\|DONE:\|STARTED:\|FIXME:\|FIXED:\|XXX:\)'
execute 'syntax match VimwikiTodo /'. g:vimwiki_rxTodo .'/' execute 'syntax match VimwikiTodo /'. g:vimwiki_rxTodo .'/'
" Load concrete Wiki syntax
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
" Tables " Tables
" execute 'syntax match VimwikiTable /'.g:vimwiki_rxTable.'/' " execute 'syntax match VimwikiTable /'.g:vimwiki_rxTable.'/'
syntax match VimwikiTableRow /\s*|.\+|\s*/ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ transparent contains=VimwikiCellSeparator,VimwikiLink, \ transparent contains=VimwikiCellSeparator,VimwikiLinkT,
\ VimwikiNoExistsLink,VimwikiEmoticons,VimwikiTodo, \ VimwikiNoExistsLinkT,VimwikiEmoticons,VimwikiTodo,
\ VimwikiBold,VimwikiItalic,VimwikiBoldItalic,VimwikiItalicBold, \ VimwikiBoldT,VimwikiItalicT,VimwikiBoldItalicT,VimwikiItalicBoldT,
\ VimwikiDelText,VimwikiSuperScript,VimwikiSubScript,VimwikiCode \ VimwikiDelTextT,VimwikiSuperScriptT,VimwikiSubScriptT,VimwikiCodeT
syntax match VimwikiCellSeparator syntax match VimwikiCellSeparator
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained \ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
@@ -54,21 +76,29 @@ execute 'syntax match VimwikiList /'.g:vimwiki_rxListBullet.'/'
execute 'syntax match VimwikiList /'.g:vimwiki_rxListNumber.'/' execute 'syntax match VimwikiList /'.g:vimwiki_rxListNumber.'/'
execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/' execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
execute 'syntax match VimwikiBold /'.g:vimwiki_rxBold.'/' execute 'syntax match VimwikiBold /'.g:vimwiki_rxBold.'/ contains=VimwikiBoldChar'
execute 'syntax match VimwikiBoldT /'.g:vimwiki_rxBold.'/ contained contains=VimwikiBoldCharT'
execute 'syntax match VimwikiItalic /'.g:vimwiki_rxItalic.'/' execute 'syntax match VimwikiItalic /'.g:vimwiki_rxItalic.'/ contains=VimwikiItalicChar'
execute 'syntax match VimwikiItalicT /'.g:vimwiki_rxItalic.'/ contained contains=VimwikiItalicCharT'
execute 'syntax match VimwikiBoldItalic /'.g:vimwiki_rxBoldItalic.'/' execute 'syntax match VimwikiBoldItalic /'.g:vimwiki_rxBoldItalic.'/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar'
execute 'syntax match VimwikiBoldItalicT /'.g:vimwiki_rxBoldItalic.'/ contained contains=VimwikiBoldItalicChatT,VimwikiItalicBoldCharT'
execute 'syntax match VimwikiItalicBold /'.g:vimwiki_rxItalicBold.'/' execute 'syntax match VimwikiItalicBold /'.g:vimwiki_rxItalicBold.'/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar'
execute 'syntax match VimwikiItalicBoldT /'.g:vimwiki_rxItalicBold.'/ contained contains=VimwikiBoldItalicCharT,VimsikiItalicBoldCharT'
execute 'syntax match VimwikiDelText /'.g:vimwiki_rxDelText.'/' execute 'syntax match VimwikiDelText /'.g:vimwiki_rxDelText.'/ contains=VimwikiDelTextChar'
execute 'syntax match VimwikiDelTextT /'.g:vimwiki_rxDelText.'/ contained contains=VimwikiDelTextChar'
execute 'syntax match VimwikiSuperScript /'.g:vimwiki_rxSuperScript.'/' execute 'syntax match VimwikiSuperScript /'.g:vimwiki_rxSuperScript.'/ contains=VimwikiSuperScriptChar'
execute 'syntax match VimwikiSuperScriptT /'.g:vimwiki_rxSuperScript.'/ contained contains=VimwikiSuperScriptCharT'
execute 'syntax match VimwikiSubScript /'.g:vimwiki_rxSubScript.'/' execute 'syntax match VimwikiSubScript /'.g:vimwiki_rxSubScript.'/ contains=VimwikiSubScriptChar'
execute 'syntax match VimwikiSubScriptT /'.g:vimwiki_rxSubScript.'/ contained contains=VimwikiSubScriptCharT'
execute 'syntax match VimwikiCode /'.g:vimwiki_rxCode.'/' execute 'syntax match VimwikiCode /'.g:vimwiki_rxCode.'/ contains=VimwikiCodeChar'
execute 'syntax match VimwikiCodeT /'.g:vimwiki_rxCode.'/ contained contains=VimwikiCodeCharT'
" <hr> horizontal rule " <hr> horizontal rule
execute 'syntax match VimwikiHR /'.g:vimwiki_rxHR.'/' execute 'syntax match VimwikiHR /'.g:vimwiki_rxHR.'/'
@@ -88,62 +118,107 @@ if g:vimwiki_hl_cb_checked
endif endif
" placeholders " placeholders
syntax match VimwikiPlaceholder /^\s*%toc\%(\s.*\)\?$/ syntax match VimwikiPlaceholder /^\s*%toc\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/ syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
syntax match VimwikiPlaceholder /^\s*%title\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam
syntax match VimwikiPlaceholderParam /\s.*/ contained
" html tags " html tags
syntax match VimwikiHTMLtag '<br\s*/\?>' let html_tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
syntax match VimwikiHTMLtag '<hr\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'
syntax region VimwikiComment start='<!--' end='-->' syntax region VimwikiComment start='<!--' end='-->'
if !vimwiki#hl_exists("VimwikiHeader1") if g:vimwiki_hl_headers == 0
execute 'syntax match VimwikiHeader /'.g:vimwiki_rxHeader.'/ contains=VimwikiTodo' execute 'syntax match VimwikiHeader /'.g:vimwiki_rxHeader.'/ contains=VimwikiTodo,VimwikiHeaderChar'
else else
" Header levels, 1-6 " Header levels, 1-6
execute 'syntax match VimwikiHeader1 /'.g:vimwiki_rxH1.'/ contains=VimwikiTodo' execute 'syntax match VimwikiHeader1 /'.g:vimwiki_rxH1.'/ contains=VimwikiTodo,VimwikiHeaderChar'
execute 'syntax match VimwikiHeader2 /'.g:vimwiki_rxH2.'/ contains=VimwikiTodo' execute 'syntax match VimwikiHeader2 /'.g:vimwiki_rxH2.'/ contains=VimwikiTodo,VimwikiHeaderChar'
execute 'syntax match VimwikiHeader3 /'.g:vimwiki_rxH3.'/ contains=VimwikiTodo' execute 'syntax match VimwikiHeader3 /'.g:vimwiki_rxH3.'/ contains=VimwikiTodo,VimwikiHeaderChar'
execute 'syntax match VimwikiHeader4 /'.g:vimwiki_rxH4.'/ contains=VimwikiTodo' execute 'syntax match VimwikiHeader4 /'.g:vimwiki_rxH4.'/ contains=VimwikiTodo,VimwikiHeaderChar'
execute 'syntax match VimwikiHeader5 /'.g:vimwiki_rxH5.'/ contains=VimwikiTodo' execute 'syntax match VimwikiHeader5 /'.g:vimwiki_rxH5.'/ contains=VimwikiTodo,VimwikiHeaderChar'
execute 'syntax match VimwikiHeader6 /'.g:vimwiki_rxH6.'/ contains=VimwikiTodo' execute 'syntax match VimwikiHeader6 /'.g:vimwiki_rxH6.'/ contains=VimwikiTodo,VimwikiHeaderChar'
endif endif
" group names "{{{ " group names "{{{
if !vimwiki#hl_exists("VimwikiHeader1")
hi def link VimwikiHeader Title call vimwiki#setup_colors()
else
hi def link VimwikiHeader1 Title
hi def link VimwikiHeader2 Title
hi def link VimwikiHeader3 Title
hi def link VimwikiHeader4 Title
hi def link VimwikiHeader5 Title
hi def link VimwikiHeader6 Title
endif
hi def VimwikiBold term=bold cterm=bold gui=bold 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 VimwikiItalic term=italic cterm=italic gui=italic
hi def link VimwikiItalicT VimwikiItalic
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
hi def link VimwikiItalicBold VimwikiBoldItalic 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 VimwikiCode PreProc
hi def link VimwikiCodeT VimwikiCode
hi def link VimwikiNoExistsLink Error hi def link VimwikiNoExistsLink Error
hi def link VimwikiNoExistsLinkT VimwikiNoExistsLink
hi def link VimwikiPre PreProc hi def link VimwikiPre PreProc
hi def link VimwikiPreT VimwikiPre
hi def link VimwikiLink Underlined hi def link VimwikiLink Underlined
hi def link VimwikiLinkT Underlined
hi def link VimwikiList Function hi def link VimwikiList Function
hi def link VimwikiCheckBox VimwikiList hi def link VimwikiCheckBox VimwikiList
hi def link VimwikiCheckBoxDone Comment hi def link VimwikiCheckBoxDone Comment
hi def link VimwikiEmoticons Character hi def link VimwikiEmoticons Character
hi def link VimwikiDelText Constant hi def link VimwikiDelText Constant
hi def link VimwikiDelTextT VimwikiDelText
hi def link VimwikiSuperScript Number hi def link VimwikiSuperScript Number
hi def link VimwikiSuperScriptT VimwikiSuperScript
hi def link VimwikiSubScript Number hi def link VimwikiSubScript Number
hi def link VimwikiSubScriptT VimwikiSubScript
hi def link VimwikiTodo Todo hi def link VimwikiTodo Todo
hi def link VimwikiComment Comment hi def link VimwikiComment Comment
hi def link VimwikiCellSeparator SpecialKey hi def link VimwikiCellSeparator PreProc
hi def link VimwikiPlaceholder SpecialKey hi def link VimwikiPlaceholder SpecialKey
hi def link VimwikiPlaceholderParam String
hi def link VimwikiHTMLtag SpecialKey hi def link VimwikiHTMLtag SpecialKey
hi def link VimwikiBoldChar VimwikiIgnore
hi def link VimwikiItalicChar VimwikiIgnore
hi def link VimwikiBoldItalicChar VimwikiIgnore
hi def link VimwikiItalicBoldChar VimwikiIgnore
hi def link VimwikiDelTextChar VimwikiIgnore
hi def link VimwikiSuperScriptChar VimwikiIgnore
hi def link VimwikiSubScriptChar VimwikiIgnore
hi def link VimwikiCodeChar VimwikiIgnore
hi def link VimwikiHeaderChar VimwikiIgnore
hi def link VimwikiLinkChar VimwikiLink
hi def link VimwikiNoLinkChar VimwikiNoExistsLink
hi def link VimwikiBoldCharT VimwikiIgnore
hi def link VimwikiItalicCharT VimwikiIgnore
hi def link VimwikiBoldItalicCharT VimwikiIgnore
hi def link VimwikiItalicBoldCharT VimwikiIgnore
hi def link VimwikiDelTextCharT VimwikiIgnore
hi def link VimwikiSuperScriptCharT VimwikiIgnore
hi def link VimwikiSubScriptCharT VimwikiIgnore
hi def link VimwikiCodeCharT VimwikiIgnore
hi def link VimwikiHeaderCharT VimwikiIgnore
hi def link VimwikiLinkCharT VimwikiLinkT
hi def link VimwikiNoLinkCharT VimwikiNoExistsLinkT
"}}} "}}}
let b:current_syntax="vimwiki" let b:current_syntax="vimwiki"
@@ -153,9 +228,9 @@ let nested = VimwikiGet('nested_syntaxes')
if !empty(nested) if !empty(nested)
for [hl_syntax, vim_syntax] in items(nested) for [hl_syntax, vim_syntax] in items(nested)
call vimwiki#nested_syntax(vim_syntax, call vimwiki#nested_syntax(vim_syntax,
\ '^{{{\%(.*[[:blank:][:punct:]]\)\?'. \ '^\s*{{{\%(.*[[:blank:][:punct:]]\)\?'.
\ hl_syntax.'\%([[:blank:][:punct:]].*\)\?', \ hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
\ '^}}}', 'VimwikiPre') \ '^\s*}}}', 'VimwikiPre')
endfor endfor
endif endif
"}}} "}}}

View File

@@ -11,6 +11,7 @@ let g:vimwiki_rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'. \'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
\'\*'. \'\*'.
\'\%([[:punct:]]\|\s\|$\)\@=' \'\%([[:punct:]]\|\s\|$\)\@='
let g:vimwiki_char_bold = '*'
" text: _emphasis_ " text: _emphasis_
" let g:vimwiki_rxItalic = '_[^_]\+_' " let g:vimwiki_rxItalic = '_[^_]\+_'
@@ -19,6 +20,7 @@ let g:vimwiki_rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'. \'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
\'_'. \'_'.
\'\%([[:punct:]]\|\s\|$\)\@=' \'\%([[:punct:]]\|\s\|$\)\@='
let g:vimwiki_char_italic = '_'
" text: *_bold italic_* or _*italic bold*_ " text: *_bold italic_* or _*italic bold*_
let g:vimwiki_rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='. let g:vimwiki_rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
@@ -26,24 +28,30 @@ let g:vimwiki_rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'. \'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'_\*'. \'_\*'.
\'\%([[:punct:]]\|\s\|$\)\@=' \'\%([[:punct:]]\|\s\|$\)\@='
let g:vimwiki_char_bolditalic = '\*_'
let g:vimwiki_rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='. let g:vimwiki_rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'_\*'. \'_\*'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'. \'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'\*_'. \'\*_'.
\'\%([[:punct:]]\|\s\|$\)\@=' \'\%([[:punct:]]\|\s\|$\)\@='
let g:vimwiki_char_italicbold = '_\*'
" text: `code` " text: `code`
let g:vimwiki_rxCode = '`[^`]\+`' let g:vimwiki_rxCode = '`[^`]\+`'
let g:vimwiki_char_code = '`'
" text: ~~deleted text~~ " text: ~~deleted text~~
let g:vimwiki_rxDelText = '\~\~[^~`]\+\~\~' let g:vimwiki_rxDelText = '\~\~[^~`]\+\~\~'
let g:vimwiki_char_deltext = '\~\~'
" text: ^superscript^ " text: ^superscript^
let g:vimwiki_rxSuperScript = '\^[^^`]\+\^' let g:vimwiki_rxSuperScript = '\^[^^`]\+\^'
let g:vimwiki_char_superscript = '^'
" text: ,,subscript,, " text: ,,subscript,,
let g:vimwiki_rxSubScript = ',,[^,`]\+,,' let g:vimwiki_rxSubScript = ',,[^,`]\+,,'
let g:vimwiki_char_subscript = ',,'
" Header levels, 1-6 " Header levels, 1-6
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$' let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$'
@@ -59,12 +67,11 @@ let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'.
\ '\%('.g:vimwiki_rxH5.'\)\|'. \ '\%('.g:vimwiki_rxH5.'\)\|'.
\ '\%('.g:vimwiki_rxH6.'\)' \ '\%('.g:vimwiki_rxH6.'\)'
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)'
" <hr>, horizontal rule " <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 = '||'
" List items start with optional whitespace(s) then '* ' or '# ' " 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_rxListNumber = '^\s*#\s'

View File

@@ -6,25 +6,33 @@
" text: '''strong''' " text: '''strong'''
let g:vimwiki_rxBold = "'''[^']\\+'''" let g:vimwiki_rxBold = "'''[^']\\+'''"
let g:vimwiki_char_bold = "'''"
" text: ''emphasis'' " text: ''emphasis''
let g:vimwiki_rxItalic = "''[^']\\+''" let g:vimwiki_rxItalic = "''[^']\\+''"
let g:vimwiki_char_italic = "''"
" text: '''''strong italic''''' " text: '''''strong italic'''''
let g:vimwiki_rxBoldItalic = "'''''[^']\\+'''''" let g:vimwiki_rxBoldItalic = "'''''[^']\\+'''''"
let g:vimwiki_rxItalicBold = g:vimwiki_rxBoldItalic let g:vimwiki_rxItalicBold = g:vimwiki_rxBoldItalic
let g:vimwiki_char_bolditalic = "'''''"
let g:vimwiki_char_italicbold = g:vimwiki_char_bolditalic
" text: `code` " text: `code`
let g:vimwiki_rxCode = '`[^`]\+`' let g:vimwiki_rxCode = '`[^`]\+`'
let g:vimwiki_char_code = '`'
" text: ~~deleted text~~ " text: ~~deleted text~~
let g:vimwiki_rxDelText = '\~\~[^~]\+\~\~' let g:vimwiki_rxDelText = '\~\~[^~]\+\~\~'
let g:vimwiki_char_deltext = '\~\~'
" text: ^superscript^ " text: ^superscript^
let g:vimwiki_rxSuperScript = '\^[^^]\+\^' let g:vimwiki_rxSuperScript = '\^[^^]\+\^'
let g:vimwiki_char_superscript = '^'
" text: ,,subscript,, " text: ,,subscript,,
let g:vimwiki_rxSubScript = ',,[^,]\+,,' let g:vimwiki_rxSubScript = ',,[^,]\+,,'
let g:vimwiki_char_subscript = ',,'
" Header levels, 1-6 " Header levels, 1-6
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$' let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$'
@@ -39,6 +47,7 @@ let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'.
\ '\%('.g:vimwiki_rxH4.'\)\|'. \ '\%('.g:vimwiki_rxH4.'\)\|'.
\ '\%('.g:vimwiki_rxH5.'\)\|'. \ '\%('.g:vimwiki_rxH5.'\)\|'.
\ '\%('.g:vimwiki_rxH6.'\)' \ '\%('.g:vimwiki_rxH6.'\)'
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)'
" <hr>, horizontal rule " <hr>, horizontal rule
let g:vimwiki_rxHR = '^----.*$' let g:vimwiki_rxHR = '^----.*$'