-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bashrc
158 lines (129 loc) · 4.76 KB
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# This file is sourced by `~/.bashrc'.
#-------------------#
#- General Configs -#
#-------------------#
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# enable vi mode and set EDITOR to vim
set -o vi
export EDITOR="nvim"
export PAGER="most"
# enable inline expansion of cmds like `!!' when hitting <space>
# typing `![beginning_of_cmd]' expands according to matching patterns,
# e.g. `!echo' expands to the last `echo' that was run
bind Space:magic-space
#------------------#
#- PS1/PS2 Config -#
#------------------#
# PS1 prompt
# always escape colors with \[...\]
# also, urxvt with screen-256color is strange!
if [ "$TERM" == "screen-256color" ]; then
export PS1=' $ '
elif [ "$TERM" == "rxvt-unicode-256color" ]; then
export PS1='[\[\033[0;36m\]\u@\h \[\e[4m\]\[\e[91m\]\W\[\033[0;32m\]\[\033[0m\033[0;32m\]$(declare -F __git_ps1 &>/dev/null && __git_ps1 " (%s)")\[\033[0m\]] $ '
else
# gnome terminal works well with icons that urxvt cannot handle
export PS1='\[\033[0m\033[0;32m\]$(declare -F __git_ps1 &>/dev/null && __git_ps1 "(%s)") $ \[\033[0m\]'
fi
# PS2 prompt
export PS2='\[\e[91m\] >>\[\033[0m\] '
# extra settings for git-part of prompt
# source /usr/share/git-core/contrib/completion/git-prompt.sh
source $HOME/dotfiles/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
#-----------------------#
#- Path and Env Config -#
#-----------------------#
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
PATH="$HOME/.cabal/bin:$PATH"
PATH="$HOME/bin/quarto-1.0.38/bin/:$PATH"
QUARTO_VERSION="1.0.38"
# RStudio configuration vars.
R_LIBS_USER="/home/daniel/code/r_libs"
# set environment variables for go (is this even necessary with modern Go?)
#GOBIN="$HOME/code/go_src/bin"
#export GOBIN
#GOPATH="$HOME/code/go_src"
#export GOPATH
#GOROOT="/usr/local/go" # needs to be set if go is in custom location
#export GOROOT
#PATH="$GOROOT/bin:$PATH"
#export PATH
# Ruby gems location on Manjaro.
PATH="$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH"
export PATH
# prevent ranger from loading rc.conf from
# /usr/share/doc/config/ and ~/.config/ranger
export RANGER_LOAD_DEFAULT_RC=FALSE
# set environment variables for rust
# RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
# export RUST_SRC_PATH
# configure fzf layout
export FZF_DEFAULT_OPTS='--layout=reverse --height 80%'
# 256-color terminal is needed for vim not to break!
export TERM="tmux-256color"
#-----------#
#- Aliases -#
#-----------#
# source ~/.bashrc more easily when changing this file
alias src="source ~/.bashrc && echo 'sourced .bashrc'"
# useful when configuring .Xresources
alias xup="xrdb ~/dotfiles/.Xresources"
# always use vim-x11 for system clipboard access
alias nv="nvim"
alias v="nvim"
alias vi="nvim"
alias vim="nvim"
# create for file browsing and viewing
alias c="clear"
alias ex="exit" # shadows vim's `ex'
alias f="ranger"
alias m="mupdf"
alias bird="thunderbird &"
# useful for faster navigation and file manipulation
alias p="pwd"
alias h="cd ~"
alias co="cd ~/code"
alias dc="cd ~/Documents" # can't use keyword `do' here!
alias dw="cd ~/Downloads"
alias dotfiles="cd ~/dotfiles" # `dot' shadows graphviz
alias bashrc="v ~/dotfiles/.bashrc"
alias vimrc="v ~/dotfiles/vim-config/configs.vim"
alias tmux_conf="v ~/dotfiles/.tmux.conf"
# remap some GNU utils to rust utilities
alias ls="exa"
alias l="exa -lahF"
alias ll="exa -lahF"
alias t="tokei"
alias b="bat"
# easy access to ipython and R
alias py="ipython"
alias r="R --no-save --no-restore --no-site-file --no-init-file -q"
# copy to system clipboard by default
alias xclip="xclip -selection clipboard"
# access music player more easily
alias n="ncmpcpp --screen=media_library --bindings=\$HOME/.config/ncmpcpp/bindings --config=\$HOME/.config/ncmpcpp/config"
# open ipython in vim mode automatically
alias ipython="ipython --TerminalInteractiveShell.editing_mode=vi"
# Suppress annoying GTK warnings that mess up gnome-term.
# Solution adapted from: http://askubuntu.com/questions/505594.
# The following generates a function named $1 which:
# - executes $(which $1) [with args]
# - suppresses output lines which match $2
# e.g. adding: _suppress echo "hello\|world"
# will generate this function:
# echo() { $(which echo) "$@" 2>&1 | tr -d '\r' | grep -v "hello\|world"; }
# and from now on, using echo will work normally except that lines with
# hello or world will not show at the output
# to see the generated functions, replace eval with echo below
# the 'tr' filter makes sure no spurious empty lines pass from some commands
_suppress() {
eval "$1() { \$(which $1) \"\$@\" 2>&1 | tr -d '\r' | grep -v \"$2\"; }"
}
_suppress gedit "Gtk-WARNING\|connect to accessibility bus"
_suppress firefox "Gtk-WARNING\|g_slice_set_config\|Gtk\|WARNING\|Warning"