diff --git a/vroom/__main__.py b/vroom/__main__.py index 45f6bd8..05e855b 100644 --- a/vroom/__main__.py +++ b/vroom/__main__.py @@ -39,7 +39,8 @@ def main(argv=None): sys.stdout.write('No running vrooms found.\n') return 0 end = 'VroomEnd()' - kill = ['vim', '--servername', args.servername, '--remote-expr', end] + kill = [args.vim_cmd, '--servername', args.servername, + '--remote-expr', end] sys.stdout.write("I hope you're happy.\n") return subprocess.call(kill) diff --git a/vroom/args.py b/vroom/args.py index d008f00..5d840d2 100644 --- a/vroom/args.py +++ b/vroom/args.py @@ -114,6 +114,14 @@ def __call__(self, _, namespace, values, option_string=None): Run Neovim instead of Vim """) +parser.add_argument( + '--vim-cmd', + help=""" +Vim command to use internally, useful if you need to override the path to the +vim executable vroom should use. Defaults to 'vim' or 'nvim', corresponding to +the --neovim arg. +""") + # # Timing @@ -315,6 +323,9 @@ def Parse(args): raise ValueError( 'You may birth tests and you may end them, but not both at once!') + if args.vim_cmd is None: + args.vim_cmd = 'nvim' if args.neovim else 'vim' + return args diff --git a/vroom/neovim_mod.py b/vroom/neovim_mod.py index 1e535a0..bc98e12 100644 --- a/vroom/neovim_mod.py +++ b/vroom/neovim_mod.py @@ -15,7 +15,7 @@ def __init__(self, args, env, writer): self.writer = writer.commands self.args = args self.start_command = [ - 'nvim', + self.args.vim_cmd, '-u', args.vimrc, '-c', 'set shell=' + args.shell, '-c', 'source %s' % CONFIGFILE] diff --git a/vroom/vim.py b/vroom/vim.py index 4fc4684..6f370cf 100644 --- a/vroom/vim.py +++ b/vroom/vim.py @@ -96,7 +96,7 @@ def __init__(self, args, env, writer): # plugins from ~/.vim/, but it also sets '-u DEFAULTS'. We supply '-u' after # to force vim to take our '-u' value (while still avoiding plugins). self.start_command = [ - 'vim', + self.args.vim_cmd, '--clean', '-u', args.vimrc, '--servername', args.servername, @@ -155,7 +155,7 @@ def Communicate(self, command, extra_delay=0): """ self.writer.Log(command) self.TryToSay([ - 'vim', + self.args.vim_cmd, '--servername', self.args.servername, '--remote-send', command]) self._cache = {} @@ -174,7 +174,7 @@ def Ask(self, expression): """ try: out = self.TryToSay([ - 'vim', + self.args.vim_cmd, '--servername', self.args.servername, '--remote-expr', 'string(%s)' % expression]) except ErrorOnExit as e: