Mercurial > vim
annotate src/testdir/test_gf.vim @ 30011:b8abb8908801 v9.0.0343
patch 9.0.0343: ColorScheme autocommand triggered when colorscheme not found
Commit: https://github.com/vim/vim/commit/5d09a401ec393dc930e1104ceb38eab34681de64
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 31 21:17:10 2022 +0100
patch 9.0.0343: ColorScheme autocommand triggered when colorscheme not found
Problem: ColorScheme autocommand triggered when colorscheme is not found.
(Romain Lafourcade)
Solution: Only trigger ColorScheme when loading the colorscheme succeeds.
(closes #11024)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 31 Aug 2022 22:30:06 +0200 |
parents | bc47aeacc8d8 |
children | 13b02c1ea0f7 |
rev | line source |
---|---|
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1 " Test for the gf and gF (goto file) commands |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " This is a test if a URL is recognized by "gf", with the cursor before and |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " after the "://". Also test ":\\". |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
5 func Test_gf_url() |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 enew! |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call append(0, [ |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 \ "first test for URL://machine.name/tmp/vimtest2a and other text", |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 \ "second test for URL://machine.name/tmp/vimtest2b. And other text", |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 \ "third test for URL:\\\\machine.name\\vimtest2c and other text", |
13103
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
11 \ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other text", |
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
12 \ "fifth test for URL://machine.name/tmp?q=vim&opt=yes and other text", |
15993
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
13 \ "sixth test for URL://machine.name:1234?q=vim and other text", |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 \ ]) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call cursor(1,1) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call search("^first") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call search("tmp") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal("URL://machine.name/tmp/vimtest2a", expand("<cfile>")) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call search("^second") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call search("URL") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>")) |
27490
fb4c30606b4a
patch 8.2.4273: the EBCDIC support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26743
diff
changeset
|
22 set isf=@,48-57,/,.,-,_,+,,,$,~,\ |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call search("^third") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 call search("name") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_equal("URL:\\\\machine.name\\vimtest2c", expand("<cfile>")) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call search("^fourth") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call search("URL") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>")) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
13103
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
30 call search("^fifth") |
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
31 call search("URL") |
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
32 call assert_equal("URL://machine.name/tmp?q=vim&opt=yes", expand("<cfile>")) |
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
33 |
15993
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
34 call search("^sixth") |
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
35 call search("URL") |
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
36 call assert_equal("URL://machine.name:1234?q=vim", expand("<cfile>")) |
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
37 |
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
38 %d |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
39 call setline(1, "demo://remote_file") |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
40 wincmd f |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
41 call assert_equal('demo://remote_file', @%) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
42 call assert_equal(2, winnr('$')) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
43 close! |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
44 |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 set isf&vim |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 enew! |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
47 endfunc |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
48 |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
49 func Test_gF() |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
50 new |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
51 call setline(1, ['111', '222', '333', '444']) |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
52 w! Xfile |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
53 close |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
54 new |
11440
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
55 set isfname-=: |
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
56 call setline(1, ['one', 'Xfile:3', 'three']) |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
57 2 |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
58 call assert_fails('normal gF', 'E37:') |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
59 call assert_equal(2, getcurpos()[1]) |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
60 w! Xfile2 |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
61 normal gF |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
62 call assert_equal('Xfile', bufname('%')) |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
63 call assert_equal(3, getcurpos()[1]) |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
64 |
18939
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
65 enew! |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
66 call setline(1, ['one', 'the Xfile line 2, and more', 'three']) |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
67 w! Xfile2 |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
68 normal 2GfX |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
69 normal gF |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
70 call assert_equal('Xfile', bufname('%')) |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
71 call assert_equal(2, getcurpos()[1]) |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
72 |
21020
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
73 " jumping to the file/line with CTRL-W_F |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
74 %bw! |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
75 edit Xfile1 |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
76 call setline(1, ['one', 'Xfile:4', 'three']) |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
77 exe "normal 2G\<C-W>F" |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
78 call assert_equal('Xfile', bufname('%')) |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
79 call assert_equal(4, getcurpos()[1]) |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
80 |
11440
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
81 set isfname& |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
82 call delete('Xfile') |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
83 call delete('Xfile2') |
21020
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
84 %bw! |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
85 endfunc |
16564
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
86 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
87 " Test for invoking 'gf' on a ${VAR} variable |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
88 func Test_gf() |
27490
fb4c30606b4a
patch 8.2.4273: the EBCDIC support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26743
diff
changeset
|
89 set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} |
16564
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
90 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
91 call writefile(["Test for gf command"], "Xtest1") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
92 if has("unix") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
93 call writefile([" ${CDIR}/Xtest1"], "Xtestgf") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
94 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
95 call writefile([" $TDIR/Xtest1"], "Xtestgf") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
96 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
97 new Xtestgf |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
98 if has("unix") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
99 let $CDIR = "." |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
100 /CDIR |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
101 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
102 if has("amiga") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
103 let $TDIR = "/testdir" |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
104 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
105 let $TDIR = "." |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
106 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
107 /TDIR |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
108 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
109 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
110 normal gf |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
111 call assert_equal('Xtest1', fnamemodify(bufname(''), ":t")) |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
112 close! |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
113 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
114 call delete('Xtest1') |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
115 call delete('Xtestgf') |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
116 endfunc |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
117 |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
118 func Test_gf_visual() |
22270
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
119 call writefile(['one', 'two', 'three', 'four'], "Xtest_gf_visual") |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
120 new |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
121 call setline(1, 'XXXtest_gf_visualXXX') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
122 set hidden |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
123 |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
124 " Visually select Xtest_gf_visual and use gf to go to that file |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
125 norm! ttvtXgf |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
126 call assert_equal('Xtest_gf_visual', bufname('%')) |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
127 |
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
128 " if multiple lines are selected, then gf should fail |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
129 call setline(1, ["one", "two"]) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
130 normal VGgf |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
131 call assert_equal('Xtest_gf_visual', @%) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
132 |
22270
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
133 " following line number is used for gF |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
134 bwipe! |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
135 new |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
136 call setline(1, 'XXXtest_gf_visual:3XXX') |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
137 norm! 0ttvt:gF |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
138 call assert_equal('Xtest_gf_visual', bufname('%')) |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
139 call assert_equal(3, getcurpos()[1]) |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
140 |
29570
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
141 " do not include the NUL at the end |
28867
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
142 call writefile(['x'], 'X') |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
143 let save_enc = &enc |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
144 for enc in ['latin1', 'utf-8'] |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
145 exe "set enc=" .. enc |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
146 new |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
147 call setline(1, 'X') |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
148 set nomodified |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
149 exe "normal \<C-V>$gf" |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
150 call assert_equal('X', bufname()) |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
151 bwipe! |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
152 endfor |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
153 let &enc = save_enc |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
154 call delete('X') |
987d29ca36a5
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
155 |
22270
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
156 " line number in visual area is used for file name |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
157 if has('unix') |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
158 bwipe! |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
159 call writefile([], "Xtest_gf_visual:3") |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
160 new |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
161 call setline(1, 'XXXtest_gf_visual:3XXX') |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
162 norm! 0ttvtXgF |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
163 call assert_equal('Xtest_gf_visual:3', bufname('%')) |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
164 call delete('Xtest_gf_visual:3') |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
165 endif |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
166 |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
167 bwipe! |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
168 call delete('Xtest_gf_visual') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
169 set hidden& |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
170 endfunc |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
171 |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
172 func Test_gf_error() |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
173 new |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
174 call assert_fails('normal gf', 'E446:') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
175 call assert_fails('normal gF', 'E446:') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
176 call setline(1, '/doesnotexist') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
177 call assert_fails('normal gf', 'E447:') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
178 call assert_fails('normal gF', 'E447:') |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
179 call assert_fails('normal [f', 'E447:') |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
180 |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
181 " gf is not allowed when text is locked |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
182 au InsertCharPre <buffer> normal! gF<CR> |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
183 let caught_e565 = 0 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
184 try |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
185 call feedkeys("ix\<esc>", 'xt') |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
186 catch /^Vim\%((\a\+)\)\=:E565/ " catch E565 |
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
187 let caught_e565 = 1 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
188 endtry |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
189 call assert_equal(1, caught_e565) |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
190 au! InsertCharPre |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
191 |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
192 bwipe! |
22502
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
193 |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
194 " gf is not allowed when buffer is locked |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
195 new |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
196 augroup Test_gf |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
197 au! |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
198 au OptionSet diff norm! gf |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
199 augroup END |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
200 call setline(1, ['Xfile1', 'line2', 'line3', 'line4']) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
201 call test_override('starting', 1) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
202 call assert_fails('diffthis', 'E788:') |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
203 call test_override('starting', 0) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
204 augroup Test_gf |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
205 au! |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
206 augroup END |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
207 bw! |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
208 endfunc |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
209 |
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
210 " If a file is not found by 'gf', then 'includeexpr' should be used to locate |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
211 " the file. |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
212 func Test_gf_includeexpr() |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
213 new |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
214 let g:Inc_fname = '' |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
215 func IncFunc() |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
216 let g:Inc_fname = v:fname |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
217 return v:fname |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
218 endfunc |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
219 setlocal includeexpr=IncFunc() |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
220 call setline(1, 'somefile.java') |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
221 call assert_fails('normal gf', 'E447:') |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
222 call assert_equal('somefile.java', g:Inc_fname) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
223 close! |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
224 delfunc IncFunc |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
225 endfunc |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
226 |
26743
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
227 " Test for using a script-local function for 'includeexpr' |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
228 func Test_includeexpr_scriptlocal_func() |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
229 func! s:IncludeFunc() |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
230 let g:IncludeFname = v:fname |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
231 return '' |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
232 endfunc |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
233 set includeexpr=s:IncludeFunc() |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
234 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr) |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
235 new | only |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
236 call setline(1, 'TestFile1') |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
237 let g:IncludeFname = '' |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
238 call assert_fails('normal! gf', 'E447:') |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
239 call assert_equal('TestFile1', g:IncludeFname) |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
240 bw! |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
241 set includeexpr=<SID>IncludeFunc() |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
242 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr) |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
243 new | only |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
244 call setline(1, 'TestFile2') |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
245 let g:IncludeFname = '' |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
246 call assert_fails('normal! gf', 'E447:') |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
247 call assert_equal('TestFile2', g:IncludeFname) |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
248 set includeexpr& |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
249 delfunc s:IncludeFunc |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
250 bw! |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
251 endfunc |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
252 |
29570
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
253 " Check that expanding directories can handle more than 255 entries. |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
254 func Test_gf_subdirs_wildcard() |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
255 let cwd = getcwd() |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
256 let dir = 'Xtestgf_dir' |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
257 call mkdir(dir) |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
258 call chdir(dir) |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
259 for i in range(300) |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
260 call mkdir(i) |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
261 call writefile([], i .. '/' .. i, 'S') |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
262 endfor |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
263 set path=./** |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
264 |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
265 new | only |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
266 call setline(1, '99') |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
267 w! Xtest1 |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
268 normal gf |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
269 call assert_equal('99', fnamemodify(bufname(''), ":t")) |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
270 |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
271 call chdir(cwd) |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
272 call delete(dir, 'rf') |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
273 set path& |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
274 endfunc |
bc47aeacc8d8
patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents:
28867
diff
changeset
|
275 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
276 " vim: shiftwidth=2 sts=2 expandtab |