fzf: add options for setting commands for all keys
This allows you to specify your own custom commands to be run when calling fzf. You might use tools like fd to search faster and take `.gitignore` files into consideration.
This commit is contained in:
parent
90bcaaf582
commit
2548c43175
|
@ -12,6 +12,16 @@ in
|
||||||
options.programs.fzf = {
|
options.programs.fzf = {
|
||||||
enable = mkEnableOption "fzf - a command-line fuzzy finder";
|
enable = mkEnableOption "fzf - a command-line fuzzy finder";
|
||||||
|
|
||||||
|
defaultCommand = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
example = "fd --type f";
|
||||||
|
description = ''
|
||||||
|
The command that gets executed as the default source for fzf
|
||||||
|
when running.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
defaultOptions = mkOption {
|
defaultOptions = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
|
@ -21,6 +31,16 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fileWidgetCommand = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
example = "fd --type f";
|
||||||
|
description = ''
|
||||||
|
The command that gets executed as the source for fzf for the
|
||||||
|
CTRL-T keybinding.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
fileWidgetOptions = mkOption {
|
fileWidgetOptions = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
|
@ -30,6 +50,16 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
changeDirWidgetCommand = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
example = "fd --type d" ;
|
||||||
|
description = ''
|
||||||
|
The command that gets executed as the source for fzf for the
|
||||||
|
ALT-C keybinding.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
changeDirWidgetOptions = mkOption {
|
changeDirWidgetOptions = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
|
@ -39,6 +69,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
historyWidgetCommand = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
The command that gets executed as the source for fzf for the
|
||||||
|
CTRL-R keybinding.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
historyWidgetOptions = mkOption {
|
historyWidgetOptions = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
|
@ -70,10 +109,14 @@ in
|
||||||
|
|
||||||
home.sessionVariables =
|
home.sessionVariables =
|
||||||
mapAttrs (n: v: toString v) (
|
mapAttrs (n: v: toString v) (
|
||||||
filterAttrs (n: v: v != []) {
|
filterAttrs (n: v: v != [] && v != null) {
|
||||||
|
FZF_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
|
||||||
FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions;
|
FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions;
|
||||||
|
FZF_CTRL_R_COMMAND = cfg.historyWidgetCommand;
|
||||||
FZF_CTRL_R_OPTS = cfg.historyWidgetOptions;
|
FZF_CTRL_R_OPTS = cfg.historyWidgetOptions;
|
||||||
|
FZF_CTRL_T_COMMAND = cfg.fileWidgetCommand;
|
||||||
FZF_CTRL_T_OPTS = cfg.fileWidgetOptions;
|
FZF_CTRL_T_OPTS = cfg.fileWidgetOptions;
|
||||||
|
FZF_DEFAULT_COMMAND = cfg.defaultCommand;
|
||||||
FZF_DEFAULT_OPTS = cfg.defaultOptions;
|
FZF_DEFAULT_OPTS = cfg.defaultOptions;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue