forked from mxaddict/dotfiles_archive_001
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
107 lines (93 loc) · 3.86 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
# Set up the prompt
autoload -Uz promptinit
promptinit
prompt redhat
# We need to turn on shared history and ignoring dupes...
setopt histignorealldups sharehistory
# Keep 10000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history
# unset MULTIBYTE so that we have better terminal support for Ctrl/Meta/Alt keys
unsetopt MULTIBYTE
# Load our keys with zkbd
autoload -Uz zkbd
bindkey -v
if [[ -f ~/.zkbd/$TERM-${DISPLAY:-$VENDOR-$OSTYPE} ]]; then
source ~/.zkbd/$TERM-${DISPLAY:-$VENDOR-$OSTYPE}
else
echo "COULD NOT LOAD: ~/.zkbd/$TERM-${DISPLAY:-$VENDOR-$OSTYPE}"
echo "WARNING: Keybindings may not be set correctly!"
echo "Execute \`zkbd\` to create bindings."
fi
# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# Add our bindings
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-search
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-search
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
[[ -n "${key[C-Up]}" ]] && bindkey "${key[C-Up]}" history-beginning-search-backward
[[ -n "${key[C-Down]}" ]] && bindkey "${key[C-Down]}" history-beginning-search-forward
[[ -n "${key[C-Left]}" ]] && bindkey "${key[C-Left]}" backward-word
[[ -n "${key[C-Right]}" ]] && bindkey "${key[C-Right]}" forward-word
[[ -n "${key[C-R]}" ]] && bindkey "${key[C-R]}" history-incremental-search-backward
[[ -n "${key[C-T]}" ]] && bindkey "${key[C-T]}" history-incremental-search-forward
# Use modern completion system
autoload -Uz compinit
compinit
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# Load our shared SHELLRC file
source ~/.shrc
# Load fzf
if [ -f ~/.fzf.zsh ]
then
source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -l -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
prvw='cat {}'
# Use bat if installed
if type bat &>/dev/null
then
prvw='bat --style=numbers --color=always {}'
fi
export FZF_CTRL_T_OPTS="--height 50% --preview-window right:70%:wrap --preview '${prvw}'"
fi
autoload -U compinit && compinit -u