File: 0003-Detect-vim_flavor-from-call-to-has-nvim.patch

package info (click to toggle)
vim-ultisnips 3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,924 kB
  • sloc: python: 8,353; sh: 64; makefile: 38
file content (38 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 225c6784f92559144405b22e47eab2915e1acbb7 Mon Sep 17 00:00:00 2001
From: Nicholas Guriev <nicholas@guriev.su>
Date: Wed, 13 Jul 2022 18:01:29 +0300
Subject: Detect vim_flavor from call to has('nvim')

---
 test_all.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/test_all.py b/test_all.py
index 2f50e37..b092834 100755
--- a/test_all.py
+++ b/test_all.py
@@ -181,14 +181,21 @@ if __name__ == "__main__":
 
         all_test_suites = unittest.defaultTestLoader.discover(start_dir="test")
 
-        vim = None
-        vim_flavor = "vim"
         if options.interface == "tmux":
             vim = VimInterfaceTmux(options.vim, options.session)
-            vim_flavor = "vim"
         else:
             vim = VimInterfaceTmuxNeovim(options.vim, options.session)
+
+        has_nvim = subprocess.check_output(
+            [options.vim, "-e", "-s", "-c", "verbose echo has('nvim')", "+q"],
+            stderr=subprocess.STDOUT,
+        )
+        if has_nvim == b"0":
+            vim_flavor = "vim"
+        elif has_nvim == b"1":
             vim_flavor = "neovim"
+        else:
+            assert 0, "Unexpected output, has_nvim=%r" % has_nvim
 
         if not options.clone_plugins and platform.system() == "Windows":
             raise RuntimeError(