annotate src/testdir/test_gn.vim @ 13742:a34b1323286c v8.0.1743

patch 8.0.1743: terminal window options are named inconsistently commit https://github.com/vim/vim/commit/6d150f783d5d3820fe69734dda1e79b8276a84d2 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 21 20:03:20 2018 +0200 patch 8.0.1743: terminal window options are named inconsistently Problem: Terminal window options are named inconsistently. Solution: prefix terminal window options with "termwin". Keep the old names for now as an alias.
author Christian Brabandt <cb@256bit.org>
date Sat, 21 Apr 2018 20:15:07 +0200
parents 1fad9675d8fd
children 96933f0ecbd1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " replace a single char by itsself quoted:
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')
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 let @/='x'
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')
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 let @/='foobar'
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'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 let @/='one\_s*two\_s'
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'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 let @/='[a]bcdx'
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'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 let @/='$'
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'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 let @/='\>\zs'
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'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 let @/='^'
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 exe "norm! 0gnd$"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 let @/='\zs'
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'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 let @/='mother'
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++)'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 let @/='i'
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
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 let @/='\%x59'
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'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 let @/='Johnny'
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'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 let @/='Depp'
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'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 let @/='a:0\@!\zs\d\+'
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
6d3584b60170 patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents: 11488
diff changeset
116 let @/='foo'
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
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
122 set wrapscan&vim
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 endfu
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9647
diff changeset
125 " vim: shiftwidth=2 sts=2 expandtab