-
Notifications
You must be signed in to change notification settings - Fork 5
/
rc.sh
136 lines (115 loc) · 4.09 KB
/
rc.sh
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
# Start of rc.sh
{{ if eq .os "linux" -}}
if ! command -v nvim &> /dev/null; then
export EDITOR=/usr/bin/vim
export MANPAGER='less -s -M +Gg'
else
# If Neovim is installed with package manager:
export EDITOR=/usr/bin/nvim
# If Neovim is installed from source:
#export EDITOR=/usr/local/bin/nvim
export MANPAGER='nvim +Man!'
fi
{{ else if eq .os "darwin" -}}
if ! command -v nvim &> /dev/null; then
export EDITOR=$HOMEBREW_PREFIX/bin/vim
export MANPAGER='less -s -M +Gg'
else
export EDITOR=$HOMEBREW_PREFIX/bin/nvim
export MANPAGER='nvim +Man!'
fi
{{ end -}}
export VISUAL="$EDITOR"
alias sudo='sudo '
alias la='ls -A'
alias ll='ls -ltAhr'
alias pd='pushd'
alias pdw='pushd .'
alias po='popd'
alias gst='git status'
alias glg='git log --all --graph --decorate'
if command -v nvim &> /dev/null; then
alias vi='nvim'
else
alias vi='vim'
fi
alias kk='kitty +kitten'
alias magit='emacsclient -n -e "(magit-status)"'
alias ta='tmux attach-session'
alias tn='tmux new-session -s'
alias tl='tmux list-sessions'
# Clear screen
cls () {
if [[ "$TERM" == "tmux-256color" && -n "TMUX" ]]; then
clear && tmux clear-history
else
# This is equivalent to clear && printf '\e[3J'
printf '\33c\e[3J'
fi
}
# Terminal colour
export CLICOLOR=1
export COLORTERM=truecolor
#export LSCOLORS=GxFxCxDxBxegedabagaced
{{ if eq .os "darwin" -}}
# If using native BSD utils
#alias ls='ls -G'
# If installed "coreutils" with homebrew,
# and added
# export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
# to ~/.bashrc_local per advice after installation
alias ls='ls --color=auto'
{{ else if eq .os "linux" -}}
alias ls='ls --color=auto'
{{ end -}}
# If $LESS is unset, Git sets it to FRX. I don't want F or X.
export LESS='R'
# less colour
export LESS_TERMCAP_so=$(tput bold; tput setaf 6) # enter standout mode
export LESS_TERMCAP_se=$(tput rmso; tput sgr0) # leave standout mode
export LESS_TERMCAP_mb=$(tput blink; tput setaf 1) # enter blinking mode
export LESS_TERMCAP_md=$(tput bold; tput setaf 3) # enter double-bright mode
export LESS_TERMCAP_me=$(tput sgr0) # turn off all appearance modes
export LESS_TERMCAP_us=$(tput sitm; tput setaf 2) # turn on underline mode
export LESS_TERMCAP_ue=$(tput ritm; tput sgr0) # turn off underline mode
# and so on
export UNISON="$HOME/.config/unison"
{{ if eq .os "darwin" -}}
alias cafe="caffeinate -disu &"
alias bup="brew update && brew upgrade"
alias lacie="smartctl -a disk3 | grep Temperature"
alias yd="noglob ~/scripts/youtube-dl/yd"
alias cm="chezmoi"
alias mp4muxer="~/gh/dlb_mp4base/bin/mp4muxer_mac"
alias mp4demuxer="~/gh/dlb_mp4demux/bin/mp4demuxer_mac"
alias rime-install="plum_dir="$HOME/.config/plum" /Library/Input\ Methods/Squirrel.app/Contents/MacOS/rime-install"
# Add N/Vim spellfiles and snippets to .chezmoitemplates
cm_add_vim () {
cp ~/.vim/spell/en.utf-8.add ~/.local/share/chezmoi/.chezmoitemplates/vim/spell
cp ~/.vim/spell/tex.utf-8.add ~/.local/share/chezmoi/.chezmoitemplates/vim/spell
cp ~/.vim/UltiSnips/tex.snippets ~/.local/share/chezmoi/.chezmoitemplates/vim/UltiSnips
}
cm_add_nvim () {
cp ~/.config/nvim/spell/en.utf-8.add ~/.local/share/chezmoi/.chezmoitemplates/vim/spell
cp ~/.config/nvim/spell/tex.utf-8.add ~/.local/share/chezmoi/.chezmoitemplates/vim/spell
cp ~/.config/nvim/UltiSnips/tex.snippets ~/.local/share/chezmoi/.chezmoitemplates/vim/UltiSnips
}
#export PATH="$HOMEBREW_PREFIX/sbin:$PATH"
export PATH="$HOMEBREW_PREFIX/opt/jpeg-turbo/bin:$PATH"
eval "$(pyenv init - --no-rehash)"
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
export PYENV_HOOK_PATH="$HOME/.config/pyenv.d"
eval "$(pyenv virtualenv-init -)"
export PATH="$HOMEBREW_PREFIX/opt/openjdk/bin:$PATH"
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
export MANPATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnuman:$MANPATH"
if [ -n "$BASH_VERSION" ]; then
eval "$(thefuck --alias)"
fi
export PATH="$HOME/.config/emacs/bin:$PATH"
export PATH="/Library/TeX/Distributions/Programs/texbin:$PATH"
export HOMEBREW_BUNDLE_FILE="$HOME/.config/Brewfile"
{{ else if eq .os "linux" -}}
alias cm="$HOME/bin/chezmoi"
{{ end -}}
# End of rc.sh