Created
January 27, 2016 06:18
-
-
Save nhooyr/3fefa09e10b7aba8ccb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from neovim import attach | |
import sys, os.path | |
args = sys.argv[1:] | |
if not args: | |
print "Usage: nvimt <filename> ..." | |
sys.exit(1) | |
addr = os.environ["NVIM_LISTEN_ADDRESS"] | |
if not addr: | |
# TODO: Open a new nvim instance if no addr | |
sys.exit(2) | |
nvim = attach("socket", path=addr) | |
def normalizePath(name): | |
return os.path.abspath(name).replace(" ", "\\ ") | |
def openFiles(): | |
for x in args: | |
nvim.command("drop {}".format(normalizePath(x))) | |
openFiles() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment