annotate src/testdir/test_man.vim @ 9326:cd9c4bbe1d03 v7.4.1945

commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 20 11:22:54 2016 +0200 patch 7.4.1945 Problem: The Man plugin doesn't work that well. Solution: Use "g:ft_man_open_mode" to be able open man pages in vert split or separate tab. Set nomodifiable for buffer with man content. Add a test. (Andrey Starodubtsev, closes #873)
author Christian Brabandt <cb@256bit.org>
date Mon, 20 Jun 2016 11:30:06 +0200
parents
children ccbb8e393d80
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9326
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 runtime ftplugin/man.vim
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 function Test_g_ft_man_open_mode()
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 let l:w = winwidth(1)
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 vnew
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 let l:h = winheight(1)
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 q
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 " split horizontally
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 let wincnt = winnr('$')
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 Man 'vim'
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 if wincnt == winnr('$')
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 " Vim manual page cannot be found.
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 return
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 endif
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_equal(l:w, winwidth(1))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call assert_true(l:h > winheight(1))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call assert_equal(1, tabpagenr('$'))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal(1, tabpagenr())
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 q
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " split horizontally
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 let g:ft_man_open_mode = "horz"
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 Man 'vim'
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal(l:w, winwidth(1))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_true(l:h > winheight(1))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal(1, tabpagenr('$'))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal(1, tabpagenr())
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 q
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " split vertically
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let g:ft_man_open_mode = "vert"
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 Man 'vim'
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_true(l:w > winwidth(1))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal(l:h, winheight(1))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal(1, tabpagenr('$'))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal(1, tabpagenr())
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 q
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " separate tab
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 let g:ft_man_open_mode = "tab"
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 Man 'vim'
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal(l:w, winwidth(1))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal(l:h, winheight(1))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal(2, tabpagenr('$'))
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal(2, tabpagenr())
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 q
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 endfunction
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 function Test_nomodifiable()
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 let wincnt = winnr('$')
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 Man 'vim'
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 if wincnt == winnr('$')
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 " Vim manual page cannot be found.
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 return
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 endif
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call assert_false(&l:modifiable)
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 q
cd9c4bbe1d03 commit https://github.com/vim/vim/commit/ddf8d1c746ee081d15c9d7e0515f6ac43adbf363
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 endfunction