Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 181 lines (129 sloc) 5.963 kb
230dff4 @thlorenz adding aliases to bashrc and not running it if not in interactive mode
authored
1 ## If not running interactively, don't do anything (e.g., don't screw up scp)
7dff4be @thlorenz fix indent and trailing in rc files
authored
2 [ -z "$PS1" ] && return
230dff4 @thlorenz adding aliases to bashrc and not running it if not in interactive mode
authored
3
ef10618 @thlorenz reorganizing bash scripts and functions
authored
4 function init () {
5 # http://stackoverflow.com/a/246128/97443
11dfda5 @thlorenz changes to switch bashrc with git completion and prompt
authored
6
ef10618 @thlorenz reorganizing bash scripts and functions
authored
7 local SOURCE="${BASH_SOURCE[0]}"
8
9 # resolve $SOURCE until the file is no longer a symlink
10 while [ -h "$SOURCE" ]; do DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
11 SOURCE="$(readlink "$SOURCE")"
12
13 # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
14 [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
15 done
16 local DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
17
ae97b3d @thlorenz adding completions for tmux, ssh, vagrant and brew
authored
18 [ -f $DIR/bash/git-prompt.sh ] && source $DIR/bash/git-prompt.sh
117cfcd @thlorenz ruby: adjusting gems home in order to avoid sudo installs
authored
19 [ -f $DIR/bash/git-prompt.sh ] && source $DIR/bash/exports.sh
ae97b3d @thlorenz adding completions for tmux, ssh, vagrant and brew
authored
20 [ -f $DIR/bash/secret-vars.sh ] && source $DIR/bash/secret-vars.sh
21 [ -f $DIR/bash/functions/index.sh ] && source $DIR/bash/functions/index.sh
22 [ -f $DIR/bash/cmd-aliases.sh ] && source $DIR/bash/cmd-aliases.sh
4d05d75 @thlorenz bash: adding vim aliases
authored
23 [ -f $DIR/bash/vim-aliases.sh ] && source $DIR/bash/vim-aliases.sh
ae97b3d @thlorenz adding completions for tmux, ssh, vagrant and brew
authored
24 [ -f $DIR/bash/git-aliases.sh ] && source $DIR/bash/git-aliases.sh
25 [ -f $DIR/bash/node-aliases.sh ] && source $DIR/bash/node-aliases.sh
ef10618 @thlorenz reorganizing bash scripts and functions
authored
26
27 # Edit/source/cat this bashrc
567f824 @thlorenz fixing bashrc edit/source aliases
authored
28 alias ,ev='vim ~/.bashrc'
29 alias ,sv='source ~/.bashrc'
30 alias ,cv='c ~/.bashrc'
6365046 @thlorenz tmux: adding tmuxifier
authored
31
32 # Source vim inputrc
33 alias ,vi='bind -f ~/.vimputrc'
ef10618 @thlorenz reorganizing bash scripts and functions
authored
34 }
7dff4be @thlorenz fix indent and trailing in rc files
authored
35 init
f03e37c @thlorenz adding secret vars
authored
36
94f4756 initial state of my dotfiles
Thorsten Lorenz authored
37
fa6d5e6 @thlorenz adjustments to vimrc and bashrc
authored
38 # don't put duplicate lines in the history. See bash(1) for more options
39 HISTCONTROL=ignoredups:ignorespace
40
41 # append to the history file, don't overwrite it
42 shopt -s histappend
43
44 # make less more friendly for non-text input files, see lesspipe(1)
45 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
94f4756 initial state of my dotfiles
Thorsten Lorenz authored
46
2fb2f63 @thlorenz minor additions in bashrc
authored
47 # workflows
48 alias yay!='git push origin master && git push --tags && npm publish'
49
50 # other
51 alias serve='echo "http://localhost:3000" && http-server -p 3000 -c-1'
52
94f4756 initial state of my dotfiles
Thorsten Lorenz authored
53 # Environment Variables
54 export EDITOR=vim
11dfda5 @thlorenz changes to switch bashrc with git completion and prompt
authored
55 export SHELL=/usr/local/bin/bash
94f4756 initial state of my dotfiles
Thorsten Lorenz authored
56
c9f93a0 @thlorenz preferring clang compiler
authored
57 ## we'll prefer clang if it's there
58 command -v clang >/dev/null 2>&1 && export CC=clang && export GYP_DEFINES='clang=1'
59 command -v clang++ >/dev/null 2>&1 && export CXX=clang++ && LINK=clang++ && export GYP_DEFINES='clang=1'
60
ab3521a @thlorenz adding ngen functions
authored
61 # Environment tweaks
f8b0fd5 @thlorenz adding clear shortcut to tmux
authored
62 export HISTIGNORE='&:ll:ls:clear:gs:git status'
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
63
64 # Below are OS specific
65 unamestr=`uname`
66
67 # ----------- DARWIN ---------------
68 if [[ "$unamestr" == "Darwin" ]]; then
69
70 echo "Configuring for $unamestr"
387ccc0 @thlorenz bash: fixing path and removing git prompt
authored
71 # PS1="\n\[\033[00;34m\]\w\[\033[00m\]\[$MAGENTA\]\$(__git_ps1)\[$WHITE\]\n➝ "
72 PS1="\n\[\033[00;34m\]\w\[\033[00m\]\[$WHITE\]\n➝ "
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
73
68a1cff @thlorenz tmuxifier: initializing PATH in bashrc
authored
74 PATH=~/.tmuxifier/bin:~/npm-global/bin:$GEM_HOME/bin:/usr/local/sbin/:$PATH
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
75
aba8d42 adding alias
Thorsten Lorenz authored
76 alias cd-js='cd ~/dev/js'
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
77
0b7ada7 @thlorenz tweaked bash rc added ubuntu cheatsheet
authored
78 alias go-udesktop='ssh tlorenz@udesktop -p 2104'
1a53777 @thlorenz bashrc changes
authored
79
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
80 alias eject='diskutil eject'
21cf884 @thlorenz noads alias
authored
81 alias noads='rm -rf /Volumes/Kindle/system/.assets && touch /Volumes/Kindle/system/.assets'
ef3c29b @thlorenz bash: eject-kindle now noads automatically
authored
82 alias eject-kindle='noads && diskutil eject /Volumes/Kindle'
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
83
cff4b2b @thlorenz adding pgrep alias on mac
authored
84 alias pgrep='ps aux | grep '
7dff4be @thlorenz fix indent and trailing in rc files
authored
85
cd79418 @thlorenz some more cheat sheets and little bashrc change
authored
86 alias flush-dns='dscacheutil -flushcache'
cff4b2b @thlorenz adding pgrep alias on mac
authored
87
7dff4be @thlorenz fix indent and trailing in rc files
authored
88 # dircolors
87ff9cf @thlorenz added dircolors to mac portion of bashrc
authored
89 export CLICOLOR=1
90
9835c9e @thlorenz minor vimrc changes, added z.sh, cat with pygmentize alias
authored
91 # npm completion (described method doesn't work at this point: http://npmjs.org/doc/completion.html)
92 source /usr/local/lib/node_modules/npm/lib/utils/completion.sh
93
11dfda5 @thlorenz changes to switch bashrc with git completion and prompt
authored
94 # git completion
95 if [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
96 source /usr/local/etc/bash_completion.d/git-completion.bash
97 fi
98
bb43d2e @thlorenz getting autojump to work by removing conflicting alias
authored
99 # autojump
100 [[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh
101
ab3521a @thlorenz adding ngen functions
authored
102 export VALUEPACK_DATA=~/.valuepack/data
103 export VALUEPACK_MINE_DB=~/.valuepack/valuepack-mine.db
bc90a48 @thlorenz more value pack exports
authored
104 export VALUEPACK_FIX_DB=~/.valuepack/valuepack-fix.db
105 export VALUEPACK_ANALYZE_DB=~/.valuepack/valuepack-analyze.db
ab3521a @thlorenz adding ngen functions
authored
106
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
107 # ----------- LINUX ---------------
74dec1a @thlorenz specific arch section
authored
108
109 # ---- ARCH ----
110
111 elif [ "$unamestr" == "Linux" ] && [ -f /etc/pacman.conf ]; then
a33675e @thlorenz tweaking openbox/arch settings
authored
112 echo "Configuring for ARCH-$unamestr"
abe29b3 @thlorenz different prompts for differnt OSs
authored
113 PS1="\n\[\033[00;34m\]arch:\w\[\033[00m\]\[$MAGENTA\]\$(__git_ps1)\[$WHITE\]\n➝ "
74dec1a @thlorenz specific arch section
authored
114
6365046 @thlorenz tmux: adding tmuxifier
authored
115 PATH=~/.tmuxifier/bin:~/npm-global/bin:$GEM_HOME/bin:$PATH
116 eval "$(tmuxifier init -)"
4b8212e @thlorenz docker and autojump aliases
authored
117
c543bd4 @thlorenz arch fixes
authored
118 shopt -s checkwinsize
b4cca7e @thlorenz optimizing X settings
authored
119
4b8212e @thlorenz docker and autojump aliases
authored
120 # docker
c543bd4 @thlorenz arch fixes
authored
121 export DOCKER_HOST='unix:///var/run/docker.sock'
4b8212e @thlorenz docker and autojump aliases
authored
122 alias docker="sudo docker -H=$DOCKER_HOST"
123
cce8d0c @thlorenz initial tmux conf and 256 color alias
authored
124 # pacman
6065ab5 @thlorenz auto logon and start X with some ambience
authored
125 alias pacman='sudo pacman'
126 alias pacmany='pacman --noconfirm'
127
cce8d0c @thlorenz initial tmux conf and 256 color alias
authored
128 # tmux
129 alias tmux='TERM=xterm-256color tmux'
130
4b8212e @thlorenz docker and autojump aliases
authored
131 alias jadd='autojump -a `pwd`'
132 alias j='cd `autojump $1`'
7dff4be @thlorenz fix indent and trailing in rc files
authored
133
d3acbc1 @thlorenz transmission aliases
authored
134 alias do-transmission="sudo systemctl start transmission"
135 alias ki-transmission="sudo systemctl stop transmission"
74dec1a @thlorenz specific arch section
authored
136
c543bd4 @thlorenz arch fixes
authored
137 [ -f /usr/lib/node_modules/npm/lib/utils/completion.sh ] && source /usr/lib/node_modules/npm/lib/utils/completion.sh
138
6065ab5 @thlorenz auto logon and start X with some ambience
authored
139 [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
140
74dec1a @thlorenz specific arch section
authored
141 # ---- All other linuxes ----
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
142 elif [[ "$unamestr" == "Linux" ]]; then
143
144 echo "Configuring for $unamestr"
acc9ecc @thlorenz bash prompt shows whoami
authored
145 PS1="\n\[\033[00;34m\]$(whoami):\w\[\033[00m\]\[$MAGENTA\]\$(__git_ps1)\[$WHITE\]\n➝ "
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
146
117cfcd @thlorenz ruby: adjusting gems home in order to avoid sudo installs
authored
147 PATH=~/npm-global/bin:$GEM_HOME/bin:$PATH
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
148
9eb6ad6 @thlorenz some more aliases
authored
149 # apt-get aliases
b896a3f @thlorenz fixed bashrc for linux
authored
150 alias update="sudo apt-get update"
151 alias install="sudo apt-get install"
152 alias upgrade="sudo apt-get upgrade"
153 alias remove="sudo apt-get remove"
230dff4 @thlorenz adding aliases to bashrc and not running it if not in interactive mode
authored
154
155 # services aliases
156 alias service="sudo service"
157 alias nx-restart="service nginx restart"
7dff4be @thlorenz fix indent and trailing in rc files
authored
158 alias nx-test="sudo nginx -t"
230dff4 @thlorenz adding aliases to bashrc and not running it if not in interactive mode
authored
159
aba8d42 adding alias
Thorsten Lorenz authored
160 alias do-transmission="transmission-daemon -g ~/.config/transmission"
161 alias ki-transmission="service transmission-daemon stop"
162
fa6d5e6 @thlorenz adjustments to vimrc and bashrc
authored
163 # check the window size after each command and, if necessary,
164 # update the values of LINES and COLUMNS.
165 shopt -s checkwinsize
166
7dff4be @thlorenz fix indent and trailing in rc files
authored
167 # set variable identifying the chroot you work in (used in the prompt below)
fa6d5e6 @thlorenz adjustments to vimrc and bashrc
authored
168 if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
169 debian_chroot=$(cat /etc/debian_chroot)
170 fi
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
171 else
abe29b3 @thlorenz different prompts for differnt OSs
authored
172 PS1="\n\[\033[00;34m\]\w\[\033[00m\]\[$MAGENTA\]\$(__git_ps1)\[$WHITE\]\n➝ "
40eefe6 @thlorenz made bashrc behave differently depending on OS
authored
173 echo "No special configuration known for $unamestr"
174 fi
c42ccb9 @thlorenz tmux: detecting if using tmuxifier to automatically switch to vi mode…
authored
175
176 # vi mode in inputrc breaks tmuxifier initialization (Enter key won't properly fire)
177 # therefore .inputrc is not initing vi mode, but .vimputrc is
61f736b @thlorenz adding tmuxifier layouts and fixing vimputrc via tmp file
authored
178 if [ ! -e /tmp/tmuxifier_loading_session ]; then
c42ccb9 @thlorenz tmux: detecting if using tmuxifier to automatically switch to vi mode…
authored
179 bind -f ~/.vimputrc
180 fi
Something went wrong with that request. Please try again.