]> git.netwichtig.de Git - user/henk/vcsh/zsh.git/blob - .zshrc
customize fzf: use tmux and fdfind
[user/henk/vcsh/zsh.git] / .zshrc
1 # zprof only makes sense at the very top
2 # zmodload zsh/zprof
3
4
5 # settings for the zsh don’t get exported
6
7 # where to write history
8 HISTFILE=~/.zsh_history
9 HISTSIZE=1000000000
10 SAVEHIST=1000000000
11
12 # print time needed for execution when it takes longer than this value
13 REPORTTIME=10
14
15
16 ## define word characters (for stuff like backward-word, forward-word, backward-kill-word,..)
17 ## these are NOT separators but chars considered part of a word
18 ## these are NOT respected by e.g. vi-backward-kill-word, it seems
19 # WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
20 ## see below how to solve this with select-word-style module
21
22
23 # where zsh looks for functions
24
25 # add my own functions
26 fpath=(~/.zsh_functions $fpath)
27
28
29 # hashed directories are usually independent and standalone
30 # so they can stay at the top
31 hash -d diary=~/Data/personal/henk/workinprogress/Dokumente/diary
32 hash -d lifedocs=~/Data/personal/henk/workinprogress/Dokumente/Leben
33 hash -d bewerbung=~/Data/personal/henk/workinprogress/Dokumente/Arbeit/bewerbung
34 hash -d rezepte=~/Data/personal/henk/workinprogress/Dokumente/rezepte/cuisine
35 hash -d templates=~/Data/personal/henk/workinprogress/templates
36 hash -d gitignore=~/Data/public/software/gitignore
37 hash -d doc=/usr/share/doc
38 hash -d TODO=~/Data/personal/henk/TODO/
39 hash -d fortunes=~/Data/personal/henk/workinprogress/Dokumente/fortunes/
40
41
42 # aliases are usually independent and standalone
43 source ~/.zsh_aliases
44
45
46 # load plugin manager after all 'static' stuff is done
47 source "${HOME}/.zgenom/zgenom.zsh"
48 # Check for plugin and zgenom updates every 7 days
49 # This does not increase the startup time.
50 zgenom autoupdate
51
52
53 # mostly static stuff, env vars
54 zgenom load 'https://github.com/joel-porquet/zsh-dircolors-solarized'
55 zgenom load "https://github.com/greymd/tmux-xpanes"
56
57
58 # options are usually independent and standalone
59 # so they can stay at the top
60 setopt AUTO_CD
61 setopt CHASE_LINKS
62
63 # switch +/- when referring to the dirstack
64 setopt PUSHD_MINUS
65
66 # Make cd push the old directory onto the directory stack
67 setopt AUTO_PUSHD
68
69 setopt AUTO_NAME_DIRS
70
71 # this should not be needed ever
72 # unclear why it is even implemented
73 # all relevant functionality should be possible without this anyway
74 # see #zsh@libera on 2024-04-14
75 # setopt BRACE_CCL
76 setopt EXTENDED_GLOB
77 setopt MARK_DIRS
78 setopt NUMERIC_GLOB_SORT
79 setopt RC_EXPAND_PARAM
80 #setopt WARN_CREATE_GLOBAL
81 setopt GLOB_DOTS
82
83 # Ignore a duplicate of the previous command
84 setopt HIST_IGNORE_DUPS
85 # Do not save commands starting with a space to history
86 setopt HIST_IGNORE_SPACE
87 # Remove superfluous blanks
88 setopt HIST_REDUCE_BLANKS
89 # expand history expansion for verification
90 setopt HIST_VERIFY
91 # save timestamp and runtime as well
92 setopt EXTENDED_HISTORY
93 # write line to history file when finished, not when started, to have correct runtime
94 setopt INC_APPEND_HISTORY_TIME
95
96 # Error on a redirections which would overwrite an existing file
97 setopt NO_CLOBBER
98 setopt CORRECT
99 setopt CORRECT_ALL
100 #unsetopt NOMATCH
101 setopt PRINT_EXIT_VALUE
102
103 setopt AUTO_CONTINUE
104 setopt NO_BG_NICE
105 # display PID when suspending processes as well
106 setopt LONG_LIST_JOBS
107 # Report the status of background jobs immediately, rather than waiting until just before printing a prompt.
108 setopt NOTIFY
109 # Whenever  a  command completion or spelling correction is attempted, make sure the entire command path is hashed first.  This makes the first completion slower but avoids false reports of spelling errors.
110 setopt HASH_LIST_ALL
111 # If unset, the cursor is set to the end of the word if completion is started. Otherwise it stays there and completion is done from both ends.
112 setopt COMPLETE_IN_WORD
113 # use zsh field splitting
114 setopt NO_SH_WORD_SPLIT
115 # unset parameters should cause an error
116 # CONFLICTS WITH ZINIT
117 # CONFLICTS WITH ZGENOM
118 # setopt NO_UNSET
119
120
121 # load before completion system initialization
122 zgenom load 'https://github.com/zsh-users/zsh-completions'
123
124 # initialize completion system before loading plugins and external configs
125 source ~/.zsh_comprc
126
127
128 # TODO reconsider this
129 # source /usr/share/autojump/autojump.sh
130
131
132 # autoload all functions defined by me
133 # since only filenames are required we
134 # * follow symlinks
135 # * work only on plainfiles
136 # * take only the filename part without dir
137 autoload ~/.zsh_functions/[^_]*(-.:t)
138
139
140 autoload -Uz vcs_info
141 zstyle ':vcs_info:*' enable git
142
143 # similar to xargs
144 autoload -U zargs
145
146 # similar to rename or mmv
147 autoload -U zmv
148 autoload -U zln
149 autoload -U zcp
150
151
152 # zle customization
153
154 # spawn editor on current command line
155 autoload -Uz edit-command-line
156 zle -N edit-command-line
157 bindkey -M vicmd '^X^E' edit-command-line
158 bindkey -M viins '^X^E' edit-command-line
159
160 # show globbing results live
161 autoload insert-files
162 zle -N insert-files
163 bindkey '^Xf' insert-files
164
165
166 #this mainly sets vars, binds keys, does zle stuff
167 # zgenom load 'https://github.com/laurenkt/zsh-vimto'
168
169 # functions and an autoload, should be fine here
170 zgenom load 'https://github.com/MichaelAquilina/zsh-you-should-use'
171
172
173 # source ~/.zsh_taskwarrior
174 # source ~/.zsh_functions
175 # source ~/.zsh_functions_media
176 # source ~/.zsh_functions_taskwarrior
177
178
179 for f in ~/.zsh_local*(N)
180 do
181         source $f
182 done
183
184
185 #zle -N zle-line-init
186 #zle -N zle-keymap-select
187
188
189 # keybindings might have been changed by plugins, etc.
190 # so they go more to the bottom
191
192 # the vi bindings for these do not respect WORDCHARS and are not replaced by the select-word-style functions
193 bindkey -M vicmd 'w' forward-word
194 bindkey -M vicmd 'b' backward-word
195 bindkey -M viins '^W' backward-kill-word
196
197 # default vi history search is strange
198 bindkey -M viins '^R' history-incremental-search-backward
199
200
201 # better word matching
202 autoload -U select-word-style
203 select-word-style normal
204 # these characters do _not_ separate words but are part of words
205 zstyle ':zle:*' word-chars '*?[]~;!#$%^(){}<>'
206
207
208 LP_ENABLE_TIME=1
209 # should probably be closer to the bottom than the top?
210 zgenom load 'https://github.com/nojhan/liquidprompt'
211
212
213 # needs to be loaded close to the end because it hooks into other stuff
214 # see https://github.com/zsh-users/zsh-syntax-highlighting
215 source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
216
217 eval "$(zoxide init zsh)"
218
219 FZF_TMUX=1
220 FZF_CTRL_T_COMMAND='command fdfind --hidden'
221 FZF_ALT_C_COMMAND='command fdfind --hidden --type d'
222 source /usr/share/doc/fzf/examples/key-bindings.zsh
223 source /usr/share/doc/fzf/examples/completion.zsh
224
225 # Use fd (https://github.com/sharkdp/fd) instead of the default find
226 # command for listing path candidates.
227 # - The first argument to the function ($1) is the base path to start traversal
228 # - See the source code (completion.{bash,zsh}) for the details.
229 _fzf_compgen_path() {
230   fdfind --hidden --follow --exclude ".git" . "$1"
231 }
232
233 # Use fd to generate the list for directory completion
234 _fzf_compgen_dir() {
235   fdfind --type d --hidden --follow --exclude ".git" . "$1"
236 }
237
238 # commands to run after initialization is complete
239 #task awaiting
240 cat ~/.motd
241 # zprof