From 5d02b557d3ea694d8a51cc3918ab5ffda33387d9 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 22 May 2021 01:46:13 +0300 Subject: [PATCH] follow links in 'open' examples cc #634 --- doc.go | 1 + docstring.go | 1 + etc/lfrc.example | 1 + lf.1 | 2 ++ 4 files changed, 5 insertions(+) diff --git a/doc.go b/doc.go index 7fcbfcf5..8897b6af 100644 --- a/doc.go +++ b/doc.go @@ -1127,6 +1127,7 @@ It is possible to use different command types: You may want to use either file extensions or mime types from 'file' command: cmd open ${{ + test -L $f && f=$(readlink -f $f) case $(file --mime-type $f -b) in text/*) vi $fx;; *) for f in $fx; do xdg-open $f > /dev/null 2> /dev/null & done;; diff --git a/docstring.go b/docstring.go index aaa1236a..5731cabf 100644 --- a/docstring.go +++ b/docstring.go @@ -1255,6 +1255,7 @@ You may want to use either file extensions or mime types from 'file' command: cmd open ${{ + test -L $f && f=$(readlink -f $f) case $(file --mime-type $f -b) in text/*) vi $fx;; *) for f in $fx; do xdg-open $f > /dev/null 2> /dev/null & done;; diff --git a/etc/lfrc.example b/etc/lfrc.example index 7fac7bac..4c2a1269 100644 --- a/etc/lfrc.example +++ b/etc/lfrc.example @@ -36,6 +36,7 @@ map O $mimeopen --ask $f # use either file extensions and/or mime types here. Below uses an editor for # text files and a file opener for the rest. cmd open ${{ + test -L $f && f=$(readlink -f $f) case $(file --mime-type $f -b) in text/*) $EDITOR $fx;; *) for f in $fx; do setsid $OPENER $f > /dev/null 2> /dev/null & done;; diff --git a/lf.1 b/lf.1 index a59c40e7..f5197244 100644 --- a/lf.1 +++ b/lf.1 @@ -13,6 +13,7 @@ lf \- terminal file manager .OP \-remote command .OP \-selection-path path .OP \-server +.OP \-single .OP \-version .OP \-help .RI [ directory ] @@ -1273,6 +1274,7 @@ You may want to use either file extensions or mime types from 'file' command: .PP .EX cmd open ${{ + test -L $f && f=$(readlink -f $f) case $(file --mime-type $f -b) in text/*) vi $fx;; *) for f in $fx; do xdg-open $f > /dev/null 2> /dev/null & done;;