68 lines
1.3 KiB
Nix
Raw Normal View History

2024-04-20 09:42:06 -04:00
{
2025-01-20 22:35:40 -05:00
config,
pkgs,
lib,
...
}:
2022-05-06 09:29:25 -04:00
2025-01-20 22:35:40 -05:00
let
cfg = config.nmasur.presets.programs.fzf;
in
2023-07-30 20:26:23 -04:00
2025-01-20 22:35:40 -05:00
{
options.nmasur.presets.programs.fzf.enable = lib.mkEnableOption "Fzf fuzzy finder";
config = lib.mkIf cfg.enable {
2022-05-06 09:29:25 -04:00
programs.fzf.enable = true;
programs.fish = {
functions = {
projects = {
description = "Jump to a project";
body = ''
2022-06-20 15:20:20 -04:00
set projdir ( \
fd \
2022-06-21 17:51:27 -04:00
--search-path $HOME/dev \
2022-06-20 15:20:20 -04:00
--type directory \
--exact-depth 2 \
2024-01-22 13:03:46 -05:00
| ${pkgs.proximity-sort}/bin/proximity-sort $PWD \
| sed 's/\\/$//' \
| fzf --tiebreak=index \
2022-06-26 21:53:08 -04:00
)
2022-06-20 15:49:25 -04:00
and cd $projdir
2022-05-06 09:29:25 -04:00
and commandline -f execute
'';
};
};
2024-04-20 09:42:06 -04:00
shellAbbrs = {
lsf = "ls -lh | fzf";
};
2022-05-06 09:29:25 -04:00
};
2022-05-29 13:44:45 -04:00
# Global fzf configuration
2024-04-20 09:42:06 -04:00
home.sessionVariables =
let
fzfCommand = "fd --type file";
in
{
FZF_DEFAULT_COMMAND = fzfCommand;
FZF_CTRL_T_COMMAND = fzfCommand;
FZF_DEFAULT_OPTS = "-m --height 50% --border";
};
2024-11-16 22:59:00 -07:00
home.packages = [
(pkgs.writeShellApplication {
name = "jqr";
runtimeInputs = [
pkgs.jq
pkgs.fzf
];
text = builtins.readFile ./bash/scripts/jqr.sh;
})
];
2025-01-20 22:35:40 -05:00
2022-05-06 09:29:25 -04:00
};
}