Mercurial > dotfiles
changeset 539:8e2e42add3af
add zsh-histdb plugin
author | zegervdv <zegervdv@me.com> |
---|---|
date | Thu, 27 Jan 2022 16:33:56 +0100 |
parents | b12e86e6c110 |
children | 9036f18c5ad4 |
files | .chezmoiexternal.toml dot_zshrc |
diffstat | 2 files changed, 30 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/.chezmoiexternal.toml Thu Jan 27 14:20:13 2022 +0100 +++ b/.chezmoiexternal.toml Thu Jan 27 16:33:56 2022 +0100 @@ -41,6 +41,18 @@ stripComponents = 1 refreshPeriod = "168h" +[".zsh/zsh-histdb"] + type = "archive" + url = "https://github.com/larkery/zsh-histdb/archive/master.tar.gz" + exact = true + stripComponents = 1 + refreshPeriod = "168h" + +[".zsh/fzf-histdb.zsh"] + type = "file" + url = "https://github.com/m42e/zsh-histdb-fzf/raw/master/fzf-histdb.zsh" + refreshPeriod = "168h" + [".zsh/completions/_fd"] type = "file" url = "https://github.com/sharkdp/fd/raw/master/contrib/completion/_fd"
--- 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