Skip to content

Commit

Permalink
feat(fish): Set fzf keybinds declaratively
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Aug 18, 2023
1 parent 09bfbf0 commit f417755
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions home-manager/modules/fzf.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
{ pkgs, ... }: {
{ pkgs, lib, ... }:
let
key-bindings = [
{
lhs = "\\ce";
rhs = "fzf-vim-widget";
}
{
lhs = "\\a";
rhs = "fzf-project-widget";
}
{
lhs = "\\ct";
rhs = "fzf-file-widget-wrapped";
}
];
in {
programs.fzf = {
enable = true;
defaultCommand = "${pkgs.ripgrep}/bin/rg --files";
Expand All @@ -13,9 +29,9 @@
programs.fish = {
interactiveShellInit = ''
for mode in insert default normal
bind -M $mode \ce fzf-vim-widget
bind -M $mode \a fzf-project-widget
bind -M $mode \ct fzf-file-widget-wrapped
${lib.concatMapStrings (keybind: ''
bind -M $mode ${keybind.lhs} ${keybind.rhs}
'') key-bindings}
end
'';
functions.fzf-file-widget-wrapped = ''
Expand Down

0 comments on commit f417755

Please sign in to comment.