aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash')
-rw-r--r--bash/.bash_aliases30
-rw-r--r--bash/.bash_profile8
-rwxr-xr-xbash/.bash_prompt52
-rw-r--r--bash/.bashrc144
4 files changed, 234 insertions, 0 deletions
diff --git a/bash/.bash_aliases b/bash/.bash_aliases
new file mode 100644
index 0000000..fa78f7b
--- /dev/null
+++ b/bash/.bash_aliases
@@ -0,0 +1,30 @@
1
2alias ...='cd -- ../..'
3alias grep='grep --color=auto'
4alias l='ls -CF'
5alias la='ls -A'
6alias ll='ls -alF'
7alias ls='ls -F --color=always'
8alias nerdz='~/scripts/nerdinfo.sh'
9alias o='xdg-open'
10alias rless='less -r'
11alias spdtst='curl -o /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip'
12alias tmux='tmux -u'
13alias tree='tree -C'
14alias vim='nvim'
15alias vime='nvim ~/.vim/vimrc'
16
17# git aliases
18alias gb='git branch -v'
19alias gc='git commit --verbose'
20alias gd='git diff --minimal'
21alias ggp='git push'
22alias gl='git log -p --abbrev-commit --pretty=medium'
23alias glo='git log --pretty=oneline --abbrev-commit'
24alias gst='git status --short'
25
26# xbps
27alias +='sudo xbps-install'
28alias ?='xbps-query -Rs'
29alias ~='sudo xbps-remove'
30
diff --git a/bash/.bash_profile b/bash/.bash_profile
new file mode 100644
index 0000000..d7df6a9
--- /dev/null
+++ b/bash/.bash_profile
@@ -0,0 +1,8 @@
1# .bash_profile
2
3# Get the aliases and functions
4[ -f $HOME/.bashrc ] && . $HOME/.bashrc
5
6
7
8export PATH="$HOME/.poetry/bin:$PATH"
diff --git a/bash/.bash_prompt b/bash/.bash_prompt
new file mode 100755
index 0000000..667d32a
--- /dev/null
+++ b/bash/.bash_prompt
@@ -0,0 +1,52 @@
1red="\e[31m"
2grn="\e[32m"
3ylw="\e[33m"
4cyn="\e[36m"
5blu="\e[34m"
6prp="\e[35m"
7bprp="\e[35;1m"
8gry="\e[94m"
9rst="\e[0m"
10
11git_branch() {
12 local git_status="$(git status 2> /dev/null)"
13 local on_branch="On branch ([^${IFS}]*)"
14 local on_commit="HEAD detached at ([^${IFS}]*)"
15
16 if [[ $git_status =~ $on_branch ]]; then
17 local branch=${BASH_REMATCH[1]}
18 echo -ne "\001${cyn}\002 $branch\001${rst}\002"
19 elif [[ $git_status =~ $on_commit ]]; then
20 local commit=${BASH_REMATCH[1]}
21 echo -ne "\001${prp}\002 $commit\001${rst}\002"
22 fi
23}
24
25prompt_pwd() {
26 if [ "$PWD" == "$HOME" ]; then
27 echo ""
28 elif [ "$PWD" == "/" ]; then
29 echo "/"
30 else
31 path="$(echo $PWD | sed -e "s-$HOME/--g")"
32 echo -ne " \001${gry}\002$path/\001${rst}\002"
33 fi
34}
35
36rootornot() {
37 if [[ "$(id -u)" -eq 0 ]]; then
38 echo -ne "\001${red}\002#\001${rst}\002"
39 else
40 echo -ne "$"
41 fi
42}
43
44host() {
45 if [ "$HOSTNAME" == "localhost" ]; then
46 echo -ne "(phone)"
47 fi
48}
49
50PS1='\n$(pista)'
51
52PS2=" > "
diff --git a/bash/.bashrc b/bash/.bashrc
new file mode 100644
index 0000000..c61dc42
--- /dev/null
+++ b/bash/.bashrc
@@ -0,0 +1,144 @@
1export PATH=$PATH":$HOME/.cargo/bin"
2export PATH=$PATH":$HOME/.poetry/bin"
3export PATH=$PATH":$HOME/scripts"
4export PATH=$PATH":$HOME/bin"
5export PATH=$PATH":$HOME/.cabal/bin"
6export PATH=$PATH":$HOME/leet/flutter/bin"
7export PATH=$PATH":$HOME/.local/bin"
8export PATH=$PATH":/usr/lib/jvm/jdk-14/bin"
9export PATH=$PATH":/usr/local/texlive/2020/bin/x86_64-linux/"
10export PATH=$PATH":/usr/local/go/bin"
11
12export AIRFLOW_HOME="$HOME/.config/airflow"
13export ANDROID_HOME="$HOME/leet/ndk/android-ndk-r21c/toolchains"
14export EDITOR=/bin/nvim
15export MANPAGER="less"
16export BROWSER="/bin/firefox"
17export GPG_TTY=$(tty)
18export TERM=xterm-256color-italic
19export TZ='Asia/Kolkata'
20export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --color=bw'
21
22export GUILE_LOAD_PATH="/usr/local/share/guile/3.0:/usr/local/share/guile"
23
24export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
25
26case $- in
27 *i*) ;;
28 *) return;;
29esac
30
31# better history syncing
32shopt -s histappend
33export HISTCONTROL=ignoreboth:erasedups
34HISTSIZE=1000
35HISTFILESIZE=2000
36export PROMPT_COMMAND=''
37export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
38
39# cool options for cool kids
40shopt -s \
41 autocd \
42 globstar \
43 checkwinsize \
44 cdspell \
45 dirspell \
46 expand_aliases \
47 dotglob \
48 gnu_errfmt \
49 histreedit \
50 nocasematch
51
52bind 'set completion-ignore-case on'
53bind 'set show-all-if-ambiguous on'
54bind 'set colored-stats on'
55bind 'set completion-display-width 1'
56bind 'TAB:menu-complete'
57bind "t: $HOME/scripts/tmux-fzf.sh"
58bind Space:magic-space
59
60if ! shopt -oq posix; then
61 if [ -f /usr/share/bash-completion/bash_completion ]; then
62 . /usr/share/bash-completion/bash_completion
63 elif [ -f /etc/bash_completion ]; then
64 . /etc/bash_completion
65 fi
66fi
67
68# local bash completions
69for cf in "$HOME"/.bash_completion.d/* ; do
70 . $cf
71done
72
73[ -f ~/.bash_aliases ] && . ~/.bash_aliases
74[ -f ~/.bash_prompt ] && . ~/.bash_prompt
75[ -f ~/.fzf.bash ] && source ~/.fzf.bash
76
77export NVM_DIR="$HOME/.nvm"
78[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
79[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
80
81# pfetch
82export PF_INFO="ascii title os kernel uptime pkgs shell "
83export PF_SEP=" "
84export PF_COL1=7
85export PF_COL2=7
86export PF_COL3=6
87export PF_ALIGN="9"
88export PF_ASCII="void"
89
90export _JAVA_AWT_WM_NONREPARENTING=1
91
92# [[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh
93# [[ -f ~/.bash_zoxide.sh ]] && source ~/.bash_zoxide.sh
94#
95# export PATH_TO_FX="$HOME/dloads/javafx/javafx-sdk-11.0.2/lib"
96# export JAVA_HOME="/usr/lib/jvm/jdk-14"
97#
98# for file in `find ~/dloads/nlp/stanford-corenlp-full-2018-10-05/ -name "*.jar"`; do
99# export CLASSPATH="$CLASSPATH:`realpath $file`"
100# done
101
102# tabtab source for packages
103# uninstall by removing these lines
104[ -f ~/.config/tabtab/__tabtab.bash ] && . ~/.config/tabtab/__tabtab.bash || true
105
106# Pista stuff
107# prompt string to display, for regular users
108export PROMPT_CHAR="$"
109export PROMPT_CHAR_COLOR="cyan"
110
111# prompt string to display, for the root user
112export PROMPT_CHAR_ROOT="#"
113export PROMPT_CHAR_ROOT_COLOR="magenta"
114
115# if SHORTEN_CWD is set to 1, `/home/nerdypepper/code` is shortened to
116# `/h/n/code`
117export SHORTEN_CWD=1
118export CWD_COLOR="white"
119
120# if EXPAND_TILDE is set to 0, `/home/nerdypepper` is shortened to `~`
121export EXPAND_TILDE=0
122
123# there are three possible states for a git repo
124# - unstaged (working tree has been modified)
125# - staged (staging area has been modified)
126# - clean (all staged changes have committed)
127
128# symbol to represent clean repo state
129export GIT_CLEAN="·"
130export GIT_CLEAN_COLOR="green"
131
132# symbol to represent unstaged repo state
133export GIT_WT_MODIFIED="×"
134export GIT_WT_MODIFIED_COLOR="red"
135
136# symbol to represent staged repo state
137export GIT_INDEX_MODIFIED="±"
138export GIT_INDEX_MODIFIED_COLOR="yellow"
139
140# if HEAD ref peels to branch
141export BRANCH_COLOR="bright black"
142
143# if HEAD ref peels to a commit (detached state)
144export COMMIT_COLOR="green"