Merge branch 'dev' into dev
This commit is contained in:
		@@ -1,97 +1,90 @@
 | 
			
		||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
 | 
			
		||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
 | 
			
		||||
" Vimwiki filetype plugin file
 | 
			
		||||
" Author: Maxim Kim <habamax@gmail.com>
 | 
			
		||||
" Home: http://code.google.com/p/vimwiki/
 | 
			
		||||
" Home: https://github.com/vimwiki/vimwiki/
 | 
			
		||||
 | 
			
		||||
if exists("b:did_ftplugin")
 | 
			
		||||
  finish
 | 
			
		||||
endif
 | 
			
		||||
let b:did_ftplugin = 1  " Don't load another plugin for this buffer
 | 
			
		||||
 | 
			
		||||
call vimwiki#u#reload_regexes()
 | 
			
		||||
 | 
			
		||||
" UNDO list {{{
 | 
			
		||||
" Reset the following options to undo this plugin.
 | 
			
		||||
let b:undo_ftplugin = "setlocal ".
 | 
			
		||||
      \ "suffixesadd< isfname< formatlistpat< ".
 | 
			
		||||
      \ "formatoptions< foldtext< ".
 | 
			
		||||
      \ "foldmethod< foldexpr< commentstring< "
 | 
			
		||||
" UNDO }}}
 | 
			
		||||
 | 
			
		||||
" MISC STUFF {{{
 | 
			
		||||
 | 
			
		||||
setlocal commentstring=%%%s
 | 
			
		||||
 | 
			
		||||
if g:vimwiki_conceallevel && exists("+conceallevel")
 | 
			
		||||
  let &l:conceallevel = g:vimwiki_conceallevel
 | 
			
		||||
if vimwiki#vars#get_global('conceallevel') && exists("+conceallevel")
 | 
			
		||||
  let &l:conceallevel = vimwiki#vars#get_global('conceallevel')
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
" GOTO FILE: gf {{{
 | 
			
		||||
execute 'setlocal suffixesadd='.VimwikiGet('ext')
 | 
			
		||||
" This is for GOTO FILE: gf
 | 
			
		||||
execute 'setlocal suffixesadd='.vimwiki#vars#get_wikilocal('ext')
 | 
			
		||||
setlocal isfname-=[,]
 | 
			
		||||
" gf}}}
 | 
			
		||||
 | 
			
		||||
" omnicomplete function for wiki files and anchors {{{
 | 
			
		||||
exe "setlocal tags+=" . escape(vimwiki#tags#metadata_file_path(), ' \|"')
 | 
			
		||||
 | 
			
		||||
let g:vimwiki_default_header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$'
 | 
			
		||||
let g:vimwiki_default_header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$'
 | 
			
		||||
let g:vimwiki_markdown_header_search = '^\s*\(#\{1,6}\)\([^#].*\)$'
 | 
			
		||||
let g:vimwiki_markdown_header_match = '^\s*\(#\{1,6}\)#\@!\s*__Header__\s*$'
 | 
			
		||||
let g:vimwiki_media_header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$'
 | 
			
		||||
let g:vimwiki_media_header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$'
 | 
			
		||||
let g:vimwiki_default_bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
 | 
			
		||||
let g:vimwiki_default_bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*\%([[:punct:]]\|\s\|$\)\@='
 | 
			
		||||
let g:vimwiki_markdown_bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
 | 
			
		||||
let g:vimwiki_markdown_bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*\%([[:punct:]]\|\s\|$\)\@='
 | 
			
		||||
let g:vimwiki_media_bold_search = "'''\\zs[^']\\+\\ze'''"
 | 
			
		||||
let g:vimwiki_media_bold_match = '''''''__Text__'''''''
 | 
			
		||||
" ^- looks strange, but is equivalent to "'''__Text__'''" but since we later
 | 
			
		||||
" want to call escape() on this string, we must keep it in single quotes
 | 
			
		||||
 | 
			
		||||
function! g:complete_wikifiles(findstart, base)
 | 
			
		||||
 | 
			
		||||
function! Complete_wikifiles(findstart, base)
 | 
			
		||||
  if a:findstart == 1
 | 
			
		||||
    let column = col('.')-1
 | 
			
		||||
    let column = col('.')-2
 | 
			
		||||
    let line = getline('.')[:column]
 | 
			
		||||
    let startoflink = match(line, '\[\[\zs[^\\[]*$')
 | 
			
		||||
    let startoflink = match(line, '\[\[\zs[^\\[\]]*$')
 | 
			
		||||
    if startoflink != -1
 | 
			
		||||
      let s:line_context = '['
 | 
			
		||||
      return startoflink
 | 
			
		||||
    endif
 | 
			
		||||
    if VimwikiGet('syntax') == 'markdown'
 | 
			
		||||
      let startofinlinelink = match(line, '\[.*\](\zs.*$')
 | 
			
		||||
    if vimwiki#vars#get_wikilocal('syntax') ==? 'markdown'
 | 
			
		||||
      let startofinlinelink = match(line, '\[.*\](\zs[^)]*$')
 | 
			
		||||
      if startofinlinelink != -1
 | 
			
		||||
        let s:line_context = '['
 | 
			
		||||
        return startofinlinelink
 | 
			
		||||
      endif
 | 
			
		||||
    endif
 | 
			
		||||
    let startoftag = match(line, ':\zs[^:[:space:]]*$')
 | 
			
		||||
    if startoftag != -1
 | 
			
		||||
      let s:line_context = ':'
 | 
			
		||||
      return startoftag
 | 
			
		||||
    endif
 | 
			
		||||
    let s:line_context = ''
 | 
			
		||||
    return -1
 | 
			
		||||
  else
 | 
			
		||||
    if a:base !~ '#'
 | 
			
		||||
    " Completion works for wikilinks/anchors, and for tags. s:line_content
 | 
			
		||||
    " tells us which string came before a:base. There seems to be no easier
 | 
			
		||||
    " solution, because calling col('.') here returns garbage.
 | 
			
		||||
    if s:line_context == ''
 | 
			
		||||
      return []
 | 
			
		||||
    elseif s:line_context == ':'
 | 
			
		||||
      " Tags completion
 | 
			
		||||
      let tags = vimwiki#tags#get_tags()
 | 
			
		||||
      if a:base != ''
 | 
			
		||||
        call filter(tags,
 | 
			
		||||
            \ "v:val[:" . (len(a:base)-1) . "] == '" . substitute(a:base, "'", "''", '') . "'" )
 | 
			
		||||
      endif
 | 
			
		||||
      return tags
 | 
			
		||||
    elseif a:base !~# '#'
 | 
			
		||||
      " we look for wiki files
 | 
			
		||||
 | 
			
		||||
      if a:base =~# '^wiki\d:'
 | 
			
		||||
        let wikinumber = eval(matchstr(a:base, '^wiki\zs\d'))
 | 
			
		||||
        let directory = VimwikiGet('path', wikinumber)
 | 
			
		||||
        let ext = VimwikiGet('ext', wikinumber)
 | 
			
		||||
        let prefix = matchstr(a:base, '^wiki\d:\zs.*')
 | 
			
		||||
        let scheme = matchstr(a:base, '^wiki\d:\ze')
 | 
			
		||||
      if a:base =~# '\m^wiki\d\+:'
 | 
			
		||||
        let wikinumber = eval(matchstr(a:base, '\m^wiki\zs\d\+'))
 | 
			
		||||
        if wikinumber >= vimwiki#vars#number_of_wikis()
 | 
			
		||||
          return []
 | 
			
		||||
        endif
 | 
			
		||||
        let prefix = matchstr(a:base, '\m^wiki\d\+:\zs.*')
 | 
			
		||||
        let scheme = matchstr(a:base, '\m^wiki\d\+:\ze')
 | 
			
		||||
      elseif a:base =~# '^diary:'
 | 
			
		||||
        let directory = VimwikiGet('path').'/'.VimwikiGet('diary_rel_path')
 | 
			
		||||
        let ext = VimwikiGet('ext')
 | 
			
		||||
        let wikinumber = -1
 | 
			
		||||
        let prefix = matchstr(a:base, '^diary:\zs.*')
 | 
			
		||||
        let scheme = matchstr(a:base, '^diary:\ze')
 | 
			
		||||
      else
 | 
			
		||||
        let directory = VimwikiGet('path')
 | 
			
		||||
        let ext = VimwikiGet('ext')
 | 
			
		||||
      else " current wiki
 | 
			
		||||
        let wikinumber = vimwiki#vars#get_bufferlocal('wiki_nr')
 | 
			
		||||
        let prefix = a:base
 | 
			
		||||
        let scheme = ''
 | 
			
		||||
      endif
 | 
			
		||||
 | 
			
		||||
      let links = vimwiki#base#get_wikilinks(wikinumber, 1)
 | 
			
		||||
      let result = []
 | 
			
		||||
      for wikifile in split(globpath(directory, '**/*'.ext), '\n')
 | 
			
		||||
        " get the filename relative to the wiki path:
 | 
			
		||||
        let subdir_filename = substitute(fnamemodify(wikifile, ':p:r'),
 | 
			
		||||
              \ '\V'.fnamemodify(directory, ':p'), '', '')
 | 
			
		||||
        if subdir_filename =~ '^'.prefix
 | 
			
		||||
          call add(result, scheme . subdir_filename)
 | 
			
		||||
      for wikifile in links
 | 
			
		||||
        if wikifile =~ '^'.vimwiki#u#escape(prefix)
 | 
			
		||||
          call add(result, scheme . wikifile)
 | 
			
		||||
        endif
 | 
			
		||||
      endfor
 | 
			
		||||
      return result
 | 
			
		||||
@@ -100,82 +93,29 @@ function! g:complete_wikifiles(findstart, base)
 | 
			
		||||
      " we look for anchors in the given wikifile
 | 
			
		||||
 | 
			
		||||
      let segments = split(a:base, '#', 1)
 | 
			
		||||
      let link_infos = vimwiki#base#resolve_scheme(segments[0].'#', 0)
 | 
			
		||||
      let wikifile = link_infos[6]
 | 
			
		||||
      let syntax = VimwikiGet('syntax', link_infos[0])
 | 
			
		||||
      let rxheader = g:vimwiki_{syntax}_header_search
 | 
			
		||||
      let rxbold = g:vimwiki_{syntax}_bold_search
 | 
			
		||||
      if !filereadable(wikifile)
 | 
			
		||||
        return []
 | 
			
		||||
      endif
 | 
			
		||||
      let filecontent = readfile(wikifile)
 | 
			
		||||
      let anchor_level = ['', '', '', '', '', '', '']
 | 
			
		||||
      let anchors = []
 | 
			
		||||
 | 
			
		||||
      for line in filecontent
 | 
			
		||||
 | 
			
		||||
        " collect headers
 | 
			
		||||
        let h_match = matchlist(line, rxheader)
 | 
			
		||||
        if !empty(h_match)
 | 
			
		||||
          let header = vimwiki#u#trim(h_match[2])
 | 
			
		||||
          let level = len(h_match[1])
 | 
			
		||||
          let anchor_level[level-1] = header
 | 
			
		||||
          for l in range(level, 6)
 | 
			
		||||
            let anchor_level[l] = ''
 | 
			
		||||
          endfor
 | 
			
		||||
          call add(anchors, header)
 | 
			
		||||
          let complete_anchor = ''
 | 
			
		||||
          for l in range(level-1)
 | 
			
		||||
            if anchor_level[l] != ''
 | 
			
		||||
              let complete_anchor .= anchor_level[l].'#'
 | 
			
		||||
            endif
 | 
			
		||||
          endfor
 | 
			
		||||
          let complete_anchor .= header
 | 
			
		||||
          call add(anchors, complete_anchor)
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        " collect bold text (there can be several in one line)
 | 
			
		||||
        let bold_count = 0
 | 
			
		||||
        let bold_end = 0
 | 
			
		||||
        while 1
 | 
			
		||||
          let bold_text = matchstr(line, rxbold, bold_end, bold_count)
 | 
			
		||||
          let bold_end = matchend(line, rxbold, bold_end, bold_count) + 1
 | 
			
		||||
          if bold_text == ""
 | 
			
		||||
            break
 | 
			
		||||
          endif
 | 
			
		||||
          let anchor_level[6] = bold_text
 | 
			
		||||
          call add(anchors, bold_text)
 | 
			
		||||
          let complete_anchor = ''
 | 
			
		||||
          for l in range(6)
 | 
			
		||||
            if anchor_level[l] != ''
 | 
			
		||||
              let complete_anchor .= anchor_level[l].'#'
 | 
			
		||||
            endif
 | 
			
		||||
          endfor
 | 
			
		||||
          let complete_anchor .= bold_text
 | 
			
		||||
          call add(anchors, complete_anchor)
 | 
			
		||||
          let bold_count += 1
 | 
			
		||||
        endwhile
 | 
			
		||||
 | 
			
		||||
      endfor
 | 
			
		||||
      let given_wikifile = segments[0] == '' ? expand('%:t:r') : segments[0]
 | 
			
		||||
      let link_infos = vimwiki#base#resolve_link(given_wikifile.'#')
 | 
			
		||||
      let wikifile = link_infos.filename
 | 
			
		||||
      let syntax = vimwiki#vars#get_wikilocal('syntax', link_infos.index)
 | 
			
		||||
      let anchors = vimwiki#base#get_anchors(wikifile, syntax)
 | 
			
		||||
 | 
			
		||||
      let filtered_anchors = []
 | 
			
		||||
      let given_anchor = join(segments[1:], '#')
 | 
			
		||||
      for anchor in anchors
 | 
			
		||||
        if anchor =~# '^'.given_anchor
 | 
			
		||||
        if anchor =~# '^'.vimwiki#u#escape(given_anchor)
 | 
			
		||||
          call add(filtered_anchors, segments[0].'#'.anchor)
 | 
			
		||||
        endif
 | 
			
		||||
      endfor
 | 
			
		||||
 | 
			
		||||
      return filtered_anchors
 | 
			
		||||
 | 
			
		||||
    endif
 | 
			
		||||
  endif
 | 
			
		||||
endfunction
 | 
			
		||||
setlocal omnifunc=g:complete_wikifiles
 | 
			
		||||
" omnicomplete }}}
 | 
			
		||||
 | 
			
		||||
" MISC }}}
 | 
			
		||||
setlocal omnifunc=Complete_wikifiles
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
" LIST STUFF {{{
 | 
			
		||||
" settings necessary for the automatic formatting of lists
 | 
			
		||||
setlocal autoindent
 | 
			
		||||
setlocal nosmartindent
 | 
			
		||||
@@ -187,8 +127,7 @@ setlocal formatoptions-=o
 | 
			
		||||
setlocal formatoptions-=2
 | 
			
		||||
setlocal formatoptions+=n
 | 
			
		||||
 | 
			
		||||
"Create 'formatlistpat'
 | 
			
		||||
let &formatlistpat = g:vimwiki_rxListItem
 | 
			
		||||
let &formatlistpat = vimwiki#vars#get_syntaxlocal('rxListItem')
 | 
			
		||||
 | 
			
		||||
if !empty(&langmap)
 | 
			
		||||
  " Valid only if langmap is a comma separated pairs of chars
 | 
			
		||||
@@ -203,67 +142,76 @@ if !empty(&langmap)
 | 
			
		||||
  endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
" LIST STUFF }}}
 | 
			
		||||
 | 
			
		||||
" FOLDING {{{
 | 
			
		||||
" Folding list items {{{
 | 
			
		||||
function! VimwikiFoldListLevel(lnum) "{{{
 | 
			
		||||
 | 
			
		||||
" ------------------------------------------------
 | 
			
		||||
" Folding stuff
 | 
			
		||||
" ------------------------------------------------
 | 
			
		||||
 | 
			
		||||
function! VimwikiFoldListLevel(lnum)
 | 
			
		||||
  return vimwiki#lst#fold_level(a:lnum)
 | 
			
		||||
endfunction "}}}
 | 
			
		||||
" Folding list items }}}
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" Folding sections and code blocks {{{
 | 
			
		||||
function! VimwikiFoldLevel(lnum) "{{{
 | 
			
		||||
 | 
			
		||||
function! VimwikiFoldLevel(lnum)
 | 
			
		||||
  let line = getline(a:lnum)
 | 
			
		||||
 | 
			
		||||
  " Header/section folding...
 | 
			
		||||
  if line =~ g:vimwiki_rxHeader
 | 
			
		||||
  if line =~# vimwiki#vars#get_syntaxlocal('rxHeader')
 | 
			
		||||
    return '>'.vimwiki#u#count_first_sym(line)
 | 
			
		||||
  " Code block folding...
 | 
			
		||||
  elseif line =~ '^\s*'.g:vimwiki_rxPreStart
 | 
			
		||||
  elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
 | 
			
		||||
    return 'a1'
 | 
			
		||||
  elseif line =~ '^\s*'.g:vimwiki_rxPreEnd.'\s*$'
 | 
			
		||||
  elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
 | 
			
		||||
    return 's1'
 | 
			
		||||
  else
 | 
			
		||||
    return "="
 | 
			
		||||
  endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
endfunction "}}}
 | 
			
		||||
 | 
			
		||||
" Constants used by VimwikiFoldText {{{
 | 
			
		||||
" Constants used by VimwikiFoldText
 | 
			
		||||
" use \u2026 and \u21b2 (or \u2424) if enc=utf-8 to save screen space
 | 
			
		||||
let s:ellipsis = (&enc ==? 'utf-8') ? "\u2026" : "..."
 | 
			
		||||
let s:ell_len = strlen(s:ellipsis)
 | 
			
		||||
let s:newline = (&enc ==? 'utf-8') ? "\u21b2 " : "  "
 | 
			
		||||
let s:tolerance = 5
 | 
			
		||||
" }}}
 | 
			
		||||
 | 
			
		||||
function! s:shorten_text_simple(text, len) "{{{ unused
 | 
			
		||||
 | 
			
		||||
" unused
 | 
			
		||||
function! s:shorten_text_simple(text, len)
 | 
			
		||||
  let spare_len = a:len - len(a:text)
 | 
			
		||||
  return (spare_len>=0) ? [a:text,spare_len] : [a:text[0:a:len].s:ellipsis, -1]
 | 
			
		||||
endfunction "}}}
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
" s:shorten_text(text, len) = [string, spare] with "spare" = len-strlen(string)
 | 
			
		||||
" for long enough "text", the string's length is within s:tolerance of "len"
 | 
			
		||||
" (so that -s:tolerance <= spare <= s:tolerance, "string" ends with s:ellipsis)
 | 
			
		||||
function! s:shorten_text(text, len) "{{{ returns [string, spare]
 | 
			
		||||
  let spare_len = a:len - strlen(a:text)
 | 
			
		||||
function! s:shorten_text(text, len)
 | 
			
		||||
  " returns [string, spare]
 | 
			
		||||
  " strlen() returns lenght in bytes, not in characters, so we'll have to do a
 | 
			
		||||
  " trick here -- replace all non-spaces with dot, calculate lengths and
 | 
			
		||||
  " indexes on it, then use original string to break at selected index.
 | 
			
		||||
  let text_pattern = substitute(a:text, '\m\S', '.', 'g')
 | 
			
		||||
  let spare_len = a:len - strlen(text_pattern)
 | 
			
		||||
  if (spare_len + s:tolerance >= 0)
 | 
			
		||||
    return [a:text, spare_len]
 | 
			
		||||
  endif
 | 
			
		||||
  " try to break on a space; assumes a:len-s:ell_len >= s:tolerance
 | 
			
		||||
  let newlen = a:len - s:ell_len
 | 
			
		||||
  let idx = strridx(a:text, ' ', newlen + s:tolerance)
 | 
			
		||||
  let idx = strridx(text_pattern, ' ', newlen + s:tolerance)
 | 
			
		||||
  let break_idx = (idx + s:tolerance >= newlen) ? idx : newlen
 | 
			
		||||
  return [a:text[0:break_idx].s:ellipsis, newlen - break_idx]
 | 
			
		||||
endfunction "}}}
 | 
			
		||||
  return [matchstr(a:text, '\m^.\{'.break_idx.'\}').s:ellipsis, newlen - break_idx]
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! VimwikiFoldText() "{{{
 | 
			
		||||
 | 
			
		||||
function! VimwikiFoldText()
 | 
			
		||||
  let line = getline(v:foldstart)
 | 
			
		||||
  let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '')
 | 
			
		||||
  let fold_len = v:foldend - v:foldstart + 1
 | 
			
		||||
  let len_text = ' ['.fold_len.'] '
 | 
			
		||||
  if line !~ '^\s*'.g:vimwiki_rxPreStart
 | 
			
		||||
  if line !~# vimwiki#vars#get_syntaxlocal('rxPreStart')
 | 
			
		||||
    let [main_text, spare_len] = s:shorten_text(main_text, 50)
 | 
			
		||||
    return main_text.len_text
 | 
			
		||||
  else
 | 
			
		||||
@@ -278,25 +226,30 @@ function! VimwikiFoldText() "{{{
 | 
			
		||||
    endif
 | 
			
		||||
    return main_text.len_text.content_text
 | 
			
		||||
  endif
 | 
			
		||||
endfunction "}}}
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" Folding sections and code blocks }}}
 | 
			
		||||
" FOLDING }}}
 | 
			
		||||
 | 
			
		||||
" COMMANDS {{{
 | 
			
		||||
 | 
			
		||||
" ------------------------------------------------
 | 
			
		||||
" Commands
 | 
			
		||||
" ------------------------------------------------
 | 
			
		||||
 | 
			
		||||
command! -buffer Vimwiki2HTML
 | 
			
		||||
      \ silent noautocmd w <bar>
 | 
			
		||||
      \ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
 | 
			
		||||
      \ if filewritable(expand('%')) | silent noautocmd w | endif
 | 
			
		||||
      \ <bar>
 | 
			
		||||
      \ let res = vimwiki#html#Wiki2HTML(expand(vimwiki#vars#get_wikilocal('path_html')),
 | 
			
		||||
      \                             expand('%'))
 | 
			
		||||
      \<bar>
 | 
			
		||||
      \ if res != '' | echo 'Vimwiki: HTML conversion is done.' | endif
 | 
			
		||||
      \ <bar>
 | 
			
		||||
      \ if res != '' | echo 'Vimwiki: HTML conversion is done, output: '
 | 
			
		||||
      \      . expand(vimwiki#vars#get_wikilocal('path_html')) | endif
 | 
			
		||||
command! -buffer Vimwiki2HTMLBrowse
 | 
			
		||||
      \ silent noautocmd w <bar>
 | 
			
		||||
      \ if filewritable(expand('%')) | silent noautocmd w | endif
 | 
			
		||||
      \ <bar>
 | 
			
		||||
      \ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
 | 
			
		||||
      \         expand(VimwikiGet('path_html')),
 | 
			
		||||
      \         expand(vimwiki#vars#get_wikilocal('path_html')),
 | 
			
		||||
      \         expand('%')))
 | 
			
		||||
command! -buffer VimwikiAll2HTML
 | 
			
		||||
      \ call vimwiki#html#WikiAll2HTML(expand(VimwikiGet('path_html')))
 | 
			
		||||
      \ call vimwiki#html#WikiAll2HTML(expand(vimwiki#vars#get_wikilocal('path_html')))
 | 
			
		||||
 | 
			
		||||
command! -buffer VimwikiTOC call vimwiki#base#table_of_contents(1)
 | 
			
		||||
 | 
			
		||||
@@ -304,14 +257,14 @@ command! -buffer VimwikiNextLink call vimwiki#base#find_next_link()
 | 
			
		||||
command! -buffer VimwikiPrevLink call vimwiki#base#find_prev_link()
 | 
			
		||||
command! -buffer VimwikiDeleteLink call vimwiki#base#delete_link()
 | 
			
		||||
command! -buffer VimwikiRenameLink call vimwiki#base#rename_link()
 | 
			
		||||
command! -buffer VimwikiFollowLink call vimwiki#base#follow_link('nosplit')
 | 
			
		||||
command! -buffer VimwikiFollowLink call vimwiki#base#follow_link('nosplit', 0, 1)
 | 
			
		||||
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=* VimwikiSplitLink call vimwiki#base#follow_link('hsplit', <f-args>)
 | 
			
		||||
command! -buffer -nargs=* VimwikiVSplitLink call vimwiki#base#follow_link('vsplit', <f-args>)
 | 
			
		||||
 | 
			
		||||
command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(<f-args>)
 | 
			
		||||
 | 
			
		||||
command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tabnew')
 | 
			
		||||
command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tab', 0, 1)
 | 
			
		||||
 | 
			
		||||
command! -buffer VimwikiGenerateLinks call vimwiki#base#generate_links()
 | 
			
		||||
 | 
			
		||||
@@ -319,21 +272,31 @@ 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'), ' ')
 | 
			
		||||
      \ escape(vimwiki#vars#get_wikilocal('path').'**/*'.vimwiki#vars#get_wikilocal('ext'), ' ')
 | 
			
		||||
 | 
			
		||||
exe 'command! -buffer -nargs=* VWS lvimgrep <args> '.
 | 
			
		||||
      \ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
 | 
			
		||||
      \ escape(vimwiki#vars#get_wikilocal('path').'**/*'.vimwiki#vars#get_wikilocal('ext'), ' ')
 | 
			
		||||
 | 
			
		||||
command! -buffer -nargs=+ VimwikiGoto call vimwiki#base#goto(<f-args>)
 | 
			
		||||
command! -buffer -nargs=+ -complete=custom,vimwiki#base#complete_links_escaped
 | 
			
		||||
      \ VimwikiGoto call vimwiki#base#goto(<f-args>)
 | 
			
		||||
 | 
			
		||||
command! -buffer VimwikiCheckLinks call vimwiki#base#check_links()
 | 
			
		||||
 | 
			
		||||
" list commands
 | 
			
		||||
command! -buffer -nargs=+ VimwikiReturn call <SID>CR(<f-args>)
 | 
			
		||||
command! -buffer -range -nargs=1 VimwikiChangeSymbolTo call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>, 'n')
 | 
			
		||||
command! -buffer -range -nargs=1 VimwikiListChangeSymbolI call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>, 'i')
 | 
			
		||||
command! -buffer -nargs=1 VimwikiChangeSymbolInListTo call vimwiki#lst#change_marker_in_list(<f-args>)
 | 
			
		||||
command! -buffer -range -nargs=1 VimwikiChangeSymbolTo
 | 
			
		||||
      \ call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>, 'n')
 | 
			
		||||
command! -buffer -range -nargs=1 VimwikiListChangeSymbolI
 | 
			
		||||
      \ call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>, 'i')
 | 
			
		||||
command! -buffer -nargs=1 VimwikiChangeSymbolInListTo
 | 
			
		||||
      \ call vimwiki#lst#change_marker_in_list(<f-args>)
 | 
			
		||||
command! -buffer -range VimwikiToggleListItem call vimwiki#lst#toggle_cb(<line1>, <line2>)
 | 
			
		||||
command! -buffer -range -nargs=+ VimwikiListChangeLvl call vimwiki#lst#change_level(<line1>, <line2>, <f-args>)
 | 
			
		||||
command! -buffer -range VimwikiToggleRejectedListItem
 | 
			
		||||
      \ call vimwiki#lst#toggle_rejected_cb(<line1>, <line2>)
 | 
			
		||||
command! -buffer -range VimwikiIncrementListItem call vimwiki#lst#increment_cb(<line1>, <line2>)
 | 
			
		||||
command! -buffer -range VimwikiDecrementListItem call vimwiki#lst#decrement_cb(<line1>, <line2>)
 | 
			
		||||
command! -buffer -range -nargs=+ VimwikiListChangeLvl
 | 
			
		||||
      \ call vimwiki#lst#change_level(<line1>, <line2>, <f-args>)
 | 
			
		||||
command! -buffer -range VimwikiRemoveSingleCB call vimwiki#lst#remove_cb(<line1>, <line2>)
 | 
			
		||||
command! -buffer VimwikiRemoveCBInList call vimwiki#lst#remove_cb_in_list()
 | 
			
		||||
command! -buffer VimwikiRenumberList call vimwiki#lst#adjust_numbered_list()
 | 
			
		||||
@@ -351,13 +314,26 @@ command! -buffer VimwikiTableMoveColumnRight call vimwiki#tbl#move_column_right(
 | 
			
		||||
command! -buffer VimwikiDiaryNextDay call vimwiki#diary#goto_next_day()
 | 
			
		||||
command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day()
 | 
			
		||||
 | 
			
		||||
" COMMANDS }}}
 | 
			
		||||
" tags commands
 | 
			
		||||
command! -buffer -bang VimwikiRebuildTags call vimwiki#tags#update_tags(1, '<bang>')
 | 
			
		||||
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
 | 
			
		||||
      \ VimwikiSearchTags VimwikiSearch /:<args>:/
 | 
			
		||||
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
 | 
			
		||||
      \ VimwikiGenerateTags call vimwiki#tags#generate_tags(<f-args>)
 | 
			
		||||
 | 
			
		||||
" KEYBINDINGS {{{
 | 
			
		||||
if g:vimwiki_use_mouse
 | 
			
		||||
command! -buffer VimwikiPasteUrl call vimwiki#html#PasteUrl(expand('%:p'))
 | 
			
		||||
command! -buffer VimwikiCatUrl call vimwiki#html#CatUrl(expand('%:p'))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
" ------------------------------------------------
 | 
			
		||||
" Keybindings
 | 
			
		||||
" ------------------------------------------------
 | 
			
		||||
 | 
			
		||||
if vimwiki#vars#get_global('use_mouse')
 | 
			
		||||
  nmap <buffer> <S-LeftMouse> <NOP>
 | 
			
		||||
  nmap <buffer> <C-LeftMouse> <NOP>
 | 
			
		||||
  nnoremap <silent><buffer> <2-LeftMouse> :call vimwiki#base#follow_link("nosplit", "\<lt>2-LeftMouse>")<CR>
 | 
			
		||||
  nnoremap <silent><buffer> <2-LeftMouse>
 | 
			
		||||
        \ :call vimwiki#base#follow_link('nosplit', 0, 1, "\<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>
 | 
			
		||||
@@ -365,46 +341,39 @@ endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>Vimwiki2HTML')
 | 
			
		||||
  nmap <buffer> <Leader>wh <Plug>Vimwiki2HTML
 | 
			
		||||
  exe 'nmap <buffer> '.vimwiki#vars#get_global('map_prefix').'h <Plug>Vimwiki2HTML'
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <script><buffer>
 | 
			
		||||
      \ <Plug>Vimwiki2HTML :Vimwiki2HTML<CR>
 | 
			
		||||
nnoremap <script><buffer> <Plug>Vimwiki2HTML :Vimwiki2HTML<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>Vimwiki2HTMLBrowse')
 | 
			
		||||
  nmap <buffer> <Leader>whh <Plug>Vimwiki2HTMLBrowse
 | 
			
		||||
  exe 'nmap <buffer> '.vimwiki#vars#get_global('map_prefix').'hh <Plug>Vimwiki2HTMLBrowse'
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <script><buffer>
 | 
			
		||||
      \ <Plug>Vimwiki2HTMLBrowse :Vimwiki2HTMLBrowse<CR>
 | 
			
		||||
nnoremap <script><buffer> <Plug>Vimwiki2HTMLBrowse :Vimwiki2HTMLBrowse<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiFollowLink')
 | 
			
		||||
  nmap <silent><buffer> <CR> <Plug>VimwikiFollowLink
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiFollowLink :VimwikiFollowLink<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiFollowLink :VimwikiFollowLink<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiSplitLink')
 | 
			
		||||
  nmap <silent><buffer> <S-CR> <Plug>VimwikiSplitLink
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiSplitLink :VimwikiSplitLink<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiSplitLink :VimwikiSplitLink<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiVSplitLink')
 | 
			
		||||
  nmap <silent><buffer> <C-CR> <Plug>VimwikiVSplitLink
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiVSplitLink :VimwikiVSplitLink<CR>
 | 
			
		||||
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>
 | 
			
		||||
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>
 | 
			
		||||
vnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLinkVisual :<C-U>VimwikiNormalizeLink 1<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiNormalizeLinkVisualCR')
 | 
			
		||||
  vmap <silent><buffer> <CR> <Plug>VimwikiNormalizeLinkVisualCR
 | 
			
		||||
@@ -416,50 +385,42 @@ if !hasmapto('<Plug>VimwikiTabnewLink')
 | 
			
		||||
  nmap <silent><buffer> <D-CR> <Plug>VimwikiTabnewLink
 | 
			
		||||
  nmap <silent><buffer> <C-S-CR> <Plug>VimwikiTabnewLink
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiTabnewLink :VimwikiTabnewLink<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiTabnewLink :VimwikiTabnewLink<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiGoBackLink')
 | 
			
		||||
  nmap <silent><buffer> <BS> <Plug>VimwikiGoBackLink
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiGoBackLink :VimwikiGoBackLink<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiGoBackLink :VimwikiGoBackLink<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiNextLink')
 | 
			
		||||
  nmap <silent><buffer> <TAB> <Plug>VimwikiNextLink
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiNextLink :VimwikiNextLink<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiNextLink :VimwikiNextLink<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiPrevLink')
 | 
			
		||||
  nmap <silent><buffer> <S-TAB> <Plug>VimwikiPrevLink
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiPrevLink :VimwikiPrevLink<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiPrevLink :VimwikiPrevLink<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiDeleteLink')
 | 
			
		||||
  nmap <silent><buffer> <Leader>wd <Plug>VimwikiDeleteLink
 | 
			
		||||
  exe 'nmap <silent><buffer> '.vimwiki#vars#get_global('map_prefix').'d <Plug>VimwikiDeleteLink'
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiDeleteLink :VimwikiDeleteLink<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiDeleteLink :VimwikiDeleteLink<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiRenameLink')
 | 
			
		||||
  nmap <silent><buffer> <Leader>wr <Plug>VimwikiRenameLink
 | 
			
		||||
  exe 'nmap <silent><buffer> '.vimwiki#vars#get_global('map_prefix').'r <Plug>VimwikiRenameLink'
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiDiaryNextDay')
 | 
			
		||||
  nmap <silent><buffer> <C-Down> <Plug>VimwikiDiaryNextDay
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiDiaryNextDay :VimwikiDiaryNextDay<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiDiaryNextDay :VimwikiDiaryNextDay<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiDiaryPrevDay')
 | 
			
		||||
  nmap <silent><buffer> <C-Up> <Plug>VimwikiDiaryPrevDay
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR>
 | 
			
		||||
 | 
			
		||||
" List mappings
 | 
			
		||||
if !hasmapto('<Plug>VimwikiToggleListItem')
 | 
			
		||||
@@ -470,35 +431,50 @@ if !hasmapto('<Plug>VimwikiToggleListItem')
 | 
			
		||||
    vmap <silent><buffer> <C-@> <Plug>VimwikiToggleListItem
 | 
			
		||||
  endif
 | 
			
		||||
endif
 | 
			
		||||
if !hasmapto('<Plug>VimwikiToggleRejectedListItem')
 | 
			
		||||
  nmap <silent><buffer> glx <Plug>VimwikiToggleRejectedListItem
 | 
			
		||||
  vmap <silent><buffer> glx <Plug>VimwikiToggleRejectedListItem
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
 | 
			
		||||
vnoremap <silent><script><buffer> <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
 | 
			
		||||
      \ <Plug>VimwikiToggleRejectedListItem :VimwikiToggleRejectedListItem<CR>
 | 
			
		||||
vnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
 | 
			
		||||
      \ <Plug>VimwikiToggleRejectedListItem :VimwikiToggleRejectedListItem<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiIncrementListItem')
 | 
			
		||||
  nmap <silent><buffer> gln <Plug>VimwikiIncrementListItem
 | 
			
		||||
  vmap <silent><buffer> gln <Plug>VimwikiIncrementListItem
 | 
			
		||||
endif
 | 
			
		||||
if !hasmapto('<Plug>VimwikiDecrementListItem')
 | 
			
		||||
  nmap <silent><buffer> glp <Plug>VimwikiDecrementListItem
 | 
			
		||||
  vmap <silent><buffer> glp <Plug>VimwikiDecrementListItem
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiIncrementListItem :VimwikiIncrementListItem<CR>
 | 
			
		||||
vnoremap <silent><script><buffer> <Plug>VimwikiIncrementListItem :VimwikiIncrementListItem<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiDecrementListItem :VimwikiDecrementListItem<CR>
 | 
			
		||||
vnoremap <silent><script><buffer> <Plug>VimwikiDecrementListItem :VimwikiDecrementListItem<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiDecreaseLvlSingleItem', 'i')
 | 
			
		||||
  imap <silent><buffer> <C-D>
 | 
			
		||||
        \ <Plug>VimwikiDecreaseLvlSingleItem
 | 
			
		||||
  imap <silent><buffer> <C-D> <Plug>VimwikiDecreaseLvlSingleItem
 | 
			
		||||
endif
 | 
			
		||||
inoremap <silent><script><buffer> <Plug>VimwikiDecreaseLvlSingleItem
 | 
			
		||||
    \ <C-O>:VimwikiListChangeLvl decrease 0<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiIncreaseLvlSingleItem', 'i')
 | 
			
		||||
  imap <silent><buffer> <C-T>
 | 
			
		||||
        \ <Plug>VimwikiIncreaseLvlSingleItem
 | 
			
		||||
  imap <silent><buffer> <C-T> <Plug>VimwikiIncreaseLvlSingleItem
 | 
			
		||||
endif
 | 
			
		||||
inoremap <silent><script><buffer> <Plug>VimwikiIncreaseLvlSingleItem
 | 
			
		||||
    \ <C-O>:VimwikiListChangeLvl increase 0<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiListNextSymbol', 'i')
 | 
			
		||||
  imap <silent><buffer> <C-L><C-J>
 | 
			
		||||
        \ <Plug>VimwikiListNextSymbol
 | 
			
		||||
  imap <silent><buffer> <C-L><C-J> <Plug>VimwikiListNextSymbol
 | 
			
		||||
endif
 | 
			
		||||
inoremap <silent><script><buffer> <Plug>VimwikiListNextSymbol
 | 
			
		||||
      \ <C-O>:VimwikiListChangeSymbolI next<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiListPrevSymbol', 'i')
 | 
			
		||||
  imap <silent><buffer> <C-L><C-K>
 | 
			
		||||
        \ <Plug>VimwikiListPrevSymbol
 | 
			
		||||
  imap <silent><buffer> <C-L><C-K> <Plug>VimwikiListPrevSymbol
 | 
			
		||||
endif
 | 
			
		||||
inoremap <silent><script><buffer> <Plug>VimwikiListPrevSymbol
 | 
			
		||||
      \ <C-O>:VimwikiListChangeSymbolI prev<CR>
 | 
			
		||||
@@ -508,21 +484,19 @@ if !hasmapto('<Plug>VimwikiListToggle', 'i')
 | 
			
		||||
endif
 | 
			
		||||
inoremap <silent><script><buffer> <Plug>VimwikiListToggle <Esc>:VimwikiListToggle<CR>
 | 
			
		||||
 | 
			
		||||
nnoremap <silent> <buffer> o :call vimwiki#lst#kbd_o()<CR>
 | 
			
		||||
nnoremap <silent> <buffer> O :call vimwiki#lst#kbd_O()<CR>
 | 
			
		||||
nnoremap <silent> <buffer> o :<C-U>call vimwiki#lst#kbd_o()<CR>
 | 
			
		||||
nnoremap <silent> <buffer> O :<C-U>call vimwiki#lst#kbd_O()<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiRenumberList')
 | 
			
		||||
  nmap <silent><buffer> glr <Plug>VimwikiRenumberList
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiRenumberList :VimwikiRenumberList<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiRenumberList :VimwikiRenumberList<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiRenumberAllLists')
 | 
			
		||||
  nmap <silent><buffer> gLr <Plug>VimwikiRenumberAllLists
 | 
			
		||||
  nmap <silent><buffer> gLR <Plug>VimwikiRenumberAllLists
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiRenumberAllLists :VimwikiRenumberAllLists<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiRenumberAllLists :VimwikiRenumberAllLists<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiDecreaseLvlSingleItem')
 | 
			
		||||
  map <silent><buffer> glh <Plug>VimwikiDecreaseLvlSingleItem
 | 
			
		||||
@@ -553,39 +527,34 @@ noremap <silent><script><buffer>
 | 
			
		||||
if !hasmapto('<Plug>VimwikiRemoveSingleCB')
 | 
			
		||||
  map <silent><buffer> gl<Space> <Plug>VimwikiRemoveSingleCB
 | 
			
		||||
endif
 | 
			
		||||
noremap <silent><script><buffer>
 | 
			
		||||
    \ <Plug>VimwikiRemoveSingleCB :VimwikiRemoveSingleCB<CR>
 | 
			
		||||
noremap <silent><script><buffer> <Plug>VimwikiRemoveSingleCB :VimwikiRemoveSingleCB<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiRemoveCBInList')
 | 
			
		||||
  map <silent><buffer> gL<Space> <Plug>VimwikiRemoveCBInList
 | 
			
		||||
endif
 | 
			
		||||
noremap <silent><script><buffer>
 | 
			
		||||
    \ <Plug>VimwikiRemoveCBInList :VimwikiRemoveCBInList<CR>
 | 
			
		||||
noremap <silent><script><buffer> <Plug>VimwikiRemoveCBInList :VimwikiRemoveCBInList<CR>
 | 
			
		||||
 | 
			
		||||
for s:k in keys(g:vimwiki_bullet_types)
 | 
			
		||||
  let s:char = (s:k == '•' ? '.' : s:k)
 | 
			
		||||
 | 
			
		||||
  if !hasmapto(':VimwikiChangeSymbolTo '.s:k.'<CR>')
 | 
			
		||||
    exe 'noremap <silent><buffer> gl'.s:char.' :VimwikiChangeSymbolTo '.s:k.'<CR>'
 | 
			
		||||
for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
 | 
			
		||||
  if !hasmapto(':VimwikiChangeSymbolTo '.s:char.'<CR>')
 | 
			
		||||
    exe 'noremap <silent><buffer> gl'.s:char.' :VimwikiChangeSymbolTo '.s:char.'<CR>'
 | 
			
		||||
  endif
 | 
			
		||||
  if !hasmapto(':VimwikiChangeSymbolInListTo '.s:k.'<CR>')
 | 
			
		||||
    exe 'noremap <silent><buffer> gL'.s:char.' :VimwikiChangeSymbolInListTo '.s:k.'<CR>'
 | 
			
		||||
  if !hasmapto(':VimwikiChangeSymbolInListTo '.s:char.'<CR>')
 | 
			
		||||
    exe 'noremap <silent><buffer> gL'.s:char.' :VimwikiChangeSymbolInListTo '.s:char.'<CR>'
 | 
			
		||||
  endif
 | 
			
		||||
 | 
			
		||||
endfor
 | 
			
		||||
for s:k in g:vimwiki_number_types
 | 
			
		||||
  if !hasmapto(':VimwikiChangeSymbolTo '.s:k.'<CR>')
 | 
			
		||||
    exe 'noremap <silent><buffer> gl'.s:k[0].' :VimwikiChangeSymbolTo '.s:k.'<CR>'
 | 
			
		||||
 | 
			
		||||
for s:typ in vimwiki#vars#get_syntaxlocal('number_types')
 | 
			
		||||
  if !hasmapto(':VimwikiChangeSymbolTo '.s:typ.'<CR>')
 | 
			
		||||
    exe 'noremap <silent><buffer> gl'.s:typ[0].' :VimwikiChangeSymbolTo '.s:typ.'<CR>'
 | 
			
		||||
  endif
 | 
			
		||||
  if !hasmapto(':VimwikiChangeSymbolInListTo '.s:k.'<CR>')
 | 
			
		||||
    exe 'noremap <silent><buffer> gL'.s:k[0].' :VimwikiChangeSymbolInListTo '.s:k.'<CR>'
 | 
			
		||||
  if !hasmapto(':VimwikiChangeSymbolInListTo '.s:typ.'<CR>')
 | 
			
		||||
    exe 'noremap <silent><buffer> gL'.s:typ[0].' :VimwikiChangeSymbolInListTo '.s:typ.'<CR>'
 | 
			
		||||
  endif
 | 
			
		||||
endfor
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function! s:CR(normal, just_mrkr) "{{{
 | 
			
		||||
  if g:vimwiki_table_mappings
 | 
			
		||||
function! s:CR(normal, just_mrkr)
 | 
			
		||||
  if vimwiki#vars#get_global('table_mappings')
 | 
			
		||||
    let res = vimwiki#tbl#kbd_cr()
 | 
			
		||||
    if res != ""
 | 
			
		||||
      exe "normal! " . res . "\<Right>"
 | 
			
		||||
@@ -594,18 +563,19 @@ function! s:CR(normal, just_mrkr) "{{{
 | 
			
		||||
    endif
 | 
			
		||||
  endif
 | 
			
		||||
  call vimwiki#lst#kbd_cr(a:normal, a:just_mrkr)
 | 
			
		||||
endfunction "}}}
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
if maparg('<CR>', 'i') !~? '<Esc>:VimwikiReturn'
 | 
			
		||||
  inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 1 5<CR>
 | 
			
		||||
if !hasmapto('VimwikiReturn', 'i')
 | 
			
		||||
  if maparg('<CR>', 'i') !~? '<Esc>:VimwikiReturn'
 | 
			
		||||
    inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 1 5<CR>
 | 
			
		||||
  endif
 | 
			
		||||
  if maparg('<S-CR>', 'i') !~? '<Esc>:VimwikiReturn'
 | 
			
		||||
    inoremap <silent><buffer> <S-CR> <Esc>:VimwikiReturn 2 2<CR>
 | 
			
		||||
  endif
 | 
			
		||||
endif
 | 
			
		||||
if maparg('<S-CR>', 'i') !~? '<Esc>:VimwikiReturn'
 | 
			
		||||
  inoremap <silent><buffer> <S-CR> <Esc>:VimwikiReturn 2 2<CR>
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
"Table mappings
 | 
			
		||||
 if g:vimwiki_table_mappings
 | 
			
		||||
 if vimwiki#vars#get_global('table_mappings')
 | 
			
		||||
   inoremap <expr> <buffer> <Tab> vimwiki#tbl#kbd_tab()
 | 
			
		||||
   inoremap <expr> <buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab()
 | 
			
		||||
 endif
 | 
			
		||||
@@ -619,8 +589,7 @@ nnoremap <buffer> gw1 :VimwikiTableAlignW 2<CR>
 | 
			
		||||
if !hasmapto('<Plug>VimwikiTableMoveColumnLeft')
 | 
			
		||||
  nmap <silent><buffer> <A-Left> <Plug>VimwikiTableMoveColumnLeft
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><script><buffer>
 | 
			
		||||
      \ <Plug>VimwikiTableMoveColumnLeft :VimwikiTableMoveColumnLeft<CR>
 | 
			
		||||
nnoremap <silent><script><buffer> <Plug>VimwikiTableMoveColumnLeft :VimwikiTableMoveColumnLeft<CR>
 | 
			
		||||
if !hasmapto('<Plug>VimwikiTableMoveColumnRight')
 | 
			
		||||
  nmap <silent><buffer> <A-Right> <Plug>VimwikiTableMoveColumnRight
 | 
			
		||||
endif
 | 
			
		||||
@@ -629,12 +598,21 @@ nnoremap <silent><script><buffer>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
" Text objects {{{
 | 
			
		||||
onoremap <silent><buffer> ah :<C-U>call vimwiki#base#TO_header(0, 0)<CR>
 | 
			
		||||
vnoremap <silent><buffer> ah :<C-U>call vimwiki#base#TO_header(0, 1)<CR>
 | 
			
		||||
" ------------------------------------------------
 | 
			
		||||
" Text objects
 | 
			
		||||
" ------------------------------------------------
 | 
			
		||||
 | 
			
		||||
onoremap <silent><buffer> ih :<C-U>call vimwiki#base#TO_header(1, 0)<CR>
 | 
			
		||||
vnoremap <silent><buffer> ih :<C-U>call vimwiki#base#TO_header(1, 1)<CR>
 | 
			
		||||
onoremap <silent><buffer> ah :<C-U>call vimwiki#base#TO_header(0, 0, v:count1)<CR>
 | 
			
		||||
vnoremap <silent><buffer> ah :<C-U>call vimwiki#base#TO_header(0, 0, v:count1)<CR>
 | 
			
		||||
 | 
			
		||||
onoremap <silent><buffer> ih :<C-U>call vimwiki#base#TO_header(1, 0, v:count1)<CR>
 | 
			
		||||
vnoremap <silent><buffer> ih :<C-U>call vimwiki#base#TO_header(1, 0, v:count1)<CR>
 | 
			
		||||
 | 
			
		||||
onoremap <silent><buffer> aH :<C-U>call vimwiki#base#TO_header(0, 1, v:count1)<CR>
 | 
			
		||||
vnoremap <silent><buffer> aH :<C-U>call vimwiki#base#TO_header(0, 1, v:count1)<CR>
 | 
			
		||||
 | 
			
		||||
onoremap <silent><buffer> iH :<C-U>call vimwiki#base#TO_header(1, 1, v:count1)<CR>
 | 
			
		||||
vnoremap <silent><buffer> iH :<C-U>call vimwiki#base#TO_header(1, 1, v:count1)<CR>
 | 
			
		||||
 | 
			
		||||
onoremap <silent><buffer> a\ :<C-U>call vimwiki#base#TO_table_cell(0, 0)<CR>
 | 
			
		||||
vnoremap <silent><buffer> a\ :<C-U>call vimwiki#base#TO_table_cell(0, 1)<CR>
 | 
			
		||||
@@ -657,8 +635,7 @@ vnoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 1)<CR>
 | 
			
		||||
if !hasmapto('<Plug>VimwikiAddHeaderLevel')
 | 
			
		||||
  nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :
 | 
			
		||||
      \<C-U>call vimwiki#base#AddHeaderLevel()<CR>
 | 
			
		||||
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :<C-U>call vimwiki#base#AddHeaderLevel()<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiRemoveHeaderLevel')
 | 
			
		||||
  nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
 | 
			
		||||
@@ -666,36 +643,59 @@ endif
 | 
			
		||||
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
 | 
			
		||||
      \<C-U>call vimwiki#base#RemoveHeaderLevel()<CR>
 | 
			
		||||
 | 
			
		||||
if !hasmapto('<Plug>VimwikiGoToParentHeader')
 | 
			
		||||
  nmap <silent><buffer> ]u <Plug>VimwikiGoToParentHeader
 | 
			
		||||
  nmap <silent><buffer> [u <Plug>VimwikiGoToParentHeader
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><buffer> <Plug>VimwikiGoToParentHeader :
 | 
			
		||||
      \<C-u>call vimwiki#base#goto_parent_header()<CR>
 | 
			
		||||
 | 
			
		||||
" }}}
 | 
			
		||||
if !hasmapto('<Plug>VimwikiGoToNextHeader')
 | 
			
		||||
  nmap <silent><buffer> ]] <Plug>VimwikiGoToNextHeader
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><buffer> <Plug>VimwikiGoToNextHeader :
 | 
			
		||||
      \<C-u>call vimwiki#base#goto_next_header()<CR>
 | 
			
		||||
 | 
			
		||||
" KEYBINDINGS }}}
 | 
			
		||||
if !hasmapto('<Plug>VimwikiGoToPrevHeader')
 | 
			
		||||
  nmap <silent><buffer> [[ <Plug>VimwikiGoToPrevHeader
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><buffer> <Plug>VimwikiGoToPrevHeader :
 | 
			
		||||
      \<C-u>call vimwiki#base#goto_prev_header()<CR>
 | 
			
		||||
 | 
			
		||||
" AUTOCOMMANDS {{{
 | 
			
		||||
function! s:toc_html()
 | 
			
		||||
  if VimwikiGet('auto_toc') >= 2 && VimwikiGet('auto_export') == 0
 | 
			
		||||
    call vimwiki#base#table_of_contents(0)
 | 
			
		||||
  endif
 | 
			
		||||
  if VimwikiGet('auto_export')
 | 
			
		||||
    call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
 | 
			
		||||
      \                         expand('%'))
 | 
			
		||||
  endif
 | 
			
		||||
endfunction
 | 
			
		||||
if !hasmapto('<Plug>VimwikiGoToNextSiblingHeader')
 | 
			
		||||
  nmap <silent><buffer> ]= <Plug>VimwikiGoToNextSiblingHeader
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><buffer> <Plug>VimwikiGoToNextSiblingHeader :
 | 
			
		||||
      \<C-u>call vimwiki#base#goto_sibling(+1)<CR>
 | 
			
		||||
 | 
			
		||||
if VimwikiGet('auto_export') || VimwikiGet('auto_toc') >= 2
 | 
			
		||||
if !hasmapto('<Plug>VimwikiGoToPrevSiblingHeader')
 | 
			
		||||
  nmap <silent><buffer> [= <Plug>VimwikiGoToPrevSiblingHeader
 | 
			
		||||
endif
 | 
			
		||||
nnoremap <silent><buffer> <Plug>VimwikiGoToPrevSiblingHeader :
 | 
			
		||||
      \<C-u>call vimwiki#base#goto_sibling(-1)<CR>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if vimwiki#vars#get_wikilocal('auto_export')
 | 
			
		||||
  " Automatically generate HTML on page write.
 | 
			
		||||
  augroup vimwiki
 | 
			
		||||
    au BufWritePost <buffer> call s:toc_html()
 | 
			
		||||
    au BufWritePost <buffer>
 | 
			
		||||
      \ call vimwiki#html#Wiki2HTML(expand(vimwiki#vars#get_wikilocal('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'))
 | 
			
		||||
" }}}
 | 
			
		||||
if vimwiki#vars#get_wikilocal('auto_toc')
 | 
			
		||||
  " Automatically update the TOC *before* the file is written
 | 
			
		||||
  augroup vimwiki
 | 
			
		||||
    au BufWritePre <buffer> call vimwiki#base#table_of_contents(0)
 | 
			
		||||
  augroup END
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
if vimwiki#vars#get_wikilocal('auto_tags')
 | 
			
		||||
  " Automatically update tags metadata on page write.
 | 
			
		||||
  augroup vimwiki
 | 
			
		||||
    au BufWritePost <buffer> call vimwiki#tags#update_tags(0, '')
 | 
			
		||||
  augroup END
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
" 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