From a47376ee04f292a3c678a39274835b0e3e2ec805 Mon Sep 17 00:00:00 2001 From: NRK Date: Mon, 1 Nov 2021 13:28:49 +0600 Subject: [PATCH 1/4] plugin: fzopen: print full path for picker mode Closes: https://github.com/mcchrish/nnn.vim/issues/133 --- plugins/fzopen | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/fzopen b/plugins/fzopen index 52abc87d..d26e96e3 100755 --- a/plugins/fzopen +++ b/plugins/fzopen @@ -42,9 +42,9 @@ fi if [ "$3" ]; then if [ "$entry" ]; then if [ "-" = "$3" ]; then - printf "%s\n" "$entry" + printf "%s\n" "${2}/$entry" else - printf "%s\n" "$entry" > "$3" + printf "%s\n" "${2}/$entry" > "$3" fi # Tell `nnn` to clear its internal selection From afb7a6e9c1f7d595b8bbb020923999f5111a87cb Mon Sep 17 00:00:00 2001 From: NRK Date: Mon, 1 Nov 2021 14:05:18 +0600 Subject: [PATCH 2/4] check if $entry is fullpath or not --- plugins/fzopen | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/fzopen b/plugins/fzopen index d26e96e3..013413fb 100755 --- a/plugins/fzopen +++ b/plugins/fzopen @@ -41,10 +41,14 @@ fi # Check for picker mode if [ "$3" ]; then if [ "$entry" ]; then + case "$entry" in + /*) fullpath="${2}/$entry" ;; + *) fullpath="$entry" ;; + esac if [ "-" = "$3" ]; then - printf "%s\n" "${2}/$entry" + printf "%s\n" "$fullpath" else - printf "%s\n" "${2}/$entry" > "$3" + printf "%s\n" "$fullpath" > "$3" fi # Tell `nnn` to clear its internal selection From d2dff487e08a861b762f251205927d496d294329 Mon Sep 17 00:00:00 2001 From: NRK Date: Mon, 1 Nov 2021 14:13:21 +0600 Subject: [PATCH 3/4] use $PWD --- plugins/fzopen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fzopen b/plugins/fzopen index 013413fb..c44122a0 100755 --- a/plugins/fzopen +++ b/plugins/fzopen @@ -42,7 +42,7 @@ fi if [ "$3" ]; then if [ "$entry" ]; then case "$entry" in - /*) fullpath="${2}/$entry" ;; + /*) fullpath="$PWD/$entry" ;; *) fullpath="$entry" ;; esac if [ "-" = "$3" ]; then From 65ae3abc247863f374c975bc670ff791f0615966 Mon Sep 17 00:00:00 2001 From: NRK Date: Mon, 1 Nov 2021 14:15:49 +0600 Subject: [PATCH 4/4] quickfix --- plugins/fzopen | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/fzopen b/plugins/fzopen index c44122a0..57035b5c 100755 --- a/plugins/fzopen +++ b/plugins/fzopen @@ -42,8 +42,8 @@ fi if [ "$3" ]; then if [ "$entry" ]; then case "$entry" in - /*) fullpath="$PWD/$entry" ;; - *) fullpath="$entry" ;; + /*) fullpath="$entry" ;; + *) fullpath="$PWD/$entry" ;; esac if [ "-" = "$3" ]; then printf "%s\n" "$fullpath"