-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
144 lines (117 loc) · 3.76 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
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
136
137
138
139
140
141
142
143
144
# vim: set ts=2 sw=2 ft=zsh:
# Sourced by all interactive shells, both login and non-login
#------------------------------
# History
#------------------------------
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000
HISTCONTROL=ignoredups:ignorespace
#------------------------------
# Variables
#------------------------------
export BROWSER="firefox"
export EDITOR="vim"
export VISUAL="vim"
#export PAGER="vimpager"
export PATH="${PATH}:${HOME}/bin"
# set default fzf command to ripgrep
# fzf: https://github.com/junegunn/fzf
# ripgrep: https://github.com/BurntSushi/ripgrep
export FZF_DEFAULT_COMMAND='rg --files'
#-----------------------------
# Dircolors
#-----------------------------
export LS_COLORS='rs=0:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:';
#------------------------------
# Keybindings
#------------------------------
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
bindkey -v
typeset -g -A key
bindkey '\e[3~' delete-char # del key behaviour
bindkey '^[[5~' up-line-or-history
bindkey '^[[6~' down-line-or-history
bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search
#------------------------------
# ShellFuncs
#------------------------------
# -- coloured manuals
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
# asdf - multi language version manager
# https://github.com/asdf-vm/asdf
# if [ -d ~/.asdf ]; then
# source "$HOME/.asdf/asdf.sh"
#
# # include completions
# fpath=(${ASDF_DIR}/completions $fpath)
# fi
# mise - lang manager
if fn_exists mise; then
eval "$(mise activate zsh)"
fi
# z-zsh
# https://github.com/agkozak/zsh-z
source ~/.zsh/zsh-z/zsh-z.plugin.zsh
zstyle ':completion:*' menu select
# And the external aliases file
source ~/.zsh/aliases
#------------------------------
# Window title
#------------------------------
# set the title of the term when "idle"
precmd_set_title () {
print -Pn "\e]0;[%n@%M][%~]%#\a"
}
# set the term title to show what is currently being executed
preexec_set_title () {
print -Pn "\e]0;[%n@%M][%~]%# ($1)\a"
}
# Add the title functions to the function arrays for execution
precmd_functions+=(precmd_set_title)
preexec_functions+=(preexec_set_title)
#------------------------------
# Prompt
#------------------------------
autoload -U colors zsh/terminfo
colors
source ~/.zsh/prompt
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
#-------------------------------------------------------------------------------
# Completions
#-------------------------------------------------------------------------------
zmodload zsh/complist
autoload -Uz compinit
compinit
#- buggy
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
#-/buggy
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:*:killall:*' menu yes select
zstyle ':completion:*:killall:*' force-list always
zstyle :compinstall filename '${HOME}/.zshrc'
#- complete pacman-color the same as pacman
compdef _pacman pacman-color=pacman
zstyle ':completion:*:pacman:*' force-list always
zstyle ':completion:*:*:pacman:*' menu yes select
# Load completions for npm
source ~/.zsh/npm-completion
# And finally, provide an entrypoint for anything that's not generally
# applicable
[ -s ~/.machine-specific ] && . ~/.machine-specific