lf, add fish cd-alias

This commit is contained in:
Julia Lange 2024-04-21 01:43:11 -07:00
parent 9978fb7921
commit b16fb47719
2 changed files with 19 additions and 3 deletions

View file

@ -10,6 +10,13 @@
config = lib.mkIf config.lf.enable { config = lib.mkIf config.lf.enable {
xdg.configFile."lf/icons".source = ./icons; xdg.configFile."lf/icons".source = ./icons;
fish.extraFunctions = lib.mkIf config.fish.enable {
lf = {
body = ''cd "$(command ${pkgs.lf}/bin/lf -print-last-dir "$argv")"'';
wraps = "${pkgs.lf}/bin/lf";
};
};
programs.lf = { programs.lf = {
enable = true; enable = true;
settings = { settings = {

View file

@ -1,10 +1,19 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let
{ functionModule = with lib.types; submodule {
options = {
body = lib.mkOption { type = lines; };
wraps = lib.mkOption {
type = nullOr str;
default = null;
};
};
};
in {
options.fish = { options.fish = {
enable = lib.mkEnableOption "Enables fish"; enable = lib.mkEnableOption "Enables fish";
extraFunctions = lib.mkOption { extraFunctions = lib.mkOption {
type = with lib.types; attrsOf lines; type = with lib.types; attrsOf (either lines functionModule);
default = {}; default = {};
}; };
}; };