mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
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>
This commit is contained in:
parent
dacf7b0811
commit
474ad74f25
21
plugins/fzcd
21
plugins/fzcd
|
@ -20,11 +20,18 @@ if [ -n "$sel" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove "./" prefix if it exists
|
# Check if selected path returned
|
||||||
sel="${sel#./}"
|
# by fzf command is absolute
|
||||||
if [ "$PWD" = "/" ]; then
|
case $sel in
|
||||||
nnn_cd "/$sel"
|
/*) nnn_cd "$sel" ;;
|
||||||
else
|
*)
|
||||||
nnn_cd "$PWD/$sel"
|
# Remove "./" prefix if it exists
|
||||||
fi
|
sel="${sel#./}"
|
||||||
|
|
||||||
|
if [ "$PWD" = "/" ]; then
|
||||||
|
nnn_cd "/$sel"
|
||||||
|
else
|
||||||
|
nnn_cd "$PWD/$sel"
|
||||||
|
fi;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue