Version 2.0.stu
This release is partly incompatible with 1.2. You should delete previous version of vimwiki before install. = Summary = * Quick page-link creation. * Redesign of link syntaxes (!) * No more CamelCase links. Check the ways to convert them http://goo.gl/15ctX * No more [[link][desc]] links. * No more [http://link description] links. * No more plain image links. Use transclusions. * No more image links identified by extension. Use transclusions. * Interwiki links. * Link schemes. * Transclusions. * Normalize link command. * Improved diary organization and generation. * List manipulation. * Markdown support. * Mathjax support. * Improved handling of special characters and punctuation in filenames and urls. * Back links command: list links referring to the current page. * Highlighting nonexisted links are off by default. * Table syntax change. Row separator uses | instead of +. * Fold multilined list items. * Custom wiki to HTML converters. * Conceal long weblinks. * Option to disable table mappings. For detailed information see issues list on http://code.google.com/p/vimwiki/issues/list
This commit is contained in:
@ -35,13 +35,17 @@ setlocal isfname-=[,]
|
||||
|
||||
" Autocreate list items {{{
|
||||
" for list items, and list items with checkboxes
|
||||
setlocal formatoptions+=tnro
|
||||
setlocal formatoptions-=cq
|
||||
if VimwikiGet('syntax') == 'default'
|
||||
setl comments=b:*,b:#,b:-
|
||||
setl formatlistpat=^\\s*[*#-]\\s*
|
||||
elseif VimwikiGet('syntax') == 'markdown'
|
||||
setlocal comments=fb:*,fb:-,fb:+,nb:> commentstring=\ >\ %s
|
||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+j
|
||||
else
|
||||
setl comments=n:*,n:#
|
||||
endif
|
||||
setlocal formatoptions=tnro
|
||||
|
||||
if !empty(&langmap)
|
||||
" Valid only if langmap is a comma separated pairs of chars
|
||||
@ -64,23 +68,15 @@ function! VimwikiFoldLevel(lnum) "{{{
|
||||
|
||||
" Header folding...
|
||||
if line =~ g:vimwiki_rxHeader
|
||||
let n = vimwiki#base#count_first_sym(line)
|
||||
let n = vimwiki#u#count_first_sym(line)
|
||||
return '>'.n
|
||||
endif
|
||||
|
||||
if g:vimwiki_fold_trailing_empty_lines == 0 && line =~ '^\s*$'
|
||||
let nnline = getline(nextnonblank(a:lnum + 1))
|
||||
else
|
||||
let nnline = getline(a:lnum + 1)
|
||||
endif
|
||||
if nnline =~ g:vimwiki_rxHeader
|
||||
let n = vimwiki#base#count_first_sym(nnline)
|
||||
return '<'.n
|
||||
endif
|
||||
let base_level = s:get_base_level(a:lnum)
|
||||
|
||||
" List item folding...
|
||||
if g:vimwiki_fold_lists
|
||||
let base_level = s:get_base_level(a:lnum)
|
||||
let nnline = getline(a:lnum + 1)
|
||||
|
||||
let rx_list_item = '\('.
|
||||
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
|
||||
@ -95,6 +91,10 @@ function! VimwikiFoldLevel(lnum) "{{{
|
||||
|
||||
if leveln > level
|
||||
return ">".(base_level+leveln-adj)
|
||||
" check if multilined list item
|
||||
elseif (nnum-a:lnum) > 1
|
||||
\ && nline =~ rx_list_item && nnline !~ '^\s*$'
|
||||
return ">".(base_level+level+1-adj)
|
||||
else
|
||||
return (base_level+level-adj)
|
||||
endif
|
||||
@ -102,34 +102,23 @@ function! VimwikiFoldLevel(lnum) "{{{
|
||||
" process multilined list items
|
||||
let [pnum, pline] = s:find_backward(rx_list_item, a:lnum)
|
||||
if pline =~ rx_list_item
|
||||
if indent(a:lnum) > indent(pnum)
|
||||
if indent(a:lnum) >= indent(pnum) && line !~ '^\s*$'
|
||||
let level = s:get_li_level(pnum)
|
||||
let adj = s:get_li_level(s:get_start_list(rx_list_item, pnum))
|
||||
|
||||
let [nnum, nline] = s:find_forward(rx_list_item, a:lnum)
|
||||
if nline =~ rx_list_item
|
||||
let leveln = s:get_li_level(nnum)
|
||||
if leveln > level
|
||||
return (base_level+leveln-adj)
|
||||
endif
|
||||
endif
|
||||
|
||||
return (base_level+level-adj)
|
||||
return (base_level+level+1-adj)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return base_level
|
||||
endif
|
||||
|
||||
return -1
|
||||
return base_level
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_base_level(lnum) "{{{
|
||||
let lnum = a:lnum - 1
|
||||
while lnum > 0
|
||||
if getline(lnum) =~ g:vimwiki_rxHeader
|
||||
return vimwiki#base#count_first_sym(getline(lnum))
|
||||
return vimwiki#u#count_first_sym(getline(lnum))
|
||||
endif
|
||||
let lnum -= 1
|
||||
endwhile
|
||||
@ -169,7 +158,7 @@ endfunction "}}}
|
||||
|
||||
function! s:get_li_level(lnum) "{{{
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
let level = vimwiki#base#count_first_sym(getline(a:lnum))
|
||||
let level = vimwiki#u#count_first_sym(getline(a:lnum))
|
||||
else
|
||||
let level = (indent(a:lnum) / &sw)
|
||||
endif
|
||||
@ -198,12 +187,16 @@ endfunction "}}}
|
||||
|
||||
" COMMANDS {{{
|
||||
command! -buffer Vimwiki2HTML
|
||||
\ w <bar> call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ silent w <bar>
|
||||
\ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ expand('%'))
|
||||
\<bar>
|
||||
\ if res != '' | echo 'Vimwiki: HTML conversion is done.' | endif
|
||||
command! -buffer Vimwiki2HTMLBrowse
|
||||
\ w <bar> call VimwikiWeblinkHandler(
|
||||
\ vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ expand('%')))
|
||||
\ silent w <bar>
|
||||
\ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
|
||||
\ expand(VimwikiGet('path_html')),
|
||||
\ expand('%')))
|
||||
command! -buffer VimwikiAll2HTML
|
||||
\ call vimwiki#html#WikiAll2HTML(expand(VimwikiGet('path_html')))
|
||||
|
||||
@ -216,12 +209,17 @@ command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link()
|
||||
command! -buffer VimwikiSplitLink call vimwiki#base#follow_link('split')
|
||||
command! -buffer VimwikiVSplitLink call vimwiki#base#follow_link('vsplit')
|
||||
|
||||
command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(<f-args>)
|
||||
|
||||
command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tabnew')
|
||||
|
||||
command! -buffer -range VimwikiToggleListItem call vimwiki#lst#ToggleListItem(<line1>, <line2>)
|
||||
|
||||
command! -buffer VimwikiGenerateLinks call vimwiki#base#generate_links()
|
||||
|
||||
command! -buffer -nargs=0 VimwikiBacklinks call vimwiki#base#backlinks()
|
||||
command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
|
||||
|
||||
exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep <args> '.
|
||||
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
|
||||
|
||||
@ -230,6 +228,10 @@ exe 'command! -buffer -nargs=* VWS lvimgrep <args> '.
|
||||
|
||||
command! -buffer -nargs=1 VimwikiGoto call vimwiki#base#goto("<args>")
|
||||
|
||||
|
||||
" list commands
|
||||
command! -buffer -nargs=* VimwikiListChangeLevel call vimwiki#lst#change_level(<f-args>)
|
||||
|
||||
" table commands
|
||||
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
|
||||
command! -buffer VimwikiTableAlignQ call vimwiki#tbl#align_or_cmd('gqq')
|
||||
@ -247,7 +249,7 @@ command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day()
|
||||
if g:vimwiki_use_mouse
|
||||
nmap <buffer> <S-LeftMouse> <NOP>
|
||||
nmap <buffer> <C-LeftMouse> <NOP>
|
||||
nnoremap <silent><buffer> <2-LeftMouse> :VimwikiFollowLink<CR>
|
||||
nnoremap <silent><buffer> <2-LeftMouse> :call vimwiki#base#follow_link("nosplit", "\<lt>2-LeftMouse>")<CR>
|
||||
nnoremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR>
|
||||
nnoremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR>
|
||||
nnoremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR>
|
||||
@ -284,6 +286,24 @@ endif
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiVSplitLink :VimwikiVSplitLink<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiNormalizeLink')
|
||||
nmap <silent><buffer> + <Plug>VimwikiNormalizeLink
|
||||
endif
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiNormalizeLink :VimwikiNormalizeLink 0<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiNormalizeLinkVisual')
|
||||
vmap <silent><buffer> + <Plug>VimwikiNormalizeLinkVisual
|
||||
endif
|
||||
vnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiNormalizeLinkVisual :<C-U>VimwikiNormalizeLink 1<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiNormalizeLinkVisualCR')
|
||||
vmap <silent><buffer> <CR> <Plug>VimwikiNormalizeLinkVisualCR
|
||||
endif
|
||||
vnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiNormalizeLinkVisualCR :<C-U>VimwikiNormalizeLink 1<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiTabnewLink')
|
||||
nmap <silent><buffer> <D-CR> <Plug>VimwikiTabnewLink
|
||||
nmap <silent><buffer> <C-S-CR> <Plug>VimwikiTabnewLink
|
||||
@ -345,7 +365,7 @@ nnoremap <silent><script><buffer>
|
||||
|
||||
function! s:CR() "{{{
|
||||
let res = vimwiki#lst#kbd_cr()
|
||||
if res == "\<CR>" && g:vimwiki_table_auto_fmt
|
||||
if res == "\<CR>" && g:vimwiki_table_mappings
|
||||
let res = vimwiki#tbl#kbd_cr()
|
||||
endif
|
||||
return res
|
||||
@ -357,9 +377,25 @@ inoremap <buffer> <expr> <CR> <SID>CR()
|
||||
" List mappings
|
||||
nnoremap <buffer> o :<C-U>call vimwiki#lst#kbd_oO('o')<CR>
|
||||
nnoremap <buffer> O :<C-U>call vimwiki#lst#kbd_oO('O')<CR>
|
||||
nnoremap <buffer> gll :VimwikiListChangeLevel <<<CR>
|
||||
nnoremap <buffer> glm :VimwikiListChangeLevel >><CR>
|
||||
nnoremap <buffer> gl* :VimwikiListChangeLevel *<CR>
|
||||
nnoremap <buffer> gl8 :VimwikiListChangeLevel *<CR>
|
||||
if VimwikiGet('syntax') == 'default'
|
||||
nnoremap <buffer> gl- :VimwikiListChangeLevel -<CR>
|
||||
nnoremap <buffer> gl# :VimwikiListChangeLevel #<CR>
|
||||
nnoremap <buffer> gl3 :VimwikiListChangeLevel #<CR>
|
||||
elseif VimwikiGet('syntax') == 'markdown'
|
||||
nnoremap <buffer> gl- :VimwikiListChangeLevel -<CR>
|
||||
nnoremap <buffer> gl1 :VimwikiListChangeLevel 1.<CR>
|
||||
elseif VimwikiGet('syntax') == 'media'
|
||||
nnoremap <buffer> gl# :VimwikiListChangeLevel #<CR>
|
||||
nnoremap <buffer> gl3 :VimwikiListChangeLevel #<CR>
|
||||
endif
|
||||
|
||||
|
||||
" Table mappings
|
||||
if g:vimwiki_table_auto_fmt
|
||||
if g:vimwiki_table_mappings
|
||||
inoremap <expr> <buffer> <Tab> vimwiki#tbl#kbd_tab()
|
||||
inoremap <expr> <buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab()
|
||||
endif
|
||||
@ -377,8 +413,6 @@ endif
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiTableMoveColumnRight :VimwikiTableMoveColumnRight<CR>
|
||||
|
||||
" Misc mappings
|
||||
inoremap <buffer> <S-CR> <br /><CR>
|
||||
|
||||
|
||||
" Text objects {{{
|
||||
@ -400,8 +434,18 @@ vnoremap <silent><buffer> ac :<C-U>call vimwiki#base#TO_table_col(0, 1)<CR>
|
||||
onoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 0)<CR>
|
||||
vnoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 1)<CR>
|
||||
|
||||
nnoremap <silent><buffer> = :call vimwiki#base#AddHeaderLevel()<CR>
|
||||
nnoremap <silent><buffer> - :call vimwiki#base#RemoveHeaderLevel()<CR>
|
||||
if !hasmapto('<Plug>VimwikiAddHeaderLevel')
|
||||
nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
|
||||
endif
|
||||
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :
|
||||
\<C-U>call vimwiki#base#AddHeaderLevel()<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiRemoveHeaderLevel')
|
||||
nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
|
||||
endif
|
||||
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
|
||||
\<C-U>call vimwiki#base#RemoveHeaderLevel()<CR>
|
||||
|
||||
|
||||
" }}}
|
||||
|
||||
@ -411,8 +455,21 @@ nnoremap <silent><buffer> - :call vimwiki#base#RemoveHeaderLevel()<CR>
|
||||
if VimwikiGet('auto_export')
|
||||
" Automatically generate HTML on page write.
|
||||
augroup vimwiki
|
||||
au BufWritePost <buffer> Vimwiki2HTML
|
||||
au BufWritePost <buffer>
|
||||
\ call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ expand('%'))
|
||||
augroup END
|
||||
endif
|
||||
|
||||
" AUTOCOMMANDS }}}
|
||||
|
||||
" PASTE, CAT URL {{{
|
||||
" html commands
|
||||
command! -buffer VimwikiPasteUrl call vimwiki#html#PasteUrl(expand('%:p'))
|
||||
command! -buffer VimwikiCatUrl call vimwiki#html#CatUrl(expand('%:p'))
|
||||
" }}}
|
||||
|
||||
" DEBUGGING {{{
|
||||
command! VimwikiPrintWikiState call vimwiki#base#print_wiki_state()
|
||||
command! VimwikiReadLocalOptions call vimwiki#base#read_wiki_options(1)
|
||||
" }}}
|
||||
|
Reference in New Issue
Block a user