Giter Club home page Giter Club logo

extended_bashrc's Introduction

extended_bashrc

Git branch

This bashrc shows on which repo I am working (and at which branch).

To use this extension, run the following:

curl -L https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh > ~/.git-prompt.sh

or copy the file .git-prompt.sh from this repo to ~/

Copy the file bashrc_ext to ~/bashrc_ext

Then, alter your .bashrc:

vim ~/.bashrc

Allow for color prompt in bash. Search for the following lines and alter it accordingly:

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
   PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;31m\]$(__git_ps1 "\n@%s")\[\033[00m\]\$ '
else
   PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

In your ~/.bashrc add the following line after the previous lines:

# Overwrites PS1
source ~/.git-prompt.sh
source ~/bashrc_ext

cdp

cdp enables you to create a config file with directory shorthands, to for example project directories. By typing cdp (or by using tab completion) you can quickly change to the configured directory.

In order to use the cd shorthand function, create a config file:

~/.cdp.config

This is an example cdp.config file:

# Config file for cdp shorthand, see https://github.com/mathijsdelangen/extended_bashrc
# Shorthands are only reloaded when bash is reloaded!

# Do not use ~, use $HOME instead
project_paths["home"]="$HOME"
project_paths["project1"]="/data/projects/project1/work"
project_paths["project1-n"]="$HOME/projects/company3/project1/Rxx"
project_paths["paard-docs"]="/data/projects/paard/docs/work"

extended_bashrc's People

Contributors

mathijsdelangen avatar

Stargazers

Okke Hendriks avatar Ahmed Bani avatar

Watchers

James Cloos avatar  avatar

Forkers

okkehendriks

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.