projectroot : Automatic guessing of projectroots
| script karma
Downloaded by 125
Comments, bugs, improvements
script versions (upload new version)
|Github project: https://github.com/dbakker/vim-projectroot
There already are a ton of plugins (such as CtrlP) that try to guess what the main project folder is of a file that you're working on, but this plugin allows to easily re-use that functionality in your own custom mappings or scripts.
* Works out-of-the-box on most projects by detecting folders such as .git.
* Very customizeable.
* Easy to use in mappings and your own scripts, just call ProjectRootGuess() to get the project root of the current file or ProjectRootGuess(file) for another file.
* Can be combined with existing plugins
* Tries to be as lightweight as possible. Only searches for a project root when a method such as ProjectRootGuess is used.
* ProjectRootGuess([file]): Returns the project root for the given file (or for the current file if none is given).
* ProjectRootExe(cmd): Temporarily changes the current directory to that of the project root, then executes the command.
* ProjectRootCD([file]): Changes the current directory to project root of the given file.
* ProjectRootBuffers([file]): Returns all buffers belonging to the same project of the given file.
For example, to automatically change the current directory to the projectroot of the current file you could add this to your .vimrc:
au BufEnter * if &ft != 'help' | call ProjectRootCD() | endif
|My recommended way of installing this plugin would be by using Vundle or Pathogen, and pointing them at https://github.com/dbakker/vim-projectroot .
To manually install the plugin just download projectroot.zip and put projectroot.vim in your plugin/ folder. However, if you are contemplating to use this you're probably advanced enough to know this yourself. :)
Click on the package to download.
ip used for rating: 126.96.36.199