Permalink
Browse files

Split .bashrc into interactive and non-interactive

  • Loading branch information...
1 parent 049e002 commit 6c9972b105902f077218e585ba52c462b5116067 @renato-zannon committed Mar 23, 2012
Showing with 69 additions and 67 deletions.
  1. +3 −67 .bashrc
  2. +62 −0 .bashrc.interactive
  3. +4 −0 .bashrc.noninteractive
View
70 .bashrc
@@ -1,69 +1,5 @@
-# If not running interactively, don't do anything
-[[ $- != *i* ]] && return
-
-# don't put duplicate lines in the history. See bash(1) for more options
-# ... or force ignoredups and ignorespace
-HISTCONTROL=ignoredups:ignorespace
-
-# append to the history file, don't overwrite it
-shopt -s histappend
-
-# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
-HISTSIZE=5000
-HISTFILESIZE=10000
-
-# check the window size after each command and, if necessary,
-# update the values of LINES and COLUMNS.
-shopt -s checkwinsize
-
-# make less more friendly for non-text input files, see lesspipe(1)
-[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
-
-if [ -f "/etc/dircolors" ] ; then
- eval $(dircolors -b /etc/dircolors)
-
- if [ -f "$HOME/.dircolors" ] ; then
- eval $(dircolors -b $HOME/.dircolors)
- fi
-fi
-
-alias ls='ls --color=auto'
-alias grep='grep --color=auto'
-alias fgrep='fgrep --color=auto'
-alias egrep='egrep --color=auto'
-
-# enable programmable completion features (you don't need to enable
-# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
-# sources /etc/bash.bashrc).
-if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
- . /etc/bash_completion
+if [[ $- == *i* ]]; then
+ source $HOME/.bashrc.interactive
fi
-eval $(keychain --eval -Q --quiet --noask id_rsa)
-
-# Sets the console to vi mode
-set -o vi
-
-alias "gvim"="$HOME/bin/transparent_gvim"
-
-export PATH="./bin:$HOME/bin:$PATH"
-
-# Just to be explicit =)
-export EDITOR="vim"
-export VIMHOME="$HOME/.vim"
-export COLORTERM="urxvt"
-
-shopt -s dirspell
-shopt -s globstar
-bind Space:magic-space
-
-function title() {
- echo -en "\033]2;$@\007"
-}
-
-alias "ssh"="lazy_ssh ssh"
-alias "scp"="lazy_ssh scp"
-alias "sshfs"="lazy_ssh sshfs"
-alias "git"="lazy_ssh git"
-
-[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
+source $HOME/.bashrc.noninteractive
View
62 .bashrc.interactive
@@ -0,0 +1,62 @@
+# don't put duplicate lines in the history. See bash(1) for more options
+# ... or force ignoredups and ignorespace
+HISTCONTROL=ignoredups:ignorespace
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+HISTSIZE=5000
+HISTFILESIZE=10000
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# make less more friendly for non-text input files, see lesspipe(1)
+[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+if [ -f "/etc/dircolors" ] ; then
+ eval $(dircolors -b /etc/dircolors)
+
+ if [ -f "$HOME/.dircolors" ] ; then
+ eval $(dircolors -b $HOME/.dircolors)
+ fi
+fi
+
+alias ls='ls --color=auto'
+alias grep='grep --color=auto'
+alias fgrep='fgrep --color=auto'
+alias egrep='egrep --color=auto'
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
+ . /etc/bash_completion
+fi
+
+eval $(keychain --eval -Q --quiet --noask id_rsa)
+
+# Sets the console to vi mode
+set -o vi
+
+alias "gvim"="$HOME/bin/transparent_gvim"
+
+# Just to be explicit =)
+export EDITOR="vim"
+export VIMHOME="$HOME/.vim"
+export COLORTERM="urxvt"
+
+shopt -s dirspell
+shopt -s globstar
+bind Space:magic-space
+
+function title() {
+ echo -en "\033]2;$@\007"
+}
+
+alias "ssh"="lazy_ssh ssh"
+alias "scp"="lazy_ssh scp"
+alias "sshfs"="lazy_ssh sshfs"
+alias "git"="lazy_ssh git"
View
4 .bashrc.noninteractive
@@ -0,0 +1,4 @@
+export PATH="$HOME/bin:$PATH"
+
+# RVM setup
+[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

0 comments on commit 6c9972b

Please sign in to comment.