summaryrefslogtreecommitdiff
path: root/lf/lfrc
diff options
context:
space:
mode:
authorself <george@gabbott.dev>2022-12-26 01:03:21 +0000
committerself <george@gabbott.dev>2022-12-26 01:03:21 +0000
commite7cb2d49f836f21069efbfdbc213266e93adde6d (patch)
tree9b358b70c81e2ef04cf14f17e698c0ae3a9d0b8f /lf/lfrc
parent6f73b3ade4c5909d07d06a679733961281e8da9f (diff)
lf
Diffstat (limited to 'lf/lfrc')
-rw-r--r--lf/lfrc58
1 files changed, 57 insertions, 1 deletions
diff --git a/lf/lfrc b/lf/lfrc
index ad4bdb2..40375bd 100644
--- a/lf/lfrc
+++ b/lf/lfrc
@@ -1,4 +1,60 @@
-map . set hidden!
+# map . set hidden!
+set shell sh
+set info size
+set dircounts
+set hidden
+set number
+set relativenumber
+set ratios 1:1:2:3:5
+
+# ranger legacy commands
+map J push 7j
+map K push 7k
+map } half-down
+map { half-up
+map a rename
+
+# execute current file (must be executable)
+map x $$f
+map X !$f
+
+cmd open $nvim $fx # use nvim for files
+
+# git support
+map gp ${{clear; git pull --rebase || true; echo "press ENTER"; read ENTER}}
+map gs ${{clear; git status; echo "press ENTER"; read ENTER}}
+map gl ${{clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit}}
+
+# fzf support
+cmd fzf ${{
+ res="$(find . | fzf --reverse | sed 's/\\/\\\\/g;s/"/\\"/g')"
+ if [ -d "$res" ] ; then
+ cmd="cd"
+ elif [ -f "$res" ] ; then
+ cmd="select"
+ else
+ exit 0
+ fi
+ lf -remote "send $id $cmd \"$res\""
+}}
+map F fzf
+
+# rg/ripgrep support
+cmd rg ${{
+ res="$( \
+ RG_PREFIX="rg --column --line-number --no-heading --color=always \
+ --smart-case "
+ FZF_DEFAULT_COMMAND="$RG_PREFIX ''" \
+ fzf --reverse --bind "change:reload:$RG_PREFIX {q} || true" \
+ --ansi --layout=reverse --header 'Search in files' \
+ | cut -d':' -f1
+ )"
+ [ ! -z "$res" ] && lf -remote "send $id select \"$res\""
+}}
+map R rg
+
+
+set preview
set previewer ~/.config/lf/preview.sh
map i $~/.config/lf/preview.sh $f | less -RX