Skip to content

Commit 907f3b0

Browse files
committed
* remove atuin from $ZSH_AUTOSUGGEST_STRATEGY to prevent atuinsh/atuin#2903 @ home/zsh.nix
1 parent 321cbc4 commit 907f3b0

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

home/zsh.nix

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
{ lib, pkgs, ... }:
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
...
6+
}:
27

38
let
49
omzPrefix = suffixs: map (i: "ohmyzsh/ohmyzsh " + i) suffixs;
@@ -50,22 +55,32 @@ lib.mkMerge [
5055
}
5156
{
5257
antidote.plugins = [ "zsh-users/zsh-autosuggestions" ];
53-
initContent = lib.mkOrder 800 ''
54-
# https://github.com/zsh-users/zsh-autosuggestions/blob/85919cd1ffa7d2d5412f6d3fe437ebdbeeec4fc5/README.md#suggestion-strategy
55-
ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion)
58+
initContent = lib.mkMerge [
59+
(lib.mkOrder 800 ''
60+
# https://github.com/zsh-users/zsh-autosuggestions/blob/85919cd1ffa7d2d5412f6d3fe437ebdbeeec4fc5/README.md#suggestion-strategy
61+
ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion)
5662
57-
# https://github.com/zsh-users/zsh-autosuggestions/issues/238#issuecomment-389324292
58-
pasteinit() {
59-
OLD_SELF_INSERT=''${''${(s.:.)widgets[self-insert]}[2,3]}
60-
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
61-
}
63+
# https://github.com/zsh-users/zsh-autosuggestions/issues/238#issuecomment-389324292
64+
pasteinit() {
65+
OLD_SELF_INSERT=''${''${(s.:.)widgets[self-insert]}[2,3]}
66+
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
67+
}
6268
63-
pastefinish() {
64-
zle -N self-insert $OLD_SELF_INSERT
65-
}
66-
zstyle :bracketed-paste-magic paste-init pasteinit
67-
zstyle :bracketed-paste-magic paste-finish pastefinish
68-
'';
69+
pastefinish() {
70+
zle -N self-insert $OLD_SELF_INSERT
71+
}
72+
zstyle :bracketed-paste-magic paste-init pasteinit
73+
zstyle :bracketed-paste-magic paste-finish pastefinish
74+
'')
75+
(lib.mkIf (with config.programs.atuin; (enable && enableZshIntegration)) (
76+
lib.mkOrder 1010 ''
77+
# https://github.com/atuinsh/atuin/pull/2903
78+
# https://stackoverflow.com/questions/3435355/remove-entry-from-array/52188874#52188874
79+
ZSH_AUTOSUGGEST_STRATEGY_EXCLUDE=(atuin)
80+
ZSH_AUTOSUGGEST_STRATEGY=''${ZSH_AUTOSUGGEST_STRATEGY:|ZSH_AUTOSUGGEST_STRATEGY_EXCLUDE}
81+
''
82+
))
83+
];
6984
}
7085
{
7186
antidote.plugins = omzPluginPrefix [ "docker" ];

0 commit comments

Comments
 (0)