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 --vim-cmd arg to override path or command for vim executable #133

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion vroom/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
11 changes: 11 additions & 0 deletions vroom/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion vroom/neovim_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions vroom/vim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {}
Expand All @@ -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:
Expand Down