Skip to content

Instantly share code, notes, and snippets.

@nhooyr
Created January 27, 2016 06:18
Show Gist options
  • Save nhooyr/3fefa09e10b7aba8ccb1 to your computer and use it in GitHub Desktop.
Save nhooyr/3fefa09e10b7aba8ccb1 to your computer and use it in GitHub Desktop.
#!/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