fzf: warn on conflicting ctrl-r bindings
Detect active fzf and history-manager Ctrl-R bindings by their configured values, warn with the winning precedence, and let the normal binding options silence the warning.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableNushellIntegration = true;
|
||||
historyWidget.nushell.command = "";
|
||||
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "fzf";
|
||||
@@ -51,6 +52,7 @@
|
||||
''
|
||||
assertFileExists "${nushellConfigFile}"
|
||||
assertFileContent "$(normalizeStorePaths "${nushellConfigFile}")" ${builtins.toFile "nushell-fzf-atuin-order-expected.nu" ''
|
||||
$env.FZF_CTRL_R_COMMAND = ""
|
||||
source /nix/store/00000000000000000000000000000000-nushell-fzf-integration.nu
|
||||
|
||||
source /nix/store/00000000000000000000000000000000-atuin-nushell-config.nu
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
atuin = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
flags = [ "--disable-ctrl-r" ];
|
||||
package = config.lib.test.mkStubPackage { name = "atuin"; };
|
||||
};
|
||||
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "fzf";
|
||||
version = "0.73.0";
|
||||
};
|
||||
};
|
||||
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
atuin = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
package = config.lib.test.mkStubPackage { name = "atuin"; };
|
||||
};
|
||||
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
historyWidget.command = "";
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "fzf";
|
||||
version = "0.73.0";
|
||||
};
|
||||
};
|
||||
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
atuin = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
package = config.lib.test.mkStubPackage { name = "atuin"; };
|
||||
};
|
||||
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
historyWidget.zsh.command = "";
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "fzf";
|
||||
version = "0.73.0";
|
||||
};
|
||||
};
|
||||
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
programs = {
|
||||
atuin = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
package = config.lib.test.mkStubPackage { name = "atuin"; };
|
||||
};
|
||||
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "fzf";
|
||||
version = "0.73.0";
|
||||
};
|
||||
};
|
||||
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
''
|
||||
programs.fzf and a history manager both configure Ctrl-R for zsh.
|
||||
|
||||
Definitions:
|
||||
zsh:
|
||||
`programs.fzf.enable` defined in ${lib.showFiles options.programs.fzf.enable.files}
|
||||
`programs.atuin.enable` defined in ${lib.showFiles options.programs.atuin.enable.files}
|
||||
|
||||
The history manager integration is sourced after fzf and owns Ctrl-R.
|
||||
Choose which integration should own Ctrl-R.
|
||||
To keep the history manager on Ctrl-R, disable fzf's binding:
|
||||
programs.fzf.historyWidget.command = "";
|
||||
or disable it for one shell:
|
||||
programs.fzf.historyWidget.zsh.command = "";
|
||||
To keep fzf on Ctrl-R with Atuin, disable Atuin's Ctrl-R binding:
|
||||
programs.atuin.flags = [ "--disable-ctrl-r" ];
|
||||
McFly has no Ctrl-R-only option in Home Manager. Disable McFly's
|
||||
shell integration for that shell if fzf should own Ctrl-R.
|
||||
To use another key, disable one default Ctrl-R binding and add a
|
||||
shell-specific key binding in your shell configuration.
|
||||
''
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
'';
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
{
|
||||
fzf-bash-widget-overrides = ./bash-widget-overrides.nix;
|
||||
fzf-ctrl-r-conflict-atuin-disabled = ./ctrl-r-conflict-atuin-disabled.nix;
|
||||
fzf-ctrl-r-conflict-fzf-disabled = ./ctrl-r-conflict-fzf-disabled.nix;
|
||||
fzf-ctrl-r-conflict-per-shell-disabled = ./ctrl-r-conflict-per-shell-disabled.nix;
|
||||
fzf-ctrl-r-conflict-warning = ./ctrl-r-conflict-warning.nix;
|
||||
fzf-disabled = ./disabled.nix;
|
||||
fzf-options = ./all-options.nix;
|
||||
fzf-bash-integration = ./bash-integration.nix;
|
||||
|
||||
Reference in New Issue
Block a user