Git Product home page Git Product logo

cd-gitroot's Introduction

cd-gitroot

Synopsis

zsh plugin to change directory to git repository root directory

Inspired by id:hitode909 blog post.

How to set up

Manually install

Put cd-gitroot and _cd-gitroot files somewhere in your $fpath and add the following line to your .zshrc:

autoload -Uz cd-gitroot

For example

# download all files
% cd /path/to/dir
% git clone https://github.com/mollifier/cd-gitroot.git

And add the following lines to your .zshrc:

fpath=(/path/to/dir/cd-gitroot(N-/) $fpath)

autoload -Uz cd-gitroot

Installing using Antigen

If you use Antigen, add the following line to your .zshrc:

antigen bundle mollifier/cd-gitroot

Using Oh-my-zsh:

If you use Oh-my-zsh:

  1. Clone this repository in oh-my-zsh's plugins directory:

     git clone https://github.com/mollifier/cd-gitroot.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/cd-gitroot
    

you 2. Activate the plugin in ~/.zshrc:

    plugins=( [plugins...] cd-gitroot)
  1. Source ~/.zshrc to take changes into account:

     source ~/.zshrc
    

Installing using Zgen

If you use zgen, add the following to your .zshrc

zgen load mollifier/cd-gitroot

to your .zshrc with your other zgen load commands.

You can set alias to this function. e.g.

alias cdu='cd-gitroot'

Usage

cd-gitroot [PATH]

If PATH isn't specified, change directory to current git repository root directory. else change directory to PATH instead of it. PATH is treated relative path in git root directory.

Options

-h display help and exit

cd-gitroot's People

Contributors

mollifier avatar ponko2 avatar unixorn avatar vegerot avatar

Watchers

 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.