mirror of
https://github.com/jarun/nnn.git
synced 2024-11-01 00:47:18 +00:00
1bf49c80e7
* Improved completion support for files with spaces
Filenames with spaces, both generally and for session names, will now
complete as expected.
* Misc shell script improvements
See discussion on:
1cca9e4b72
35 lines
594 B
Bash
Executable file
35 lines
594 B
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
# Description: Run fzf and go to the directory of the file selected
|
|
#
|
|
# Shell: POSIX compliant
|
|
# Author: Anna Arad
|
|
|
|
. "$(dirname "$0")"/.nnn-plugin-helper
|
|
|
|
if [ "$(cmd_exists fzy)" -eq "0" ]; then
|
|
if [ "$(cmd_exists fd)" -eq "0" ]; then
|
|
fd=fd
|
|
elif [ "$(cmd_exists fdfind)" -eq "0" ]; then
|
|
fd=fdfind
|
|
else
|
|
fd=find
|
|
fi
|
|
|
|
sel=$($fd | fzy)
|
|
elif [ "$(cmd_exists fzf)" -eq "0" ]; then
|
|
sel=$(fzf)
|
|
else
|
|
exit 1
|
|
fi
|
|
|
|
if [ -n "$sel" ]; then
|
|
if ! [ -d "$sel" ]; then
|
|
sel=$(dirname "$sel")
|
|
fi
|
|
|
|
# Remove "./" prefix if it exists
|
|
sel="${sel#./}"
|
|
nnn_cd "$PWD/$sel"
|
|
fi
|