blob: 0509006feb45e70ea9dd70e233d67569fbaa6968 (
plain)
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
|
# Colors and prompt
autoload -U colors && colors
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
if [ "$USER" = "root" ]; then
# Make it so that we display root's user@host on the left and colored red so
# that it is quite clear that we are under root.
PROMPT=$'\n''%{[38;5;14m%}%B%~ ${reset_color}%F{yellow}${vcs_info_msg_0_}%f'$'\n''%F{red}%n%f@%F{red}%m%f %F{green}→%f '
else
PROMPT=$'\n''%{[38;5;14m%}%B%~ ${reset_color}%F{yellow}${vcs_info_msg_0_}%f'$'\n''%F{green}→%f '
RPROMPT='%{[38;5;14m%} %n%f@%F{red}%m%f'
fi
zstyle ':vcs_info:git:*' formats ' %b'
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
zstyle :compinstall filename '/home/yaroslav/.zshrc'
# History
HISTFILE=~/.cache/zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory autocd beep notify
# vi mode
bindkey -v
# Use vim keys in tab complete menu:
bindkey -M menuselect 'H' vi-backward-char
bindkey -M menuselect 'K' vi-up-line-or-history
bindkey -M menuselect 'L' vi-forward-char
bindkey -M menuselect 'J' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
# History search
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
bindkey -a "k" history-beginning-search-backward
bindkey -a "j" history-beginning-search-forward
# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'underline' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
echo -ne '\e[5 q' # Use beam shape cursor on startup.
printf "\033]2;%s\a" "$HOST:$PWD" # Set terminal window title to current dir
# Repeat for every new prompt
precmd () {
echo -ne '\e[5 q'
printf "\033]2;%s\a" "$HOST:$PWD"
}
zle -N zle-keymap-select
[ -f "$HOME/.config/zsh/shortcuts" ] && . "$HOME/.config/zsh/shortcuts"
if [ -f "$HOME/.cache/colorscheme" ]; then
# trap "source $HOME/.cache/colorscheme && shtheme ultramar-\$COLORSCHEME" SIGUSR1
trap "source $HOME/.cache/colorscheme" SIGUSR1
source $HOME/.cache/colorscheme
# shtheme ultramar-$COLORSCHEME
fi
if [ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]
then
# Arch/Artix
. /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
elif [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]
then
# Debian
. /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
|