From d507f878e6ec1e464fe29f39d73804740978b9a7 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 9 Nov 2024 00:16:26 +0800 Subject: change: less func to use bat --- func.zsh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/func.zsh b/func.zsh index ca65d7e..27be3dc 100755 --- a/func.zsh +++ b/func.zsh @@ -249,21 +249,21 @@ function vim () { # fi #} -#function less () { -# if [ ! -e "$1" ] -# then -# DIR=$(dirname "$1") -# OWNER=$(stat -c '%U' "$DIR") -# else -# OWNER=$(stat -c '%U' "$1") -# fi -# if [[ "$OWNER" == "root" ]] -# then -# sudo /usr/bin/less "$1" -# else -# /usr/bin/less "$1" -# fi -#} +function less () { + if [ ! -e "$1" ] + then + DIR=$(dirname "$1") + OWNER=$(stat -c '%U' "$DIR") + else + OWNER=$(stat -c '%U' "$1") + fi + if [[ "$OWNER" == "root" ]] + then + sudo bat "$1" + else + bat "$1" + fi +} # move applications function move_to_desktop { -- cgit v1.2.3