From 777569f95fba78408d2ee0cdddcd39e08b51d351 Mon Sep 17 00:00:00 2001 From: mMontu Date: Tue, 12 Jul 2016 11:41:44 -0300 Subject: [PATCH 001/108] Workaround for slow folding methods (issue #225) --- doc/vimwiki.txt | 2 ++ plugin/vimwiki.vim | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 9cc5dd9..7192574 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -2288,6 +2288,8 @@ Limitations: - 'list' is intended to work with lists nicely indented with 'shiftwidth'. - '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* diff --git a/plugin/vimwiki.vim b/plugin/vimwiki.vim index d7abb6c..90fb166 100644 --- a/plugin/vimwiki.vim +++ b/plugin/vimwiki.vim @@ -156,15 +156,15 @@ function! s:setup_buffer_enter() "{{{ " Settings foldmethod, foldexpr and foldtext are local to window. Thus in a " new tab with the same buffer folding is reset to vim defaults. So we " insist vimwiki folding here. - if g:vimwiki_folding ==? 'expr' + if g:vimwiki_folding =~? '^expr.*' setlocal fdm=expr setlocal foldexpr=VimwikiFoldLevel(v:lnum) setlocal foldtext=VimwikiFoldText() - elseif g:vimwiki_folding ==? 'list' || g:vimwiki_folding ==? 'lists' + elseif g:vimwiki_folding =~? '^list.*' || g:vimwiki_folding ==? '^lists.*' setlocal fdm=expr setlocal foldexpr=VimwikiFoldListLevel(v:lnum) setlocal foldtext=VimwikiFoldText() - elseif g:vimwiki_folding ==? 'syntax' + elseif g:vimwiki_folding =~? '^syntax.*' setlocal fdm=syntax setlocal foldtext=VimwikiFoldText() else @@ -446,6 +446,14 @@ augroup vimwiki exe 'autocmd InsertLeave *'.s:ext.' call vimwiki#tbl#format(line("."))' exe 'autocmd InsertEnter *'.s:ext.' call vimwiki#tbl#reset_tw(line("."))' endif + if g:vimwiki_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 augroup END "}}} From 6b34e954e8fd669e302e7ad5d679b8448dc128f1 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Wed, 21 Dec 2016 17:09:25 +0100 Subject: [PATCH 002/108] Add new functions for variable access Ref #256 --- autoload/vimwiki/vars.vim | 203 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 autoload/vimwiki/vars.vim diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim new file mode 100644 index 0000000..f7ccdb8 --- /dev/null +++ b/autoload/vimwiki/vars.vim @@ -0,0 +1,203 @@ +" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 +" Vimwiki autoload plugin file +" Desc: stuff concerning Vimwiki's state +" Home: https://github.com/vimwiki/vimwiki/ + + +" copy the user's settings from variables of the form g:vimwiki_