Jay Taylor's notes

back to listing index

bashrc/init.sh at master · fotinakis/bashrc

[web search]
Original source (github.com)
Tags: bash examples shell history shell-scripting bashrc github.com
Clipped on: 2022-11-23

master

bashrc / init.sh

Go to file
Latest commit c4945f6 Oct 13, 2020 History
1 contributor
81 lines (72 sloc) 2.24 KB
1 #!/bin/bash
2
3 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4 source $DIR/crazy-prompt.sh
5 source $DIR/git-autocomplete.sh
6
7 # Local, unversioned init.
8 if [ -f $DIR/init-local.sh ]
9 then
10 source $DIR/init-local.sh
11 fi
12
13 # Aliases.
14 alias ..="cd .."
15 alias cd..="cd .."
16 alias sr="screen -r"
17 alias ll="ls -alF"
18 alias la="ls -A"
19 alias l="ls -CF"
20 alias gr="egrep -r"
21 alias brc="vim ~/src/bashrc/init.sh"
22 alias brcl="vim ~/src/bashrc/init-local.sh"
23 alias src="source ~/.bashrc"
24 alias k="kill %%"
25 alias r="bundle exec rspec"
26 alias n="npm run start"
27 alias nt="npm test"
28 alias beg="bundle exec guard"
29 # Git.
30 alias gca="git commit -a"
31 alias gb="git branch"
32 alias gd="git diff"
33 alias gdc="git diff --cached"
34 alias gch="git checkout"
35 alias gpom="git pull origin master"
36 alias gp="git pull"
37 alias gs="git status"
38 alias gbddd="git branch --merged | grep -v '*' | grep -v '^ master$' | xargs -n 1 git branch -d"
39 # Common repos.
40 alias s="cd ~/src"
41 alias sgo="cd ~/src/go/src"
42 alias sb="cd ~/src/bashrc"
43 # Misc.
44 alias dc="docker-compose"
45 alias ember="./node_modules/ember-cli/bin/ember"
46
47 # Eternal bash history.
48 # ---------------------
49 # Undocumented feature which sets the size to "unlimited".
50 # http://stackoverflow.com/questions/9457233/unlimited-bash-history
51 export HISTFILESIZE=
52 export HISTSIZE=
53 export HISTTIMEFORMAT="[%F %T] "
54 # Change the file location because certain bash sessions truncate .bash_history file upon close.
55 # http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
56 export HISTFILE=~/.bash_eternal_history
57
58 # Force prompt to write history after every command.
59 # http://superuser.com/questions/20900/bash-history-loss
60 PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
61 shopt -s histappend
62 stophistory () {
63 PROMPT_COMMAND="bash_prompt_command"
64 echo 'History recording stopped. Make sure to `kill -9 $$` at the end of the session.'
65 }
66
67 # Go path.
68 export GOPATH=$HOME/src/go/
69 export PATH=$PATH:$GOPATH/bin
70
71 # Setup ssh-agent.
72 if [[ $OSTYPE == 'linux-gnu' ]]; then
73 pgrep -f ssh-agent > /dev/null || ssh-agent > ~/.ssh/agent_config.sh
74 eval `cat ~/.ssh/agent_config.sh`
75 fi
76
77 # Enable tab completion for aliases. Must come after everything else.
78 source $DIR/alias-tab-completion.sh
79
80 # Turn off annoying mac message.
81 export BASH_SILENCE_DEPRECATION_WARNING=1

Footer

© 2022 GitHub, Inc.