From 6c41c95f282861d1cd49827d4a1ca992944a861f Mon Sep 17 00:00:00 2001
From: Jan Edmund Lazo <janedmundlazo@hotmail.com>
Date: Sun, 27 Aug 2017 00:55:14 -0400
Subject: [PATCH] [vim] s:execute_term works in GVim on Windows

Requirements:
- compiled with +terminal
- has patch-8.0.995
- has('gui_running') returns 1
---
 plugin/fzf.vim | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index 6b16b10e..e18b23c7 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -389,7 +389,7 @@ try
   let use_height = has_key(dict, 'down') &&
         \ !(has('nvim') || s:is_win || has('win32unix') || s:present(dict, 'up', 'left', 'right')) &&
         \ executable('tput') && filereadable('/dev/tty')
-  let use_term = has('nvim-0.2.1') || (has('nvim') && !s:is_win)
+  let use_term = has('nvim-0.2.1') || (has('nvim') && !s:is_win) || (has('terminal') && has('gui_running') && has('patch-8.0.995'))
   let use_tmux = (!use_height && !use_term || prefer_tmux) && !has('win32unix') && s:tmux_enabled() && s:splittable(dict)
   if prefer_tmux && use_tmux
     let use_height = 0
@@ -647,7 +647,7 @@ function! s:execute_term(dict, command, temps) abort
       endif
     endif
   endfunction
-  function! fzf.on_exit(id, code, _event)
+  function! fzf.on_exit(id, code, ...)
     if s:getpos() == self.ppos " {'window': 'enew'}
       for [opt, val] in items(self.winopts)
         execute 'let' opt '=' val
@@ -692,7 +692,12 @@ function! s:execute_term(dict, command, temps) abort
     else
       let command = a:command
     endif
-    call termopen(command.s:term_marker, fzf)
+    let command .= s:term_marker
+    if has('nvim')
+      call termopen(command, fzf)
+    else
+      call term_start([&shell, &shellcmdflag, command], {'curwin': fzf.buf, 'exit_cb': function(fzf.on_exit)})
+    endif
   finally
     if s:present(a:dict, 'dir')
       lcd -
-- 
GitLab