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 --clean to avoid loading ftplugins #119

Merged
merged 1 commit into from
Feb 19, 2021
Merged
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
11 changes: 11 additions & 0 deletions vroom/vim.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ class Communicator(object):
def __init__(self, args, env, writer):
self.writer = writer.commands
self.args = args
# The order of switches matters. '--clean' will prevent vim from loading any
# 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',
'--clean',
'-u', args.vimrc,
'--servername', args.servername,
'-c', 'set shell=' + args.shell,
Expand All @@ -120,6 +124,13 @@ def Start(self):
# still has a _vim attribute it can query for details.
self.process = subprocess.Popen(self.start_command, env=self.env)
time.sleep(self.args.startuptime)
if self.process.poll() is not None and self.process.poll() != 0:
# If vim exited this quickly, it probably means we passed a switch it
# doesn't recognize. Try again without the '--clean' switch since this is
# new in 8.0.1554+.
self.start_command.remove('--clean')
Copy link
Contributor

@dbarnett dbarnett Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I'm thinking of eventually plumbing through and posting a warning notice in the final output if we couldn't use --clean.

self.process = subprocess.Popen(self.start_command, env=self.env)
time.sleep(self.args.startuptime)

def _IsCurrentDisplayUsable(self):
"""Check whether vim fails using the current configured display."""
Expand Down