]> Freerunner's - dotfiles.git/commitdiff
lf: preparations for using lf as a file picker
authorAndre Ramnitz <tux.rising@gmail.com>
Wed, 4 Dec 2024 21:38:21 +0000 (22:38 +0100)
committerAndre Ramnitz <tux.rising@gmail.com>
Wed, 4 Dec 2024 21:42:28 +0000 (22:42 +0100)
lf: add a modified kks-lf2 script to get this working
note: use this to overwrite the default kks-lf script provided by kks

dot-config/lf/lfrc
dot-local/bin/kks-lf! [new file with mode: 0755]

index 4a0499a19628fda29d517b118f200a82ec9ab826..3428df18a6968b7e9c6d53630b6bd688ed0f4399 100644 (file)
@@ -43,9 +43,6 @@ set ifs "\n"
 # leave some space at the top and the bottom of the screen
 set scrolloff 3
 
-# use enter for shell commands
-map <enter> shell
-
 # make sure trash folder exists
 %mkdir -p ~/.trash
 
@@ -505,6 +502,7 @@ map \| shell-pipe
 map '%' : select-all
 
 # various commands
+map <enter> open
 map <esc> unselect
 map ~ toggle_preview
 map C edit-config
diff --git a/dot-local/bin/kks-lf! b/dot-local/bin/kks-lf!
new file mode 100755 (executable)
index 0000000..b4caf2b
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# open lf in single-pane view with current buffer selected
+#
+# requires:
+# - lf (https://github.com/gokcehan/lf)
+
+# kks get '%val{buffile}' |
+       # xargs -I {} lf -command "set nopreview; set ratios 1" {}
+
+lf -command "set nopreview; set ratios 1" -selection-path "/tmp/lf-chosen-file.XXXX"
+kks edit "$(cat "/tmp/lf-chosen-file.XXXX")"
+