-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc
130 lines (104 loc) · 4 KB
/
dot_zshrc
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
#completion definitions for the brew command and also some brew packages, code is from https://docs.brew.sh/Shell-Completion
if type brew &>/dev/null
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit
compinit
fi
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
#set c++ compiler to gcc 14
# export CC=/opt/homebrew/bin/gcc-14
#my aliases
alias n='nvim'
alias ls='lsd'
alias home="z /Users/ayaan"
alias up="z .."
alias iina="/Applications/IINA.app/Contents/MacOS/iina-cli"
alias ra="ranger"
alias fn="open ."
alias l='ls -l'
alias la='ls -a'
alias lla='ls -la'
alias lt='ls --tree'
alias laf='la | fzf'
alias cat='bat'
alias wvim='NVIM_APPNAME="wvim" nvim'
alias cd='z'
alias codi='code-insiders .'
alias lg='lazygit'
alias cdf="eval \"z \\\"\\\`osascript -e 'tell app \\\\\\\"Finder\\\\\\\" to return the POSIX path of (target of window 1 as alias)'\\\`\\\"\""
alias !='eval "$(fc -ln -1)" | fzf'
#cdf alias docs
#gets the path of the folder i am cd'd into in the finder app, in finder i have an apple script pinned to the toolbar, which opens a new tab in kitty and runs the cdf command, effectively cding me into the current finder directory in one click.
#there is def a smarter way of doing this but oh well
#cdf alias docs
vv() {
# Assumes all configs exist in directories named ~/.config/nvim.*
local config=$(fd --max-depth 1 --glob 'nvim.*' ~/.config | fzf --prompt="Neovim Configs > " --height=~50% --layout=reverse --border --exit-0)
# If I exit fzf without selecting a config, don't open Neovim
[[ -z $config ]] && echo "No config selected" && return
# Open Neovim with the selected config
NVIM_APPNAME=$(basename $config) nvim $@
}
#got below code from:
#https://yazi-rs.github.io/docs/quick-start/
#when you hit q in yazi, it exits yazi and cd's into whatever directory you were in in yazi
function yy() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd "$cwd"
echo "$cwd"
fi
rm -f -- "$tmp"
}
# Set up fzf key bindings and fuzzy completion
source <(fzf --zsh)
#fzf custom color scheme, currently catppuccin mocha
export FZF_DEFAULT_OPTS=" \
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 \
--layout="reverse"
--border="rounded" --border-label="" --preview-window="border-rounded"
"
# Preview file content using bat
export FZF_CTRL_T_OPTS="
--height 90%
--walker-skip .git,node_modules,target
--preview 'bat -n --color=always {}'
--bind 'ctrl-/:change-preview-window(down|hidden|)'"
export FZF_ALT_C_OPTS="
--walker-skip .git,node_modules,target
--preview 'lsd --tree {}'"
eval $(thefuck --alias heck)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
eval "$(zoxide init zsh)"
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
#zsh autosuggestions case insensitve file completion stuff:
#
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
autoload -Uz compinit && compinit
#
#keybindings for zsh autosuggestions:
bindkey '^y' autosuggest-accept
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
#keybindings for jk to esc, zsh default vim mode emulation
bindkey -M viins 'jk' vi-cmd-mode
#pyenv
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
#increase the limit for the num of entries saved in history
HISTSIZE=99999999
SAVEHIST=$HISTSIZE
#atuin, for command history search and stuff
. "$HOME/.atuin/bin/env"
eval "$(atuin init zsh --disable-up-arrow)"
#keep in end for starship
eval "$(starship init zsh)"
export STARSHIP_CONFIG=~/.config/starship/starship.toml