Kaynağa Gözat

Allow absolute paths returned by fzf in fzcd plugin (#682)

* Allow absolute paths returned by fzf in fzcd plugin

* Fix issue with POSIX syntax

* Add descriptive comment

* Add comment

* Remove description

* Add new line at the end of the file

Co-authored-by: Jan Meischner <jan.meischner@verimi.com>
master
Jan Meischner GitHub 4 yıl önce
ebeveyn
işleme
474ad74f25
Veri tabanında bu imza için bilinen anahtar bulunamadı GPG Anahtar Kimliği: 4AEE18F83AFDEB23
1 değiştirilmiş dosya ile 14 ekleme ve 7 silme
  1. +14
    -7
      plugins/fzcd

+ 14
- 7
plugins/fzcd Dosyayı Görüntüle

@@ -20,11 +20,18 @@ if [ -n "$sel" ]; then
exit 0
fi

# Remove "./" prefix if it exists
sel="${sel#./}"
if [ "$PWD" = "/" ]; then
nnn_cd "/$sel"
else
nnn_cd "$PWD/$sel"
fi
# Check if selected path returned
# by fzf command is absolute
case $sel in
/*) nnn_cd "$sel" ;;
*)
# Remove "./" prefix if it exists
sel="${sel#./}"
if [ "$PWD" = "/" ]; then
nnn_cd "/$sel"
else
nnn_cd "$PWD/$sel"
fi;;
esac
fi

Yükleniyor…
İptal
Kaydet