Implement auto-chdir option

This commit is contained in:
Ivan Tishchenko 2015-01-24 10:49:20 +03:00
parent 13e76aed2e
commit 0511b51a5f
3 changed files with 19 additions and 0 deletions

View File

@ -151,6 +151,10 @@ function! vimwiki#base#setup_buffer_state(idx) " {{{ Init page-specific variable
call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir), a:idx) call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir), a:idx)
call VimwikiSet('url', vimwiki#html#get_wikifile_url(expand('%:p')), a:idx) call VimwikiSet('url', vimwiki#html#get_wikifile_url(expand('%:p')), a:idx)
if g:vimwiki_auto_chdir == 1
exe 'lcd' VimwikiGet('path')
endif
" update cache " update cache
call vimwiki#base#cache_buffer_state() call vimwiki#base#cache_buffer_state()
endfunction " }}} endfunction " }}}

View File

@ -2556,6 +2556,19 @@ before the plugin loads. >
The default is '<Leader>w'. The default is '<Leader>w'.
------------------------------------------------------------------------------
*g:vimwiki_auto_chdir*
When set to 1, enables auto-cd feature. Whenever vimwiki page is opened,
vimwiki performs an |:lcd| to the vimwiki folder to where the page belongs.
Value Description~
0 Do not change directory.
1 Change directory to vimwiki folder on opening page.
Default: 0
============================================================================== ==============================================================================
13. Miscellaneous *vimwiki-misc* 13. Miscellaneous *vimwiki-misc*

View File

@ -452,6 +452,8 @@ call s:default('map_prefix', '<Leader>w')
call s:default('current_idx', 0) call s:default('current_idx', 0)
call s:default('auto_chdir', 0)
" Scheme regexes should be defined even if syntax file is not loaded yet " Scheme regexes should be defined even if syntax file is not loaded yet
" cause users should be able to <leader>w<leader>w without opening any " cause users should be able to <leader>w<leader>w without opening any
" vimwiki file first " vimwiki file first