Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tool to open file in existing nvim #3

Open
josephholsten opened this issue Jan 31, 2016 · 0 comments
Open

add tool to open file in existing nvim #3

josephholsten opened this issue Jan 31, 2016 · 0 comments

Comments

@josephholsten
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant