-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.zshrc
82 lines (71 loc) · 2.72 KB
/
.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
export EDITOR=nvim
KEYTIMEOUT=1 # lower delay of ESC to enter normal mode (vim mode)
# History
setopt hist_ignore_all_dups # ignore duplicate entries
setopt hist_save_no_dups # don't save duplicates
setopt share_history # share command history data between parallel sessions
setopt hist_verify
# Path
export PATH="/opt/homebrew/bin:$PATH"
# Key Bindings
bindkey -v # enable VIM mode
bindkey "^Z" fzf-cd-widget # CTRL-Z [fzf shortcut to change directory]
bindkey '^P' history-search-forward # CTRL-P [search history as vim keybind]
bindkey '^N' history-search-backward # CTRL-N [search history as vim keybind]
bindkey '^Y' autosuggest-accept # CTRL-Y [accept suggestion as vim keybind]
# Completion
if type brew &>/dev/null; then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" # load brew completions
autoload -Uz compinit
compinit
fi
# FZF Customization
export FZF_DEFAULT_OPTS="
--bind 'ctrl-y:accept'
--preview-window 'border-none'
--highlight-line
--height 90% --tmux 80%
--info=inline-right
--layout=reverse-list
"
# OPTION-C shortcut to change directory: exclude folders
export FZF_ALT_C_OPTS="
--walker-skip .git,node_modules,target,Library,Applications,Pictures,Music,.local,.cache,.Trash
--border-label=' FZF Change Directory '
"
# CTRL-T shortcut to search files: exclude folders, preview with bat
export FZF_CTRL_T_OPTS="
--walker-skip .git,node_modules,target,Library,Applications,Pictures,Music,.local,.cache,.Trash
--preview 'bat -n --color=always {}'
--border-label=' FZF Files '
"
# CTRL-R shortcut to search command history: CTRL-Y to copy the command into clipboard using pbcopy
export FZF_CTRL_R_OPTS="
--bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'
--color header:bold
--header 'Press CTRL-Y to copy command into clipboard'
--border-label=' FZF Commands '
"
# Aliases
alias ls="ls -lhF --color"
alias lsa="ls -lhAF --color"
alias code="codium"
alias search="brew search"
alias install="brew install"
alias upgrade="brew upgrade"
alias uninstall="brew uninstall --zap" # uninstall with zap to remove app leftovers
alias outdated="brew outdated"
alias autoremove="brew autoremove"
alias vim="nvim"
alias v="nvim"
alias so="source ~/.zshrc" # source zshrc to update changes
# Prompt https://github.com/sindresorhus/pure
fpath+=("$(brew --prefix)/share/zsh/site-functions") # use system zsh
autoload -U promptinit
promptinit # Initialize the prompt system
zstyle :prompt:pure:path color 6 # changes path color to cyan
prompt pure # load pure
# Plugins
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source <(fzf --zsh)