The original project can be found at but the modification that I applyed maybe are too personal so I preferred to keep this repo as a fork for now
Rooter is a Vim plugin which changes the working directory to the project root when you open a file.
The project root is identified by the presence of known directory, such as a VCS directory, or file, such as a Rakefile or a "Container" directory. Currently git, darcs, mercurial, bazaar, and subversion are supported.
By default you don't need to do anything: vim-rooter will change the working directory automatically.
You can always invoke vim-rooter manually.
Note: autochdir
will be disabled by this plugin
If you want to use this plugin manually you have to set the g:rooter_manual_only
and define a mapping for <Plug>(rooter-change-root-directory)
like this:
map <silent> <unique> <Leader>foo <Plug>(rooter-change-root-directory)
where <Leader>foo
is the mapping you want.
You can add your own directory and file patterns like this:
call rooter#extend_patterns(['Rakefile', '.git/'])
this will add the patterns to the default one.
Note: directories should have a trailing slash.
If a pattern like this is set
call rooter#extend_patterns(['~/some/path/{}'])
With this directories:
+-~/
| +-some
| | +-path
| | | +-project1
| | | +-project2
Open a file inside project1 would set ~/some/path/project1 as local current directory
You can have vim-rooter change directory (:cd
) instead of
locally changing directory (:lcd
) by adding this to your .vimrc
:
let g:rooter_use_cd = 1
When vim-rooter encounters a non-project file, it won't change directory by default. If you would instead like vim-rooter to change to the file's directory, do this:
let g:rooter_change_directory_for_non_project_files = 1
Install the distributed files into your Vim script directory which is usually ~/.vim/, or $HOME/vimfiles on Windows.
cd ~/.vim/bundle
git clone git://github.com/vheon/vim-rooter.git
Bundle 'vheon/vim-rooter'