Mercurial > vim
annotate src/testdir/test_gn.vim @ 19106:38d18056e6e6 v8.2.0113
patch 8.2.0113: "make cmdidxs" fails
Commit: https://github.com/vim/vim/commit/9b24dfcb9f676e7f7a09a9062f0d05b2104a87eb
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 12 15:46:08 2020 +0100
patch 8.2.0113: "make cmdidxs" fails
Problem: "make cmdidxs" fails.
Solution: Allow address for ":cquit". Add --not-a-term to avoid a delay.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Jan 2020 16:00:03 +0100 |
parents | c0445cb7cfe0 |
children | a4bd28e2cf1d |
rev | line source |
---|---|
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for gn command |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_gn_command() |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
4 noautocmd new |
16376
3b5d401a58ce
patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents:
15239
diff
changeset
|
5 " replace a single char by itself quoted: |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 call setline('.', 'abc x def x ghi x jkl') |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
7 let @/ = 'x' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 exe "norm! cgn'x'\<esc>.." |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call assert_equal("abc 'x' def 'x' ghi 'x' jkl", getline('.')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 sil! %d_ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
11 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 " simple search match |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call setline('.', 'foobar') |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
14 let @/ = 'foobar' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 exe "norm! gncsearchmatch" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_equal('searchmatch', getline('.')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
18 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 " replace a multi-line match |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call setline('.', ['', 'one', 'two']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
21 let @/ = 'one\_s*two\_s' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 exe "norm! gnceins\<CR>zwei" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_equal(['','eins','zwei'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
25 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 " test count argument |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call setline('.', ['', 'abcdx | abcdx | abcdx']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
28 let @/ = '[a]bcdx' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 exe "norm! 2gnd" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 call assert_equal(['','abcdx | | abcdx'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
32 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 " join lines |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 call setline('.', ['join ', 'lines']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
35 let @/ = '$' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 exe "norm! 0gnd" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call assert_equal(['join lines'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
39 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 " zero-width match |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 call setline('.', ['', 'zero width pattern']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
42 let @/ = '\>\zs' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 exe "norm! 0gnd" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 call assert_equal(['', 'zerowidth pattern'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
46 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 " delete first and last chars |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 call setline('.', ['delete first and last chars']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
49 let @/ = '^' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 exe "norm! 0gnd$" |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
51 let @/ = '\zs' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 exe "norm! gnd" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 call assert_equal(['elete first and last char'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
55 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 " using visual mode |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 call setline('.', ['', 'uniquepattern uniquepattern']) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 exe "norm! /[u]niquepattern/s\<cr>vlgnd" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call assert_equal(['', ' uniquepattern'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
61 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 " backwards search |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 call setline('.', ['my very excellent mother just served us nachos']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
64 let @/ = 'mother' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 exe "norm! $cgNmongoose" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 call assert_equal(['my very excellent mongoose just served us nachos'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
68 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 " search for single char |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call setline('.', ['','for (i=0; i<=10; i++)']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
71 let @/ = 'i' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 exe "norm! cgnj" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 call assert_equal(['','for (j=0; i<=10; i++)'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
75 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 " search hex char |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call setline('.', ['','Y']) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 set noignorecase |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
79 let @/ = '\%x59' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 exe "norm! gnd" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 call assert_equal(['',''], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
83 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 " test repeating gdn |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call setline('.', ['', '1', 'Johnny', '2', 'Johnny', '3']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
86 let @/ = 'Johnny' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 exe "norm! dgn." |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 call assert_equal(['','1', '', '2', '', '3'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
90 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 " test repeating gUgn |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 call setline('.', ['', '1', 'Depp', '2', 'Depp', '3']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
93 let @/ = 'Depp' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 exe "norm! gUgn." |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 call assert_equal(['', '1', 'DEPP', '2', 'DEPP', '3'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
97 |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 " test using look-ahead assertions |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 call setline('.', ['a:10', '', 'a:1', '', 'a:20']) |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
100 let @/ = 'a:0\@!\zs\d\+' |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 exe "norm! 2nygno\<esc>p" |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 call assert_equal(['a:10', '', 'a:1', '1', '', 'a:20'], getline(1,'$')) |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 sil! %d _ |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
104 |
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
105 " test using nowrapscan |
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
106 set nowrapscan |
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
107 call setline(1, 'foo bar baz') |
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
108 exe "norm! /bar/e\<cr>" |
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
109 exe "norm! gnd" |
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
110 call assert_equal(['foo baz'], getline(1,'$')) |
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
111 sil! %d_ |
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
112 |
12539
6d3584b60170
patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents:
11488
diff
changeset
|
113 " search upwards with nowrapscan set |
6d3584b60170
patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents:
11488
diff
changeset
|
114 call setline('.', ['foo', 'bar', 'foo', 'baz']) |
6d3584b60170
patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents:
11488
diff
changeset
|
115 set nowrapscan |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
116 let @/ = 'foo' |
12539
6d3584b60170
patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents:
11488
diff
changeset
|
117 $ |
6d3584b60170
patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents:
11488
diff
changeset
|
118 norm! dgN |
6d3584b60170
patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents:
11488
diff
changeset
|
119 call assert_equal(['foo', 'bar', '', 'baz'], getline(1,'$')) |
6d3584b60170
patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents:
11488
diff
changeset
|
120 sil! %d_ |
6d3584b60170
patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents:
11488
diff
changeset
|
121 |
14000
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
122 " search using the \zs atom |
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
123 call setline(1, [' nnoremap', '' , 'nnoremap']) |
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
124 set wrapscan&vim |
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
125 let @/ = '\_s\zsnnoremap' |
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
126 $ |
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
127 norm! cgnmatch |
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
128 call assert_equal([' nnoremap', '', 'match'], getline(1,'$')) |
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
129 sil! %d_ |
96933f0ecbd1
patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
130 |
18426
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
131 " make sure it works correctly for one-char wide search items |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
132 call setline('.', ['abcdefghi']) |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
133 let @/ = 'a' |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
134 exe "norm! 0fhvhhgNgU" |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
135 call assert_equal(['ABCDEFGHi'], getline(1,'$')) |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
136 call setline('.', ['abcdefghi']) |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
137 let @/ = 'b' |
18500
c0445cb7cfe0
patch 8.1.2244: 'wrapscan' is not used for "gn"
Bram Moolenaar <Bram@vim.org>
parents:
18448
diff
changeset
|
138 " this gn wraps around the end of the file |
18426
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
139 exe "norm! 0fhvhhgngU" |
18500
c0445cb7cfe0
patch 8.1.2244: 'wrapscan' is not used for "gn"
Bram Moolenaar <Bram@vim.org>
parents:
18448
diff
changeset
|
140 call assert_equal(['aBCDEFGHi'], getline(1,'$')) |
18426
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
141 sil! %d _ |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
142 call setline('.', ['abcdefghi']) |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
143 let @/ = 'f' |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
144 exe "norm! 0vllgngU" |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
145 call assert_equal(['ABCDEFghi'], getline(1,'$')) |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
146 sil! %d _ |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
147 call setline('.', ['12345678']) |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
148 let @/ = '5' |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
149 norm! gg0f7vhhhhgnd |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
150 call assert_equal(['12348'], getline(1,'$')) |
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
151 sil! %d _ |
18448
35e0ab1f2975
patch 8.1.2218: "gN" is off by one in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
18426
diff
changeset
|
152 call setline('.', ['12345678']) |
35e0ab1f2975
patch 8.1.2218: "gN" is off by one in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
18426
diff
changeset
|
153 let @/ = '5' |
35e0ab1f2975
patch 8.1.2218: "gN" is off by one in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
18426
diff
changeset
|
154 norm! gg0f2vf7gNd |
35e0ab1f2975
patch 8.1.2218: "gN" is off by one in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
18426
diff
changeset
|
155 call assert_equal(['1678'], getline(1,'$')) |
35e0ab1f2975
patch 8.1.2218: "gN" is off by one in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
18426
diff
changeset
|
156 sil! %d _ |
18426
3b80bdbdc832
patch 8.1.2207: "gn" doesn't work quite right
Bram Moolenaar <Bram@vim.org>
parents:
16376
diff
changeset
|
157 |
11488
9473793c7bb5
patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
158 set wrapscan&vim |
9647
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 endfu |
847518911c0b
commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 |
15239
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
161 func Test_gn_multi_line() |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
162 new |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
163 call setline(1, [ |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
164 \ 'func Tm1()', |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
165 \ ' echo "one"', |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
166 \ 'endfunc', |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
167 \ 'func Tm2()', |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
168 \ ' echo "two"', |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
169 \ 'endfunc', |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
170 \ 'func Tm3()', |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
171 \ ' echo "three"', |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
172 \ 'endfunc', |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
173 \]) |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
174 /\v^func Tm\d\(\)\n.*\zs".*"\ze$ |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
175 normal jgnrx |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
176 call assert_equal(' echo xxxxx', getline(5)) |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
177 bwipe! |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
178 endfunc |
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
14000
diff
changeset
|
179 |
9909
3ee84d270ea7
commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents:
9647
diff
changeset
|
180 " vim: shiftwidth=2 sts=2 expandtab |