2018-04-20 07:03:53 +02:00
|
|
|
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
2010-01-20 01:00:00 +01:00
|
|
|
" Vimwiki filetype plugin file
|
2015-02-23 12:10:42 +01:00
|
|
|
" Home: https://github.com/vimwiki/vimwiki/
|
2010-01-20 01:00:00 +01:00
|
|
|
|
|
|
|
if exists("b:did_ftplugin")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let b:did_ftplugin = 1 " Don't load another plugin for this buffer
|
2013-07-18 07:55:24 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
setlocal commentstring=%%%s
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2016-12-21 19:43:34 +01:00
|
|
|
if vimwiki#vars#get_global('conceallevel') && exists("+conceallevel")
|
|
|
|
let &l:conceallevel = vimwiki#vars#get_global('conceallevel')
|
2010-08-24 02:00:00 +02:00
|
|
|
endif
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
" This is for GOTO FILE: gf
|
2016-12-22 21:00:19 +01:00
|
|
|
execute 'setlocal suffixesadd='.vimwiki#vars#get_wikilocal('ext')
|
2010-01-20 01:00:00 +01:00
|
|
|
setlocal isfname-=[,]
|
|
|
|
|
2017-03-31 21:32:45 +02:00
|
|
|
exe "setlocal tags+=" . escape(vimwiki#path#to_string(vimwiki#tags#metadata_file_path()), ' \|"')
|
2015-01-09 23:44:25 +01:00
|
|
|
|
2014-02-13 12:42:24 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2014-07-30 21:46:22 +02:00
|
|
|
function! Complete_wikifiles(findstart, base)
|
2014-02-13 12:42:24 +01:00
|
|
|
if a:findstart == 1
|
2015-02-09 21:56:28 +01:00
|
|
|
let column = col('.')-2
|
2014-02-13 12:42:24 +01:00
|
|
|
let line = getline('.')[:column]
|
2015-02-09 21:56:28 +01:00
|
|
|
let startoflink = match(line, '\[\[\zs[^\\[\]]*$')
|
2014-02-13 12:42:24 +01:00
|
|
|
if startoflink != -1
|
2015-02-09 21:40:17 +01:00
|
|
|
let s:line_context = '['
|
2014-02-13 12:42:24 +01:00
|
|
|
return startoflink
|
|
|
|
endif
|
2016-12-23 20:05:53 +01:00
|
|
|
if vimwiki#vars#get_wikilocal('syntax') ==? 'markdown'
|
2015-02-09 21:56:28 +01:00
|
|
|
let startofinlinelink = match(line, '\[.*\](\zs[^)]*$')
|
2014-02-13 12:42:24 +01:00
|
|
|
if startofinlinelink != -1
|
2015-02-09 21:40:17 +01:00
|
|
|
let s:line_context = '['
|
2014-02-13 12:42:24 +01:00
|
|
|
return startofinlinelink
|
|
|
|
endif
|
|
|
|
endif
|
2015-01-04 23:29:42 +01:00
|
|
|
let startoftag = match(line, ':\zs[^:[:space:]]*$')
|
|
|
|
if startoftag != -1
|
2015-02-09 21:40:17 +01:00
|
|
|
let s:line_context = ':'
|
2015-01-04 23:29:42 +01:00
|
|
|
return startoftag
|
|
|
|
endif
|
2015-02-09 21:40:17 +01:00
|
|
|
let s:line_context = ''
|
2014-02-13 12:42:24 +01:00
|
|
|
return -1
|
|
|
|
else
|
2015-02-09 21:40:17 +01:00
|
|
|
" Completion works for wikilinks/anchors, and for tags. s:line_content
|
2018-04-17 07:13:37 +02:00
|
|
|
" tells us which string came before a:base. There seems to be no easier
|
2015-02-09 21:40:17 +01:00
|
|
|
" solution, because calling col('.') here returns garbage.
|
|
|
|
if s:line_context == ''
|
|
|
|
return []
|
|
|
|
elseif s:line_context == ':'
|
2015-01-04 23:29:42 +01:00
|
|
|
" Tags completion
|
2015-06-10 22:00:07 +02:00
|
|
|
let tags = vimwiki#tags#get_tags()
|
2015-02-04 22:05:04 +01:00
|
|
|
if a:base != ''
|
|
|
|
call filter(tags,
|
2015-01-04 23:29:42 +01:00
|
|
|
\ "v:val[:" . (len(a:base)-1) . "] == '" . substitute(a:base, "'", "''", '') . "'" )
|
2015-02-04 22:05:04 +01:00
|
|
|
endif
|
2015-01-04 23:29:42 +01:00
|
|
|
return tags
|
2015-02-12 20:20:16 +01:00
|
|
|
elseif a:base !~# '#'
|
2014-02-13 12:42:24 +01:00
|
|
|
" we look for wiki files
|
|
|
|
|
|
|
|
if a:base =~# '^wiki\d:'
|
|
|
|
let wikinumber = eval(matchstr(a:base, '^wiki\zs\d'))
|
2016-12-28 22:17:08 +01:00
|
|
|
if wikinumber >= vimwiki#vars#number_of_wikis()
|
2014-09-16 10:18:40 +02:00
|
|
|
return []
|
|
|
|
endif
|
2018-04-25 18:02:23 +02:00
|
|
|
let diary = 0
|
2014-02-13 12:42:24 +01:00
|
|
|
let prefix = matchstr(a:base, '^wiki\d:\zs.*')
|
|
|
|
let scheme = matchstr(a:base, '^wiki\d:\ze')
|
|
|
|
elseif a:base =~# '^diary:'
|
2018-04-25 18:02:23 +02:00
|
|
|
let wikinumber = vimwiki#vars#get_bufferlocal('wiki_nr')
|
|
|
|
let diary = 1
|
2014-02-13 12:42:24 +01:00
|
|
|
let prefix = matchstr(a:base, '^diary:\zs.*')
|
|
|
|
let scheme = matchstr(a:base, '^diary:\ze')
|
2014-09-16 10:18:40 +02:00
|
|
|
else " current wiki
|
2017-01-07 21:51:15 +01:00
|
|
|
let wikinumber = vimwiki#vars#get_bufferlocal('wiki_nr')
|
2018-04-25 18:02:23 +02:00
|
|
|
let diary = 0
|
2014-02-13 12:42:24 +01:00
|
|
|
let prefix = a:base
|
|
|
|
let scheme = ''
|
|
|
|
endif
|
|
|
|
|
2018-04-25 18:02:23 +02:00
|
|
|
let links = vimwiki#base#get_wikilinks(wikinumber, diary, 1)
|
2014-02-13 12:42:24 +01:00
|
|
|
let result = []
|
2014-12-04 21:18:58 +01:00
|
|
|
for wikifile in links
|
|
|
|
if wikifile =~ '^'.vimwiki#u#escape(prefix)
|
|
|
|
call add(result, scheme . wikifile)
|
2014-02-13 12:42:24 +01:00
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
return result
|
|
|
|
|
|
|
|
else
|
|
|
|
" we look for anchors in the given wikifile
|
|
|
|
|
|
|
|
let segments = split(a:base, '#', 1)
|
2018-04-25 18:02:23 +02:00
|
|
|
let given_wikifile = segments[0] == '' ?
|
|
|
|
\ vimwiki#path#filename_without_extension(vimwiki#path#current_file())
|
|
|
|
\ : segments[0]
|
2015-03-13 16:31:15 +01:00
|
|
|
let link_infos = vimwiki#base#resolve_link(given_wikifile.'#')
|
2017-03-31 21:32:45 +02:00
|
|
|
let wikifile = link_infos.path
|
2016-12-23 20:05:53 +01:00
|
|
|
let syntax = vimwiki#vars#get_wikilocal('syntax', link_infos.index)
|
2014-08-14 13:08:24 +02:00
|
|
|
let anchors = vimwiki#base#get_anchors(wikifile, syntax)
|
2014-02-13 12:42:24 +01:00
|
|
|
|
|
|
|
let filtered_anchors = []
|
|
|
|
let given_anchor = join(segments[1:], '#')
|
|
|
|
for anchor in anchors
|
2014-08-14 13:08:24 +02:00
|
|
|
if anchor =~# '^'.vimwiki#u#escape(given_anchor)
|
2014-02-13 12:42:24 +01:00
|
|
|
call add(filtered_anchors, segments[0].'#'.anchor)
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
return filtered_anchors
|
2014-08-14 13:08:24 +02:00
|
|
|
|
2014-02-13 12:42:24 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
2014-12-04 21:18:58 +01:00
|
|
|
setlocal omnifunc=Complete_wikifiles
|
2014-02-13 12:42:24 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
|
|
|
|
2014-01-06 14:11:16 +01:00
|
|
|
" settings necessary for the automatic formatting of lists
|
2013-07-08 11:37:35 +02:00
|
|
|
setlocal autoindent
|
|
|
|
setlocal nosmartindent
|
|
|
|
setlocal nocindent
|
|
|
|
setlocal comments=""
|
|
|
|
setlocal formatoptions-=c
|
|
|
|
setlocal formatoptions-=r
|
|
|
|
setlocal formatoptions-=o
|
|
|
|
setlocal formatoptions-=2
|
|
|
|
setlocal formatoptions+=n
|
|
|
|
|
2016-12-28 22:17:08 +01:00
|
|
|
let &formatlistpat = vimwiki#vars#get_syntaxlocal('rxListItem')
|
2013-07-08 11:37:35 +02:00
|
|
|
|
2010-05-12 02:00:00 +02:00
|
|
|
if !empty(&langmap)
|
|
|
|
" Valid only if langmap is a comma separated pairs of chars
|
2014-02-24 12:16:23 +01:00
|
|
|
let s:l_o = matchstr(&langmap, '\C,\zs.\zeo,')
|
|
|
|
if s:l_o
|
|
|
|
exe 'nnoremap <silent> <buffer> '.s:l_o.' :call vimwiki#lst#kbd_o()<CR>a'
|
2010-05-12 02:00:00 +02:00
|
|
|
endif
|
|
|
|
|
2014-02-24 12:16:23 +01:00
|
|
|
let s:l_O = matchstr(&langmap, '\C,\zs.\zeO,')
|
|
|
|
if s:l_O
|
|
|
|
exe 'nnoremap <silent> <buffer> '.s:l_O.' :call vimwiki#lst#kbd_O()<CR>a'
|
2010-05-12 02:00:00 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
|
|
|
" ------------------------------------------------
|
|
|
|
" Folding stuff
|
|
|
|
" ------------------------------------------------
|
|
|
|
|
|
|
|
function! VimwikiFoldListLevel(lnum)
|
2013-07-24 09:09:41 +02:00
|
|
|
return vimwiki#lst#fold_level(a:lnum)
|
2018-04-20 07:03:53 +02:00
|
|
|
endfunction
|
2013-04-19 05:46:58 +02:00
|
|
|
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
function! VimwikiFoldLevel(lnum)
|
2013-04-19 05:46:58 +02:00
|
|
|
let line = getline(a:lnum)
|
|
|
|
|
|
|
|
" Header/section folding...
|
2017-01-07 21:51:15 +01:00
|
|
|
if line =~# vimwiki#vars#get_syntaxlocal('rxHeader')
|
2013-04-19 05:46:58 +02:00
|
|
|
return '>'.vimwiki#u#count_first_sym(line)
|
|
|
|
" Code block folding...
|
2017-01-07 21:51:15 +01:00
|
|
|
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
|
2013-04-19 05:46:58 +02:00
|
|
|
return 'a1'
|
2017-01-07 21:51:15 +01:00
|
|
|
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
|
2013-04-19 05:46:58 +02:00
|
|
|
return 's1'
|
|
|
|
else
|
|
|
|
return "="
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
endfunction
|
2013-04-19 05:46:58 +02:00
|
|
|
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
" Constants used by VimwikiFoldText
|
2013-04-19 05:46:58 +02:00
|
|
|
" 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
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
|
|
|
" unused
|
|
|
|
function! s:shorten_text_simple(text, len)
|
2013-04-19 05:46:58 +02:00
|
|
|
let spare_len = a:len - len(a:text)
|
|
|
|
return (spare_len>=0) ? [a:text,spare_len] : [a:text[0:a:len].s:ellipsis, -1]
|
2018-04-20 07:03:53 +02:00
|
|
|
endfunction
|
|
|
|
|
2013-04-19 05:46:58 +02:00
|
|
|
|
|
|
|
" 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)
|
2018-04-20 07:03:53 +02:00
|
|
|
function! s:shorten_text(text, len)
|
|
|
|
" returns [string, spare]
|
2015-07-07 21:54:57 +02:00
|
|
|
" 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)
|
2013-04-19 05:46:58 +02:00
|
|
|
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
|
2015-07-07 21:54:57 +02:00
|
|
|
let idx = strridx(text_pattern, ' ', newlen + s:tolerance)
|
2013-04-19 05:46:58 +02:00
|
|
|
let break_idx = (idx + s:tolerance >= newlen) ? idx : newlen
|
2018-04-20 07:03:53 +02:00
|
|
|
return [matchstr(a:text, '\m^.\{'.break_idx.'\}').s:ellipsis, newlen - break_idx]
|
|
|
|
endfunction
|
|
|
|
|
2013-04-19 05:46:58 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
function! VimwikiFoldText()
|
2013-04-19 05:46:58 +02:00
|
|
|
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.'] '
|
2017-01-07 21:51:15 +01:00
|
|
|
if line !~# vimwiki#vars#get_syntaxlocal('rxPreStart')
|
2013-04-19 05:46:58 +02:00
|
|
|
let [main_text, spare_len] = s:shorten_text(main_text, 50)
|
|
|
|
return main_text.len_text
|
|
|
|
else
|
|
|
|
" fold-text for code blocks: use one or two of the starting lines
|
|
|
|
let [main_text, spare_len] = s:shorten_text(main_text, 24)
|
|
|
|
let line1 = substitute(getline(v:foldstart+1), '^\s*', ' ', '')
|
|
|
|
let [content_text, spare_len] = s:shorten_text(line1, spare_len+20)
|
|
|
|
if spare_len > s:tolerance && fold_len > 3
|
|
|
|
let line2 = substitute(getline(v:foldstart+2), '^\s*', s:newline, '')
|
|
|
|
let [more_text, spare_len] = s:shorten_text(line2, spare_len+12)
|
|
|
|
let content_text .= more_text
|
|
|
|
endif
|
|
|
|
return main_text.len_text.content_text
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
endfunction
|
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
" ------------------------------------------------
|
|
|
|
" Commands
|
|
|
|
" ------------------------------------------------
|
2010-01-20 01:00:00 +01:00
|
|
|
|
|
|
|
command! -buffer Vimwiki2HTML
|
2014-10-23 12:18:28 +02:00
|
|
|
\ if filewritable(expand('%')) | silent noautocmd w | endif
|
|
|
|
\ <bar>
|
2018-04-30 21:27:00 +02:00
|
|
|
\ let res = vimwiki#html#Wiki2HTML(vimwiki#path#current_file())
|
2014-10-23 12:18:28 +02:00
|
|
|
\ <bar>
|
2018-04-30 21:27:00 +02:00
|
|
|
\ if !vimwiki#path#is_null(res) | echo 'Vimwiki: HTML conversion is done, output: '
|
2018-04-25 21:46:00 +02:00
|
|
|
\ . vimwiki#path#to_string(vimwiki#vars#get_wikilocal('path_html')) | endif
|
2011-06-11 02:00:00 +02:00
|
|
|
command! -buffer Vimwiki2HTMLBrowse
|
2014-10-23 12:18:28 +02:00
|
|
|
\ if filewritable(expand('%')) | silent noautocmd w | endif
|
|
|
|
\ <bar>
|
2018-04-30 21:27:00 +02:00
|
|
|
\ let result = vimwiki#html#Wiki2HTML(vimwiki#path#current_file())
|
|
|
|
\ <bar>
|
|
|
|
\ if !vimwiki#path#is_null(result) | call vimwiki#base#system_open_link(result) | endif
|
2010-01-20 01:00:00 +01:00
|
|
|
command! -buffer VimwikiAll2HTML
|
2018-04-30 21:27:00 +02:00
|
|
|
\ call vimwiki#html#WikiAll2HTML()
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2014-02-18 14:47:42 +01:00
|
|
|
command! -buffer VimwikiTOC call vimwiki#base#table_of_contents(1)
|
2014-02-13 12:42:24 +01:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
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()
|
2018-02-16 17:47:32 +01:00
|
|
|
command! -buffer VimwikiFollowLink call vimwiki#base#follow_link('nosplit', 0, 1)
|
2011-06-11 02:00:00 +02:00
|
|
|
command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link()
|
2018-02-16 17:47:32 +01:00
|
|
|
command! -buffer VimwikiSplitLink call vimwiki#base#follow_link('hsplit', 0, 1)
|
|
|
|
command! -buffer VimwikiVSplitLink call vimwiki#base#follow_link('vsplit', 0, 1)
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(<f-args>)
|
|
|
|
|
2018-02-16 17:47:32 +01:00
|
|
|
command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tab', 0, 1)
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
command! -buffer VimwikiGenerateLinks call vimwiki#base#generate_links()
|
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
command! -buffer -nargs=0 VimwikiBacklinks call vimwiki#base#backlinks()
|
|
|
|
command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
|
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep <args> '.
|
2017-03-31 21:32:45 +02:00
|
|
|
\ escape(vimwiki#path#to_string(vimwiki#vars#get_wikilocal('path')).'**/*'.vimwiki#vars#get_wikilocal('ext'), ' ')
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
exe 'command! -buffer -nargs=* VWS lvimgrep <args> '.
|
2017-03-31 21:32:45 +02:00
|
|
|
\ escape(vimwiki#path#to_string(vimwiki#vars#get_wikilocal('path')).'**/*'.vimwiki#vars#get_wikilocal('ext'), ' ')
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2014-11-10 21:04:06 +01:00
|
|
|
command! -buffer -nargs=+ -complete=custom,vimwiki#base#complete_links_escaped
|
2014-11-06 22:02:37 +01:00
|
|
|
\ VimwikiGoto call vimwiki#base#goto(<f-args>)
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2014-12-04 21:18:58 +01:00
|
|
|
command! -buffer VimwikiCheckLinks call vimwiki#base#check_links()
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" list commands
|
2014-01-06 14:11:16 +01:00
|
|
|
command! -buffer -nargs=+ VimwikiReturn call <SID>CR(<f-args>)
|
2018-02-15 18:38:39 +01:00
|
|
|
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>)
|
2014-02-04 10:40:14 +01:00
|
|
|
command! -buffer -range VimwikiToggleListItem call vimwiki#lst#toggle_cb(<line1>, <line2>)
|
2018-04-20 07:03:53 +02:00
|
|
|
command! -buffer -range VimwikiToggleRejectedListItem
|
|
|
|
\ call vimwiki#lst#toggle_rejected_cb(<line1>, <line2>)
|
2018-02-17 21:05:06 +01:00
|
|
|
command! -buffer -range VimwikiIncrementListItem call vimwiki#lst#increment_cb(<line1>, <line2>)
|
|
|
|
command! -buffer -range VimwikiDecrementListItem call vimwiki#lst#decrement_cb(<line1>, <line2>)
|
2018-02-15 18:38:39 +01:00
|
|
|
command! -buffer -range -nargs=+ VimwikiListChangeLvl
|
|
|
|
\ call vimwiki#lst#change_level(<line1>, <line2>, <f-args>)
|
2014-01-06 14:11:16 +01:00
|
|
|
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()
|
|
|
|
command! -buffer VimwikiRenumberAllLists call vimwiki#lst#adjust_whole_buffer()
|
|
|
|
command! -buffer VimwikiListToggle call vimwiki#lst#toggle_list_item()
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2010-02-23 01:00:00 +01:00
|
|
|
" table commands
|
2011-06-11 02:00:00 +02:00
|
|
|
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
|
|
|
|
command! -buffer VimwikiTableAlignQ call vimwiki#tbl#align_or_cmd('gqq')
|
|
|
|
command! -buffer VimwikiTableAlignW call vimwiki#tbl#align_or_cmd('gww')
|
|
|
|
command! -buffer VimwikiTableMoveColumnLeft call vimwiki#tbl#move_column_left()
|
|
|
|
command! -buffer VimwikiTableMoveColumnRight call vimwiki#tbl#move_column_right()
|
2010-02-23 01:00:00 +01:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
" diary commands
|
2011-06-11 02:00:00 +02:00
|
|
|
command! -buffer VimwikiDiaryNextDay call vimwiki#diary#goto_next_day()
|
|
|
|
command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day()
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2015-01-06 20:30:28 +01:00
|
|
|
" tags commands
|
2018-04-20 07:03:53 +02:00
|
|
|
command! -buffer -bang VimwikiRebuildTags call vimwiki#tags#update_tags(1, '<bang>')
|
2015-02-23 11:29:02 +01:00
|
|
|
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
2015-01-06 20:44:41 +01:00
|
|
|
\ VimwikiSearchTags VimwikiSearch /:<args>:/
|
2015-02-23 11:29:02 +01:00
|
|
|
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
|
|
|
\ VimwikiGenerateTags call vimwiki#tags#generate_tags(<f-args>)
|
2015-01-06 20:30:28 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
command! -buffer VimwikiPasteUrl call vimwiki#html#PasteUrl(expand('%:p'))
|
|
|
|
command! -buffer VimwikiCatUrl call vimwiki#html#CatUrl(expand('%:p'))
|
|
|
|
|
|
|
|
|
|
|
|
" ------------------------------------------------
|
|
|
|
" Keybindings
|
|
|
|
" ------------------------------------------------
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2016-12-21 21:28:48 +01:00
|
|
|
if vimwiki#vars#get_global('use_mouse')
|
2010-01-20 01:00:00 +01:00
|
|
|
nmap <buffer> <S-LeftMouse> <NOP>
|
|
|
|
nmap <buffer> <C-LeftMouse> <NOP>
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><buffer> <2-LeftMouse>
|
|
|
|
\ :call vimwiki#base#follow_link('nosplit', 0, 1, "\<lt>2-LeftMouse>")<CR>
|
2011-06-11 02:00:00 +02:00
|
|
|
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>
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>Vimwiki2HTML')
|
2016-12-21 21:28:48 +01:00
|
|
|
exe 'nmap <buffer> '.vimwiki#vars#get_global('map_prefix').'h <Plug>Vimwiki2HTML'
|
2011-06-11 02:00:00 +02:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <script><buffer> <Plug>Vimwiki2HTML :Vimwiki2HTML<CR>
|
2011-06-11 02:00:00 +02:00
|
|
|
|
|
|
|
if !hasmapto('<Plug>Vimwiki2HTMLBrowse')
|
2016-12-21 21:28:48 +01:00
|
|
|
exe 'nmap <buffer> '.vimwiki#vars#get_global('map_prefix').'hh <Plug>Vimwiki2HTMLBrowse'
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <script><buffer> <Plug>Vimwiki2HTMLBrowse :Vimwiki2HTMLBrowse<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiFollowLink')
|
|
|
|
nmap <silent><buffer> <CR> <Plug>VimwikiFollowLink
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiFollowLink :VimwikiFollowLink<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiSplitLink')
|
|
|
|
nmap <silent><buffer> <S-CR> <Plug>VimwikiSplitLink
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiSplitLink :VimwikiSplitLink<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiVSplitLink')
|
|
|
|
nmap <silent><buffer> <C-CR> <Plug>VimwikiVSplitLink
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiVSplitLink :VimwikiVSplitLink<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiNormalizeLink')
|
|
|
|
nmap <silent><buffer> + <Plug>VimwikiNormalizeLink
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLink :VimwikiNormalizeLink 0<CR>
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiNormalizeLinkVisual')
|
|
|
|
vmap <silent><buffer> + <Plug>VimwikiNormalizeLinkVisual
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
vnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLinkVisual :<C-U>VimwikiNormalizeLink 1<CR>
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiNormalizeLinkVisualCR')
|
|
|
|
vmap <silent><buffer> <CR> <Plug>VimwikiNormalizeLinkVisualCR
|
|
|
|
endif
|
|
|
|
vnoremap <silent><script><buffer>
|
|
|
|
\ <Plug>VimwikiNormalizeLinkVisualCR :<C-U>VimwikiNormalizeLink 1<CR>
|
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiTabnewLink')
|
|
|
|
nmap <silent><buffer> <D-CR> <Plug>VimwikiTabnewLink
|
|
|
|
nmap <silent><buffer> <C-S-CR> <Plug>VimwikiTabnewLink
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiTabnewLink :VimwikiTabnewLink<CR>
|
2011-06-11 02:00:00 +02:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiGoBackLink')
|
|
|
|
nmap <silent><buffer> <BS> <Plug>VimwikiGoBackLink
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiGoBackLink :VimwikiGoBackLink<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiNextLink')
|
|
|
|
nmap <silent><buffer> <TAB> <Plug>VimwikiNextLink
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiNextLink :VimwikiNextLink<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiPrevLink')
|
|
|
|
nmap <silent><buffer> <S-TAB> <Plug>VimwikiPrevLink
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiPrevLink :VimwikiPrevLink<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiDeleteLink')
|
2016-12-21 21:28:48 +01:00
|
|
|
exe 'nmap <silent><buffer> '.vimwiki#vars#get_global('map_prefix').'d <Plug>VimwikiDeleteLink'
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiDeleteLink :VimwikiDeleteLink<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiRenameLink')
|
2016-12-21 21:28:48 +01:00
|
|
|
exe 'nmap <silent><buffer> '.vimwiki#vars#get_global('map_prefix').'r <Plug>VimwikiRenameLink'
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2014-01-06 14:11:16 +01:00
|
|
|
if !hasmapto('<Plug>VimwikiDiaryNextDay')
|
|
|
|
nmap <silent><buffer> <C-Down> <Plug>VimwikiDiaryNextDay
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiDiaryNextDay :VimwikiDiaryNextDay<CR>
|
2014-01-06 14:11:16 +01:00
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiDiaryPrevDay')
|
|
|
|
nmap <silent><buffer> <C-Up> <Plug>VimwikiDiaryPrevDay
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR>
|
2014-01-06 14:11:16 +01:00
|
|
|
|
|
|
|
" List mappings
|
2014-02-04 10:40:14 +01:00
|
|
|
if !hasmapto('<Plug>VimwikiToggleListItem')
|
|
|
|
nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
|
|
|
|
vmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
|
2010-01-20 01:00:00 +01:00
|
|
|
if has("unix")
|
2014-02-04 10:40:14 +01:00
|
|
|
nmap <silent><buffer> <C-@> <Plug>VimwikiToggleListItem
|
|
|
|
vmap <silent><buffer> <C-@> <Plug>VimwikiToggleListItem
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
|
|
|
endif
|
2018-02-19 07:07:22 +01:00
|
|
|
if !hasmapto('<Plug>VimwikiToggleRejectedListItem')
|
|
|
|
nmap <silent><buffer> glx <Plug>VimwikiToggleRejectedListItem
|
|
|
|
vmap <silent><buffer> glx <Plug>VimwikiToggleRejectedListItem
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
|
|
|
|
vnoremap <silent><script><buffer> <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
|
2011-06-11 02:00:00 +02:00
|
|
|
nnoremap <silent><script><buffer>
|
2018-02-19 07:07:22 +01:00
|
|
|
\ <Plug>VimwikiToggleRejectedListItem :VimwikiToggleRejectedListItem<CR>
|
2013-07-08 11:37:35 +02:00
|
|
|
vnoremap <silent><script><buffer>
|
2018-02-19 07:07:22 +01:00
|
|
|
\ <Plug>VimwikiToggleRejectedListItem :VimwikiToggleRejectedListItem<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-02-17 21:05:06 +01:00
|
|
|
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
|
2018-04-20 07:03:53 +02:00
|
|
|
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>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2014-01-06 14:11:16 +01:00
|
|
|
if !hasmapto('<Plug>VimwikiDecreaseLvlSingleItem', 'i')
|
2018-04-20 07:03:53 +02:00
|
|
|
imap <silent><buffer> <C-D> <Plug>VimwikiDecreaseLvlSingleItem
|
2014-01-06 14:11:16 +01:00
|
|
|
endif
|
|
|
|
inoremap <silent><script><buffer> <Plug>VimwikiDecreaseLvlSingleItem
|
|
|
|
\ <C-O>:VimwikiListChangeLvl decrease 0<CR>
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiIncreaseLvlSingleItem', 'i')
|
2018-04-20 07:03:53 +02:00
|
|
|
imap <silent><buffer> <C-T> <Plug>VimwikiIncreaseLvlSingleItem
|
2014-01-06 14:11:16 +01:00
|
|
|
endif
|
|
|
|
inoremap <silent><script><buffer> <Plug>VimwikiIncreaseLvlSingleItem
|
|
|
|
\ <C-O>:VimwikiListChangeLvl increase 0<CR>
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiListNextSymbol', 'i')
|
2018-04-20 07:03:53 +02:00
|
|
|
imap <silent><buffer> <C-L><C-J> <Plug>VimwikiListNextSymbol
|
2014-01-06 14:11:16 +01:00
|
|
|
endif
|
|
|
|
inoremap <silent><script><buffer> <Plug>VimwikiListNextSymbol
|
|
|
|
\ <C-O>:VimwikiListChangeSymbolI next<CR>
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiListPrevSymbol', 'i')
|
2018-04-20 07:03:53 +02:00
|
|
|
imap <silent><buffer> <C-L><C-K> <Plug>VimwikiListPrevSymbol
|
2014-01-06 14:11:16 +01:00
|
|
|
endif
|
|
|
|
inoremap <silent><script><buffer> <Plug>VimwikiListPrevSymbol
|
|
|
|
\ <C-O>:VimwikiListChangeSymbolI prev<CR>
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiListToggle', 'i')
|
|
|
|
imap <silent><buffer> <C-L><C-M> <Plug>VimwikiListToggle
|
|
|
|
endif
|
|
|
|
inoremap <silent><script><buffer> <Plug>VimwikiListToggle <Esc>:VimwikiListToggle<CR>
|
|
|
|
|
2018-02-16 18:11:49 +01:00
|
|
|
nnoremap <silent> <buffer> o :<C-U>call vimwiki#lst#kbd_o()<CR>
|
|
|
|
nnoremap <silent> <buffer> O :<C-U>call vimwiki#lst#kbd_O()<CR>
|
2014-01-06 14:11:16 +01:00
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiRenumberList')
|
|
|
|
nmap <silent><buffer> glr <Plug>VimwikiRenumberList
|
2010-08-24 02:00:00 +02:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiRenumberList :VimwikiRenumberList<CR>
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2014-01-06 14:11:16 +01:00
|
|
|
if !hasmapto('<Plug>VimwikiRenumberAllLists')
|
|
|
|
nmap <silent><buffer> gLr <Plug>VimwikiRenumberAllLists
|
|
|
|
nmap <silent><buffer> gLR <Plug>VimwikiRenumberAllLists
|
2010-08-24 02:00:00 +02:00
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiRenumberAllLists :VimwikiRenumberAllLists<CR>
|
2014-01-06 14:11:16 +01:00
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiDecreaseLvlSingleItem')
|
|
|
|
map <silent><buffer> glh <Plug>VimwikiDecreaseLvlSingleItem
|
|
|
|
endif
|
|
|
|
noremap <silent><script><buffer>
|
|
|
|
\ <Plug>VimwikiDecreaseLvlSingleItem :VimwikiListChangeLvl decrease 0<CR>
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiIncreaseLvlSingleItem')
|
|
|
|
map <silent><buffer> gll <Plug>VimwikiIncreaseLvlSingleItem
|
|
|
|
endif
|
|
|
|
noremap <silent><script><buffer>
|
|
|
|
\ <Plug>VimwikiIncreaseLvlSingleItem :VimwikiListChangeLvl increase 0<CR>
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiDecreaseLvlWholeItem')
|
|
|
|
map <silent><buffer> gLh <Plug>VimwikiDecreaseLvlWholeItem
|
|
|
|
map <silent><buffer> gLH <Plug>VimwikiDecreaseLvlWholeItem
|
|
|
|
endif
|
|
|
|
noremap <silent><script><buffer>
|
|
|
|
\ <Plug>VimwikiDecreaseLvlWholeItem :VimwikiListChangeLvl decrease 1<CR>
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiIncreaseLvlWholeItem')
|
|
|
|
map <silent><buffer> gLl <Plug>VimwikiIncreaseLvlWholeItem
|
|
|
|
map <silent><buffer> gLL <Plug>VimwikiIncreaseLvlWholeItem
|
|
|
|
endif
|
|
|
|
noremap <silent><script><buffer>
|
|
|
|
\ <Plug>VimwikiIncreaseLvlWholeItem :VimwikiListChangeLvl increase 1<CR>
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiRemoveSingleCB')
|
|
|
|
map <silent><buffer> gl<Space> <Plug>VimwikiRemoveSingleCB
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
noremap <silent><script><buffer> <Plug>VimwikiRemoveSingleCB :VimwikiRemoveSingleCB<CR>
|
2014-01-06 14:11:16 +01:00
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiRemoveCBInList')
|
|
|
|
map <silent><buffer> gL<Space> <Plug>VimwikiRemoveCBInList
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
noremap <silent><script><buffer> <Plug>VimwikiRemoveCBInList :VimwikiRemoveCBInList<CR>
|
2014-01-06 14:11:16 +01:00
|
|
|
|
2017-01-04 21:53:03 +01:00
|
|
|
for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
|
2014-07-30 21:26:07 +02:00
|
|
|
if !hasmapto(':VimwikiChangeSymbolTo '.s:char.'<CR>')
|
|
|
|
exe 'noremap <silent><buffer> gl'.s:char.' :VimwikiChangeSymbolTo '.s:char.'<CR>'
|
2014-01-06 14:11:16 +01:00
|
|
|
endif
|
2014-07-30 21:26:07 +02:00
|
|
|
if !hasmapto(':VimwikiChangeSymbolInListTo '.s:char.'<CR>')
|
|
|
|
exe 'noremap <silent><buffer> gL'.s:char.' :VimwikiChangeSymbolInListTo '.s:char.'<CR>'
|
2014-01-06 14:11:16 +01:00
|
|
|
endif
|
|
|
|
endfor
|
2014-07-30 21:26:07 +02:00
|
|
|
|
2017-01-04 21:53:03 +01:00
|
|
|
for s:typ in vimwiki#vars#get_syntaxlocal('number_types')
|
2014-07-30 21:26:07 +02:00
|
|
|
if !hasmapto(':VimwikiChangeSymbolTo '.s:typ.'<CR>')
|
|
|
|
exe 'noremap <silent><buffer> gl'.s:typ[0].' :VimwikiChangeSymbolTo '.s:typ.'<CR>'
|
2014-01-06 14:11:16 +01:00
|
|
|
endif
|
2014-07-30 21:26:07 +02:00
|
|
|
if !hasmapto(':VimwikiChangeSymbolInListTo '.s:typ.'<CR>')
|
|
|
|
exe 'noremap <silent><buffer> gL'.s:typ[0].' :VimwikiChangeSymbolInListTo '.s:typ.'<CR>'
|
2014-01-06 14:11:16 +01:00
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
function! s:CR(normal, just_mrkr)
|
2016-12-21 21:28:48 +01:00
|
|
|
if vimwiki#vars#get_global('table_mappings')
|
2011-06-11 02:00:00 +02:00
|
|
|
let res = vimwiki#tbl#kbd_cr()
|
2013-07-08 11:37:35 +02:00
|
|
|
if res != ""
|
|
|
|
exe "normal! " . res . "\<Right>"
|
2013-07-30 09:56:33 +02:00
|
|
|
startinsert
|
2013-07-08 11:37:35 +02:00
|
|
|
return
|
|
|
|
endif
|
2010-08-24 02:00:00 +02:00
|
|
|
endif
|
2013-07-08 11:37:35 +02:00
|
|
|
call vimwiki#lst#kbd_cr(a:normal, a:just_mrkr)
|
2018-04-20 07:03:53 +02:00
|
|
|
endfunction
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2016-12-06 00:17:38 +01:00
|
|
|
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
|
2014-01-06 14:11:16 +01:00
|
|
|
endif
|
2013-07-08 11:37:35 +02:00
|
|
|
|
|
|
|
"Table mappings
|
2016-12-21 21:28:48 +01:00
|
|
|
if vimwiki#vars#get_global('table_mappings')
|
2013-07-08 11:37:35 +02:00
|
|
|
inoremap <expr> <buffer> <Tab> vimwiki#tbl#kbd_tab()
|
|
|
|
inoremap <expr> <buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab()
|
|
|
|
endif
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2010-02-23 01:00:00 +01:00
|
|
|
|
|
|
|
nnoremap <buffer> gqq :VimwikiTableAlignQ<CR>
|
|
|
|
nnoremap <buffer> gww :VimwikiTableAlignW<CR>
|
2011-06-11 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiTableMoveColumnLeft')
|
|
|
|
nmap <silent><buffer> <A-Left> <Plug>VimwikiTableMoveColumnLeft
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><script><buffer> <Plug>VimwikiTableMoveColumnLeft :VimwikiTableMoveColumnLeft<CR>
|
2011-06-11 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiTableMoveColumnRight')
|
|
|
|
nmap <silent><buffer> <A-Right> <Plug>VimwikiTableMoveColumnRight
|
|
|
|
endif
|
|
|
|
nnoremap <silent><script><buffer>
|
|
|
|
\ <Plug>VimwikiTableMoveColumnRight :VimwikiTableMoveColumnRight<CR>
|
2010-05-12 02:00:00 +02:00
|
|
|
|
2010-02-23 01:00:00 +01:00
|
|
|
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
" ------------------------------------------------
|
|
|
|
" Text objects
|
|
|
|
" ------------------------------------------------
|
|
|
|
|
2018-04-06 07:16:07 +02:00
|
|
|
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>
|
2010-05-12 02:00:00 +02:00
|
|
|
|
2018-04-06 07:16:07 +02:00
|
|
|
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>
|
2010-05-12 02:00:00 +02:00
|
|
|
|
2018-04-06 07:16:07 +02:00
|
|
|
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>
|
2010-05-12 02:00:00 +02:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
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>
|
2010-05-12 02:00:00 +02:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
onoremap <silent><buffer> i\ :<C-U>call vimwiki#base#TO_table_cell(1, 0)<CR>
|
|
|
|
vnoremap <silent><buffer> i\ :<C-U>call vimwiki#base#TO_table_cell(1, 1)<CR>
|
2010-05-12 02:00:00 +02:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
onoremap <silent><buffer> ac :<C-U>call vimwiki#base#TO_table_col(0, 0)<CR>
|
|
|
|
vnoremap <silent><buffer> ac :<C-U>call vimwiki#base#TO_table_col(0, 1)<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
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>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2013-10-30 10:53:34 +01:00
|
|
|
onoremap <silent><buffer> al :<C-U>call vimwiki#lst#TO_list_item(0, 0)<CR>
|
|
|
|
vnoremap <silent><buffer> al :<C-U>call vimwiki#lst#TO_list_item(0, 1)<CR>
|
|
|
|
|
|
|
|
onoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 0)<CR>
|
|
|
|
vnoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 1)<CR>
|
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
if !hasmapto('<Plug>VimwikiAddHeaderLevel')
|
|
|
|
nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :<C-U>call vimwiki#base#AddHeaderLevel()<CR>
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiRemoveHeaderLevel')
|
|
|
|
nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
|
|
|
|
endif
|
|
|
|
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
|
|
|
|
\<C-U>call vimwiki#base#RemoveHeaderLevel()<CR>
|
|
|
|
|
2018-04-06 21:11:40 +02:00
|
|
|
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>
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>VimwikiGoToPrevHeader')
|
|
|
|
nmap <silent><buffer> [[ <Plug>VimwikiGoToPrevHeader
|
|
|
|
endif
|
|
|
|
nnoremap <silent><buffer> <Plug>VimwikiGoToPrevHeader :
|
|
|
|
\<C-u>call vimwiki#base#goto_prev_header()<CR>
|
|
|
|
|
|
|
|
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 !hasmapto('<Plug>VimwikiGoToPrevSiblingHeader')
|
|
|
|
nmap <silent><buffer> [= <Plug>VimwikiGoToPrevSiblingHeader
|
|
|
|
endif
|
|
|
|
nnoremap <silent><buffer> <Plug>VimwikiGoToPrevSiblingHeader :
|
|
|
|
\<C-u>call vimwiki#base#goto_sibling(-1)<CR>
|
2010-01-20 01:00:00 +01:00
|
|
|
|
|
|
|
|
2010-02-23 01:00:00 +01:00
|
|
|
|
2016-12-22 19:12:03 +01:00
|
|
|
if vimwiki#vars#get_wikilocal('auto_export')
|
2014-11-11 13:52:18 +01:00
|
|
|
" Automatically generate HTML on page write.
|
|
|
|
augroup vimwiki
|
2018-04-30 21:27:00 +02:00
|
|
|
au BufWritePost <buffer> call vimwiki#html#Wiki2HTML(vimwiki#path#current_file())
|
2014-11-11 13:52:18 +01:00
|
|
|
augroup END
|
|
|
|
endif
|
2014-02-18 14:47:42 +01:00
|
|
|
|
2016-12-22 19:12:03 +01:00
|
|
|
if vimwiki#vars#get_wikilocal('auto_toc')
|
2014-11-11 13:52:18 +01:00
|
|
|
" Automatically update the TOC *before* the file is written
|
2010-02-23 01:00:00 +01:00
|
|
|
augroup vimwiki
|
2014-11-11 13:52:18 +01:00
|
|
|
au BufWritePre <buffer> call vimwiki#base#table_of_contents(0)
|
2010-02-23 01:00:00 +01:00
|
|
|
augroup END
|
|
|
|
endif
|
2015-01-02 22:59:18 +01:00
|
|
|
|
2016-12-22 18:16:05 +01:00
|
|
|
if vimwiki#vars#get_wikilocal('auto_tags')
|
2015-01-02 22:59:18 +01:00
|
|
|
" Automatically update tags metadata on page write.
|
|
|
|
augroup vimwiki
|
2015-05-15 10:56:46 +02:00
|
|
|
au BufWritePost <buffer> call vimwiki#tags#update_tags(0, '')
|
2015-01-02 22:59:18 +01:00
|
|
|
augroup END
|
|
|
|
endif
|
2012-06-07 02:00:00 +02:00
|
|
|
|