GithubHelp home page GithubHelp logo

umitkablan / vim-rooter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from airblade/vim-rooter

0.0 2.0 0.0 64 KB

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

License: MIT License

Vim Script 94.82% Shell 5.18%

vim-rooter's Introduction

Rooter

Rooter changes the working directory to the project root when you open a file or directory.

The project root is identified by the presence of a known directory, such as a VCS directory, or file, such as a Rakefile. Out of the box it knows about git, darcs, mercurial, bazaar, and subversion, but you can configure it to look for anything.

Use

By default you don't need to do anything: vim-rooter will change the working directory automatically and echo the new working directory.

You can turn this off (see below) and use the :Rooter command to invoke vim-rooter manually.

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

Non-project files

There are three options for non-project files/directories:

  • Don't change directory (default).

    let g:rooter_change_directory_for_non_project_files = ''
  • Change to file's directory (similar to autochdir).

    let g:rooter_change_directory_for_non_project_files = 'current'
  • Change to home directory.

    let g:rooter_change_directory_for_non_project_files = 'home'

Configuration

vim-rooter will unset &autochdir if it's set.

By default all files and directories trigger vim-rooter. Configure a comma separated list of file patterns to specify which files trigger vim-rooter. Include / to trigger vim-rooter on directories.

" directories and all files (default)
let g:rooter_targets = '/,*'

" ignore directories; all files
let g:rooter_targets = '*'

" ignore directories; yaml files
let g:rooter_targets = '*.yml,*.yaml'

" directories and yaml files
let g:rooter_targets = '/,*.yml,*.yaml'

To stop vim-rooter changing directory automatically:

let g:rooter_manual_only = 1

To specify how to identify a project's root directory:

let g:rooter_patterns = ['Rakefile', '.git/']

Vim-rooter checks the patterns depth (height?) first. Directories must have a trailing slash. To work correctly with git submodules place .git before .git/.

To change directory for the current window only (:lcd):

let g:rooter_use_lcd = 1

To stop vim-rooter echoing the project directory:

let g:rooter_silent_chdir = 1

By default vim-rooter doesn't resolve symbolic links. To resolve links:

let g:rooter_resolve_links = 1

Using root-finding functionality in other scripts

The public function FindRootDirectory() returns the absolute path to the root directory as a string, if a root directory is found, or an empty string otherwise.

If that's all you need you can turn off the directory-changing behaviour with:

let g:rooter_manual_only = 1

Installation

Install into ~/.vim/plugin/rooter.vim or, if you're using Pathogen, into ~/.vim/bundle/rooter.vim.

vim-rooter's People

Contributors

airblade avatar blueyed avatar ciuncan avatar endel avatar gryftir avatar kuniwak avatar leucos avatar mechazoidal avatar rdnetto avatar roryokane avatar rphillips avatar teranex avatar travv0 avatar victor-pavlychko avatar wridgers avatar zah avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.