f8b98a03cfc71892b3191f841553a885d2d88631
[dotfiles] / .bashrc
1 #!/bin/sh
2
3 # ~/.bashrc: executed by bash(1) for non-login shells.
4 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
5 # for examples
6
7 # vcprompt & other things
8 export PATH=$PATH:$HOME/bin
9
10 # nim lang
11 export PATH=$PATH:$HOME/bin/nim-0.10.2/bin
12
13 # If not running interactively, don't do anything
14 case $- in
15 *i*) ;;
16 *) return;;
17 esac
18
19
20 # make less more friendly for non-text input files, see lesspipe(1)
21 #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
22
23 # set variable identifying the chroot you work in (used in the prompt below)
24 if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
25 debian_chroot=$(cat /etc/debian_chroot)
26 fi
27
28 # set a fancy prompt (non-color, unless we know we "want" color)
29 case "$TERM" in
30 xterm-color) color_prompt=yes;;
31 esac
32
33 # uncomment for a colored prompt, if the terminal has the capability; turned
34 # off by default to not distract the user: the focus in a terminal window
35 # should be on the output of commands, not on the prompt
36 force_color_prompt=yes
37
38 if [ -n "$force_color_prompt" ]; then
39 if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
40 # We have color support; assume it's compliant with Ecma-48
41 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
42 # a case would tend to support setf rather than setaf.)
43 color_prompt=yes
44 else
45 color_prompt=
46 fi
47 fi
48
49 # export command for coloring
50 # '\e[x;ym $PS1 \e[m' or [\033[x;ym\] $PS1 [\033[00m\] x;y being the color pair to use
51
52 if [ "$color_prompt" = yes ]; then
53 #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $(__git_ps1 "[%s]") \$ '
54 #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $(vcprompt -f %b%a%m%u) > '
55 if [ $USER='nsukami' ]; then
56 #PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]\h\[\033[00m\]:\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] > '
57 PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]k\[\033[00m\]:\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] \n > '
58 else
59 PS1='${debian_chroot:+($debian_chroot)}\u@\[\033[31m\]\h\[\033[00m\]:\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] \n > '
60 fi
61 else
62 #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w $(__git_ps1 "[%s]") \$ '
63 if [ $USER='nsukami']; then
64 #PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]\h\[\033[00m\]:\w $(vcprompt -f %b%a%m%u) > '
65 PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]k\[\033[00m\]:\w $(vcprompt -f %b%a%m%u) \n > '
66 else
67 PS1='${debian_chroot:+($debian_chroot)}\u@\[\033[31m\]\h\[\033[00m\]:\w $(vcprompt -f %b%a%m%u) \n > '
68 fi
69
70 fi
71 unset color_prompt force_color_prompt
72
73 # If this is an xterm set the title to user@host:dir
74 case "$TERM" in
75 xterm*|rxvt*)
76 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w $(vcprompt -f %b%a%m%u) \a\]$PS1"
77 ;;
78 *)
79 ;;
80 esac
81
82 # enable color support of ls
83 if [ -x /usr/bin/dircolors ]; then
84 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
85 alias ls='ls --color=auto'
86 fi
87
88
89
90 # enable programmable completion features (you don't need to enable
91 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
92 # sources /etc/bash.bashrc).
93 if ! shopt -oq posix; then
94 if [ -f /usr/share/bash-completion/bash_completion ]; then
95 . /usr/share/bash-completion/bash_completion
96 elif [ -f /etc/bash_completion ]; then
97 . /etc/bash_completion
98 fi
99 fi
100
101 # start gpg agent
102 # be sure to have done apt install gpg-agent pinentry-curses first
103 eval `gpg-agent --daemon`
104
105 # Alias definitions.
106 # You may want to put all your additions into a separate file like
107 # ~/.bash_aliases, instead of adding them here directly.
108 # See /usr/share/doc/bash-doc/examples in the bash-doc package.
109 [[ -f ~/.bash_aliases ]] && . ~/.bash_aliases
110
111 # git completion
112 [[ -f ~/.git_completion ]] && . ~/.git_completion
113
114 # personal customization
115 [[ -f ~/.bash_customization ]] && . ~/.bash_customization
116
117 # personal functions
118 [[ -f ~/.bash_function ]] && . ~/.bash_function
119
120 # personal export
121 [[ -f ~/.bash_export ]] && . ~/.bash_export
122
123 # personal color
124 [[ -f ~/.bash_color ]] && . ~/.bash_color
125
126 # personal shopt
127 [[ -f ~/.bash_shopt ]] && . ~/.bash_shopt
128
129 # git completion
130 [[ -f ~/.git_completion ]] && . ~/.git_completion
131
132 # is or is not
133 [[ -f ~/.bash_is ]] && . ~/.bash_is
134
135 # jump to directories
136 [[ -f ~/.bash_marks ]] && . ~/.bash_marks
137
138 # tmux completion script
139 [[ -f ~/.bash_tmux ]] && . ~/.bash_tmux
140
141 # jump completion script
142 [[ -f ~/.bash_compl ]] && . ~/.bash_compl
143
144 # jump completion script
145 [[ -f ~/.bash_base64 ]] && . ~/.bash_base64
146
147 # emacs launcher script
148 [[ -f ~/.bash_emacs ]] && . ~/.bash_emacs
149
150 # memo
151 [[ -f ~/.bash_memo ]] && . ~/.bash_memo
152
153 # custom bindings
154
155 [[ -f ~/.bash_bind ]] && . ~/.bash_bind
156
157 # custom filters
158
159 [[ -f ~/.bash_filters ]] && . ~/.bash_filters
160
161 # print available tmux sessions if available
162 tmux list-sessions 2> /dev/null