From 9e4a35d318d284c2f2c286d6b9032942687551dc Mon Sep 17 00:00:00 2001 From: AlexApps99 Date: Tue, 26 Apr 2022 11:05:32 +1200 Subject: [PATCH] Remove -Z when GOLFVIM=nvim --- lib/vimgolf/lib/vimgolf/cli.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/vimgolf/lib/vimgolf/cli.rb b/lib/vimgolf/lib/vimgolf/cli.rb index decdd12..e8ade60 100644 --- a/lib/vimgolf/lib/vimgolf/cli.rb +++ b/lib/vimgolf/lib/vimgolf/cli.rb @@ -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 @@ -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