diff options
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/fzcd | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/plugins/fzcd b/plugins/fzcd index 1925d77..8cc21ab 100755 --- a/plugins/fzcd +++ b/plugins/fzcd @@ -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 |