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

Remove -Z when GOLFVIM=nvim #346

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 9 additions & 2 deletions lib/vimgolf/lib/vimgolf/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ module VimGolf

GOLFDEBUG = ENV['GOLFDEBUG'].to_sym rescue false
GOLFHOST = ENV['GOLFHOST'] || "https://www.vimgolf.com"
GOLFSHOWDIFF = ENV['GOLFSHOWDIFF'] || 'vim -d -n'
GOLFVIM = ENV['GOLFVIM'] || 'vim'
# Use provided vim by default
GOLFSHOWDIFF = ENV['GOLFSHOWDIFF'] || GOLFVIM + ' -d -n'

class Error
end
Expand Down Expand Up @@ -130,10 +131,16 @@ def play(challenge)
# -u vimrc - load vimgolf .vimrc to level the playing field
# -U NONE - don't load .gvimrc
# -W logfile - keylog file (overwrites if already exists)
vimcmd = GOLFVIM.shellsplit + %W{-Z -n --noplugin -i NONE +0 -u #{challenge.vimrc_path} -U NONE -W #{challenge.log_path} #{challenge.work_path}}
vimcmd = GOLFVIM.shellsplit + %W{-n --noplugin -i NONE +0 -u #{challenge.vimrc_path} -U NONE -W #{challenge.log_path} #{challenge.work_path}}
if GOLFVIM == "gvim"
vimcmd += %W{ --nofork}
end
# neovim does not support -Z
# Technically this makes cheating easier,
# but with custom GOLFVIM one could always make a script to filter -Z out
if GOLFVIM != "nvim"
vimcmd += %W{ -Z}
end
debug(vimcmd)
system(*vimcmd) # assembled as an array, bypasses the shell

Expand Down