support for numbered lists and much other list stuff
This commit is contained in:
parent
1c88deeee0
commit
8744a31031
@ -1424,8 +1424,7 @@ endfunction " }}}
|
||||
" arguments rxUrl, rxDesc, and rxStyle are copied verbatim, without any
|
||||
" special character escapes or substitutions.
|
||||
function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle) "{{{
|
||||
let magic_chars = '.*[\^$'
|
||||
let lnk = escape(a:template, magic_chars)
|
||||
let lnk = vimwiki#u#escape(a:template)
|
||||
if a:rxUrl != ""
|
||||
let lnk = substitute(lnk, '__LinkUrl__', '\='."'".a:rxUrl."'", '')
|
||||
endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -447,7 +447,7 @@ endfunction "}}}
|
||||
function! vimwiki#tbl#kbd_cr() "{{{
|
||||
let lnum = line('.')
|
||||
if !s:is_table(getline(lnum))
|
||||
return "\<CR>"
|
||||
return ""
|
||||
endif
|
||||
|
||||
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
|
||||
@ -507,9 +507,14 @@ function! vimwiki#tbl#format(lnum, ...) "{{{
|
||||
endif
|
||||
|
||||
let indent = s:get_indent(a:lnum)
|
||||
if &expandtab
|
||||
let indentstring = repeat(' ', indent)
|
||||
else
|
||||
let indentstring = repeat(' ', indent / &tabstop) . repeat(' ', indent % &tabstop)
|
||||
endif
|
||||
|
||||
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2)
|
||||
let row = repeat(' ', indent).row
|
||||
let row = indentstring.row
|
||||
call setline(lnum, row)
|
||||
endfor
|
||||
|
||||
|
@ -75,3 +75,6 @@ function! vimwiki#u#path_common_pfx(path1, path2) "{{{
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#u#escape(string) "{{{
|
||||
return escape(a:string, '.*[]\^$')
|
||||
endfunction "}}}
|
||||
|
@ -1702,14 +1702,23 @@ Default: 0
|
||||
Checked list items can be highlighted with a color:
|
||||
|
||||
* [X] the whole line can be highlighted with the option set to 1.
|
||||
* this line is highlighted as well with the option set to 2
|
||||
* [ ] I wish vim could use strikethru.
|
||||
|
||||
Value Description~
|
||||
1 Highlight checked [X] check box with |group-name| "Comment".
|
||||
0 Don't.
|
||||
0 Don't highlight anything.
|
||||
1 Highlight checked [X] list item with |group-name| "Comment".
|
||||
2 Highlight checked [X] list item and all its child items.
|
||||
|
||||
Default: 0
|
||||
|
||||
Note: Option 2 does not work perfectly. Specifically, it might break on
|
||||
preformatted text or if you mix tabs and spaces for indenting, and indented
|
||||
headers will erroneously be highlighted.
|
||||
Furthermore, if your list is long, Vim's highlight can break. Consider putting
|
||||
>
|
||||
au BufEnter file.wiki :syntax sync fromstart
|
||||
in your .vimrc
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_global_ext*
|
||||
@ -1786,12 +1795,15 @@ Default: 'Vimwiki'
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_listsyms*
|
||||
|
||||
String of 5 symbols for list items with checkboxes.
|
||||
Default value is ' .oOX'.
|
||||
List of 5 symbols for list items with checkboxes.
|
||||
Default value is [' ', '.', 'o', 'O', 'X'].
|
||||
|
||||
g:vimwiki_listsyms[0] is for 0% done items.
|
||||
g:vimwiki_listsyms[4] is for 100% done items.
|
||||
|
||||
You can set it to some more fancy symbols like this:
|
||||
|
||||
let g:vimwiki_listsyms = ['✗', '○', '◐', '●', '✓']
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_use_mouse*
|
||||
|
@ -11,7 +11,7 @@ let b:did_ftplugin = 1 " Don't load another plugin for this buffer
|
||||
" UNDO list {{{
|
||||
" Reset the following options to undo this plugin.
|
||||
let b:undo_ftplugin = "setlocal ".
|
||||
\ "suffixesadd< isfname< comments< ".
|
||||
\ "suffixesadd< isfname< formatlistpat< ".
|
||||
\ "formatoptions< foldtext< ".
|
||||
\ "foldmethod< foldexpr< commentstring< "
|
||||
" UNDO }}}
|
||||
@ -32,29 +32,69 @@ setlocal isfname-=[,]
|
||||
" gf}}}
|
||||
|
||||
" Autocreate list items {{{
|
||||
" for list items, and list items with checkboxes
|
||||
setlocal formatoptions+=tnro
|
||||
setlocal formatoptions-=cq
|
||||
" for bulleted and numbered list items, and list items with checkboxes
|
||||
setlocal autoindent
|
||||
setlocal nosmartindent
|
||||
setlocal nocindent
|
||||
setlocal comments=""
|
||||
setlocal formatoptions-=c
|
||||
setlocal formatoptions-=r
|
||||
setlocal formatoptions-=o
|
||||
setlocal formatoptions-=2
|
||||
setlocal formatoptions+=n
|
||||
|
||||
|
||||
if VimwikiGet('syntax') == 'default'
|
||||
setl comments=b:*,b:#,b:-
|
||||
setl formatlistpat=^\\s*[*#-]\\s*
|
||||
"1 means multiple bullets, like * ** ***
|
||||
let g:vimwiki_bullet_points = { '-':0, '*':1, '#':1 , '◆':1}
|
||||
let g:vimwiki_bullet_numbers = ['1iIaA', '.)]']
|
||||
"this should contain at least one element
|
||||
"it is used for i_<C-A> among other things
|
||||
let g:vimwiki_list_markers = ['-', '#', '◆', '1.', 'i)', 'a)']
|
||||
elseif VimwikiGet('syntax') == 'markdown'
|
||||
setlocal comments=fb:*,fb:-,fb:+,nb:> commentstring=\ >\ %s
|
||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+j
|
||||
else
|
||||
setl comments=n:*,n:#
|
||||
let g:vimwiki_bullet_points = { '-':0, '*':0, '+':0 }
|
||||
let g:vimwiki_bullet_numbers = ['1', '.']
|
||||
let g:vimwiki_list_markers = ['-', '*', '+', '1.']
|
||||
else "media
|
||||
"better leave this as it is, because media syntax is special
|
||||
let g:vimwiki_bullet_points = { '*':1, '#':1 }
|
||||
let g:vimwiki_bullet_numbers = ['', '']
|
||||
let g:vimwiki_list_markers = ['*', '#']
|
||||
endif
|
||||
|
||||
let g:vimwiki_rxListBullet = join( map(keys(g:vimwiki_bullet_points), 'vimwiki#u#escape(v:val) . repeat("\\+", g:vimwiki_bullet_points[v:val])') , '\|')
|
||||
|
||||
"create regex for numbered list
|
||||
if g:vimwiki_bullet_numbers[0] == ''
|
||||
"regex that matches nothing
|
||||
let g:vimwiki_rxListNumber = '$^'
|
||||
else
|
||||
let s:char_to_rx = {'1': '\d\+', 'i': '[ivxlcdm]\+', 'I': '[IVXLCDM]\+', 'a': '\l\{1,3}', 'A': '\u\{1,3}'}
|
||||
let g:vimwiki_rxListNumber = '\C\%(' . join( map(split(g:vimwiki_bullet_numbers[0], '.\zs'), "s:char_to_rx[v:val]"), '\|').'\)'
|
||||
let g:vimwiki_rxListNumber .= '['.vimwiki#u#escape(g:vimwiki_bullet_numbers[1]).']'
|
||||
endif
|
||||
|
||||
if VimwikiGet('syntax') == 'default' || VimwikiGet('syntax') == 'markdown'
|
||||
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
|
||||
else
|
||||
let g:vimwiki_rxListItemAndChildren = '^\('.g:vimwiki_rxListBullet.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\%('.g:vimwiki_rxListBullet.'\).*\|^$\|^\s.*\)\)*'
|
||||
endif
|
||||
|
||||
"Create 'formatlistpat'
|
||||
let &formatlistpat = vimwiki#lst#get_list_item_rx(1)
|
||||
|
||||
|
||||
|
||||
if !empty(&langmap)
|
||||
" Valid only if langmap is a comma separated pairs of chars
|
||||
let l_o = matchstr(&langmap, '\C,\zs.\zeo,')
|
||||
if l_o
|
||||
exe 'nnoremap <buffer> '.l_o.' :call vimwiki#lst#kbd_oO("o")<CR>a'
|
||||
exe 'nnoremap <buffer> '.l_o.' :call vimwiki#lst#kbd_o()<CR>a'
|
||||
endif
|
||||
|
||||
let l_O = matchstr(&langmap, '\C,\zs.\zeO,')
|
||||
if l_O
|
||||
exe 'nnoremap <buffer> '.l_O.' :call vimwiki#lst#kbd_oO("O")<CR>a'
|
||||
exe 'nnoremap <buffer> '.l_O.' :call vimwiki#lst#kbd_O()<CR>a'
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -277,7 +317,7 @@ command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(
|
||||
|
||||
command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tabnew')
|
||||
|
||||
command! -buffer -range VimwikiToggleListItem call vimwiki#lst#ToggleListItem(<line1>, <line2>)
|
||||
command! -buffer -range VimwikiToggleCheckbox call vimwiki#lst#toggle_cb(<line1>, <line2>)
|
||||
|
||||
command! -buffer VimwikiGenerateLinks call vimwiki#base#generate_links()
|
||||
|
||||
@ -294,7 +334,12 @@ command! -buffer -nargs=1 VimwikiGoto call vimwiki#base#goto("<args>")
|
||||
|
||||
|
||||
" list commands
|
||||
command! -buffer -nargs=* VimwikiListChangeLevel call vimwiki#lst#change_level(<f-args>)
|
||||
command! -buffer -range -nargs=1 VimwikiListChangeMarker call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>)
|
||||
command! -buffer -nargs=1 VimwikiListChangeMarkerInList call vimwiki#lst#change_marker_in_list(<f-args>)
|
||||
command! -buffer -nargs=+ VimwikiListLineBreak call <SID>CR(<f-args>)
|
||||
command! -buffer -range -nargs=1 VimwikiListIncreaseLvl call vimwiki#lst#change_level(<line1>, <line2>, 'increase', <f-args>)
|
||||
command! -buffer -range -nargs=1 VimwikiListDecreaseLvl call vimwiki#lst#change_level(<line1>, <line2>, 'decrease', <f-args>)
|
||||
command! -buffer -range VimwikiListRemoveCB call vimwiki#lst#remove_cb(<line1>, <line2>)
|
||||
|
||||
" table commands
|
||||
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
|
||||
@ -405,15 +450,18 @@ endif
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiToggleListItem')
|
||||
nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
|
||||
vmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
|
||||
if !hasmapto('<Plug>VimwikiToggleCheckbox')
|
||||
nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleCheckbox
|
||||
vmap <silent><buffer> <C-Space> <Plug>VimwikiToggleCheckbox
|
||||
if has("unix")
|
||||
nmap <silent><buffer> <C-@> <Plug>VimwikiToggleListItem
|
||||
nmap <silent><buffer> <C-@> <Plug>VimwikiToggleCheckbox
|
||||
vmap <silent><buffer> <C-@> <Plug>VimwikiToggleCheckbox
|
||||
endif
|
||||
endif
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
|
||||
\ <Plug>VimwikiToggleCheckbox :VimwikiToggleCheckbox<CR>
|
||||
vnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiToggleCheckbox :VimwikiToggleCheckbox<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiDiaryNextDay')
|
||||
nmap <silent><buffer> <C-Down> <Plug>VimwikiDiaryNextDay
|
||||
@ -427,42 +475,67 @@ endif
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR>
|
||||
|
||||
function! s:CR() "{{{
|
||||
let res = vimwiki#lst#kbd_cr()
|
||||
if res == "\<CR>" && g:vimwiki_table_mappings
|
||||
function! s:CR(normal, just_mrkr) "{{{
|
||||
if g:vimwiki_table_mappings
|
||||
let res = vimwiki#tbl#kbd_cr()
|
||||
if res != ""
|
||||
exe "normal! " . res . "\<Right>"
|
||||
return
|
||||
endif
|
||||
return res
|
||||
endif
|
||||
call vimwiki#lst#kbd_cr(a:normal, a:just_mrkr)
|
||||
endfunction "}}}
|
||||
|
||||
" List and Table <CR> mapping
|
||||
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
|
||||
inoremap <buffer> <CR> <Esc>:VimwikiListLineBreak 1 5<CR>
|
||||
inoremap <buffer> <S-CR> <Esc>:VimwikiListLineBreak 2 2<CR>
|
||||
nnoremap <silent> <buffer> o :call vimwiki#lst#kbd_o()<CR>
|
||||
nnoremap <silent> <buffer> O :call vimwiki#lst#kbd_O()<CR>
|
||||
map <silent> <buffer> glh :VimwikiListDecreaseLvl 0<CR>
|
||||
map <silent> <buffer> gll :VimwikiListIncreaseLvl 0<CR>
|
||||
map <silent> <buffer> gLh :VimwikiListDecreaseLvl 1<CR>
|
||||
map <silent> <buffer> gLl :VimwikiListIncreaseLvl 1<CR>
|
||||
map <silent> <buffer> gLH glH
|
||||
map <silent> <buffer> gLL gLl
|
||||
inoremap <buffer> <C-D> <C-O>:VimwikiListDecreaseLvl 0<CR>
|
||||
inoremap <buffer> <C-T> <C-O>:VimwikiListIncreaseLvl 0<CR>
|
||||
inoremap <buffer> <C-A> <C-O>:VimwikiListChangeMarker next<CR>
|
||||
inoremap <buffer> <C-S> <C-O>:VimwikiListChangeMarker prev<CR>
|
||||
nmap <silent> <buffer> glr :call vimwiki#lst#adjust_numbered_list()<CR>
|
||||
nmap <silent> <buffer> gLr :call vimwiki#lst#adjust_whole_buffer()<CR>
|
||||
nmap <silent> <buffer> gLR gLr
|
||||
noremap <silent> <buffer> gl<Space> :VimwikiListRemoveCB<CR>
|
||||
map <silent> <buffer> gL<Space> :call vimwiki#lst#remove_cb_in_list()<CR>
|
||||
inoremap <silent> <buffer> <C-B> <Esc>:call vimwiki#lst#toggle_list_item()<CR>
|
||||
|
||||
for s:k in keys(g:vimwiki_bullet_points)
|
||||
exe 'noremap <silent> <buffer> gl'.s:k.' :VimwikiListChangeMarker '.s:k.'<CR>'
|
||||
exe 'noremap <silent> <buffer> gL'.s:k.' :VimwikiListChangeMarkerInList '.s:k.'<CR>'
|
||||
endfor
|
||||
for s:a in split(g:vimwiki_bullet_numbers[0], '.\zs')
|
||||
let chars = split(g:vimwiki_bullet_numbers[1], '.\zs')
|
||||
if len(chars) == 0
|
||||
exe 'noremap <silent> <buffer> gl'.s:a.' :VimwikiListChangeMarker '.s:a.'<CR>'
|
||||
exe 'noremap <silent> <buffer> gL'.s:a.' :VimwikiListChangeMarkerInList '.s:a.'<CR>'
|
||||
elseif len(chars) == 1
|
||||
exe 'noremap <silent> <buffer> gl'.s:a.' :VimwikiListChangeMarker '.s:a.chars[0].'<CR>'
|
||||
exe 'noremap <silent> <buffer> gL'.s:a.' :VimwikiListChangeMarkerInList '.s:a.chars[0].'<CR>'
|
||||
else
|
||||
for s:b in chars
|
||||
exe 'noremap <silent> <buffer> gl'.s:a.s:b.' :VimwikiListChangeMarker '.s:a.s:b.'<CR>'
|
||||
exe 'noremap <silent> <buffer> gL'.s:a.s:b.' :VimwikiListChangeMarkerInList '.s:a.s:b.'<CR>'
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
||||
" Table mappings
|
||||
if g:vimwiki_table_mappings
|
||||
"Table mappings
|
||||
if g:vimwiki_table_mappings
|
||||
inoremap <expr> <buffer> <Tab> vimwiki#tbl#kbd_tab()
|
||||
inoremap <expr> <buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab()
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
nnoremap <buffer> gqq :VimwikiTableAlignQ<CR>
|
||||
nnoremap <buffer> gww :VimwikiTableAlignW<CR>
|
||||
|
@ -392,7 +392,7 @@ call s:default('ext2syntax', {}) " syntax map keyed on extension
|
||||
call s:default('hl_headers', 0)
|
||||
call s:default('hl_cb_checked', 0)
|
||||
call s:default('list_ignore_newline', 1)
|
||||
call s:default('listsyms', ' .oOX')
|
||||
call s:default('listsyms', [' ', '.', 'o', 'O', 'X'])
|
||||
call s:default('use_calendar', 1)
|
||||
call s:default('table_mappings', 1)
|
||||
call s:default('table_auto_fmt', 1)
|
||||
|
@ -49,9 +49,6 @@ execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
|
||||
" -------------------------------------------------------------------------
|
||||
let time0 = vimwiki#u#time(starttime) "XXX
|
||||
|
||||
let g:vimwiki_rxListItem = '\('.
|
||||
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
|
||||
\ '\)'
|
||||
|
||||
" LINKS: setup of larger regexes {{{
|
||||
|
||||
@ -67,12 +64,11 @@ let g:vimwiki_WikiLinkTemplate2 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLinkSeparator. '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiLinkSuffix
|
||||
"
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\\]]'
|
||||
|
||||
let g:vimwiki_rxWikiLinkPrefix = escape(g:vimwiki_rxWikiLinkPrefix, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkSuffix = escape(g:vimwiki_rxWikiLinkSuffix, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkSeparator = escape(g:vimwiki_rxWikiLinkSeparator, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkPrefix = vimwiki#u#escape(g:vimwiki_rxWikiLinkPrefix)
|
||||
let g:vimwiki_rxWikiLinkSuffix = vimwiki#u#escape(g:vimwiki_rxWikiLinkSuffix)
|
||||
let g:vimwiki_rxWikiLinkSeparator = vimwiki#u#escape(g:vimwiki_rxWikiLinkSeparator)
|
||||
let g:vimwiki_rxWikiLinkUrl = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLinkDescr = valid_chars.'\{-}'
|
||||
|
||||
@ -116,9 +112,9 @@ let g:vimwiki_WikiInclTemplate2 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
|
||||
let valid_chars = '[^\\\}]'
|
||||
|
||||
let g:vimwiki_rxWikiInclPrefix = escape(g:vimwiki_rxWikiInclPrefix, magic_chars)
|
||||
let g:vimwiki_rxWikiInclSuffix = escape(g:vimwiki_rxWikiInclSuffix, magic_chars)
|
||||
let g:vimwiki_rxWikiInclSeparator = escape(g:vimwiki_rxWikiInclSeparator, magic_chars)
|
||||
let g:vimwiki_rxWikiInclPrefix = vimwiki#u#escape(g:vimwiki_rxWikiInclPrefix)
|
||||
let g:vimwiki_rxWikiInclSuffix = vimwiki#u#escape(g:vimwiki_rxWikiInclSuffix)
|
||||
let g:vimwiki_rxWikiInclSeparator = vimwiki#u#escape(g:vimwiki_rxWikiInclSeparator)
|
||||
let g:vimwiki_rxWikiInclUrl = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclArg = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclArgs = '\%('. g:vimwiki_rxWikiInclSeparator. g:vimwiki_rxWikiInclArg. '\)'.'\{-}'
|
||||
@ -406,24 +402,19 @@ syntax match VimwikiCellSeparator
|
||||
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||
|
||||
" List items
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListBullet.'/'
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListNumber.'/'
|
||||
execute 'syntax match VimwikiList /'.vimwiki#lst#get_list_item_rx(0).'/'
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
|
||||
" List item checkbox
|
||||
"syntax match VimwikiCheckBox /\[.\?\]/
|
||||
let g:vimwiki_rxCheckBox = '\s*\[['.g:vimwiki_listsyms.']\?\]\s'
|
||||
" Todo lists have a checkbox
|
||||
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListBullet.g:vimwiki_rxCheckBox.'/'
|
||||
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListNumber.g:vimwiki_rxCheckBox.'/'
|
||||
if g:vimwiki_hl_cb_checked
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListBullet.'\s*\['.g:vimwiki_listsyms[4].'\]\s.*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListNumber.'\s*\['.g:vimwiki_listsyms[4].'\]\s.*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
execute 'syntax match VimwikiListTodo /'.vimwiki#lst#get_list_item_rx(1).'/'
|
||||
|
||||
if g:vimwiki_hl_cb_checked == 1
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#lst#get_list_item_rx(0).'\s*\['.g:vimwiki_listsyms[4].'\]\s.*$/ '.
|
||||
\ 'contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
|
||||
elseif g:vimwiki_hl_cb_checked == 2
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemAndChildren.'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
endif
|
||||
|
||||
|
||||
execute 'syntax match VimwikiEqIn /'.g:vimwiki_rxEqIn.'/ contains=VimwikiEqInChar'
|
||||
execute 'syntax match VimwikiEqInT /'.g:vimwiki_rxEqIn.'/ contained contains=VimwikiEqInCharT'
|
||||
|
||||
|
@ -72,10 +72,6 @@ let g:vimwiki_rxHR = '^-----*$'
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let g:vimwiki_rxTableSep = '|'
|
||||
|
||||
" List items start with optional whitespace(s) then '* ' or '# '
|
||||
let g:vimwiki_rxListBullet = '^\s*[*-]\s'
|
||||
let g:vimwiki_rxListNumber = '^\s*#\s'
|
||||
|
||||
let g:vimwiki_rxListDefine = '::\(\s\|$\)'
|
||||
|
||||
" Preformatted text
|
||||
|
@ -72,10 +72,6 @@ let g:vimwiki_rxHR = '^-----*$'
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let g:vimwiki_rxTableSep = '|'
|
||||
|
||||
" List items start with optional whitespace(s) then '* ' or '1. ', '2. ', etc.
|
||||
let g:vimwiki_rxListBullet = '^\s*[*+-]\s'
|
||||
let g:vimwiki_rxListNumber = '^\s*[0-9]\+\.\s'
|
||||
|
||||
let g:vimwiki_rxListDefine = '::\%(\s\|$\)'
|
||||
|
||||
" Preformatted text
|
||||
|
@ -42,12 +42,11 @@ let g:vimwiki_WikiLink1Template2 = g:vimwiki_rxWikiLink1Prefix . '__LinkDescript
|
||||
\ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLink1Suffix
|
||||
"
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\\[\]]'
|
||||
|
||||
let g:vimwiki_rxWikiLink1Prefix = escape(g:vimwiki_rxWikiLink1Prefix, magic_chars)
|
||||
let g:vimwiki_rxWikiLink1Suffix = escape(g:vimwiki_rxWikiLink1Suffix, magic_chars)
|
||||
let g:vimwiki_rxWikiLink1Separator = escape(g:vimwiki_rxWikiLink1Separator, magic_chars)
|
||||
let g:vimwiki_rxWikiLink1Prefix = vimwiki#u#escape(g:vimwiki_rxWikiLink1Prefix)
|
||||
let g:vimwiki_rxWikiLink1Suffix = vimwiki#u#escape(g:vimwiki_rxWikiLink1Suffix)
|
||||
let g:vimwiki_rxWikiLink1Separator = vimwiki#u#escape(g:vimwiki_rxWikiLink1Separator)
|
||||
let g:vimwiki_rxWikiLink1Url = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLink1Descr = valid_chars.'\{-}'
|
||||
|
||||
@ -125,12 +124,11 @@ let g:vimwiki_Weblink1Template = g:vimwiki_rxWeblink1Prefix . '__LinkDescription
|
||||
\ g:vimwiki_rxWeblink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWeblink1Suffix
|
||||
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\]'
|
||||
|
||||
let g:vimwiki_rxWeblink1Prefix = escape(g:vimwiki_rxWeblink1Prefix, magic_chars)
|
||||
let g:vimwiki_rxWeblink1Suffix = escape(g:vimwiki_rxWeblink1Suffix, magic_chars)
|
||||
let g:vimwiki_rxWeblink1Separator = escape(g:vimwiki_rxWeblink1Separator, magic_chars)
|
||||
let g:vimwiki_rxWeblink1Prefix = vimwiki#u#escape(g:vimwiki_rxWeblink1Prefix)
|
||||
let g:vimwiki_rxWeblink1Suffix = vimwiki#u#escape(g:vimwiki_rxWeblink1Suffix)
|
||||
let g:vimwiki_rxWeblink1Separator = vimwiki#u#escape(g:vimwiki_rxWeblink1Separator)
|
||||
let g:vimwiki_rxWeblink1Url = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWeblink1Descr = valid_chars.'\{-}'
|
||||
|
||||
|
@ -53,11 +53,6 @@ let g:vimwiki_rxHR = '^-----*$'
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let g:vimwiki_rxTableSep = '|'
|
||||
|
||||
" Bulleted list items start with whitespace(s), then '*'
|
||||
" highlight only bullets and digits.
|
||||
let g:vimwiki_rxListBullet = '^\s*\*\+\s\%([^*]*$\)\@='
|
||||
let g:vimwiki_rxListNumber = '^\s*#\+\s'
|
||||
|
||||
let g:vimwiki_rxListDefine = '^\%(;\|:\)\s'
|
||||
|
||||
" Preformatted text
|
||||
|
Loading…
Reference in New Issue
Block a user