diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-08-23 21:08:16 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-08-23 21:08:16 +0200 |
| commit | 8d8bc982564fc5af477869bf8a4e682550dec67a (patch) | |
| tree | 04fc3c6ee06adc1979d3135a8177206a754ffa29 | |
| parent | modules/{users,fish,zsh}: Set-up fish as default shell for soispha (diff) | |
| download | nixos-config-8d8bc982564fc5af477869bf8a4e682550dec67a.zip | |
modules/lf: Rewrite `ll` and `lm` to fish's syntax
These need to be written in fish, so that they can work with the `.`
command.
| -rw-r--r-- | modules/by-name/lf/lf/module.nix | 12 | ||||
| -rw-r--r-- | modules/by-name/lf/lf/wrappers/default.nix | 4 | ||||
| -rw-r--r--[-rwxr-xr-x] | modules/by-name/lf/lf/wrappers/ll.fish (renamed from modules/by-name/lf/lf/wrappers/lm/lm.sh) | 25 | ||||
| -rwxr-xr-x | modules/by-name/lf/lf/wrappers/ll/ll.sh | 23 | ||||
| -rw-r--r-- | modules/by-name/lf/lf/wrappers/lm.fish (renamed from modules/by-name/lf/lf/wrappers/ll/default.nix) | 18 | ||||
| -rw-r--r-- | modules/by-name/lf/lf/wrappers/lm/default.nix | 18 |
6 files changed, 26 insertions, 74 deletions
diff --git a/modules/by-name/lf/lf/module.nix b/modules/by-name/lf/lf/module.nix index c47599bd..a95bdb03 100644 --- a/modules/by-name/lf/lf/module.nix +++ b/modules/by-name/lf/lf/module.nix @@ -83,11 +83,11 @@ in { # fish '' function ll - . ${lib.getExe packages.ll} + . ${./wrappers/ll.fish} end function lm - . ${lib.getExe packages.lm} + . ${./wrappers/lm.fish} end ''; @@ -97,10 +97,10 @@ in { "lf/colors".source = ./colors; }; - programs.zsh.shellAliases = { - ll = ". ${lib.getExe packages.ll}"; - lm = ". ${lib.getExe packages.lm}"; - }; + # programs.zsh.shellAliases = { + # ll = ". ${lib.getExe packages.ll}"; + # lm = ". ${lib.getExe packages.lm}"; + # }; programs.lf = { enable = true; diff --git a/modules/by-name/lf/lf/wrappers/default.nix b/modules/by-name/lf/lf/wrappers/default.nix deleted file mode 100644 index 7257a66e..00000000 --- a/modules/by-name/lf/lf/wrappers/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -{pkgs}: { - ll = pkgs.callPackage ./ll {}; - lm = pkgs.callPackage ./lm {}; -} diff --git a/modules/by-name/lf/lf/wrappers/lm/lm.sh b/modules/by-name/lf/lf/wrappers/ll.fish index 71213721..7a146993 100755..100644 --- a/modules/by-name/lf/lf/wrappers/lm/lm.sh +++ b/modules/by-name/lf/lf/wrappers/ll.fish @@ -1,4 +1,4 @@ -#!/usr/bin/env dash +#!/usr/bin/env fish # nixos-config - My current NixOS configuration # @@ -10,19 +10,14 @@ # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -die() { - echo "ERROR: $1" - exit 1 -} +begin + test -d "$XDG_RUNTIME_DIR/ll"; or mkdir "$XDG_RUNTIME_DIR/ll" + set last_directory "$XDG_RUNTIME_DIR/ll/last_directory" -msg() { - echo "$1" -} + command lf -last-dir-path="$last_directory" "$argv" -if [ -f "$XDG_RUNTIME_DIR/ll/last_directory" ]; then - last_dir="$(cat "$XDG_RUNTIME_DIR/ll/last_directory")" - cd "$last_dir" || die "$last_dir does not exist!" -else - msg "No last directory saved (try using ll instead)." -fi -# vim: ft=sh + set dir "$(cat "$last_directory")" + if not cd "$dir" + echo "ll: Failed to cd to '$dir'. Does it exist?" + end +end diff --git a/modules/by-name/lf/lf/wrappers/ll/ll.sh b/modules/by-name/lf/lf/wrappers/ll/ll.sh deleted file mode 100755 index 9bb314c6..00000000 --- a/modules/by-name/lf/lf/wrappers/ll/ll.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env dash - -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. - -[ -d "$XDG_RUNTIME_DIR/ll" ] || mkdir "$XDG_RUNTIME_DIR/ll" -last_directory="$XDG_RUNTIME_DIR/ll/last_directory" - -command lf -last-dir-path="$last_directory" "$@" - -dir="$(cat "$last_directory")" -if ! cd "$dir"; then - die "ll: Failed to cd to '$dir'. Does it exist?" -fi - -# vim: ft=sh diff --git a/modules/by-name/lf/lf/wrappers/ll/default.nix b/modules/by-name/lf/lf/wrappers/lm.fish index 6e4ee336..b590c143 100644 --- a/modules/by-name/lf/lf/wrappers/ll/default.nix +++ b/modules/by-name/lf/lf/wrappers/lm.fish @@ -1,3 +1,5 @@ +#!/usr/bin/env fish + # nixos-config - My current NixOS configuration # # Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> @@ -7,12 +9,12 @@ # # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{writeShellApplication}: -writeShellApplication { - name = "ll"; - text = builtins.readFile ./ll.sh; - # This is sourced in the shell - inheritPath = true; - bashOptions = []; -} +begin + if test -f "$XDG_RUNTIME_DIR/ll/last_directory" + set last_dir "$(cat "$XDG_RUNTIME_DIR/ll/last_directory")" + cd "$last_dir"; or echo "$last_dir does not exist!" + else + echo "No last directory saved (try using ll instead)." + end +end diff --git a/modules/by-name/lf/lf/wrappers/lm/default.nix b/modules/by-name/lf/lf/wrappers/lm/default.nix deleted file mode 100644 index 42bdc687..00000000 --- a/modules/by-name/lf/lf/wrappers/lm/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{writeShellApplication}: -writeShellApplication { - name = "lm"; - text = builtins.readFile ./lm.sh; - - # This is sourced in the shell - inheritPath = true; - bashOptions = []; -} |
