Merge branch 'new-lists' of github.com:vimwiki/vimwiki into new-lists

This commit is contained in:
Maxim Kim 2013-09-08 14:53:42 +04:00
commit 3eaaf12b2d
12 changed files with 1623 additions and 771 deletions

View File

@ -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

View File

@ -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

View File

@ -75,3 +75,16 @@ function! vimwiki#u#path_common_pfx(path1, path2) "{{{
endif
endfunction "}}}
function! vimwiki#u#escape(string) "{{{
return escape(a:string, '.*[]\^$')
endfunction "}}}
" Load concrete Wiki syntax: sets regexes and templates for headers and links
function vimwiki#u#reload_regexes() "{{{
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
endfunction "}}}
" Load syntax-specific functionality
function vimwiki#u#reload_regexes_custom() "{{{
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'_custom.vim'
endfunction "}}}

View File

@ -280,13 +280,6 @@ NORMAL MODE *vimwiki-local-mappings*
To remap: >
:nmap <Leader>rr <Plug>VimwikiRenameLink
<
*vimwiki_<C-Space>*
<C-Space> Toggle list item on/off (checked/unchecked)
Maps to |:VimwikiToggleListItem|.
To remap: >
:nmap <leader>tt <Plug>VimwikiToggleListItem
< See |vimwiki-todo-lists|.
*vimwiki_=*
= Add header level. Create if needed.
There is nothing to indent with '==' command in
@ -308,27 +301,80 @@ NORMAL MODE *vimwiki-local-mappings*
the cursor over a word or link, or in visual mode with
the selected text .
*vimwiki_glm*
glm Increase the indent of a single-line list item.
*vimwiki_<C-Space>*
<C-Space> Toggle list item on/off (checked/unchecked)
Maps to |:VimwikiToggleListItem|.
To remap: >
:nmap <leader>tt <Plug>VimwikiToggleListItem
< See |vimwiki-todo-lists|.
*vimwiki_gll*
gll Decrease the indent of a single-line list item.
*vimwiki_gl<Space>*
gl<Space> Remove checkbox from list item.
*vimwiki_glstar* *vimwiki_gl8*
gl* or gl8 Switch or insert a "*" symbol. Only available in
supported syntaxes.
*vimwiki_gL<Space>*
gL<Space> Remove checkboxes from all sibling list items.
*vimwiki_gl#* *vimwiki_gl3*
gl# or gl3 Switch or insert a "#" symbol. Only available in
supported syntaxes.
*vimwiki_gll* *vimwiki_gLl*
gll Increase the level of a list item.
gLl Increase the level of a list item and all child items.
*vimwiki_gl-*
gl- Switch or insert a "-" symbol. Only available in
supported syntaxes.
*vimwiki_glh* *vimwiki_gLh*
glh Decrease the level of a list item.
gLh Decrease the level of a list item and all child items.
*vimwiki_gl1*
gl1 Switch or insert a "1." symbol. Only available in
supported syntaxes.
*vimwiki_glr* *vimwiki_gLr*
glr Renumber list items for the current list.
gLr Renumber list items for the whole buffer.
*vimwiki_glstar* *vimwiki_gLstar*
gl* Make a list item out of normal line or change the marker
of the current item to *.
gL* Change the marker of the current list to *.
*vimwiki_gl#* *vimwiki_gL#*
gl# Make a list item out of normal line or change the marker
of the current item to #.
gL# Change the marker of the current list to #.
*vimwiki_gl-* *vimwiki_gL-*
gl- Make a list item out of normal line or change the marker
of the current item to -.
gL- Change the marker of the current list to -.
*vimwiki_gl.* *vimwiki_gL.*
gl. Make a list item out of normal line or change the marker
of the current item to •.
gL. Change the marker of the current list to •.
*vimwiki_gl1* *vimwiki_gL1*
gl1 Make a list item out of normal line or change the marker
of the current item to 1., the numbering is adjusted
according to the surrounding list items.
gL1 Change the marker of the current list to 1. 2. 3. ...
*vimwiki_gla* *vimwiki_gLa*
gla Make a list item out of normal line or change the marker
of the current item to a), the numbering is adjusted
according to the surrounding list items.
gLa Change the marker of the current list to a) b) c) ...
*vimwiki_glA* *vimwiki_gLA*
glA Make a list item out of normal line or change the marker
of the current item to A), the numbering is adjusted
according to the surrounding list items.
gLA Change the marker of the current list to A) B) C) ...
*vimwiki_gli* *vimwiki_gLi*
gli Make a list item out of normal line or change the marker
of the current item to i), the numbering is adjusted
according to the surrounding list items.
gLi Change the marker of the current list to i) ii) iii) ...
*vimwiki_glI* *vimwiki_gLI*
glI Make a list item out of normal line or change the marker
of the current item to I), the numbering is adjusted
according to the surrounding list items.
gLI Change the marker of the current list to I) II) III) ...
*vimwiki_gqq* *vimwiki_gww*
gqq Format table. If you made some changes to a table
@ -372,15 +418,43 @@ Note: <2-LeftMouse> is just left double click.
INSERT MODE *vimwiki-table-mappings*
*vimwiki_i_<CR>*
*vimwiki_i_<CR>_table*
<CR> Go to the table cell beneath the current one, create
a new row if on the last one.
*vimwiki_i_<Tab>*
*vimwiki_i_<Tab>_table*
<Tab> Go to the next table cell, create a new row if on the
last cell.
See |g:vimwiki_table_mappings| to turn them off.
INSERT MODE *vimwiki-list-mappings*
*vimwiki_i_<CR>_list*
<CR> In a list item, insert a new bullet or number in the
next line, numbers are incremented.
In an empty list item, delete the item marker. This is
useful to end a list, you simply press <CR> twice.
*vimwiki_i_<S-CR>_list*
<S-CR> Does not insert a new list item, useful to create
multilined list items.
*vimwiki_i_<C-T>_list*
<C-T> Increase the level of a list item.
*vimwiki_i_<C-D>_list*
<C-D> Decrease the level of a list item.
*vimwiki_i_<C-L>_<C-J>_list*
<C-L><C-J> Change the marker of the current list item to the next
available. From - to • to 1. to * to I) to a).
*vimwiki_i_<C-L>_<C-K>_list*
<C-L><C-K> Change the marker of the current list item to the prev
available. From - to a) to I) to * to 1. to •.
*vimwiki_i_<C-L>_<C-M>_list*
<C-L><C-M> Create/remove a marker from a list item.
------------------------------------------------------------------------------
3.3. Text objects *vimwiki-text-objects*
@ -688,72 +762,79 @@ two lines.
5.5. Lists *vimwiki-syntax-lists*
Unordered lists: >
- Bulleted list item 1
- Bulleted list item 2
or: >
• Bulleted list item 1
• Bulleted list item 2
or: >
* Bulleted list item 1
* Bulleted list item 2
* Bulleted list sub item 1
* Bulleted list sub item 2
* more ...
* and more ...
* ...
* Bulleted list sub item 3
* etc.
or: >
- Bulleted list item 1
- Bulleted list item 2
- Bulleted list sub item 1
- Bulleted list sub item 2
- more ...
- and more ...
- ...
- Bulleted list sub item 3
- etc.
# Bulleted list item 1
# Bulleted list item 2
or mix: >
- Bulleted list item 1
- Bulleted list item 2
* Bulleted list sub item 1
* Bulleted list sub item 2
* more ...
- and more ...
- ...
* Bulleted list sub item 3
* etc.
Ordered lists: >
# Numbered list item 1
# Numbered list item 2
# Numbered list sub item 1
# Numbered list sub item 2
# more ...
# and more ...
# ...
# Numbered list sub item 3
# etc.
1. Numbered list item 1
2. Numbered list item 2
3. Numbered list item 3
or: >
1) Numbered list item 1
2) Numbered list item 2
3) Numbered list item 3
or: >
a) Numbered list item 1
b) Numbered list item 2
c) Numbered list item 3
or: >
A) Numbered list item 1
B) Numbered list item 2
C) Numbered list item 3
or: >
i) Numbered list item 1
ii) Numbered list item 2
iii) Numbered list item 3
or: >
I) Numbered list item 1
II) Numbered list item 2
III) Numbered list item 3
It is possible to mix bulleted and numbered lists: >
* Bulleted list item 1
* Bulleted list item 2
# Numbered list sub item 1
# Numbered list sub item 2
You can nest and mix the various types: >
- Bulleted list item 1
- Bulleted list item 2
a) Numbered list sub item 1
b) more ...
• and more ...
• ...
c) Numbered list sub item 3
1. Numbered list sub sub item 1
2. Numbered list sub sub item 2
d) etc.
- Bulleted list item 3
Note that a space after *, - or # is essential.
Multiline list items: >
* Bulleted list item 1
List item 1 continued line.
List item 1 next continued line.
* Bulleted list item 2
* Bulleted list sub item 1
List sub item 1 continued line.
List sub item 1 next continued line.
* Bulleted list sub item 2
* etc.
Note that a space after the list item markers (-, *, 1. etc.) are essential
List items can span multiple lines: >
* Item 1
Item 1 continued line.
Item 1 next continued line.
* Item 2
- Sub item 1
Sub item 1 continued line.
Sub item 1 next continued line.
- Sub item 2
- etc.
Continuation of Item 2
Next continuation of Item 2
Definition lists: >
Term 1:: Definition 1
Term 2::
:: Definition 2
:: Definition 3
Term 1:: Definition 1
Term 2::
:: Definition 2
:: Definition 3
------------------------------------------------------------------------------
@ -1702,14 +1783,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 +1876,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*

View File

@ -8,10 +8,12 @@ if exists("b:did_ftplugin")
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< comments< ".
\ "suffixesadd< isfname< formatlistpat< ".
\ "formatoptions< foldtext< ".
\ "foldmethod< foldexpr< commentstring< "
" UNDO }}}
@ -32,153 +34,45 @@ setlocal isfname-=[,]
" gf}}}
" Autocreate list items {{{
" for list items, and list items with checkboxes
setlocal formatoptions+=tnro
setlocal formatoptions-=cq
if VimwikiGet('syntax') == 'default'
setl comments=b:*,b:#,b:-
setl formatlistpat=^\\s*[*#-]\\s*
elseif VimwikiGet('syntax') == 'markdown'
setlocal comments=fb:*,fb:-,fb:+,nb:> commentstring=\ >\ %s
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+j
else
setl comments=n:*,n:#
endif
" 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
"Create 'formatlistpat'
let &formatlistpat = g:vimwiki_rxListItem
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
" COMMENTS }}}
" FOLDING for headers and list items using expr fold method. {{{
" Folding list items using expr fold method. {{{
function! s:get_base_level(lnum) "{{{
let lnum = a:lnum - 1
while lnum > 0
if getline(lnum) =~ g:vimwiki_rxHeader
return vimwiki#u#count_first_sym(getline(lnum))
endif
let lnum -= 1
endwhile
return 0
endfunction "}}}
function! s:find_forward(rx_item, lnum) "{{{
let lnum = a:lnum + 1
while lnum <= line('$')
let line = getline(lnum)
if line =~ a:rx_item
\ || line =~ '^\S'
\ || line =~ g:vimwiki_rxHeader
break
endif
let lnum += 1
endwhile
return [lnum, getline(lnum)]
endfunction "}}}
function! s:find_backward(rx_item, lnum) "{{{
let lnum = a:lnum - 1
while lnum > 1
let line = getline(lnum)
if line =~ a:rx_item
\ || line =~ '^\S'
break
endif
let lnum -= 1
endwhile
return [lnum, getline(lnum)]
endfunction "}}}
function! s:get_li_level(lnum) "{{{
if VimwikiGet('syntax') == 'media'
let level = vimwiki#u#count_first_sym(getline(a:lnum))
else
let level = (indent(a:lnum) / &sw)
endif
return level
endfunction "}}}
function! s:get_start_list(rx_item, lnum) "{{{
let lnum = a:lnum
while lnum >= 1
let line = getline(lnum)
if line !~ a:rx_item && line =~ '^\S'
return nextnonblank(lnum + 1)
endif
let lnum -= 1
endwhile
return 0
endfunction "}}}
" FOLDING {{{
" Folding list items {{{
function! VimwikiFoldListLevel(lnum) "{{{
let line = getline(a:lnum)
"" XXX Disabled: Header/section folding...
"if line =~ g:vimwiki_rxHeader
" return '>'.vimwiki#u#count_first_sym(line)
"endif
"let nnline = getline(a:lnum+1)
"" Unnecessary?
"if nnline =~ g:vimwiki_rxHeader
" return '<'.vimwiki#u#count_first_sym(nnline)
"endif
"" Very slow when called on every single line!
"let base_level = s:get_base_level(a:lnum)
"FIXME does not work correctly
let base_level = 0
if line =~ g:vimwiki_rxListItem
let [nnum, nline] = s:find_forward(g:vimwiki_rxListItem, a:lnum)
let level = s:get_li_level(a:lnum)
let leveln = s:get_li_level(nnum)
let adj = s:get_li_level(s:get_start_list(g:vimwiki_rxListItem, a:lnum))
if leveln > level
return ">".(base_level+leveln-adj)
" check if multilined list item
elseif (nnum-a:lnum) > 1
\ && (nline =~ g:vimwiki_rxListItem || nnline !~ '^\s*$')
return ">".(base_level+level+1-adj)
else
return (base_level+level-adj)
endif
else
" process multilined list items
let [pnum, pline] = s:find_backward(g:vimwiki_rxListItem, a:lnum)
if pline =~ g:vimwiki_rxListItem
if indent(a:lnum) >= indent(pnum) && line !~ '^\s*$'
let level = s:get_li_level(pnum)
let adj = s:get_li_level(s:get_start_list(g:vimwiki_rxListItem, pnum))
return (base_level+level+1-adj)
endif
endif
endif
return base_level
return vimwiki#lst#fold_level(a:lnum)
endfunction "}}}
" Folding list items }}}
" Folding sections and code blocks using expr fold method. {{{
" Folding sections and code blocks {{{
function! VimwikiFoldLevel(lnum) "{{{
let line = getline(a:lnum)
@ -277,7 +171,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 +188,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 +304,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 +329,58 @@ 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>"
startinsert
return
endif
endif
return res
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-L><C-J> <C-O>:VimwikiListChangeMarker next<CR>
inoremap <buffer> <C-L><C-K> <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-L><C-M> <Esc>:call vimwiki#lst#toggle_list_item()<CR>
for s:k in keys(g:vimwiki_bullet_types)
let s:char = (s:k == '•' ? '.' : s:k)
exe 'noremap <silent> <buffer> gl'.s:char.' :VimwikiListChangeMarker '.s:k.'<CR>'
exe 'noremap <silent> <buffer> gL'.s:char.' :VimwikiListChangeMarkerInList '.s:k.'<CR>'
endfor
for s:k in g:vimwiki_number_types
exe 'noremap <silent> <buffer> gl'.s:k[0].' :VimwikiListChangeMarker '.s:k.'<CR>'
exe 'noremap <silent> <buffer> gL'.s:k[0].' :VimwikiListChangeMarkerInList '.s:k.'<CR>'
endfor
"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
" 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
nnoremap <buffer> gqq :VimwikiTableAlignQ<CR>
nnoremap <buffer> gww :VimwikiTableAlignW<CR>

View File

@ -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)

View File

@ -9,6 +9,7 @@ if version < 600
elseif exists("b:current_syntax")
finish
endif
"TODO do nothing if ...? (?)
let starttime = reltime() " start the clock
if VimwikiGet('maxhi')
@ -43,15 +44,9 @@ let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
" }}}
" -------------------------------------------------------------------------
" Load concrete Wiki syntax: sets regexes and templates for headers and links
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
" -------------------------------------------------------------------------
let time0 = vimwiki#u#time(starttime) "XXX
call vimwiki#u#reload_regexes()
let g:vimwiki_rxListItem = '\('.
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
\ '\)'
let time0 = vimwiki#u#time(starttime) "XXX
" LINKS: setup of larger regexes {{{
@ -67,12 +62,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 +110,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. '\)'.'\{-}'
@ -279,7 +273,6 @@ call s:add_target_syntax_ON(target, 'VimwikiLink')
" }}}
" generic headers "{{{
if g:vimwiki_symH
"" symmetric
@ -405,25 +398,19 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
syntax match VimwikiCellSeparator
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
" List items
execute 'syntax match VimwikiList /'.g:vimwiki_rxListBullet.'/'
execute 'syntax match VimwikiList /'.g:vimwiki_rxListNumber.'/'
" Lists
execute 'syntax match VimwikiList /'.g:vimwiki_rxListItemWithoutCB.'/'
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 /'.g:vimwiki_rxListItem.'/'
if g:vimwiki_hl_cb_checked == 1
execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemWithoutCB.'\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'
@ -503,8 +490,6 @@ else
endif
"}}}
" syntax group highlighting "{{{
hi def link VimwikiMarkers Normal
@ -542,7 +527,6 @@ hi def link VimwikiLinkT VimwikiLink
hi def link VimwikiList Identifier
hi def link VimwikiListTodo VimwikiList
"hi def link VimwikiCheckBox VimwikiList
hi def link VimwikiCheckBoxDone Comment
hi def link VimwikiEmoticons Character
hi def link VimwikiHR Identifier
@ -589,10 +573,8 @@ hi def link VimwikiLinkCharT VimwikiLinkT
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
"}}}
" -------------------------------------------------------------------------
" Load syntax-specific functionality
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'_custom.vim'
" -------------------------------------------------------------------------
call vimwiki#u#reload_regexes_custom()
" FIXME it now does not make sense to pretend there is a single syntax "vimwiki"
let b:current_syntax="vimwiki"

View File

@ -72,11 +72,19 @@ 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'
" Lists
"1 means multiple bullets, like * ** ***
let g:vimwiki_bullet_types = { '-':0, '*':0, '#':0 , '•':0 }
let g:vimwiki_number_types = ['1)', '1.', 'i)', 'I)', 'a)', 'A)']
"this should contain at least one element
"it is used for i_<C-L><C-J> among other things
let g:vimwiki_list_markers = ['-', '•', '1.', '*', 'I)', 'a)']
let g:vimwiki_rxListDefine = '::\(\s\|$\)'
call vimwiki#lst#setup_marker_infos()
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
" Preformatted text
let g:vimwiki_rxPreStart = '{{{'

View File

@ -72,11 +72,16 @@ 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'
" Lists
let g:vimwiki_bullet_types = { '-':0, '*':0, '+':0 }
let g:vimwiki_number_types = ['1.']
let g:vimwiki_list_markers = ['-', '*', '+', '1.']
let g:vimwiki_rxListDefine = '::\%(\s\|$\)'
call vimwiki#lst#setup_marker_infos()
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
" Preformatted text
let g:vimwiki_rxPreStart = '```'

View File

@ -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.'\{-}'

View File

@ -53,12 +53,16 @@ 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'
" Lists
let g:vimwiki_bullet_types = { '*':1, '#':1 }
let g:vimwiki_number_types = []
let g:vimwiki_list_markers = ['*', '#']
let g:vimwiki_rxListDefine = '^\%(;\|:\)\s'
call vimwiki#lst#setup_marker_infos()
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
" Preformatted text
let g:vimwiki_rxPreStart = '<pre>'