Skip to content

Changes Vim working directory to project root (identified by presence of known directory or file).

Notifications You must be signed in to change notification settings

vheon/vim-rooter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 

Repository files navigation

This is a fork repo

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

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.

Use

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

Configuration

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.

Container Directory

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

Installation

Manual Install

Install the distributed files into your Vim script directory which is usually ~/.vim/, or $HOME/vimfiles on Windows.

Pathogen

cd ~/.vim/bundle
git clone git://github.com/vheon/vim-rooter.git

Vundle

Bundle 'vheon/vim-rooter'

About

Changes Vim working directory to project root (identified by presence of known directory or file).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%