summaryrefslogtreecommitdiff
path: root/modules/lf.nix
diff options
context:
space:
mode:
authorShubham Saini <ssaini@fispan.com>2023-09-30 04:02:23 +0000
committerShubham Saini <ssaini@fispan.com>2023-09-30 04:02:23 +0000
commitfdf1c788488534825abdbfe8f8c0e8e95a876d57 (patch)
tree1186b8b594f8a540bf019006cb3f2544219c8cd4 /modules/lf.nix
parentfdb9ba23a2cff4b50a699eb89435aa9a9de77891 (diff)
nix: reorg programs into modules
Diffstat (limited to 'modules/lf.nix')
-rw-r--r--modules/lf.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/lf.nix b/modules/lf.nix
new file mode 100644
index 0000000..b0dd304
--- /dev/null
+++ b/modules/lf.nix
@@ -0,0 +1,41 @@
1{ config, pkgs, ... }:
2
3{
4 programs.lf = {
5 enable = true;
6 settings = {
7 shell = "sh";
8 icons = true;
9 drawbox = true;
10 scrolloff = 10;
11 shellopts = "-eu";
12 };
13 commands = {
14 extract = ''
15 %{{
16 set -f
17 case $f in
18 *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
19 *.tar.gz|*.tgz) tar xzvf $f;;
20 *.tar.xz|*.txz) tar xJvf $f;;
21 *.zip) unzip $f;;
22 *.rar) unrar x $f;;
23 *.7z) 7z x $f;;
24 esac
25 }}
26 '';
27 open = ''
28 %{{
29 case $(file --mime-type -Lb $f) in
30 text/*) lf -remote "send $id \$$EDITOR \$fx";;
31 *) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;;
32 esac
33 }}
34 '';
35 };
36 keybindings = {
37 "<enter>" = "shell";
38 "." = "set hidden!";
39 };
40 };
41}