nvimfs
nvimfs copied to clipboard
add tool to open file in existing nvim
neovimfs has given me the ability to emulate plan9 acme's ability to open a file in the existing editor with a B
script, here's what I'm using now:
#!/bin/sh
if [ x != x"$DEBUG" ]; then
set -x
fi
neovimfs="$HOME/.config/nvim/neovimfs"
client="$(find "$neovimfs/clients" -depth 1| grep -v new | head -1 | xargs basename)"
fullpath="$(realpath "$1")"
if [ -z "$client" ]; then
exec "$EDITOR" "$fullpath"
else
escaped=$(echo "$fullpath" | sed 's/ /\\ /')
cmd="$neovimfs/clients/$client/cmd"
if [ ! -f "$cmd" ]; then
echo "cmd socket '$cmd' missing" >&2
exit 1
fi
echo "vsplit" > "$cmd"
echo "e $escaped" > "$cmd"
echo "$fullpath opened in existing editor" >&2
fi