mirror of https://github.com/nirenjan/dotfiles.git
Move Bash startup files to separate folder
Make it easier to add new configuration to Bash by adding a .bash file to ~/.bashrc.d/. This file will be executed on startup.master
parent
6aa4ac66b4
commit
a5071c6285
|
@ -6,48 +6,11 @@ add_to_path() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Define the colors used by the prompt
|
|
||||||
if [[ ! -z $TERM && "$TERM" != "dumb" ]]
|
|
||||||
then
|
|
||||||
T_B=$(tput setaf 4) # Blue
|
|
||||||
T_G=$(tput setaf 2) # Green
|
|
||||||
T_Y=$(tput setaf 3) # Yellow
|
|
||||||
T_S=$(tput sgr0) # Reset
|
|
||||||
else
|
|
||||||
# We've probably been invoked by an SSH command, there's no terminal
|
|
||||||
# to deal with. Don't bother coloring the prompt.
|
|
||||||
T_B=''
|
|
||||||
T_G=''
|
|
||||||
T_Y=''
|
|
||||||
T_S=''
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Import the Git prompt shell functions. These can be found
|
|
||||||
# @github:git/git/contrib/completion/git_prompt.sh
|
|
||||||
if [ -f $HOME/.git_prompt.sh ]; then
|
|
||||||
source $HOME/.git_prompt.sh
|
|
||||||
export PS1='\[$T_B\]\u@\h \[$T_S\][\[$T_G\]$(smartwd)$(__git_ps1 " \[$T_Y\](%s)")\[$T_S\]]\$ '
|
|
||||||
else
|
|
||||||
export PS1='\[$T_B\]\u@\h \[$T_S\][\[$T_G\]$(smartwd)\[$T_S\]]\$ '
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add $HOME/bin to PATH
|
# Add $HOME/bin to PATH
|
||||||
add_to_path $HOME/bin
|
add_to_path $HOME/bin
|
||||||
|
|
||||||
# Add ls coloring
|
# Source all *.bash files in ~/.bashrc.d/
|
||||||
# Don't bother if LS_COLORS is already set
|
for f in $(ls $HOME/.bashrc.d/*.bash)
|
||||||
if [[ -z $LS_COLORS && -f $HOME/.bashrc.lscolors ]]; then
|
do
|
||||||
source $HOME/.bashrc.lscolors
|
source $f
|
||||||
fi
|
done
|
||||||
|
|
||||||
# Source the common aliases across systems
|
|
||||||
if [[ -f $HOME/.bashrc.aliases ]]; then
|
|
||||||
source $HOME/.bashrc.aliases
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Keep system specific aliases in a seperate file called .aliases
|
|
||||||
# If .aliases exists it will envoked by the next line:
|
|
||||||
if [ -f $HOME/.aliases ]; then
|
|
||||||
source $HOME/.aliases
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# Source the common aliases across systems
|
||||||
# ls aliases
|
# ls aliases
|
||||||
alias ll='ls -l'
|
alias ll='ls -l'
|
||||||
|
|
||||||
|
@ -6,9 +7,15 @@ alias tgp='time git pull'
|
||||||
alias gf='git fetch'
|
alias gf='git fetch'
|
||||||
|
|
||||||
# Tmux aliases
|
# Tmux aliases
|
||||||
# Use this to launch in 16-color mode
|
# Use this to launch in 256-color mode
|
||||||
alias tmux='TERM=screen-256color-bce tmux -2 -u'
|
alias tmux='TERM=screen-256color-bce tmux -2 -u'
|
||||||
# Attach to an existing tmux session
|
# Attach to an existing tmux session
|
||||||
alias work='TERM=screen-256color-bce tmux -2 -u attach -d'
|
alias work='TERM=screen-256color-bce tmux -2 -u attach -d'
|
||||||
# Trigger tmux to reopen the socket if it cannot attach
|
# Trigger tmux to reopen the socket if it cannot attach
|
||||||
alias kick='pkill -USR1 -u $USER tmux'
|
alias kick='pkill -USR1 -u $USER tmux'
|
||||||
|
|
||||||
|
# Keep system specific aliases in a seperate file called .aliases
|
||||||
|
# If .aliases exists it will envoked by the next line:
|
||||||
|
if [ -f $HOME/.aliases ]; then
|
||||||
|
source $HOME/.aliases
|
||||||
|
fi
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Git prompt functionality
|
||||||
|
|
||||||
|
# Define the colors used by the prompt
|
||||||
|
if [[ ! -z $TERM && "$TERM" != "dumb" ]]
|
||||||
|
then
|
||||||
|
T_B=$(tput setaf 4) # Blue
|
||||||
|
T_G=$(tput setaf 2) # Green
|
||||||
|
T_Y=$(tput setaf 3) # Yellow
|
||||||
|
T_S=$(tput sgr0) # Reset
|
||||||
|
else
|
||||||
|
# We've probably been invoked by an SSH command, there's no terminal
|
||||||
|
# to deal with. Don't bother coloring the prompt.
|
||||||
|
T_B=''
|
||||||
|
T_G=''
|
||||||
|
T_Y=''
|
||||||
|
T_S=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Import the Git prompt shell functions. These can be found
|
||||||
|
# @github:git/git/contrib/completion/git_prompt.sh
|
||||||
|
if [ -f $HOME/.git_prompt.sh ]; then
|
||||||
|
source $HOME/.git_prompt.sh
|
||||||
|
export PS1='\[$T_B\]\u@\h \[$T_S\][\[$T_G\]$(smartwd)$(__git_ps1 " \[$T_Y\](%s)")\[$T_S\]]\$ '
|
||||||
|
else
|
||||||
|
export PS1='\[$T_B\]\u@\h \[$T_S\][\[$T_G\]$(smartwd)\[$T_S\]]\$ '
|
||||||
|
fi
|
|
@ -1,3 +1,9 @@
|
||||||
|
# Add ls coloring
|
||||||
|
# Don't bother setting LS_COLORS if it's alredy set
|
||||||
|
if [[ -n "$LS_COLORS" ]]
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "`uname`" == *"Darwin"* ]]
|
if [[ "`uname`" == *"Darwin"* ]]
|
||||||
then
|
then
|
||||||
|
@ -28,7 +34,7 @@ then
|
||||||
# 9. executable with setguid set
|
# 9. executable with setguid set
|
||||||
# 10. directory writable by others, with sticky bit
|
# 10. directory writable by others, with sticky bit
|
||||||
# 11. directory writable by others, without sticky bit
|
# 11. directory writable by others, without sticky bit
|
||||||
|
|
||||||
export LSCOLORS="ExGxbxdxCxegedabagacad"
|
export LSCOLORS="ExGxbxdxCxegedabagacad"
|
||||||
|
|
||||||
# Must use either CLICOLOR=1 or ls -G
|
# Must use either CLICOLOR=1 or ls -G
|
||||||
|
@ -51,4 +57,3 @@ then
|
||||||
eval `gdircolors $DCFILE`
|
eval `gdircolors $DCFILE`
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
3
install
3
install
|
@ -216,8 +216,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lnfile bash/bashrc.common ~/.bashrc.common
|
lnfile bash/bashrc.common ~/.bashrc.common
|
||||||
lnfile bash/bashrc.lscolors ~/.bashrc.lscolors
|
lnfile bash/bashrc.d ~/.bashrc.d
|
||||||
lnfile bash/bashrc.aliases ~/.bashrc.aliases
|
|
||||||
lnfile dircolors ~/.dir_colors
|
lnfile dircolors ~/.dir_colors
|
||||||
|
|
||||||
if [[ $PRINT_INST == 1 ]]
|
if [[ $PRINT_INST == 1 ]]
|
||||||
|
|
Loading…
Reference in New Issue