Add ZSH configuration
This commit is contained in:
parent
30d7a48f35
commit
50436ebda9
0
dot_config/.keep
Normal file
0
dot_config/.keep
Normal file
0
dot_config/zsh/.keep
Normal file
0
dot_config/zsh/.keep
Normal file
13
dot_config/zsh/editor.zsh
Normal file
13
dot_config/zsh/editor.zsh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Neovim
|
||||
if command -v nvim &> /dev/null; then
|
||||
alias vi="nvim"
|
||||
alias ni="nvim"
|
||||
alias vim="nvim"
|
||||
export EDITOR="nvim"
|
||||
else
|
||||
export EDITOR="vi"
|
||||
fi
|
||||
|
||||
alias edit="${EDITOR}"
|
11
dot_config/zsh/homebrew.zsh
Normal file
11
dot_config/zsh/homebrew.zsh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Add packages not linked by homebrew to the PATH
|
||||
PREFIX=$(brew --prefix)
|
||||
if command -v brew &>/dev/null; then
|
||||
for pkg in bison flex llvm openjdk; do
|
||||
if [ -d "$PREFIX/opt/$pkg/bin" ]; then
|
||||
export PATH="$PREFIX/opt/$pkg/bin":$PATH
|
||||
fi
|
||||
done
|
||||
fi
|
11
dot_config/zsh/misc.zsh
Normal file
11
dot_config/zsh/misc.zsh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Reload zsh configuration
|
||||
alias reload='. ~/.zshrc'
|
||||
|
||||
# Change Kitty themes
|
||||
alias set-dark-theme='kitty +kitten themes Rose-pine-moon'
|
||||
alias set-light-theme='kitty +kitten themes Rose-pine-dawn'
|
||||
|
||||
# MiniZinc
|
||||
export BIGBAD="compute.optimisation-2020.cloud.edu.au"
|
27
dot_config/zsh/programming.zsh
Normal file
27
dot_config/zsh/programming.zsh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
### C++ ###
|
||||
# CMake output compile_commands.json
|
||||
export CMAKE_EXPORT_COMPILE_COMMANDS=1
|
||||
# CMake use Ninja by default
|
||||
export CMAKE_GENERATOR="Ninja Multi-Config"
|
||||
|
||||
### MiniZinc ###
|
||||
|
||||
if [ -d "/opt/homebrew/share/minizinc/solvers" ]; then
|
||||
export MZN_SOLVER_PATH=$MZN_SOLVER_PATH:"/opt/homebrew/share/minizinc/solvers"
|
||||
fi
|
||||
|
||||
|
||||
### Python ###
|
||||
# Add pipx installed binaries to PATH
|
||||
if [ -d "$HOME/.local/bin" ]; then
|
||||
export PATH=$PATH:"$HOME/.local/bin"
|
||||
fi
|
||||
|
||||
### Rust ###
|
||||
# Add cargo installed binaries to PATH
|
||||
if [ -d "$HOME/.cargo/bin" ]; then
|
||||
export PATH=$PATH:"$HOME/.cargo/bin"
|
||||
fi
|
||||
|
27
dot_config/zsh/ragequit.zsh
Normal file
27
dot_config/zsh/ragequit.zsh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
function flip() {
|
||||
perl -C3 -Mutf8 -lpe '$_=reverse;y/a-zA-Z.['\'',({?!\"<_;‿⁅∴\r/ɐqɔpǝɟƃɥıɾʞ|ɯuodbɹsʇnʌʍxʎzɐqɔpǝɟƃɥıɾʞ|ɯuodbɹsʇnʌʍxʎz˙],'\'')}¿¡,>‾؛⁀⁆∵\n/' <<< "$1"
|
||||
}
|
||||
|
||||
function fuck() {
|
||||
CMD="pkill"
|
||||
which $CMD >/dev/null || CMD="killall"
|
||||
echo
|
||||
if [ "$1" "==" "off" ]; then
|
||||
shift
|
||||
FLIP=(' (ノಠ益ಠ)ノ彡' '(ノಠ-ಠ)ノ彡')
|
||||
SIG="-9"
|
||||
else
|
||||
[ "$1" "==" "you" ] && shift
|
||||
FLIP=(' (╯°□°)╯︵' '(ノ ゜Д゜)ノ ︵' '(ノಥДಥ)ノ︵' ' ヽ(`Д´)ノ︵' ' (ノಥ益ಥ)ノ ')
|
||||
SIG=""
|
||||
fi
|
||||
[ -z "$1" ] && { echo "┬─┬ ノ( ゜-゜ノ) patience young grasshopper"; echo; return; }
|
||||
F=${FLIP[$RANDOM % ${#FLIP[@]} ]}
|
||||
if $CMD $SIG "$1"; then
|
||||
echo "$F$(flip $1)"; echo
|
||||
else
|
||||
echo "┬─┬ ︵ /(.□. \)"; echo
|
||||
fi
|
||||
}
|
20
dot_config/zsh/tools.zsh
Normal file
20
dot_config/zsh/tools.zsh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# ls
|
||||
if command -v exa &> /dev/null; then
|
||||
alias ls="exa"
|
||||
alias l="exa -la"
|
||||
else
|
||||
alias l="ls -lah"
|
||||
fi
|
||||
|
||||
# cat
|
||||
if command -v bat &> /dev/null; then
|
||||
alias cat="bat"
|
||||
alias less="bat"
|
||||
fi
|
||||
|
||||
# fzf - Command line fuzzy finder
|
||||
if command -v fd &> /dev/null; then
|
||||
export FZF_DEFAULT_COMMAND='fd --type f'
|
||||
fi
|
50
dot_zshrc
Normal file
50
dot_zshrc
Normal file
@ -0,0 +1,50 @@
|
||||
export ZPLUG_HOME=$(brew --prefix zplug)
|
||||
source $ZPLUG_HOME/init.zsh
|
||||
|
||||
zplug "plugins/extract", from:oh-my-zsh
|
||||
zplug "plugins/git", from:oh-my-zsh
|
||||
zplug "plugins/gpg-agent", from:oh-my-zsh
|
||||
zplug "zsh-users/zsh-history-substring-search"
|
||||
zplug "plugins/history-substring-search", from:oh-my-zsh
|
||||
zplug "zsh-users/zsh-syntax-highlighting", defer:2
|
||||
export _Z_DATA=$HOME/.cache/zjumpdata
|
||||
zplug "rupa/z", use:z.sh
|
||||
|
||||
zplug "~/.config/zsh/", from:local
|
||||
|
||||
if ! zplug check --verbose; then
|
||||
printf "Install? [y/N]: "
|
||||
if read -q; then
|
||||
echo; zplug install
|
||||
fi
|
||||
fi
|
||||
zplug load
|
||||
|
||||
set -o vi
|
||||
if zplug check zsh-users/zsh-history-substring-search; then
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
fi
|
||||
|
||||
# History file configuration
|
||||
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
|
||||
HISTSIZE=50000
|
||||
SAVEHIST=10000
|
||||
|
||||
# History command configuration
|
||||
setopt extended_history # record timestamp of command in HISTFILE
|
||||
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||
setopt hist_ignore_space # ignore commands that start with space
|
||||
setopt hist_verify # show command with history expansion to user before running it
|
||||
setopt inc_append_history # add commands to HISTFILE in order of execution
|
||||
setopt share_history # share command history data
|
||||
setopt autocd # change directory when given dir without cmd
|
||||
|
||||
# Case insensitive autocompletion
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
|
||||
# Start Starship Prompt
|
||||
if command -v starship &> /dev/null; then
|
||||
eval "$(starship init zsh)"
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user