diff options
author | lassulus <lassulus@lassul.us> | 2022-11-20 01:21:36 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-11-20 01:21:36 +0100 |
commit | df68f9efc2c84b7507f5e1745e78bdb9e14cc851 (patch) | |
tree | 373788aed3973e6292380b9e10f0ead82083c58a | |
parent | 548fb5b41cd07c464ec7dc1ca5ab262b7f22b2d1 (diff) |
l zsh: use atuin for shell history
-rw-r--r-- | lass/2configs/zsh.nix | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/lass/2configs/zsh.nix b/lass/2configs/zsh.nix index 6571461ca..ed00068b1 100644 --- a/lass/2configs/zsh.nix +++ b/lass/2configs/zsh.nix @@ -1,6 +1,17 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = [ pkgs.fzf ]; + environment.systemPackages = with pkgs; [ + atuin + direnv + fzf + ]; + environment.variables.ATUIN_CONFIG_DIR = toString (pkgs.writeTextDir "/config.toml" '' + auto_sync = true + update_check = false + sync_address = "http://green.r:8888" + sync_frequency = 0 + style = "compact" + ''); programs.zsh = { enable = true; shellInit = '' @@ -12,27 +23,9 @@ setopt autocd extendedglob bindkey -e - #history magic - bindkey "[A" up-line-or-local-history - bindkey "[B" down-line-or-local-history - up-line-or-local-history() { - zle set-local-history 1 - zle up-line-or-history - zle set-local-history 0 - } - zle -N up-line-or-local-history - down-line-or-local-history() { - zle set-local-history 1 - zle down-line-or-history - zle set-local-history 0 - } - zle -N down-line-or-local-history - - setopt SHARE_HISTORY - setopt HIST_IGNORE_ALL_DUPS - # setopt inc_append_history - bindkey '^R' history-incremental-search-backward + # # setopt inc_append_history + # bindkey '^R' history-incremental-search-backward #C-x C-e open line in editor autoload -z edit-command-line @@ -43,6 +36,13 @@ source ${pkgs.fzf}/share/fzf/completion.zsh source ${pkgs.fzf}/share/fzf/key-bindings.zsh + # atuin distributed shell history + export ATUIN_NOBIND="true" # disable all keybdinings of atuin + eval "$(atuin init zsh)" + bindkey '^r' _atuin_search_widget # bind ctrl+r to atuin + # use zsh only session history + fc -p + #completion magic autoload -Uz compinit compinit @@ -67,11 +67,6 @@ bindkey "Od" emacs-backward-word ''; promptInit = '' - # TODO: figure out why we need to set this here - HISTSIZE=900001 - HISTFILESIZE=$HISTSIZE - SAVEHIST=$HISTSIZE - autoload -U promptinit promptinit |