diff --git a/home-manager/cli/nnn.nix b/home-manager/cli/nnn.nix index 39f58d17..c83f7d60 100644 --- a/home-manager/cli/nnn.nix +++ b/home-manager/cli/nnn.nix @@ -53,34 +53,10 @@ in }; }; - programs.zsh.initExtra = '' - n() - { - # Block nesting of nnn in subshells - if [ -n $NNNLVL ] && [ "''${NNNLVL:-0}" -ge 1 ]; then - echo "nnn is already running" - return - fi - - # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) - # To cd on quit only on ^G, remove the "export" as in: - # NNN_TMPFILE="''${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" - # NOTE: NNN_TMPFILE is fixed, should not be modified - export NNN_TMPFILE="''${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" - - # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn - # stty start undef - # stty stop undef - # stty lwrap undef - # stty lnext undef - - ${config.programs.nnn.finalPackage}/bin/nnn -a "$@" - - if [ -f "$NNN_TMPFILE" ]; then - . "$NNN_TMPFILE" - rm -f "$NNN_TMPFILE" > /dev/null - fi - } + programs.zsh.initExtra = /* bash */ '' + # Export NNN_TMPFILE to quit on cd always + export NNN_TMPFILE="${config.xdg.configHome}/nnn/.lastd" + . ${config.programs.nnn.finalPackage}/share/quitcd/quitcd.bash_sh_zsh ''; }; }