diff options
Diffstat (limited to 'modules/lf.nix')
-rw-r--r-- | modules/lf.nix | 41 |
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 | } | ||