Repository navigation
Expand file tree
/
Copy path.shrc
More file actions
executable file
·109 lines (92 loc) · 3.38 KB
/
Copy path.shrc
File metadata and controls
executable file
·109 lines (92 loc) · 3.38 KB
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
#!/bin/sh
. ~/.profile
set -- ~/bin/functions/*.sh
while [ $# -gt 0 ]; do
. "$1"
shift
done
[ -f ~/opt/z/z.sh ] && . ~/opt/z/z.sh
# Use a termcap that exists in the server
alias rsync='TERM=xterm-16color rsync'
alias scp='TERM=xterm-16color scp'
alias ssh='TERM=xterm-16color ssh'
# Python version
alias pip='python3 -m pip'
alias pip2='python2 -m pip'
alias pip3='python3 -m pip'
alias python=python3
# Workarounds
alias chocolate-doom='sdl_wrap.sh chocolate-doom'
alias crispy-doom='sdl_wrap.sh crispy-doom'
alias prboom-plus='sdl_wrap.sh prboom-plus'
alias zdoom='sdl_wrap.sh zdoom'
# Convert 256 to 16 color
# Validation (replace 256 color, pass 16 color):
# printf '\x1b[38;5;200m foo \x1b[0m \x1b[38;5;1m bar \x1b[0m' | 16
# TODO: Support true color
# printf "\x1b[38;2;255;100;0m TRUECOLOR \x1b[0m\n" | 16
alias 16="awk '{gsub(/\x1b\[[0-9]*;[0-9]*;([0-9]{3,}|([2-9][0-9])|(1[7-9]))m/, "'"'"\x1b[38;5;5m"'"'"); print;}'"
alias ..='cd ..'
alias ctags='ctags --sort=yes'
alias docker='(systemctl status docker | grep -q "Active: inactive" && sudo systemctl start docker); sudo /usr/bin/docker'
alias gdb='gdb -q'
alias info='info --vi-keys'
alias l='ls -lAhZ'
alias la='ls -lAh'
alias lr='ls -lAhtr'
alias mcm='make clean; make'
alias nxargs='xargs -d"\n" -i -n1 -r'
alias p='python -i $HOME/code/snippets/py/bit_twiddling.py'
alias r='ranger'
alias rm='rm --one-file-system -I'
alias v="gvim -v -u $HOME/code/config/large-files.vimrc"
alias vim='gvim -v'
# Force help to be output instead of error due to small terminal size
env COLS=80 hexedit -h < /dev/null 2>&1 \
| grep -qa -- '\[-s | --sector\] \[-m | --maximize\] \[--color\]' \
&& alias hexedit="hexedit --color --maximize --sector"
diff --color / / > /dev/null 2>&1 \
&& alias diff='diff --color'
if command -v nproc > /dev/null 2>&1; then
alias make='make -j $(nproc)'
elif command -v getconf > /dev/null 2>&1; then
alias make='make -j $(getconf _NPROCESSORS_ONLN)'
fi
command -v rlwrap > /dev/null 2>&1 \
&& alias sqlite="rlwrap -a -N -c -i -f ~/.rlwrap/sqlite3_completions sqlite3" \
&& alias winedbg="rlwrap -a -N -c -i -z ~/.rlwrap/filters/winedbg_fzf.pl winedbg"
if [ -n "$TERM" ]; then
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
# Avoid error `tput: No value for $TERM and no -T specified`
# Validation: `ssh foo@bar /bin/true`
export TERM="$TERM"
else
[ -f ~/.less_termcap ] && . ~/.less_termcap
[ -f ~/.lscolors ] && . ~/.lscolors
# shellcheck disable=SC1003
if [ -f ~/.local/share/Xresources/osc4/light ]; then
while read -r i; do
if [ -n "$TMUX" ]; then
printf '\ePtmux;\e\e]4;%s\a\e\\' "$i"
else
printf '\e]4;%s\a' "$i"
fi
done < ~/.local/share/Xresources/osc4/light
fi
fi
fi
# Disable flow control
stty -ixon
pwd | grep -q '^/$' && cd ~
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
export SDKMAN_DIR="$HOME/.sdkman"
[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ] && . "$SDKMAN_DIR/bin/sdkman-init.sh"
export NVM_DIR="$HOME/.config/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"
# (nvm use v22.2.0 >/dev/null &)
export PATH="$PATH:$HOME/.rvm/bin"
# . ~/.rvm/scripts/rvm
# (rvm use 2.7 >/dev/null &)
export PATH="$PATH:$HOME/.local/share/coursier/bin"
# vim: filetype=sh