fish: fix last-working-dir function

This commit is contained in:
2024-03-19 09:09:11 +01:00
parent b35c87b4d6
commit 915a821e12
2 changed files with 9 additions and 22 deletions

View File

@ -26,7 +26,11 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.file = { ".config/starship.toml".source = ./starship.toml; }; home.file = {
".config/starship.toml".source = ./starship.toml;
".config/fish/conf.d/last-working-dir.fish".source =
./last-working-dir.fish;
};
home.packages = with pkgs; [ starship ]; home.packages = with pkgs; [ starship ];
@ -40,16 +44,10 @@ in {
interactiveShellInit = "set fish_greeting"; # Disable default greeting interactiveShellInit = "set fish_greeting"; # Disable default greeting
plugins = [ plugins = [{
{
name = "z"; name = "z";
src = pkgs.fishPlugins.z.src; src = pkgs.fishPlugins.z.src;
} }];
{
name = "lwd";
src = ./last-working-dir.fish;
}
];
functions = { functions = {
fzf-z = '' fzf-z = ''
@ -63,12 +61,6 @@ in {
run = '' run = ''
nix run nixpkgs#"$argv[1]" -- $argv[2..-1] nix run nixpkgs#"$argv[1]" -- $argv[2..-1]
''; '';
# Last working directory functionality
# __onpwd = {
# onVariable = "PWD";
# body = "set --universal LAST_WORKING_DIR $PWD";
# };
}; };
}; };
}; };

View File

@ -1,7 +1,3 @@
if status --is-interactive; and test -d $LAST_WORKING_DIR; and test $PWD = $HOME
cd $LAST_WORKING_DIR
end
function lwd function lwd
cd $LAST_WORKING_DIR cd $LAST_WORKING_DIR
end end
@ -9,4 +5,3 @@ end
function __onpwd --on-variable PWD function __onpwd --on-variable PWD
set --universal LAST_WORKING_DIR $PWD set --universal LAST_WORKING_DIR $PWD
end end
# __onpwd