Merge branch 'new-lists' of github.com:vimwiki/vimwiki into new-lists
This commit is contained in:
commit
3eaaf12b2d
@ -1424,8 +1424,7 @@ endfunction " }}}
|
|||||||
" arguments rxUrl, rxDesc, and rxStyle are copied verbatim, without any
|
" arguments rxUrl, rxDesc, and rxStyle are copied verbatim, without any
|
||||||
" special character escapes or substitutions.
|
" special character escapes or substitutions.
|
||||||
function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle) "{{{
|
function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle) "{{{
|
||||||
let magic_chars = '.*[\^$'
|
let lnk = vimwiki#u#escape(a:template)
|
||||||
let lnk = escape(a:template, magic_chars)
|
|
||||||
if a:rxUrl != ""
|
if a:rxUrl != ""
|
||||||
let lnk = substitute(lnk, '__LinkUrl__', '\='."'".a:rxUrl."'", '')
|
let lnk = substitute(lnk, '__LinkUrl__', '\='."'".a:rxUrl."'", '')
|
||||||
endif
|
endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -447,7 +447,7 @@ endfunction "}}}
|
|||||||
function! vimwiki#tbl#kbd_cr() "{{{
|
function! vimwiki#tbl#kbd_cr() "{{{
|
||||||
let lnum = line('.')
|
let lnum = line('.')
|
||||||
if !s:is_table(getline(lnum))
|
if !s:is_table(getline(lnum))
|
||||||
return "\<CR>"
|
return ""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
|
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
|
||||||
@ -507,9 +507,14 @@ function! vimwiki#tbl#format(lnum, ...) "{{{
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let indent = s:get_indent(a:lnum)
|
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)
|
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)
|
call setline(lnum, row)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -75,3 +75,16 @@ function! vimwiki#u#path_common_pfx(path1, path2) "{{{
|
|||||||
endif
|
endif
|
||||||
endfunction "}}}
|
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 "}}}
|
||||||
|
263
doc/vimwiki.txt
263
doc/vimwiki.txt
@ -280,13 +280,6 @@ NORMAL MODE *vimwiki-local-mappings*
|
|||||||
To remap: >
|
To remap: >
|
||||||
:nmap <Leader>rr <Plug>VimwikiRenameLink
|
: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_=*
|
*vimwiki_=*
|
||||||
= Add header level. Create if needed.
|
= Add header level. Create if needed.
|
||||||
There is nothing to indent with '==' command in
|
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 cursor over a word or link, or in visual mode with
|
||||||
the selected text .
|
the selected text .
|
||||||
|
|
||||||
*vimwiki_glm*
|
*vimwiki_<C-Space>*
|
||||||
glm Increase the indent of a single-line list item.
|
<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*
|
*vimwiki_gl<Space>*
|
||||||
gll Decrease the indent of a single-line list item.
|
gl<Space> Remove checkbox from list item.
|
||||||
|
|
||||||
*vimwiki_glstar* *vimwiki_gl8*
|
*vimwiki_gL<Space>*
|
||||||
gl* or gl8 Switch or insert a "*" symbol. Only available in
|
gL<Space> Remove checkboxes from all sibling list items.
|
||||||
supported syntaxes.
|
|
||||||
|
|
||||||
*vimwiki_gl#* *vimwiki_gl3*
|
*vimwiki_gll* *vimwiki_gLl*
|
||||||
gl# or gl3 Switch or insert a "#" symbol. Only available in
|
gll Increase the level of a list item.
|
||||||
supported syntaxes.
|
gLl Increase the level of a list item and all child items.
|
||||||
|
|
||||||
*vimwiki_gl-*
|
*vimwiki_glh* *vimwiki_gLh*
|
||||||
gl- Switch or insert a "-" symbol. Only available in
|
glh Decrease the level of a list item.
|
||||||
supported syntaxes.
|
gLh Decrease the level of a list item and all child items.
|
||||||
|
|
||||||
*vimwiki_gl1*
|
*vimwiki_glr* *vimwiki_gLr*
|
||||||
gl1 Switch or insert a "1." symbol. Only available in
|
glr Renumber list items for the current list.
|
||||||
supported syntaxes.
|
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*
|
*vimwiki_gqq* *vimwiki_gww*
|
||||||
gqq Format table. If you made some changes to a table
|
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*
|
INSERT MODE *vimwiki-table-mappings*
|
||||||
*vimwiki_i_<CR>*
|
*vimwiki_i_<CR>_table*
|
||||||
<CR> Go to the table cell beneath the current one, create
|
<CR> Go to the table cell beneath the current one, create
|
||||||
a new row if on the last one.
|
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
|
<Tab> Go to the next table cell, create a new row if on the
|
||||||
last cell.
|
last cell.
|
||||||
See |g:vimwiki_table_mappings| to turn them off.
|
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*
|
3.3. Text objects *vimwiki-text-objects*
|
||||||
@ -688,72 +762,79 @@ two lines.
|
|||||||
5.5. Lists *vimwiki-syntax-lists*
|
5.5. Lists *vimwiki-syntax-lists*
|
||||||
|
|
||||||
Unordered 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 1
|
||||||
* Bulleted list item 2
|
* Bulleted list item 2
|
||||||
* Bulleted list sub item 1
|
|
||||||
* Bulleted list sub item 2
|
|
||||||
* more ...
|
|
||||||
* and more ...
|
|
||||||
* ...
|
|
||||||
* Bulleted list sub item 3
|
|
||||||
* etc.
|
|
||||||
or: >
|
or: >
|
||||||
- Bulleted list item 1
|
# Bulleted list item 1
|
||||||
- Bulleted list item 2
|
# Bulleted list item 2
|
||||||
- Bulleted list sub item 1
|
|
||||||
- Bulleted list sub item 2
|
|
||||||
- more ...
|
|
||||||
- and more ...
|
|
||||||
- ...
|
|
||||||
- Bulleted list sub item 3
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
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: >
|
Ordered lists: >
|
||||||
# Numbered list item 1
|
1. Numbered list item 1
|
||||||
# Numbered list item 2
|
2. Numbered list item 2
|
||||||
# Numbered list sub item 1
|
3. Numbered list item 3
|
||||||
# Numbered list sub item 2
|
or: >
|
||||||
# more ...
|
1) Numbered list item 1
|
||||||
# and more ...
|
2) Numbered list item 2
|
||||||
# ...
|
3) Numbered list item 3
|
||||||
# Numbered list sub item 3
|
or: >
|
||||||
# etc.
|
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: >
|
You can nest and mix the various types: >
|
||||||
* Bulleted list item 1
|
- Bulleted list item 1
|
||||||
* Bulleted list item 2
|
- Bulleted list item 2
|
||||||
# Numbered list sub item 1
|
a) Numbered list sub item 1
|
||||||
# Numbered list sub item 2
|
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: >
|
Note that a space after the list item markers (-, *, 1. etc.) are essential
|
||||||
* Bulleted list item 1
|
|
||||||
List item 1 continued line.
|
List items can span multiple lines: >
|
||||||
List item 1 next continued line.
|
* Item 1
|
||||||
* Bulleted list item 2
|
Item 1 continued line.
|
||||||
* Bulleted list sub item 1
|
Item 1 next continued line.
|
||||||
List sub item 1 continued line.
|
* Item 2
|
||||||
List sub item 1 next continued line.
|
- Sub item 1
|
||||||
* Bulleted list sub item 2
|
Sub item 1 continued line.
|
||||||
* etc.
|
Sub item 1 next continued line.
|
||||||
|
- Sub item 2
|
||||||
|
- etc.
|
||||||
|
Continuation of Item 2
|
||||||
|
Next continuation of Item 2
|
||||||
|
|
||||||
|
|
||||||
Definition lists: >
|
Definition lists: >
|
||||||
Term 1:: Definition 1
|
Term 1:: Definition 1
|
||||||
Term 2::
|
Term 2::
|
||||||
:: Definition 2
|
:: Definition 2
|
||||||
:: Definition 3
|
:: Definition 3
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@ -1702,14 +1783,23 @@ Default: 0
|
|||||||
Checked list items can be highlighted with a color:
|
Checked list items can be highlighted with a color:
|
||||||
|
|
||||||
* [X] the whole line can be highlighted with the option set to 1.
|
* [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.
|
* [ ] I wish vim could use strikethru.
|
||||||
|
|
||||||
Value Description~
|
Value Description~
|
||||||
1 Highlight checked [X] check box with |group-name| "Comment".
|
0 Don't highlight anything.
|
||||||
0 Don't.
|
1 Highlight checked [X] list item with |group-name| "Comment".
|
||||||
|
2 Highlight checked [X] list item and all its child items.
|
||||||
|
|
||||||
Default: 0
|
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*
|
*g:vimwiki_global_ext*
|
||||||
@ -1786,12 +1876,15 @@ Default: 'Vimwiki'
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*g:vimwiki_listsyms*
|
*g:vimwiki_listsyms*
|
||||||
|
|
||||||
String of 5 symbols for list items with checkboxes.
|
List of 5 symbols for list items with checkboxes.
|
||||||
Default value is ' .oOX'.
|
Default value is [' ', '.', 'o', 'O', 'X'].
|
||||||
|
|
||||||
g:vimwiki_listsyms[0] is for 0% done items.
|
g:vimwiki_listsyms[0] is for 0% done items.
|
||||||
g:vimwiki_listsyms[4] is for 100% 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*
|
*g:vimwiki_use_mouse*
|
||||||
|
@ -8,10 +8,12 @@ if exists("b:did_ftplugin")
|
|||||||
endif
|
endif
|
||||||
let b:did_ftplugin = 1 " Don't load another plugin for this buffer
|
let b:did_ftplugin = 1 " Don't load another plugin for this buffer
|
||||||
|
|
||||||
|
call vimwiki#u#reload_regexes()
|
||||||
|
|
||||||
" UNDO list {{{
|
" UNDO list {{{
|
||||||
" Reset the following options to undo this plugin.
|
" Reset the following options to undo this plugin.
|
||||||
let b:undo_ftplugin = "setlocal ".
|
let b:undo_ftplugin = "setlocal ".
|
||||||
\ "suffixesadd< isfname< comments< ".
|
\ "suffixesadd< isfname< formatlistpat< ".
|
||||||
\ "formatoptions< foldtext< ".
|
\ "formatoptions< foldtext< ".
|
||||||
\ "foldmethod< foldexpr< commentstring< "
|
\ "foldmethod< foldexpr< commentstring< "
|
||||||
" UNDO }}}
|
" UNDO }}}
|
||||||
@ -32,153 +34,45 @@ setlocal isfname-=[,]
|
|||||||
" gf}}}
|
" gf}}}
|
||||||
|
|
||||||
" Autocreate list items {{{
|
" Autocreate list items {{{
|
||||||
" for list items, and list items with checkboxes
|
" for bulleted and numbered list items, and list items with checkboxes
|
||||||
setlocal formatoptions+=tnro
|
setlocal autoindent
|
||||||
setlocal formatoptions-=cq
|
setlocal nosmartindent
|
||||||
if VimwikiGet('syntax') == 'default'
|
setlocal nocindent
|
||||||
setl comments=b:*,b:#,b:-
|
setlocal comments=""
|
||||||
setl formatlistpat=^\\s*[*#-]\\s*
|
setlocal formatoptions-=c
|
||||||
elseif VimwikiGet('syntax') == 'markdown'
|
setlocal formatoptions-=r
|
||||||
setlocal comments=fb:*,fb:-,fb:+,nb:> commentstring=\ >\ %s
|
setlocal formatoptions-=o
|
||||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+j
|
setlocal formatoptions-=2
|
||||||
else
|
setlocal formatoptions+=n
|
||||||
setl comments=n:*,n:#
|
|
||||||
endif
|
|
||||||
|
"Create 'formatlistpat'
|
||||||
|
let &formatlistpat = g:vimwiki_rxListItem
|
||||||
|
|
||||||
|
|
||||||
if !empty(&langmap)
|
if !empty(&langmap)
|
||||||
" Valid only if langmap is a comma separated pairs of chars
|
" Valid only if langmap is a comma separated pairs of chars
|
||||||
let l_o = matchstr(&langmap, '\C,\zs.\zeo,')
|
let l_o = matchstr(&langmap, '\C,\zs.\zeo,')
|
||||||
if l_o
|
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
|
||||||
|
|
||||||
let l_O = matchstr(&langmap, '\C,\zs.\zeO,')
|
let l_O = matchstr(&langmap, '\C,\zs.\zeO,')
|
||||||
if l_O
|
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
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" COMMENTS }}}
|
" COMMENTS }}}
|
||||||
|
|
||||||
" FOLDING for headers and list items using expr fold method. {{{
|
" FOLDING {{{
|
||||||
|
" Folding list items {{{
|
||||||
" 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 "}}}
|
|
||||||
|
|
||||||
function! VimwikiFoldListLevel(lnum) "{{{
|
function! VimwikiFoldListLevel(lnum) "{{{
|
||||||
let line = getline(a:lnum)
|
return vimwiki#lst#fold_level(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
|
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
" Folding list items }}}
|
" Folding list items }}}
|
||||||
|
|
||||||
" Folding sections and code blocks using expr fold method. {{{
|
" Folding sections and code blocks {{{
|
||||||
function! VimwikiFoldLevel(lnum) "{{{
|
function! VimwikiFoldLevel(lnum) "{{{
|
||||||
let line = getline(a: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 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()
|
command! -buffer VimwikiGenerateLinks call vimwiki#base#generate_links()
|
||||||
|
|
||||||
@ -294,7 +188,12 @@ command! -buffer -nargs=1 VimwikiGoto call vimwiki#base#goto("<args>")
|
|||||||
|
|
||||||
|
|
||||||
" list commands
|
" 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
|
" table commands
|
||||||
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
|
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
|
||||||
@ -405,15 +304,18 @@ endif
|
|||||||
nnoremap <silent><script><buffer>
|
nnoremap <silent><script><buffer>
|
||||||
\ <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>
|
\ <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>
|
||||||
|
|
||||||
if !hasmapto('<Plug>VimwikiToggleListItem')
|
if !hasmapto('<Plug>VimwikiToggleCheckbox')
|
||||||
nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
|
nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleCheckbox
|
||||||
vmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
|
vmap <silent><buffer> <C-Space> <Plug>VimwikiToggleCheckbox
|
||||||
if has("unix")
|
if has("unix")
|
||||||
nmap <silent><buffer> <C-@> <Plug>VimwikiToggleListItem
|
nmap <silent><buffer> <C-@> <Plug>VimwikiToggleCheckbox
|
||||||
|
vmap <silent><buffer> <C-@> <Plug>VimwikiToggleCheckbox
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
nnoremap <silent><script><buffer>
|
nnoremap <silent><script><buffer>
|
||||||
\ <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
|
\ <Plug>VimwikiToggleCheckbox :VimwikiToggleCheckbox<CR>
|
||||||
|
vnoremap <silent><script><buffer>
|
||||||
|
\ <Plug>VimwikiToggleCheckbox :VimwikiToggleCheckbox<CR>
|
||||||
|
|
||||||
if !hasmapto('<Plug>VimwikiDiaryNextDay')
|
if !hasmapto('<Plug>VimwikiDiaryNextDay')
|
||||||
nmap <silent><buffer> <C-Down> <Plug>VimwikiDiaryNextDay
|
nmap <silent><buffer> <C-Down> <Plug>VimwikiDiaryNextDay
|
||||||
@ -427,42 +329,58 @@ endif
|
|||||||
nnoremap <silent><script><buffer>
|
nnoremap <silent><script><buffer>
|
||||||
\ <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR>
|
\ <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR>
|
||||||
|
|
||||||
function! s:CR() "{{{
|
function! s:CR(normal, just_mrkr) "{{{
|
||||||
let res = vimwiki#lst#kbd_cr()
|
if g:vimwiki_table_mappings
|
||||||
if res == "\<CR>" && g:vimwiki_table_mappings
|
|
||||||
let res = vimwiki#tbl#kbd_cr()
|
let res = vimwiki#tbl#kbd_cr()
|
||||||
|
if res != ""
|
||||||
|
exe "normal! " . res . "\<Right>"
|
||||||
|
startinsert
|
||||||
|
return
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
return res
|
call vimwiki#lst#kbd_cr(a:normal, a:just_mrkr)
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
" List and Table <CR> mapping
|
|
||||||
inoremap <buffer> <expr> <CR> <SID>CR()
|
|
||||||
|
|
||||||
" List mappings
|
" List mappings
|
||||||
nnoremap <buffer> o :<C-U>call vimwiki#lst#kbd_oO('o')<CR>
|
inoremap <buffer> <CR> <Esc>:VimwikiListLineBreak 1 5<CR>
|
||||||
nnoremap <buffer> O :<C-U>call vimwiki#lst#kbd_oO('O')<CR>
|
inoremap <buffer> <S-CR> <Esc>:VimwikiListLineBreak 2 2<CR>
|
||||||
nnoremap <buffer> gll :VimwikiListChangeLevel <<<CR>
|
nnoremap <silent> <buffer> o :call vimwiki#lst#kbd_o()<CR>
|
||||||
nnoremap <buffer> glm :VimwikiListChangeLevel >><CR>
|
nnoremap <silent> <buffer> O :call vimwiki#lst#kbd_O()<CR>
|
||||||
nnoremap <buffer> gl* :VimwikiListChangeLevel *<CR>
|
map <silent> <buffer> glh :VimwikiListDecreaseLvl 0<CR>
|
||||||
nnoremap <buffer> gl8 :VimwikiListChangeLevel *<CR>
|
map <silent> <buffer> gll :VimwikiListIncreaseLvl 0<CR>
|
||||||
if VimwikiGet('syntax') == 'default'
|
map <silent> <buffer> gLh :VimwikiListDecreaseLvl 1<CR>
|
||||||
nnoremap <buffer> gl- :VimwikiListChangeLevel -<CR>
|
map <silent> <buffer> gLl :VimwikiListIncreaseLvl 1<CR>
|
||||||
nnoremap <buffer> gl# :VimwikiListChangeLevel #<CR>
|
map <silent> <buffer> gLH glH
|
||||||
nnoremap <buffer> gl3 :VimwikiListChangeLevel #<CR>
|
map <silent> <buffer> gLL gLl
|
||||||
elseif VimwikiGet('syntax') == 'markdown'
|
inoremap <buffer> <C-D> <C-O>:VimwikiListDecreaseLvl 0<CR>
|
||||||
nnoremap <buffer> gl- :VimwikiListChangeLevel -<CR>
|
inoremap <buffer> <C-T> <C-O>:VimwikiListIncreaseLvl 0<CR>
|
||||||
nnoremap <buffer> gl1 :VimwikiListChangeLevel 1.<CR>
|
inoremap <buffer> <C-L><C-J> <C-O>:VimwikiListChangeMarker next<CR>
|
||||||
elseif VimwikiGet('syntax') == 'media'
|
inoremap <buffer> <C-L><C-K> <C-O>:VimwikiListChangeMarker prev<CR>
|
||||||
nnoremap <buffer> gl# :VimwikiListChangeLevel #<CR>
|
nmap <silent> <buffer> glr :call vimwiki#lst#adjust_numbered_list()<CR>
|
||||||
nnoremap <buffer> gl3 :VimwikiListChangeLevel #<CR>
|
nmap <silent> <buffer> gLr :call vimwiki#lst#adjust_whole_buffer()<CR>
|
||||||
endif
|
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> gqq :VimwikiTableAlignQ<CR>
|
||||||
nnoremap <buffer> gww :VimwikiTableAlignW<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_headers', 0)
|
||||||
call s:default('hl_cb_checked', 0)
|
call s:default('hl_cb_checked', 0)
|
||||||
call s:default('list_ignore_newline', 1)
|
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('use_calendar', 1)
|
||||||
call s:default('table_mappings', 1)
|
call s:default('table_mappings', 1)
|
||||||
call s:default('table_auto_fmt', 1)
|
call s:default('table_auto_fmt', 1)
|
||||||
|
@ -9,6 +9,7 @@ if version < 600
|
|||||||
elseif exists("b:current_syntax")
|
elseif exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"TODO do nothing if ...? (?)
|
"TODO do nothing if ...? (?)
|
||||||
let starttime = reltime() " start the clock
|
let starttime = reltime() " start the clock
|
||||||
if VimwikiGet('maxhi')
|
if VimwikiGet('maxhi')
|
||||||
@ -43,15 +44,9 @@ let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
|
|||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" -------------------------------------------------------------------------
|
call vimwiki#u#reload_regexes()
|
||||||
" 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
|
|
||||||
|
|
||||||
let g:vimwiki_rxListItem = '\('.
|
let time0 = vimwiki#u#time(starttime) "XXX
|
||||||
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
|
|
||||||
\ '\)'
|
|
||||||
|
|
||||||
" LINKS: setup of larger regexes {{{
|
" LINKS: setup of larger regexes {{{
|
||||||
|
|
||||||
@ -67,12 +62,11 @@ let g:vimwiki_WikiLinkTemplate2 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
|||||||
\ g:vimwiki_rxWikiLinkSeparator. '__LinkDescription__'.
|
\ g:vimwiki_rxWikiLinkSeparator. '__LinkDescription__'.
|
||||||
\ g:vimwiki_rxWikiLinkSuffix
|
\ g:vimwiki_rxWikiLinkSuffix
|
||||||
"
|
"
|
||||||
let magic_chars = '.*[]\^$'
|
|
||||||
let valid_chars = '[^\\\]]'
|
let valid_chars = '[^\\\]]'
|
||||||
|
|
||||||
let g:vimwiki_rxWikiLinkPrefix = escape(g:vimwiki_rxWikiLinkPrefix, magic_chars)
|
let g:vimwiki_rxWikiLinkPrefix = vimwiki#u#escape(g:vimwiki_rxWikiLinkPrefix)
|
||||||
let g:vimwiki_rxWikiLinkSuffix = escape(g:vimwiki_rxWikiLinkSuffix, magic_chars)
|
let g:vimwiki_rxWikiLinkSuffix = vimwiki#u#escape(g:vimwiki_rxWikiLinkSuffix)
|
||||||
let g:vimwiki_rxWikiLinkSeparator = escape(g:vimwiki_rxWikiLinkSeparator, magic_chars)
|
let g:vimwiki_rxWikiLinkSeparator = vimwiki#u#escape(g:vimwiki_rxWikiLinkSeparator)
|
||||||
let g:vimwiki_rxWikiLinkUrl = valid_chars.'\{-}'
|
let g:vimwiki_rxWikiLinkUrl = valid_chars.'\{-}'
|
||||||
let g:vimwiki_rxWikiLinkDescr = valid_chars.'\{-}'
|
let g:vimwiki_rxWikiLinkDescr = valid_chars.'\{-}'
|
||||||
|
|
||||||
@ -116,9 +110,9 @@ let g:vimwiki_WikiInclTemplate2 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
|||||||
|
|
||||||
let valid_chars = '[^\\\}]'
|
let valid_chars = '[^\\\}]'
|
||||||
|
|
||||||
let g:vimwiki_rxWikiInclPrefix = escape(g:vimwiki_rxWikiInclPrefix, magic_chars)
|
let g:vimwiki_rxWikiInclPrefix = vimwiki#u#escape(g:vimwiki_rxWikiInclPrefix)
|
||||||
let g:vimwiki_rxWikiInclSuffix = escape(g:vimwiki_rxWikiInclSuffix, magic_chars)
|
let g:vimwiki_rxWikiInclSuffix = vimwiki#u#escape(g:vimwiki_rxWikiInclSuffix)
|
||||||
let g:vimwiki_rxWikiInclSeparator = escape(g:vimwiki_rxWikiInclSeparator, magic_chars)
|
let g:vimwiki_rxWikiInclSeparator = vimwiki#u#escape(g:vimwiki_rxWikiInclSeparator)
|
||||||
let g:vimwiki_rxWikiInclUrl = valid_chars.'\{-}'
|
let g:vimwiki_rxWikiInclUrl = valid_chars.'\{-}'
|
||||||
let g:vimwiki_rxWikiInclArg = valid_chars.'\{-}'
|
let g:vimwiki_rxWikiInclArg = valid_chars.'\{-}'
|
||||||
let g:vimwiki_rxWikiInclArgs = '\%('. g:vimwiki_rxWikiInclSeparator. g:vimwiki_rxWikiInclArg. '\)'.'\{-}'
|
let g:vimwiki_rxWikiInclArgs = '\%('. g:vimwiki_rxWikiInclSeparator. g:vimwiki_rxWikiInclArg. '\)'.'\{-}'
|
||||||
@ -279,7 +273,6 @@ call s:add_target_syntax_ON(target, 'VimwikiLink')
|
|||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
" generic headers "{{{
|
" generic headers "{{{
|
||||||
if g:vimwiki_symH
|
if g:vimwiki_symH
|
||||||
"" symmetric
|
"" symmetric
|
||||||
@ -405,25 +398,19 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
|||||||
syntax match VimwikiCellSeparator
|
syntax match VimwikiCellSeparator
|
||||||
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||||
|
|
||||||
" List items
|
" Lists
|
||||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListBullet.'/'
|
execute 'syntax match VimwikiList /'.g:vimwiki_rxListItemWithoutCB.'/'
|
||||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListNumber.'/'
|
|
||||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
|
execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
|
||||||
" List item checkbox
|
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListItem.'/'
|
||||||
"syntax match VimwikiCheckBox /\[.\?\]/
|
|
||||||
let g:vimwiki_rxCheckBox = '\s*\[['.g:vimwiki_listsyms.']\?\]\s'
|
if g:vimwiki_hl_cb_checked == 1
|
||||||
" Todo lists have a checkbox
|
execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemWithoutCB.'\s*\['.g:vimwiki_listsyms[4].'\]\s.*$/ '.
|
||||||
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListBullet.g:vimwiki_rxCheckBox.'/'
|
\ 'contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||||
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListNumber.g:vimwiki_rxCheckBox.'/'
|
elseif g:vimwiki_hl_cb_checked == 2
|
||||||
if g:vimwiki_hl_cb_checked
|
execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemAndChildren.'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||||
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'
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
execute 'syntax match VimwikiEqIn /'.g:vimwiki_rxEqIn.'/ contains=VimwikiEqInChar'
|
execute 'syntax match VimwikiEqIn /'.g:vimwiki_rxEqIn.'/ contains=VimwikiEqInChar'
|
||||||
execute 'syntax match VimwikiEqInT /'.g:vimwiki_rxEqIn.'/ contained contains=VimwikiEqInCharT'
|
execute 'syntax match VimwikiEqInT /'.g:vimwiki_rxEqIn.'/ contained contains=VimwikiEqInCharT'
|
||||||
|
|
||||||
@ -503,8 +490,6 @@ else
|
|||||||
endif
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
" syntax group highlighting "{{{
|
" syntax group highlighting "{{{
|
||||||
|
|
||||||
hi def link VimwikiMarkers Normal
|
hi def link VimwikiMarkers Normal
|
||||||
@ -542,7 +527,6 @@ hi def link VimwikiLinkT VimwikiLink
|
|||||||
|
|
||||||
hi def link VimwikiList Identifier
|
hi def link VimwikiList Identifier
|
||||||
hi def link VimwikiListTodo VimwikiList
|
hi def link VimwikiListTodo VimwikiList
|
||||||
"hi def link VimwikiCheckBox VimwikiList
|
|
||||||
hi def link VimwikiCheckBoxDone Comment
|
hi def link VimwikiCheckBoxDone Comment
|
||||||
hi def link VimwikiEmoticons Character
|
hi def link VimwikiEmoticons Character
|
||||||
hi def link VimwikiHR Identifier
|
hi def link VimwikiHR Identifier
|
||||||
@ -589,10 +573,8 @@ hi def link VimwikiLinkCharT VimwikiLinkT
|
|||||||
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
|
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" -------------------------------------------------------------------------
|
|
||||||
" Load syntax-specific functionality
|
" 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"
|
" FIXME it now does not make sense to pretend there is a single syntax "vimwiki"
|
||||||
let b:current_syntax="vimwiki"
|
let b:current_syntax="vimwiki"
|
||||||
|
@ -72,11 +72,19 @@ let g:vimwiki_rxHR = '^-----*$'
|
|||||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||||
let g:vimwiki_rxTableSep = '|'
|
let g:vimwiki_rxTableSep = '|'
|
||||||
|
|
||||||
" List items start with optional whitespace(s) then '* ' or '# '
|
" Lists
|
||||||
let g:vimwiki_rxListBullet = '^\s*[*-]\s'
|
"1 means multiple bullets, like * ** ***
|
||||||
let g:vimwiki_rxListNumber = '^\s*#\s'
|
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\|$\)'
|
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
|
" Preformatted text
|
||||||
let g:vimwiki_rxPreStart = '{{{'
|
let g:vimwiki_rxPreStart = '{{{'
|
||||||
|
@ -72,11 +72,16 @@ let g:vimwiki_rxHR = '^-----*$'
|
|||||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||||
let g:vimwiki_rxTableSep = '|'
|
let g:vimwiki_rxTableSep = '|'
|
||||||
|
|
||||||
" List items start with optional whitespace(s) then '* ' or '1. ', '2. ', etc.
|
" Lists
|
||||||
let g:vimwiki_rxListBullet = '^\s*[*+-]\s'
|
let g:vimwiki_bullet_types = { '-':0, '*':0, '+':0 }
|
||||||
let g:vimwiki_rxListNumber = '^\s*[0-9]\+\.\s'
|
let g:vimwiki_number_types = ['1.']
|
||||||
|
let g:vimwiki_list_markers = ['-', '*', '+', '1.']
|
||||||
let g:vimwiki_rxListDefine = '::\%(\s\|$\)'
|
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
|
" Preformatted text
|
||||||
let g:vimwiki_rxPreStart = '```'
|
let g:vimwiki_rxPreStart = '```'
|
||||||
|
@ -42,12 +42,11 @@ let g:vimwiki_WikiLink1Template2 = g:vimwiki_rxWikiLink1Prefix . '__LinkDescript
|
|||||||
\ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'.
|
\ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'.
|
||||||
\ g:vimwiki_rxWikiLink1Suffix
|
\ g:vimwiki_rxWikiLink1Suffix
|
||||||
"
|
"
|
||||||
let magic_chars = '.*[]\^$'
|
|
||||||
let valid_chars = '[^\\\[\]]'
|
let valid_chars = '[^\\\[\]]'
|
||||||
|
|
||||||
let g:vimwiki_rxWikiLink1Prefix = escape(g:vimwiki_rxWikiLink1Prefix, magic_chars)
|
let g:vimwiki_rxWikiLink1Prefix = vimwiki#u#escape(g:vimwiki_rxWikiLink1Prefix)
|
||||||
let g:vimwiki_rxWikiLink1Suffix = escape(g:vimwiki_rxWikiLink1Suffix, magic_chars)
|
let g:vimwiki_rxWikiLink1Suffix = vimwiki#u#escape(g:vimwiki_rxWikiLink1Suffix)
|
||||||
let g:vimwiki_rxWikiLink1Separator = escape(g:vimwiki_rxWikiLink1Separator, magic_chars)
|
let g:vimwiki_rxWikiLink1Separator = vimwiki#u#escape(g:vimwiki_rxWikiLink1Separator)
|
||||||
let g:vimwiki_rxWikiLink1Url = valid_chars.'\{-}'
|
let g:vimwiki_rxWikiLink1Url = valid_chars.'\{-}'
|
||||||
let g:vimwiki_rxWikiLink1Descr = 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_rxWeblink1Separator. '__LinkUrl__'.
|
||||||
\ g:vimwiki_rxWeblink1Suffix
|
\ g:vimwiki_rxWeblink1Suffix
|
||||||
|
|
||||||
let magic_chars = '.*[]\^$'
|
|
||||||
let valid_chars = '[^\\]'
|
let valid_chars = '[^\\]'
|
||||||
|
|
||||||
let g:vimwiki_rxWeblink1Prefix = escape(g:vimwiki_rxWeblink1Prefix, magic_chars)
|
let g:vimwiki_rxWeblink1Prefix = vimwiki#u#escape(g:vimwiki_rxWeblink1Prefix)
|
||||||
let g:vimwiki_rxWeblink1Suffix = escape(g:vimwiki_rxWeblink1Suffix, magic_chars)
|
let g:vimwiki_rxWeblink1Suffix = vimwiki#u#escape(g:vimwiki_rxWeblink1Suffix)
|
||||||
let g:vimwiki_rxWeblink1Separator = escape(g:vimwiki_rxWeblink1Separator, magic_chars)
|
let g:vimwiki_rxWeblink1Separator = vimwiki#u#escape(g:vimwiki_rxWeblink1Separator)
|
||||||
let g:vimwiki_rxWeblink1Url = valid_chars.'\{-}'
|
let g:vimwiki_rxWeblink1Url = valid_chars.'\{-}'
|
||||||
let g:vimwiki_rxWeblink1Descr = valid_chars.'\{-}'
|
let g:vimwiki_rxWeblink1Descr = valid_chars.'\{-}'
|
||||||
|
|
||||||
|
@ -53,12 +53,16 @@ let g:vimwiki_rxHR = '^-----*$'
|
|||||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||||
let g:vimwiki_rxTableSep = '|'
|
let g:vimwiki_rxTableSep = '|'
|
||||||
|
|
||||||
" Bulleted list items start with whitespace(s), then '*'
|
" Lists
|
||||||
" highlight only bullets and digits.
|
let g:vimwiki_bullet_types = { '*':1, '#':1 }
|
||||||
let g:vimwiki_rxListBullet = '^\s*\*\+\s\%([^*]*$\)\@='
|
let g:vimwiki_number_types = []
|
||||||
let g:vimwiki_rxListNumber = '^\s*#\+\s'
|
let g:vimwiki_list_markers = ['*', '#']
|
||||||
|
|
||||||
let g:vimwiki_rxListDefine = '^\%(;\|:\)\s'
|
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
|
" Preformatted text
|
||||||
let g:vimwiki_rxPreStart = '<pre>'
|
let g:vimwiki_rxPreStart = '<pre>'
|
||||||
|
Loading…
Reference in New Issue
Block a user