Selaa lähdekoodia

添加 yazi 文件管理器安装和配置功能

- 新增 install_yy 函数,用于安装 x-cmd 和 yazi
- 添加 yy 函数,用于启动 yazi并处理目录跳转
-此更新使用户能够轻松安装和使用 yazi 文件管理器
tianyun 7 kuukautta sitten
vanhempi
commit
9957267608
1 muutettua tiedostoa jossa 18 lisäystä ja 0 poistoa
  1. 18 0
      sh_config.sh

+ 18 - 0
sh_config.sh

@@ -120,6 +120,24 @@ function install_vimrc(){
   wget -O ~/.vimrc https://git.tianyunperfect.cn/tianyunperfect/note_pub/raw/master/.vimrc
   wget -O ~/.vimrc https://git.tianyunperfect.cn/tianyunperfect/note_pub/raw/master/.vimrc
 }
 }
 
 
+function install_yy(){
+    eval "$(curl https://get.x-cmd.com)"    # 安装 x-cmd
+    x env use yazi                          # 安装 yazi
+}
+
+yy() {
+    local _yy_tmp=; local _yy_cwd=
+    _yy_tmp="$(command mktemp -t "yazi-cwd.XXXXXX")"
+    command yazi "$@" --cwd-file="$_yy_tmp"
+
+    _yy_cwd="$(cat -- "$_yy_tmp")"
+    command rm -f -- "$_yy_tmp"
+
+    if [ -n "$_yy_cwd" ] && [ "$_yy_cwd" != "$PWD" ]; then
+        command cd -- "$_yy_cwd"
+    fi
+}
+
 
 
 function k8s-get-all-namespace(){
 function k8s-get-all-namespace(){
 	kubectl get namespace
 	kubectl get namespace