comparison dot_zshrc @ 539:8e2e42add3af

add zsh-histdb plugin
author zegervdv <zegervdv@me.com>
date Thu, 27 Jan 2022 16:33:56 +0100
parents 0cc89a031281
children 9036f18c5ad4
comparison
equal deleted inserted replaced
538:b12e86e6c110 539:8e2e42add3af
4 export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=green,fg=black' 4 export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=green,fg=black'
5 5
6 source ~/.zsh/zsh-autosuggestions.zsh 6 source ~/.zsh/zsh-autosuggestions.zsh
7 7
8 source ~/.zsh/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 8 source ~/.zsh/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
9
10 source ~/.zsh/zsh-histdb/zsh-histdb.plugin.zsh
11 source ~/.zsh/fzf-histdb.zsh
12
13 _zsh_autosuggest_strategy_histdb_top_here() {
14 local query="select commands.argv from
15 history left join commands on history.command_id = commands.rowid
16 left join places on history.place_id = places.rowid
17 where places.dir LIKE '$(sql_escape $PWD)%'
18 and commands.argv LIKE '$(sql_escape $1)%'
19 group by commands.argv order by count(*) desc limit 1"
20 suggestion=$(_histdb_query "$query")
21 }
22
23 ZSH_AUTOSUGGEST_STRATEGY=histdb_top_here
9 24
10 fpath=(~/.zsh/completions $fpath) 25 fpath=(~/.zsh/completions $fpath)
11 26
12 export TERM=xterm-256color 27 export TERM=xterm-256color
13 28
240 255
241 export RIPGREP_CONFIG_PATH=$HOME/.config/ripgrep/ripgreprc 256 export RIPGREP_CONFIG_PATH=$HOME/.config/ripgrep/ripgreprc
242 export BAT_CONFIG_PATH=$HOME/.config/bat/config 257 export BAT_CONFIG_PATH=$HOME/.config/bat/config
243 258
244 [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh 259 [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
245 export FZF_DEFAULT_COMMAND='ag -g ""' 260
261 bindkey '^r' histdb-fzf-widget
262
246 [ -f ~/.zshrc.local ] && source ~/.zshrc.local 263 [ -f ~/.zshrc.local ] && source ~/.zshrc.local
247 264
248 # Must run after brew is loaded 265 # Must run after brew is loaded
249 export SUDO_EDITOR=$(which nvim) 266 export SUDO_EDITOR=$(which nvim)
250 eval "$(direnv hook zsh)" 267 eval "$(direnv hook zsh)"