Mercurial > dotfiles
diff 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 |
line wrap: on
line diff
--- a/dot_zshrc Thu Jan 27 14:20:13 2022 +0100 +++ b/dot_zshrc Thu Jan 27 16:33:56 2022 +0100 @@ -7,6 +7,21 @@ source ~/.zsh/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh +source ~/.zsh/zsh-histdb/zsh-histdb.plugin.zsh +source ~/.zsh/fzf-histdb.zsh + +_zsh_autosuggest_strategy_histdb_top_here() { + local query="select commands.argv from +history left join commands on history.command_id = commands.rowid +left join places on history.place_id = places.rowid +where places.dir LIKE '$(sql_escape $PWD)%' +and commands.argv LIKE '$(sql_escape $1)%' +group by commands.argv order by count(*) desc limit 1" + suggestion=$(_histdb_query "$query") +} + +ZSH_AUTOSUGGEST_STRATEGY=histdb_top_here + fpath=(~/.zsh/completions $fpath) export TERM=xterm-256color @@ -242,7 +257,9 @@ export BAT_CONFIG_PATH=$HOME/.config/bat/config [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh -export FZF_DEFAULT_COMMAND='ag -g ""' + +bindkey '^r' histdb-fzf-widget + [ -f ~/.zshrc.local ] && source ~/.zshrc.local # Must run after brew is loaded