Mercurial > vim
annotate src/testdir/shared.vim @ 12170:1345621ecdfb v8.0.0965
patch 8.0.0965: not restoring cursor shape after it was set in a terminal
commit https://github.com/vim/vim/commit/3eee06e7d4c3a8e2dbb2577a1eef0e0f108e0288
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 19 19:40:50 2017 +0200
patch 8.0.0965: not restoring cursor shape after it was set in a terminal
Problem: The cursor shape is not reset after it was changed in a terminal.
Solution: Request the original cursor shape and restore it. Add t_RS.
Do not add t_SH for now, it does not work properly.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 19 Aug 2017 19:45:04 +0200 |
parents | d2c20ec4b95a |
children | 61a9642297cc |
rev | line source |
---|---|
9517
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Functions shared by several tests. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " Get the name of the Python executable. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " Also keeps it in s:python. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 func PythonProg() |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 " This test requires the Python command to run the test server. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 " This most likely only works on Unix and Windows. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 if has('unix') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " We also need the job feature or the pkill command to make sure the server |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 " can be stopped. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 if !(executable('python') && (has('job') || executable('pkill'))) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 return '' |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 let s:python = 'python' |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 elseif has('win32') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 " Use Python Launcher for Windows (py.exe) if available. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 if executable('py.exe') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 let s:python = 'py.exe' |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 elseif executable('python.exe') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 let s:python = 'python.exe' |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 else |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 return '' |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 else |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 return '' |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 return s:python |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 endfunc |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 " Run "cmd". Returns the job if using a job. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 func RunCommand(cmd) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 let job = 0 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 if has('job') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 let job = job_start(a:cmd, {"stoponexit": "hup"}) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call job_setoptions(job, {"stoponexit": "kill"}) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 elseif has('win32') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 exe 'silent !start cmd /c start "test_channel" ' . a:cmd |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 else |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 exe 'silent !' . a:cmd . '&' |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 return job |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 endfunc |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 " Read the port number from the Xportnr file. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 func GetPort() |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 let l = [] |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 for i in range(200) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 try |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 let l = readfile("Xportnr") |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 catch |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 endtry |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 if len(l) >= 1 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 break |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 sleep 10m |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 endfor |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 call delete("Xportnr") |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 if len(l) == 0 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 " Can't make the connection, give up. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 return 0 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 return l[0] |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 endfunc |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 " Run a Python server for "cmd" and call "testfunc". |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 " Always kills the server before returning. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 func RunServer(cmd, testfunc, args) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 " The Python program writes the port number in Xportnr. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call delete("Xportnr") |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 if len(a:args) == 1 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 let arg = ' ' . a:args[0] |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 else |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 let arg = '' |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 let pycmd = s:python . " " . a:cmd . arg |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 try |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 let g:currentJob = RunCommand(pycmd) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 " Wait for up to 2 seconds for the port number to be there. |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 let port = GetPort() |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 if port == 0 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call assert_false(1, "Can't start " . a:cmd) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 return |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 call call(function(a:testfunc), [port]) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 catch |
10422
e664ee056a84
commit https://github.com/vim/vim/commit/4b785f69c0616dba5d3f38e8ce4b5398cec89407
Christian Brabandt <cb@256bit.org>
parents:
10309
diff
changeset
|
91 call assert_false(1, 'Caught exception: "' . v:exception . '" in ' . v:throwpoint) |
9517
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 finally |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 call s:kill_server(a:cmd) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 endtry |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 endfunc |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 func s:kill_server(cmd) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 if has('job') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 if exists('g:currentJob') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 call job_stop(g:currentJob) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 unlet g:currentJob |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 elseif has('win32') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 let cmd = substitute(a:cmd, ".py", '', '') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 call system('taskkill /IM ' . s:python . ' /T /F /FI "WINDOWTITLE eq ' . cmd . '"') |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 else |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 call system("pkill -f " . a:cmd) |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 endfunc |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 " Wait for up to a second for "expr" to become true. |
9933
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
112 " Return time slept in milliseconds. With the +reltime feature this can be |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
113 " more than the actual waiting time. Without +reltime it can also be less. |
11709
c3227699ad4d
patch 8.0.0737: crash when X11 selection is very big
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
114 func WaitFor(expr, ...) |
c3227699ad4d
patch 8.0.0737: crash when X11 selection is very big
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
115 let timeout = get(a:000, 0, 1000) |
9933
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
116 " using reltime() is more accurate, but not always available |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
117 if has('reltime') |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
118 let start = reltime() |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
119 else |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
120 let slept = 0 |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
121 endif |
11709
c3227699ad4d
patch 8.0.0737: crash when X11 selection is very big
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
122 for i in range(timeout / 10) |
9517
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 try |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 if eval(a:expr) |
9933
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
125 if has('reltime') |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
126 return float2nr(reltimefloat(reltime(start)) * 1000) |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
127 endif |
9810
6a28d0c6f929
commit https://github.com/vim/vim/commit/b73598e2f022a22fec512ea681c70d2775e8fd87
Christian Brabandt <cb@256bit.org>
parents:
9806
diff
changeset
|
128 return slept |
9517
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 endif |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 catch |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 endtry |
9933
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
132 if !has('reltime') |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
133 let slept += 10 |
7f38e72a9d65
commit https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4
Christian Brabandt <cb@256bit.org>
parents:
9818
diff
changeset
|
134 endif |
9517
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 sleep 10m |
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 endfor |
11709
c3227699ad4d
patch 8.0.0737: crash when X11 selection is very big
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
137 return timeout |
9517
9f8f03a44886
commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 endfunc |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
139 |
10309
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
140 " Wait for up to a given milliseconds. |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
141 " With the +timers feature this waits for key-input by getchar(), Resume() |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
142 " feeds key-input and resumes process. Return time waited in milliseconds. |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
143 " Without +timers it uses simply :sleep. |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
144 func Standby(msec) |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
145 if has('timers') |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
146 let start = reltime() |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
147 let g:_standby_timer = timer_start(a:msec, function('s:feedkeys')) |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
148 call getchar() |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
149 return float2nr(reltimefloat(reltime(start)) * 1000) |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
150 else |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
151 execute 'sleep ' a:msec . 'm' |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
152 return a:msec |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
153 endif |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
154 endfunc |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
155 |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
156 func Resume() |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
157 if exists('g:_standby_timer') |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
158 call timer_stop(g:_standby_timer) |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
159 call s:feedkeys(0) |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
160 unlet g:_standby_timer |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
161 endif |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
162 endfunc |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
163 |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
164 func s:feedkeys(timer) |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
165 call feedkeys('x', 'nt') |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
166 endfunc |
88331ee68367
commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b
Christian Brabandt <cb@256bit.org>
parents:
9933
diff
changeset
|
167 |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
168 " Get the command to run Vim, with -u NONE and --not-a-term arguments. |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
169 " Returns an empty string on error. |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
170 func GetVimCommand() |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
171 if !filereadable('vimcmd') |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
172 return '' |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
173 endif |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
174 let cmd = readfile('vimcmd')[0] |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
175 let cmd = substitute(cmd, '-u \f\+', '-u NONE', '') |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
176 if cmd !~ '-u NONE' |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
177 let cmd = cmd . ' -u NONE' |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
178 endif |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
179 let cmd .= ' --not-a-term' |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
180 let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '') |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
181 return cmd |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
182 endfunc |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
183 |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
184 " Run Vim, using the "vimcmd" file and "-u NORC". |
9806
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
185 " "before" is a list of Vim commands to be executed before loading plugins. |
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
186 " "after" is a list of Vim commands to be executed after loading plugins. |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
187 " Plugins are not loaded, unless 'loadplugins' is set in "before". |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
188 " Return 1 if Vim could be executed. |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
189 func RunVim(before, after, arguments) |
9818
5c288e5e1493
commit https://github.com/vim/vim/commit/7a9a5f4019ce332cb11ce5370e3fa609299ce737
Christian Brabandt <cb@256bit.org>
parents:
9810
diff
changeset
|
190 return RunVimPiped(a:before, a:after, a:arguments, '') |
9806
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
191 endfunc |
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
192 |
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
193 func RunVimPiped(before, after, arguments, pipecmd) |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
194 let cmd = GetVimCommand() |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
11022
diff
changeset
|
195 if cmd == '' |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
196 return 0 |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
197 endif |
9804
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9794
diff
changeset
|
198 let args = '' |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
199 if len(a:before) > 0 |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
200 call writefile(a:before, 'Xbefore.vim') |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
201 let args .= ' --cmd "so Xbefore.vim"' |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
202 endif |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
203 if len(a:after) > 0 |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
204 call writefile(a:after, 'Xafter.vim') |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
205 let args .= ' -S Xafter.vim' |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
206 endif |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
207 |
9806
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
208 exe "silent !" . a:pipecmd . cmd . args . ' ' . a:arguments |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
209 |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
210 if len(a:before) > 0 |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
211 call delete('Xbefore.vim') |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
212 endif |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
213 if len(a:after) > 0 |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
214 call delete('Xafter.vim') |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
215 endif |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
216 return 1 |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9517
diff
changeset
|
217 endfunc |
12106
d2c20ec4b95a
patch 8.0.0933: terminal test tries to start GUI when it's not possible
Christian Brabandt <cb@256bit.org>
parents:
11709
diff
changeset
|
218 |
d2c20ec4b95a
patch 8.0.0933: terminal test tries to start GUI when it's not possible
Christian Brabandt <cb@256bit.org>
parents:
11709
diff
changeset
|
219 func CanRunGui() |
d2c20ec4b95a
patch 8.0.0933: terminal test tries to start GUI when it's not possible
Christian Brabandt <cb@256bit.org>
parents:
11709
diff
changeset
|
220 return has('gui') && ($DISPLAY != "" || has('gui_running')) |
d2c20ec4b95a
patch 8.0.0933: terminal test tries to start GUI when it's not possible
Christian Brabandt <cb@256bit.org>
parents:
11709
diff
changeset
|
221 endfunc |