Commit fb9feed374eda74150da5b0d4422d847dc477709

Authored by mj
1 parent 05a0b829fc
Exists in master and in 2 other branches 02-merge, dev

ADD .bashrc

Showing 2 changed files with 134 additions and 24 deletions Inline Diff

File was created 1 # If not running interactively, don't do anything
2 case $- in
3 *i*) ;;
4 *) return;;
5 esac
6
7 ########################
8 # ******************** #
9 # * * #
10 # * COMPLETION * #
11 # * * #
12 # ******************** #
13 ########################
14
15 # enable bash completion in interactive shells
16 if [ -f /etc/bash_completion ]; then
17 . /etc/bash_completion
18 fi
19
20 # if the command-not-found package is installed, use it
21 if [ -x /usr/lib/command-not-found ]; then
22 function command_not_found_handle {
23 # check because c-n-f could've been removed in the meantime
24 if [ -x /usr/lib/command-not-found ]; then
25 /usr/bin/python /usr/lib/command-not-found -- $1
26 return $?
27 else
28 return 127
29 fi
30 }
31 fi
32
33 ########################
34 # ******************** #
35 # * * #
36 # * HISTORY * #
37 # * * #
38 # ******************** #
39 ########################
40
41 # Eternal bash history.
42 # ---------------------
43 export HISTFILESIZE=
44 export HISTSIZE=
45 export HISTTIMEFORMAT="[%F %T] "
46 # Change the file location
47 export HISTFILE=~/.history
48 # Force prompt to write history after every command
49 PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
50
51
52 # check the window size after each command
53 shopt -s checkwinsize
54
55 # If set, the pattern "**" used in a pathname expansion context will
56 # match all files and zero or more directories and subdirectories.
57 #shopt -s globstar
58
59 # set variable identifying the chroot you work in (used in the prompt below)
60 if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
61 debian_chroot=$(cat /etc/debian_chroot)
62 fi
63
64 # set a fancy prompt
65 case "$TERM" in
66 xterm-color) color_prompt=yes;;
67 esac
68
69 # colored prompt
70 force_color_prompt=yes
71
72 if [ -n "$force_color_prompt" ]; then
73 if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
74 # We have color support; assume it's compliant with Ecma-48
75 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
76 # a case would tend to support setf rather than setaf.)
77 color_prompt=yes
78 else
79 color_prompt=
80 fi
81 fi
82
83 if [ "$color_prompt" = yes ]; then
84 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
85 else
86 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
87 fi
88 #unset color_prompt force_color_prompt
89
90 # enable color support of ls and also add handy aliases
91 if [ -x /usr/bin/dircolors ]; then
92 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
93 alias ls='ls --color=auto'
94 alias dir='dir --color=auto'
95 alias vdir='vdir --color=auto'
96
97 alias grep='grep --color=auto'
98 alias fgrep='fgrep --color=auto'
99 alias egrep='egrep --color=auto'
100 fi
101
102
103 # Alias definitions
104
105 if [ -f ~/.bash_aliases ]; then
106 . ~/.bash_aliases
107 fi
108
1 # ** Initiate with: ** 1 # ** Initiate with: **
2 # cd && wget http://git.str8.biz/mj/zsh-config/raw/master/tools/install.sh -O -| sh 2 # cd && wget http://git.str8.biz/mj/zsh-config/raw/master/tools/install.sh -O -| sh
3 # ----------------------------------------------------------------------------------- 3 # -----------------------------------------------------------------------------------
4 4
5 set -e 5 set -e
6 6
7 if [ ! -n "$ZCNF" ]; then 7 if [ ! -n "$ZCNF" ]; then
8 ZCNF=~/.config/zsh-config 8 ZCNF=~/.config/zsh-config
9 fi 9 fi
10 10
11 if [ ! -n "$ZSH" ]; then 11 if [ ! -n "$ZSH" ]; then
12 ZSH=$ZCNF/tools/oh-my-zsh 12 ZSH=$ZCNF/tools/oh-my-zsh
13 fi 13 fi
14 14
15 echo "\033[0;34mCleaning...\033[0m"
16 if [ -d ~/.config ]; then
17 if [ -d ~/.config/zsh-config ]; then
18 rm -rf ~/.config/zsh-config
19 fi
20 if [ -d ~/.config/oh-my-zsh ]; then
21 rm -rf ~/.config/oh-my-zsh
22 fi
23 if [ -d ~/.config/antigen ]; then
24 rm -rf ~/.config/antigen
25 fi
26 fi
27 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
28 rm ~/.zshrc
29 fi
30 if [ -f ~/.bash_aliases ] || [ -h ~/.bash_aliases ]; then
31 rm ~/.bash_aliases
32 fi
33
34 echo "\033[0;34mCloning Zsh Config...\033[0m" 15 echo "\033[0;34mCloning Zsh Config...\033[0m"
35 hash git >/dev/null 2>&1 && env git clone --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || { 16 hash git >/dev/null 2>&1 && env git clone --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || {
36 echo "can't clone repo.." 17 echo "can't clone repo.."
37 } 18 }
38 19
39 echo "\033[0;34mLooking for an existing zsh config...\033[0m" 20 echo "\033[0;34mCleaning...\033[0m"
40 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then 21 if [ -d ~/.config/zsh-config ]; then
41 echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-zsh-cnf\033[0m"; 22 if [ -d ~/.config/zsh-config ]; then
42 mv ~/.zshrc ~/.zshrc.pre-zsh-cnf; 23 rm -rf ~/.config/zsh-config
24 fi
25 if [ -d ~/.config/oh-my-zsh ]; then
26 rm -rf ~/.config/oh-my-zsh
27 fi
28 if [ -d ~/.config/antigen ]; then
29 rm -rf ~/.config/antigen
30 fi
31 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
32 mv ~/.zshrc ~/.zshrc.pre-zsh-cnf
33 fi
34
35 #
36 # BASH:
37 #
38
39 if [ -f ~/.bashrc ] || [ -h ~/.bashrc ]; then
40 mv ~/.bashrc ~/.bashrc.pre-zsh-cnf
41 fi
42 if [ -f ~/.bash_aliases ] || [ -h ~/.bash_aliases ]; then
43 rm ~/.bash_aliases
44 fi
43 fi 45 fi
44 46
45 echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" 47 echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m"
46 ln -s $ZCNF/templates/zshrc ~/.zshrc 48 ln -s $ZCNF/templates/zshrc ~/.zshrc
49 ln -s $ZCNF/templates/bashrc ~/.bashrc
47 ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases 50 ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases
48 sed -i -e "/^export ZSH=/ c\\ 51 sed -i -e "/^export ZSH=/ c\\
49 export ZSH=$ZSH 52 export ZSH=$ZSH
50 " ~/.zshrc 53 " ~/.zshrc
51 54
52 echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" 55 echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
53 sed -i -e "/export PATH=/ c\\ 56 sed -i -e "/export PATH=/ c\\
54 export PATH=\"$PATH\" 57 export PATH=\"$PATH\"