Merge branch 'mMontu-dev' into dev

This commit is contained in:
EinfachToll 2018-04-22 21:25:09 +02:00
commit 66a565d388
2 changed files with 16 additions and 4 deletions

View File

@ -2458,6 +2458,8 @@ Limitations:
- 'list' is intended to work with lists nicely indented with 'shiftwidth'. - 'list' is intended to work with lists nicely indented with 'shiftwidth'.
- 'syntax' is only available for the default syntax so far. - 'syntax' is only available for the default syntax so far.
The options above can be suffixed with ':quick' (e.g.: 'expr:quick') in order
to use some workarounds to make folds work faster.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:vimwiki_list_ignore_newline* *g:vimwiki_list_ignore_newline*

View File

@ -147,18 +147,18 @@ endfunction
" Vimwiki buffer. " Vimwiki buffer.
function! s:set_windowlocal_options() function! s:set_windowlocal_options()
let foldmethod = vimwiki#vars#get_global('folding') let foldmethod = vimwiki#vars#get_global('folding')
if foldmethod ==? 'expr' if foldmethod =~? '^expr.*'
setlocal foldmethod=expr setlocal foldmethod=expr
setlocal foldexpr=VimwikiFoldLevel(v:lnum) setlocal foldexpr=VimwikiFoldLevel(v:lnum)
setlocal foldtext=VimwikiFoldText() setlocal foldtext=VimwikiFoldText()
elseif foldmethod ==? 'list' || foldmethod ==? 'lists' elseif foldmethod =~? '^list.*' || foldmethod =~? '^lists.*'
setlocal foldmethod=expr setlocal foldmethod=expr
setlocal foldexpr=VimwikiFoldListLevel(v:lnum) setlocal foldexpr=VimwikiFoldListLevel(v:lnum)
setlocal foldtext=VimwikiFoldText() setlocal foldtext=VimwikiFoldText()
elseif foldmethod ==? 'syntax' elseif foldmethod =~? '^syntax.*'
setlocal foldmethod=syntax setlocal foldmethod=syntax
setlocal foldtext=VimwikiFoldText() setlocal foldtext=VimwikiFoldText()
elseif foldmethod ==? 'custom' elseif foldmethod =~? '^custom.*'
" do nothing " do nothing
else else
setlocal foldmethod=manual setlocal foldmethod=manual
@ -229,6 +229,16 @@ augroup vimwiki
exe 'autocmd InsertLeave *'.s:ext.' call vimwiki#tbl#format(line("."))' exe 'autocmd InsertLeave *'.s:ext.' call vimwiki#tbl#format(line("."))'
exe 'autocmd InsertEnter *'.s:ext.' call vimwiki#tbl#reset_tw(line("."))' exe 'autocmd InsertEnter *'.s:ext.' call vimwiki#tbl#reset_tw(line("."))'
endif endif
if vimwiki#vars#get_global('folding') =~? ':quick$'
" from http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
" Don't screw up folds when inserting text that might affect them, until
" leaving insert mode. Foldmethod is local to the window. Protect against
" screwing up folding when switching between windows.
exe 'autocmd InsertEnter *'.s:ext.' if !exists("w:last_fdm") | let w:last_fdm=&foldmethod'.
\ ' | setlocal foldmethod=manual | endif'
exe 'autocmd InsertLeave,WinLeave *'.s:ext.' if exists("w:last_fdm") |'.
\ 'let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif'
endif
endfor endfor
augroup END augroup END