about summary refs log tree commit diff stats
path: root/home-manger/lf/default.nix
diff options
context:
space:
mode:
authorene <ene@sils.li>2023-02-07 17:11:02 +0100
committerene <ene@sils.li>2023-02-07 17:11:02 +0100
commit99da1374bbcd8165b15bb8666ebd3e20923db876 (patch)
tree20a264658537914852cb001b22bedc151043fe79 /home-manger/lf/default.nix
parentFeat(home-manger): Add support for less (diff)
downloadnixos-config-99da1374bbcd8165b15bb8666ebd3e20923db876.tar.gz
nixos-config-99da1374bbcd8165b15bb8666ebd3e20923db876.zip
Feat(home-manger): Add support for lf
Diffstat (limited to '')
-rw-r--r--home-manger/lf/default.nix200
1 files changed, 200 insertions, 0 deletions
diff --git a/home-manger/lf/default.nix b/home-manger/lf/default.nix
new file mode 100644
index 00000000..fd8c4b39
--- /dev/null
+++ b/home-manger/lf/default.nix
@@ -0,0 +1,200 @@
+{
+  config,
+  pkgs,
+  ...
+}: let
+  shell = file:
+    "\${{" + builtins.readFile "${file}" + "}}"; # closes the lf tui
+  pipe = file:
+    "%{{" + builtins.readFile "${file}" + "}}"; # runs the command in the ui,term bar
+  async = file:
+    "&{{" + builtins.readFile "${file}" + "}}"; # runs the command in the background
+  wait = file:
+    "!{{" + builtins.readFile "${file}" + "}}"; # adds a prompt after the command has run
+in {
+  home-manager.xdg.configFile."lf/icons" = {
+    target = "lf/icons";
+    source = "./icons";
+  };
+  home-manager.xdg.configFile."lf/colors" = {
+    target = "lf/colors";
+    source = "./colors";
+  };
+
+  home-manager.programs.lf = {
+    enable = true;
+
+    commands = {
+      help = shell "./cmds/help.sh";
+      open = shell "./cmds/open.sh";
+      mk_dir = pipe "./cmds/mk_dir.sh";
+      mk_scr = shell "./cmds/mk_scr.sh";
+      mk_file = shell "./cmds/mk_file.sh";
+      chmod = pipe "./cmds/chmod.sh";
+      mk_ln = shell "./cmds/mk_ln.sh"; # TODO could be pipe, right?
+      sudo_mk_file = shell "./cmds/sudo_mk_file.sh";
+      set_wall_paper = pipe "./cmds/set_wall_paper.sh";
+      fzf_jump = shell "./cmds/fzf_jump.sh";
+      broot_jump = shell "./cmds/broot_jump.sh";
+      open_config = shell "./cmds/open_config.sh";
+
+      dragon = pipe "./cmds/dragon.sh";
+      dragon_stay = pipe "./cmds/dragon_stay.sh";
+      dragon_individual = pipe "./cmds/dragon_individual.sh";
+      dl_file = pipe "./cmds/dl_file.sh";
+
+      unarchive = pipe "./cmds/unarchive.sh";
+      archive = pipe "./cmds/archive.sh";
+
+      trash = pipe "./cmds/trash.sh";
+      clear_trash = pipe "./cmds/clear_trash.sh";
+      restore_trash = shell "./cmds/restore_trash.sh";
+
+      stripspace = pipe "./cmds/stripspace.sh";
+    };
+    keybindings = {
+      # Remove some defaults
+      m = null;
+      "'" = null;
+      #" = null; # TODO
+      d = null;
+      c = null;
+      e = null;
+      j = null;
+      k = null;
+      l = null;
+      ";" = null;
+
+      # File Openers
+      ee = "\$\$EDITOR \"$f\"";
+      u = "%\$IVIEWER \"$f\"";
+      cc = "\$sudo -e \"$f\"";
+
+      # Archive Mappings
+      au = "unarchive";
+      a = "archive";
+
+      # Trash Mappings
+      dd = "trash";
+      jc = "clear_trash";
+      jr = "restore_trash";
+
+      # Broot Mapping
+      f = "broot_jump";
+
+      # Dragon Mapping
+      dr = "dragon";
+      ds = "dragon-stay";
+      di = "dragon-individual";
+      #dm = "mvdragon";
+      #dc = "cpdragon";
+      dl = "dlfile";
+
+      ss = "stripspace";
+
+      # Vim keys
+      h = "updir";
+      t = "down";
+      n = "up";
+      s = "open";
+
+      # Basic Functions
+      bn = "help";
+      kk = "mklkn";
+      "." = "set hidden!";
+      DD = "delete";
+      p = "paste";
+      x = "cut";
+      y = "copy";
+      "<enter>" = "open";
+      mf = "mkfile";
+      mr = "sudomkfile";
+      md = "mkdir";
+      ms = "mkscr";
+      ch = "chmod";
+      bg = "setwallpaper";
+      o = "open_config";
+      br = "\$vimv \$fx"; # TODO what is this command?
+      r = "rename";
+      H = "top";
+      L = "bottom";
+      R = "reload";
+      C = "clear";
+      U = "unselect";
+
+      # Movement
+      gjr = "cd ~/.local/share/Trash/files";
+      gus = "cd /run/dt";
+
+      "gr." = "cd /home/dt/repos";
+      grr = "cd /home/dt/repos/rust";
+      grp = "cd /home/dt/repos/python";
+      grc = "cd /home/dt/repos/c";
+      gra = "cd /home/dt/repos/auto_hot_key";
+      grt = "cd /home/dt/repos/tex";
+      grs = "cd /home/dt/repos/shell";
+
+      grch = "cd /home/dt/repos/chroot";
+      grpe = "cd /home/dt/repos/perl";
+      grja = "cd /home/dt/repos/java";
+      grjs = "cd /home/dt/repos/java_script";
+      # -------------
+      "gm." = "cd /home/dt/media";
+      gmpi = "cd /home/dt/media/pictures";
+      gmdo = "cd /home/dt/media/downloads";
+      gmpl = "cd /home/dt/media/playlist";
+      gmis = "cd /home/dt/media/isos";
+      # -------------
+      "gs." = "cd /home/dt/school";
+      gsgs = "cd /home/dt/school/geschichte";
+      gsch = "cd /home/dt/school/chemie";
+      gsen = "cd /home/dt/school/english";
+      gsgo = "cd /home/dt/school/geographie";
+      gsin = "cd /home/dt/school/infomatik";
+      gsso = "cd /home/dt/school/sozialkunde";
+      gskr = "cd /home/dt/school/katholische_religion";
+      gsmu = "cd /home/dt/school/musik";
+      gsla = "cd /home/dt/school/latein";
+      gsde = "cd /home/dt/school/deutsch";
+      gsma = "cd /home/dt/school/mathematik";
+      gspr = "cd /home/dt/school/praktikum";
+      gsbi = "cd /home/dt/school/biologie";
+      gssp = "cd /home/dt/school/sport";
+      gsphy = "cd /home/dt/school/physik";
+      gsphi = "cd /home/dt/school/philosophie";
+
+      gc = "cd ~/.config";
+      gl = "cd ~/.local";
+      gE = "cd /etc";
+
+      "gU." = "cd /usr";
+      gUs = " cd /usr/share";
+
+      gt = "cd /tmp";
+    };
+    previewer = {
+      keybinding = "i";
+      source = "ctpv";
+    };
+    settings = {
+      cleaner = "ctpvclear";
+      autoquit = true; # quit the server, if no clients are left
+      dircounts = true; # count things in directories TODO this has performance impact
+      dirpreviews = true; # preview for directories
+      drawbox = true;
+      errorfmt = "\\033[1;91m==> ERROR:\\033[0m\\033[1;93m%s\\033[0m";
+      hidden = true; # show hidden files
+      icons = true;
+      ifs =  "\n"; # internal field separator for shell commands
+      info = ["size"]; # show the size of a directory
+      shell = "sh";
+      shellopts = ["-e" "-u"]; # e: exit on error; u: error for unset variables
+    };
+    extraConfig = ''
+      &ctpv -s $id
+      &ctpvquit $id
+    '';
+  };
+}
+# vim: ts=2
+