diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-11-09 00:16:26 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-11-09 00:16:26 +0800 |
| commit | d507f878e6ec1e464fe29f39d73804740978b9a7 (patch) | |
| tree | bef85bf67d07d2d10ec315d2f217e6ad3afe40e6 | |
| parent | 14a6d6ea839ded5ac4d64671957ca673e8447922 (diff) | |
change: less func to use bat
| -rwxr-xr-x | func.zsh | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -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 { |
