dotfiles/data/zsh/bottom-zshrc

217 lines
6.0 KiB
Plaintext
Raw Normal View History

2023-08-05 19:29:17 +00:00
# vim: set filetype=zsh:
2023-07-17 04:50:01 +00:00
# Put this on bottom of ~/.zshrc
2023-07-07 17:25:25 +00:00
# https://blog.izissise.net/posts/env-path/
typeset -U path PATH
2024-01-23 17:21:20 +00:00
2024-02-06 05:04:22 +00:00
# Alias
alias g="git"
alias moe="make"
alias meo="make"
# https://wiki.archlinux.org/title/XDG_Base_Directory
export XDG_CONFIG_HOME=~/.config
export XDG_CACHE_HOME=~/.cache
export XDG_DATA_HOME=~/.local/share
2023-10-06 08:03:33 +00:00
# https://www.topbug.net/blog/2016/09/27/make-gnu-less-more-powerful/
export LESS="-RF -i -K -s -x2 --wordwrap"
# zsh plugins
2024-10-09 07:54:59 +00:00
# https://github.com/zsh-users/zsh-syntax-highlighting
if [[ -f /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
# https://github.com/zsh-users/zsh-autosuggestions
if [[ -f /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
2024-10-09 07:54:59 +00:00
export ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
export ZSH_AUTOSUGGEST_MANUAL_REBIND=true
export ZSH_AUTOSUGGEST_HISTORY_IGNORE=$HISTORY_IGNORE
fi
# https://unix.stackexchange.com/q/621606
# https://github.com/zsh-users/zsh-history-substring-search
if [[ -f /opt/homebrew/share/zsh-history-substring-search/zsh-history-substring-search.zsh ]]; then
source /opt/homebrew/share/zsh-history-substring-search/zsh-history-substring-search.zsh
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND=''
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND=''
2024-10-09 07:54:59 +00:00
export HISTORY_SUBSTRING_SEARCH_PREFIXED=true
fi
# git
# https://stackoverflow.com/a/43747486
export GIT_COMPLETION_CHECKOUT_NO_GUESS=1
2022-12-01 03:42:39 +00:00
# nvim
2023-03-16 08:43:03 +00:00
if command -v nvim &>/dev/null; then
2024-05-10 08:25:11 +00:00
export EDITOR=nvim
export VISUAL=nvim
export GIT_EDITOR=nvim
alias vi="nvim"
alias vim="nvim"
fi
2022-12-01 03:42:39 +00:00
# go
# https://stackoverflow.com/a/13542854
if command -v go &>/dev/null; then
if [[ -d $HOME/go ]]; then
export GOPATH=$HOME/go
path=($path $GOPATH/bin)
fi
# Depend on your company
# export GOPRIVATE=example.company.com
fi
2022-12-01 03:42:39 +00:00
# fzf
2023-08-06 07:26:21 +00:00
# https://github.com/junegunn/fzf
2023-04-19 09:58:24 +00:00
if command -v fzf &>/dev/null; then
2024-05-10 08:25:11 +00:00
export FZF_COMPLETION_TRIGGER='~~'
2024-01-23 17:05:57 +00:00
2024-09-30 02:44:41 +00:00
# https://github.com/catppuccin/fzf
# Remove bg for transparent terminal
export FZF_DEFAULT_OPTS="\
--ansi \
--pointer='🔫' --prompt='🪓 ' \
--color=bg+:#313244,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 \
2024-10-09 08:04:27 +00:00
--color=selected-bg:#45475a"
2024-09-30 02:44:41 +00:00
2024-05-10 08:25:11 +00:00
if command -v fd &>/dev/null; then
_fzf_compgen_path() {
fd --type file . "$1"
}
2024-01-23 17:05:57 +00:00
2024-05-10 08:25:11 +00:00
_fzf_compgen_dir() {
fd --type directory . "$1"
}
2024-01-23 17:05:57 +00:00
2024-05-10 08:25:11 +00:00
export FZF_DEFAULT_COMMAND="fd --type file --color=always"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd --type directory --color=always"
fi
2022-12-01 03:42:39 +00:00
2024-05-10 08:25:11 +00:00
if command -v bat &>/dev/null; then
export FZF_CTRL_T_OPTS="--preview 'bat --color=always --line-range=:500 {}'"
fi
2023-10-29 15:40:07 +00:00
2024-05-10 08:25:11 +00:00
if command -v eza &>/dev/null; then
export FZF_ALT_C_OPTS="--preview 'eza --tree --level 1 {}'"
fi
source <(fzf --zsh)
# https://github.com/Aloxaf/fzf-tab
if [[ -f $HOME/.zsh-plugins/fzf-tab/fzf-tab.plugin.zsh ]]; then
source /Users/anon/.zsh-plugins/fzf-tab/fzf-tab.plugin.zsh
zstyle ':completion:*' menu no
2024-10-09 08:04:27 +00:00
zstyle ':fzf-tab:*' fzf-flags \
--ansi \
--pointer='🔫' --prompt='🪓 ' \
--color=bg+:#313244,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 \
--color=selected-bg:#45475a
fi
2023-04-19 09:58:24 +00:00
fi
2022-12-01 03:42:39 +00:00
2024-01-16 14:50:48 +00:00
# https://github.com/BurntSushi/ripgrep
if command -v rg &>/dev/null; then
2024-05-10 08:25:11 +00:00
export RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/ripgreprc"
2024-01-16 14:50:48 +00:00
fi
2023-10-29 15:40:07 +00:00
# https://github.com/eza-community/eza
if command -v eza &>/dev/null; then
2024-05-10 08:25:11 +00:00
alias ls="eza"
alias la="eza -la"
alias lt="eza --tree"
2023-10-29 15:40:07 +00:00
fi
2024-05-08 18:41:54 +00:00
# https://github.com/kovidgoyal/kitty
if command -v kitten &>/dev/null; then
2024-05-10 08:25:11 +00:00
alias kssh="kitten ssh"
2024-05-08 18:41:54 +00:00
fi
# https://github.com/dandavison/delta
if command -v delta &>/dev/null; then
alias da="delta"
eval "$(delta --generate-completion zsh)"
fi
# https://github.com/wilfred/difftastic
if command -v difft &>/dev/null; then
2024-05-10 08:25:11 +00:00
export DFT_DISPLAY=inline
export DFT_TAB_WIDTH=2
fi
2023-01-22 14:06:31 +00:00
# https://restic.readthedocs.io/en/latest/manual_rest.html
2023-04-19 09:58:24 +00:00
if command -v restic &>/dev/null; then
2024-05-10 08:25:11 +00:00
export RESTIC_PASSWORD_FILE=$HOME/.restic_password_file
2023-04-19 09:58:24 +00:00
fi
2023-01-22 14:06:31 +00:00
# https://github.com/sharkdp/vivid
2023-03-16 08:43:03 +00:00
if command -v vivid &>/dev/null; then
2024-05-10 08:25:11 +00:00
export LS_COLORS="$(vivid generate catppuccin-mocha)"
fi
2023-03-16 08:27:23 +00:00
2024-02-10 16:56:53 +00:00
# https://github.com/ajeetdsouza/zoxide
if command -v zoxide &>/dev/null; then
2024-06-08 07:48:14 +00:00
export _ZO_ECHO=1
2024-05-10 08:25:11 +00:00
eval "$(zoxide init zsh)"
2024-02-10 16:56:53 +00:00
fi
# https://github.com/walles/moar
if command -v moar &>/dev/null; then
2024-05-10 08:25:11 +00:00
export MOAR="-no-linenumbers -no-statusbar -quit-if-one-screen -wrap"
export PAGER=moar
fi
2024-02-10 16:56:53 +00:00
# https://github.com/Schniz/fnm
if command -v fnm &>/dev/null; then
2024-05-10 08:25:11 +00:00
eval "$(fnm env --use-on-cd)"
2024-02-10 16:56:53 +00:00
fi
# https://github.com/oven-sh/bun
if command -v bun &>/dev/null; then
if [[ -d $HOME/.cache/.bun/bin ]]; then
path=($path $HOME/.cache/.bun/bin)
fi
fi
2024-08-22 04:48:03 +00:00
# https://github.com/casey/just
if command -v just &>/dev/null; then
alias jst="just"
eval "$(just --completions zsh)"
2024-08-22 04:48:03 +00:00
fi
2024-09-15 10:36:08 +00:00
# https://github.com/rclone/rclone
if command -v rclone &>/dev/null; then
export RCLONE_PROGRESS=true
2024-09-25 05:56:03 +00:00
export RCLONE_EXCLUDE=".DS_Store"
2024-09-15 10:36:08 +00:00
fi
2024-07-22 11:26:41 +00:00
# https://github.com/crate-ci/typos
if command -v typos &>/dev/null; then
alias typo="typos --config ~/.config/typos/typos.toml"
fi
# https://github.com/orhun/daktilo
if command -v daktilo &>/dev/null; then
2024-05-10 08:25:11 +00:00
export DAKTILO_CONFIG="$HOME/.config/daktilo/daktilo.toml"
fi
2024-02-10 16:56:53 +00:00
# https://github.com/starship/starship
if command -v starship &>/dev/null; then
eval "$(starship init zsh)"
2023-08-19 11:25:12 +00:00
fi
export PATH