From 258073fb21e961e2c1f279cffc999dd982ae758a Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 12 Feb 2023 13:44:53 +0100 Subject: [PATCH] feat: add lf snippet for bashrc --- lf-snippet.sh | 16 ++++++++++++++++ server-init.sh | 7 ++++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 lf-snippet.sh diff --git a/lf-snippet.sh b/lf-snippet.sh new file mode 100644 index 0000000..c44df1a --- /dev/null +++ b/lf-snippet.sh @@ -0,0 +1,16 @@ +## Exit on working directory for lf +lf () { + tmp="$(mktemp)" + _lf -last-dir-path="$tmp" "$@" --command "set hidden" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" + if [ -d "$dir" ]; then + if [ "$dir" != "$(pwd)" ]; then + cd "$dir" + fi + fi + fi +} + + diff --git a/server-init.sh b/server-init.sh index fc96e4b..7c80216 100644 --- a/server-init.sh +++ b/server-init.sh @@ -6,4 +6,9 @@ cd workspace wget https://github.com/gokcehan/lf/releases/download/r28/lf-linux-amd64.tar.gz -O lf.tar.gz tar -xzf lf.tar.gz sudo mv lf /usr/bin/_lf -mkdir -p ~/.config +mkdir -p ~/.config/lf +cd ~/.config/lf +wget https://git.nunosempere.com/open.source/server-init/raw/branch/master/lfrc -O lfrc +cd ~ +touch .bashrc +e