comparison dot_zshrc @ 261:217fba8117c8

Add zshrc file
author zegervdv <zegervdv@me.com>
date Sat, 23 May 2020 22:17:29 +0200
parents
children 44d179225271
comparison
equal deleted inserted replaced
260:5fd0a7044f9f 261:217fba8117c8
1 # vim:ft=zsh
2
3 export LC_ALL=$LANG
4
5 PROMPT='%F{cyan}%T%f %F{red}%m%f %F{blue}%~%b%f
6 %j > '
7
8
9 vim_ins_mode="%F{yellow}[INS]%f"
10 vim_cmd_mode="%F{green}[NRM]%f"
11 vim_mode=$vim_ins_mode
12
13 function zle-keymap-select {
14 vim_mode="${${KEYMAP/vicmd/${vim_cmd_mode}}/(main|viins)/${vim_ins_mode}}"
15 zle reset-prompt
16 }
17 zle -N zle-keymap-select
18
19 function zle-line-finish {
20 vim_mode=$vim_ins_mode
21 }
22 zle -N zle-line-finish
23
24 function TRAPINT() {
25 vim_mode=$vim_ins_mode
26 return $(( 128 + $1 ))
27 }
28
29 RPROMPT='${vim_mode}'
30
31 zmodload -i zsh/complist
32
33 bindkey -v
34
35 export CLICOLOR=1
36 export LS_COLORS='no=00;37:fi=00:di=00;33:ln=04;36:pi=40;33:so=01;35:bd=40;33;01:'
37
38 # Options
39 setopt monitor
40 setopt auto_cd
41 setopt cdablevars
42 setopt pushd_ignore_dups
43 setopt interactive_comments
44 setopt append_history
45 setopt inc_append_history
46 setopt hist_ignore_dups
47 setopt hist_find_no_dups
48 setopt hist_reduce_blanks
49 setopt extended_history
50 setopt hist_expire_dups_first
51 setopt hist_verify
52 setopt share_history
53 setopt transient_rprompt
54 setopt prompt_subst
55 setopt multios
56 setopt correct_all
57 setopt autopushd
58 setopt pushdminus
59 setopt pushdsilent
60 setopt nobeep
61 setopt notify
62 REPORTTIME=5
63
64 HISTSIZE=3000
65 SAVEHIST=3000
66 HISTFILE=~/.zsh_history
67
68 # Completion
69 setopt complete_in_word
70 setopt always_to_end
71 setopt auto_menu
72
73 # activate color-completion
74 zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
75
76 # format on completion
77 zstyle ':completion:*:descriptions' format $'%{\e[0;31m%}completing %B%d%b%{\e[0m%}'
78
79 # insert all expansions for expand completer
80 zstyle ':completion:*:expand:*' tag-order all-expansions
81 zstyle ':completion:*:history-words' list false
82
83 # activate menu
84 zstyle ':completion:*:history-words' menu yes
85
86 # ignore duplicate entries
87 zstyle ':completion:*:history-words' remove-all-dups yes
88 zstyle ':completion:*:history-words' stop yes
89
90 zstyle ':completion:*:matches' group 'yes'
91 zstyle ':completion:*' group-name ''
92 if [[ "$NOMENU" -eq 0 ]] ; then
93 # if there are more than 5 options allow selecting from a menu
94 zstyle ':completion:*' menu select=5
95 else
96 # don't use any menus at all
97 setopt no_auto_menu
98 fi
99
100 zstyle ':completion:*:messages' format '%d'
101 zstyle ':completion:*:options' auto-description '%d'
102
103 # describe options in full
104 zstyle ':completion:*:options' description 'yes'
105
106 # complete manual by their section
107 zstyle ':completion:*:manuals' separate-sections true
108 zstyle ':completion:*:manuals.*' insert-sections true
109 zstyle ':completion:*:man:*' menu yes select
110
111 # Search path for sudo completion
112 zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
113 /usr/local/bin \
114 /usr/sbin \
115 /usr/bin \
116 /sbin \
117 /bin \
118 /usr/X11R6/bin
119
120 # provide .. as a completion
121 zstyle ':completion:*' specal-dirs ..
122
123 # case insensitive path-completion
124 zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
125
126 # nvim completion
127 zstyle ':completion::*:nvim:*' ignored-patterns '*.(o|hex|elf|pyc|pdf|dup)'
128
129 autoload -U compinit && compinit
130
131 # fg when pressing Ctrl+Z
132 function fancy-ctrl-z () {
133 if [[ $#BUFFER -eq 0 ]]; then
134 if [[ $(jobs | wc -l) -gt 0 ]]; then
135 BUFFER='fg'
136 zle accept-line
137 fi
138 else
139 zle push-input
140 zle clear-screen
141 fi
142 }
143 zle -N fancy-ctrl-z
144 bindkey '^Z' fancy-ctrl-z
145
146 # Aliases
147 alias l="ls -haltr --color"
148 alias ll="ls -haltr --color"
149 alias xclip='xclip -selection clipboard'
150
151 # Exports
152 export XDG_CONFIG_HOME=$HOME/.config
153 export PATH=$HOME/bin:$PATH
154
155 export EDITOR=nvim
156 export HGEDITOR=nvim
157
158 [ -f ~/.fzf.zsh ] &&source ~/.fzf.zsh
159 export FZF_DEFAULT_COMMAND='ag -g ""'