Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect user's &autochdir for not triggered buffer #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can turn this off (see below) and use the `:Rooter` command to invoke Rooter

When Rooter changes the working directory it emits the autocmd user event `RooterChDir`.

Rooter will unset `&autochdir` if it's set.
For triggered buffers, rooter will unset `&autochdir` if it's set. For other buffers, rooter respect user's setting of `&autochdir`.


## Configuration
Expand Down
3 changes: 1 addition & 2 deletions doc/rooter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ Rooter manually.
When Rooter changes the working directory it emits the |autocmd| |User| event
`RooterChDir`.

Rooter will unset 'autochdir' if it's set.

For triggered buffers, rooter will unset `&autochdir` if it's set. For other buffers, rooter respect user's setting of `&autochdir`.

==============================================================================
Configuration *rooter-configuration*
Expand Down
11 changes: 10 additions & 1 deletion plugin/rooter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ if !exists('g:rooter_manual_only')
let g:rooter_manual_only = 0
endif

let s:user_autochdir=0
if exists('+autochdir') && &autochdir && !g:rooter_manual_only
let s:user_autochdir=1
set noautochdir
endif

Expand Down Expand Up @@ -66,7 +68,14 @@ augroup END


function! s:rooter()
if !s:activate() | return | endif
if !s:activate()
if s:user_autochdir
setl autochdir
endif
return
endif

set noautochdir

let root = getbufvar('%', 'rootDir')
if empty(root)
Expand Down