Skip to content

Instantly share code, notes, and snippets.

@ruph
Last active February 23, 2016 15:47

Revisions

  1. ruph revised this gist Jun 5, 2015. 1 changed file with 25 additions and 3 deletions.
    28 changes: 25 additions & 3 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,29 @@
    # Set the PS1 prompt (with colors).
    # Based on http://www.ibm.com/developerworks/library/l-tip-prompt/
    Set the PS1 prompt (with colors).
    # Based on http://www-128.ibm.com/developerworks/linux/library/l-tip-prompt/
    # And http://networking.ringofsaturn.com/Unix/Bash-prompts.php .
    PS1="\[\e[37;1m\]\h\[\e[37;1m\]:\[\e[30;1m\]\w$ \[\e[0m\]"
    # PS1="\h\[\e[32;1m\]:\[\e[32;1m\]\w$ \[\e[0m\]"

    ## GIT / SVN aware prompt
    BLACK="\[\033[0;38m\]"
    RED="\[\033[0;31m\]"
    RED_BOLD="\[\033[01;31m\]"
    BLUE="\[\033[01;34m\]"
    GREEN="\[\033[0;32m\]"

    parse_git_branch () {
    git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (git::\1)#'
    }
    parse_svn_branch() {
    parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | egrep -o '(tags|branches)/[^/]+|trunk' | egrep -o '[^/]+$' | awk '{print " ("$1")" }'
    }
    parse_svn_url() {
    svn info 2>/dev/null | sed -ne 's#^URL: ##p'
    }
    parse_svn_repository_root() {
    svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'
    }

    PS1='\h\[\e[32;1m\]:\[\e[32;1m\]\w\[\033[0;31m\]$(parse_git_branch)$(parse_svn_branch)\[\033[00m\]\$ '

    # Set the default editor to vim.
    export EDITOR=vim
  2. ruph revised this gist May 25, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .bashrc
    Original file line number Diff line number Diff line change
    @@ -46,4 +46,4 @@ alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/

    # GNU GLOBAL (gtags)
    export GTAGSCONF="$HOME/.globalrc"
    export GTAGSLABEL="ctags"
    export GTAGSLABEL="pygments-parser"
  3. ruph revised this gist May 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .bashrc
    Original file line number Diff line number Diff line change
    @@ -46,4 +46,4 @@ alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/

    # GNU GLOBAL (gtags)
    export GTAGSCONF="$HOME/.globalrc"
    export GTAGSLABLE="ctags"
    export GTAGSLABEL="ctags"
  4. ruph revised this gist May 11, 2015. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion .bashrc
    Original file line number Diff line number Diff line change
    @@ -42,4 +42,8 @@ alias svnci="svn st | grep ^[AMD] | awk '{print \$2}' | xargs svn ci"

    # Quick way to rebuild the Launch Services database and get rid
    # of duplicates in the Open With submenu.
    alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user'
    alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user'

    # GNU GLOBAL (gtags)
    export GTAGSCONF="$HOME/.globalrc"
    export GTAGSLABLE="ctags"
  5. ruph revised this gist Feb 22, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .bashrc
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # Set the PS1 prompt (with colors).
    # Based on http://www-128.ibm.com/developerworks/linux/library/l-tip-prompt/
    # Based on http://www.ibm.com/developerworks/library/l-tip-prompt/
    # And http://networking.ringofsaturn.com/Unix/Bash-prompts.php .
    PS1="\[\e[37;1m\]\h\[\e[37;1m\]:\[\e[30;1m\]\w$ \[\e[0m\]"

  6. ruph revised this gist Sep 16, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,9 @@ PS1="\[\e[37;1m\]\h\[\e[37;1m\]:\[\e[30;1m\]\w$ \[\e[0m\]"
    # Set the default editor to vim.
    export EDITOR=vim

    # Proper java home
    export JAVA_HOME=$(/usr/libexec/java_home)

    # Set bash history
    HISTFILE="$HOME/.bash_history"
    HISTFILESIZE=10240
  7. ruph revised this gist Jun 18, 2013. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,10 @@ alias grep='grep --color=auto --exclude-dir=\.svn'
    export CLICOLOR=1
    export LSCOLORS=GxFxCxDxBxegedabagaced

    alias svnadd="svn st | grep ^? | awk '{print \$2}' | xargs svn add"
    alias svndel="svn st | grep ^! | awk '{print \$2}' | xargs svn del"
    alias svnci="svn st | grep ^[AMD] | awk '{print \$2}' | xargs svn ci"

    # Quick way to rebuild the Launch Services database and get rid
    # of duplicates in the Open With submenu.
    alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user'
  8. ruph revised this gist Mar 16, 2013. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion .bashrc
    Original file line number Diff line number Diff line change
    @@ -31,4 +31,8 @@ alias grep='grep --color=auto --exclude-dir=\.svn'

    # Sweet colors
    export CLICOLOR=1
    export LSCOLORS=GxFxCxDxBxegedabagaced
    export LSCOLORS=GxFxCxDxBxegedabagaced

    # Quick way to rebuild the Launch Services database and get rid
    # of duplicates in the Open With submenu.
    alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user'
  9. ruph revised this gist Nov 4, 2012. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -12,15 +12,18 @@ HISTFILESIZE=10240
    HISTSIZE=10240

    # Avoid succesive duplicates in the bash command history.
    export HISTCONTROL=ignoredups:erasedups
    export HISTCONTROL=ignoredups:erasedups:ignorespace

    # ... and ignore ls and cd (if they are called without arguments), and bg,
    # fg, exit, and clear, _and_ any command prefaced with a space
    export HISTIGNORE='&:clear:ls:cd:[bf]g:exit:[ t\]*'

    # Append commands to the bash command history file (~/.bash_history)
    # instead of overwriting it.
    shopt -s histappend

    # Append commands to the history every time a prompt is shown,
    # instead of after closing the session.
    PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
    # Write out changes in history after every command
    export PROMPT_COMMAND="history -a"

    # Make grep more user friendly by highlighting matches
    # and exclude grepping through .svn folders.
  10. ruph revised this gist Oct 22, 2012. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion .bashrc
    Original file line number Diff line number Diff line change
    @@ -24,4 +24,8 @@ PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"

    # Make grep more user friendly by highlighting matches
    # and exclude grepping through .svn folders.
    alias grep='grep --color=auto --exclude-dir=\.svn'
    alias grep='grep --color=auto --exclude-dir=\.svn'

    # Sweet colors
    export CLICOLOR=1
    export LSCOLORS=GxFxCxDxBxegedabagaced
  11. ruph created this gist Oct 22, 2012.
    27 changes: 27 additions & 0 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # Set the PS1 prompt (with colors).
    # Based on http://www-128.ibm.com/developerworks/linux/library/l-tip-prompt/
    # And http://networking.ringofsaturn.com/Unix/Bash-prompts.php .
    PS1="\[\e[37;1m\]\h\[\e[37;1m\]:\[\e[30;1m\]\w$ \[\e[0m\]"

    # Set the default editor to vim.
    export EDITOR=vim

    # Set bash history
    HISTFILE="$HOME/.bash_history"
    HISTFILESIZE=10240
    HISTSIZE=10240

    # Avoid succesive duplicates in the bash command history.
    export HISTCONTROL=ignoredups:erasedups

    # Append commands to the bash command history file (~/.bash_history)
    # instead of overwriting it.
    shopt -s histappend

    # Append commands to the history every time a prompt is shown,
    # instead of after closing the session.
    PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"

    # Make grep more user friendly by highlighting matches
    # and exclude grepping through .svn folders.
    alias grep='grep --color=auto --exclude-dir=\.svn'