Last active
August 9, 2017 04:43
-
-
Save himalay/b7c8a75d03ce044d0cfe9c74da2f4559 to your computer and use it in GitHub Desktop.
Git bash profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ######## PROMPT ######## | |
| # export PS1="\[\e]0;\W\a\]\n\[\e[32m\]➜\[\e[m\] \[\033[1;36m\]\W\[\033[0m\] $(__git_ps1) " | |
| # $ \[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__g it_ps1`\[\033[0m\]\n$ | |
| if test -f /etc/profile.d/git-sdk.sh | |
| then | |
| TITLEPREFIX=SDK-${MSYSTEM#MINGW} | |
| else | |
| TITLEPREFIX=$MSYSTEM | |
| fi | |
| # PS1='\[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]' # set window title | |
| PS1='\[\033]0;.../${PWD##*/}\007\]' # set window title | |
| PS1="$PS1"'\n ' # new line | |
| # PS1="$PS1"'\[\033[32m\]' # change to green | |
| # PS1="$PS1"'\u@\h ' # user@host<space> | |
| # PS1="$PS1"'\[\033[35m\]' # change to purple | |
| # PS1="$PS1"'$MSYSTEM ' # show MSYSTEM | |
| PS1="$PS1"'\[\033[33m\]' # change to brownish yellow | |
| PS1="$PS1"'\w' # current working directory | |
| if test -z "$WINELOADERNOEXEC" | |
| then | |
| GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)" | |
| COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}" | |
| COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}" | |
| COMPLETION_PATH="$COMPLETION_PATH/share/git/completion" | |
| if test -f "$COMPLETION_PATH/git-prompt.sh" | |
| then | |
| . "$COMPLETION_PATH/git-completion.bash" | |
| . "$COMPLETION_PATH/git-prompt.sh" | |
| PS1="$PS1"'\[\033[36m\]' # change color to cyan | |
| PS1="$PS1"'`__git_ps1`' # bash function | |
| fi | |
| fi | |
| PS1="$PS1"'\[\033[0m\]' # change color | |
| PS1="$PS1"'\n' # new line | |
| # PS1="$PS1"'\[\e[32m\]➜ \[\e[m\]' # prompt: always ➜ | |
| PS1="$PS1"'\[\e[1;31m\] ♥ \[\e[m\]' # prompt: always 💓 | |
| MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc | |
| ######## HISTORY ######## | |
| # Append to the history file, don't overwrite it | |
| shopt -s histappend | |
| # Save multi-line commands as one command | |
| shopt -s cmdhist | |
| # Record each line as it gets issued | |
| PROMPT_COMMAND='history -a' | |
| # Huge history. Doesn't appear to slow things down, so why not? | |
| HISTSIZE=500000 | |
| HISTFILESIZE=100000 | |
| # Avoid duplicate entries | |
| HISTCONTROL="erasedups:ignoreboth" | |
| # Don't record some commands | |
| export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history" | |
| # Useful timestamp format | |
| HISTTIMEFORMAT='%F %T ' | |
| ######## PATH ######## | |
| export PATH="~/.bin:$HOME/AppData/Local/atom/bin:/c/Program Files (x86)/Microsoft VS Code/bin:$PATH" | |
| export PATH=/usr/bin/:$PATH | |
| export PATH=/c/Program\ Files/MongoDB/Server/3.4/bin/:$PATH | |
| export PATH=/c/Program\ Files/Oracle/VirtualBox:$PATH | |
| # node/npm | |
| NPM_PACKAGES="$HOME/.npm-packages" | |
| export PATH="$NPM_PACKAGES:$PATH" | |
| ######## ALIAS ######## | |
| alias etc="cd /c/Windows/System32/Drivers/etc" | |
| # ubuntu virtualbox | |
| alias vmls="VBoxManage list vms" | |
| alias vmstart="VBoxManage startvm --type headless ubuntu" | |
| alias vmssh="ssh himalay@127.0.0.1" | |
| alias vmstat="VBoxManage showvminfo ubuntu | grep State" | |
| ######## TAB/AUTO-COMPLETION ######## | |
| # Perform file completion in a case insensitive fashion | |
| bind "set completion-ignore-case on" | |
| # Treat hyphens and underscores as equivalent | |
| bind "set completion-map-case on" | |
| # Display matches for ambiguous patterns at first tab press | |
| bind "set show-all-if-ambiguous on" | |
| # Immediately add a trailing slash when autocompleting symlinks to directories | |
| bind "set mark-symlinked-directories on" | |
| # Prepend cd to directory names automatically | |
| shopt -s autocd 2> /dev/null | |
| # Correct spelling errors during tab-completion | |
| shopt -s dirspell 2> /dev/null | |
| # Correct spelling errors in arguments supplied to cd | |
| shopt -s cdspell 2> /dev/null | |
| # Enable history expansion with space. E.g. typing !!<space> will replace the !! with your last command | |
| bind Space:magic-space | |
| # base directory for cd command | |
| CDPATH=".:~/projects:~/projects/eremit" | |
| # Enable incremental history search with up/down arrows (also Readline goodness) | |
| bind '"\e[A": history-search-backward' | |
| bind '"\e[B": history-search-forward' | |
| bind '"\e[C": forward-char' | |
| bind '"\e[D": backward-char' | |
| ######## MISC ######## | |
| if [ -z "$SSH_AUTH_SOCK" ] ; then | |
| eval `ssh-agent` | |
| ssh-add | |
| fi | |
| # Automatically trim long paths in the prompt (requires Bash 4.x) | |
| PROMPT_DIRTRIM=2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment