Mercurial > vim
comparison runtime/ftplugin/man.vim @ 17470:d2a834aa7cc0 v8.1.1733
patch 8.1.1733: the man ftplugin leaves an empty buffer behind
commit https://github.com/vim/vim/commit/e5e6950193ddf365c6c507ddefcd7f9db939e5ac
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jul 22 22:09:21 2019 +0200
patch 8.1.1733: the man ftplugin leaves an empty buffer behind
Problem: The man ftplugin leaves an empty buffer behind.
Solution: Don't make new window and edit, use split. (Jason Franklin)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 22 Jul 2019 22:15:04 +0200 |
parents | 7cfe57329284 |
children | d9aa921b7198 |
comparison
equal
deleted
inserted
replaced
17469:30eb99624cdd | 17470:d2a834aa7cc0 |
---|---|
1 " Vim filetype plugin file | 1 " Vim filetype plugin file |
2 " Language: man | 2 " Language: man |
3 " Maintainer: SungHyun Nam <goweol@gmail.com> | 3 " Maintainer: SungHyun Nam <goweol@gmail.com> |
4 " Last Change: 2019 Jan 22 | 4 " Last Change: 2019 Jul 22 |
5 " (fix by Jason Franklin) | |
5 | 6 |
6 " To make the ":Man" command available before editing a manual page, source | 7 " To make the ":Man" command available before editing a manual page, source |
7 " this script from your startup vimrc file. | 8 " this script from your startup vimrc file. |
8 | 9 |
9 " If 'filetype' isn't "man", we must have been called to only define ":Man". | 10 " If 'filetype' isn't "man", we must have been called to only define ":Man". |
140 endif | 141 endif |
141 exec "let s:man_tag_buf_".s:man_tag_depth." = ".bufnr("%") | 142 exec "let s:man_tag_buf_".s:man_tag_depth." = ".bufnr("%") |
142 exec "let s:man_tag_lin_".s:man_tag_depth." = ".line(".") | 143 exec "let s:man_tag_lin_".s:man_tag_depth." = ".line(".") |
143 exec "let s:man_tag_col_".s:man_tag_depth." = ".col(".") | 144 exec "let s:man_tag_col_".s:man_tag_depth." = ".col(".") |
144 let s:man_tag_depth = s:man_tag_depth + 1 | 145 let s:man_tag_depth = s:man_tag_depth + 1 |
146 | |
147 let open_cmd = 'edit' | |
145 | 148 |
146 " Use an existing "man" window if it exists, otherwise open a new one. | 149 " Use an existing "man" window if it exists, otherwise open a new one. |
147 if &filetype != "man" | 150 if &filetype != "man" |
148 let thiswin = winnr() | 151 let thiswin = winnr() |
149 exe "norm! \<C-W>b" | 152 exe "norm! \<C-W>b" |
159 endif | 162 endif |
160 endwhile | 163 endwhile |
161 endif | 164 endif |
162 if &filetype != "man" | 165 if &filetype != "man" |
163 if exists("g:ft_man_open_mode") | 166 if exists("g:ft_man_open_mode") |
164 if g:ft_man_open_mode == "vert" | 167 if g:ft_man_open_mode == 'vert' |
165 vnew | 168 let open_cmd = 'vsplit' |
166 elseif g:ft_man_open_mode == "tab" | 169 elseif g:ft_man_open_mode == 'tab' |
167 tabnew | 170 let open_cmd = 'tabedit' |
168 else | 171 else |
169 new | 172 let open_cmd = 'split' |
170 endif | 173 endif |
171 else | 174 else |
172 if a:cmdmods != '' | 175 let open_cmd = a:cmdmods . ' split' |
173 exe a:cmdmods . ' new' | |
174 else | |
175 new | |
176 endif | |
177 endif | 176 endif |
178 setl nonu fdc=0 | 177 setl nonu fdc=0 |
179 endif | 178 endif |
180 endif | 179 endif |
181 silent exec "edit $HOME/".page.".".sect."~" | 180 |
181 silent execute open_cmd . " $HOME/" . page . '.' . sect . '~' | |
182 | |
182 " Avoid warning for editing the dummy file twice | 183 " Avoid warning for editing the dummy file twice |
183 setl buftype=nofile noswapfile | 184 setl buftype=nofile noswapfile |
184 | 185 |
185 setl ma nonu nornu nofen | 186 setl ma nonu nornu nofen |
186 silent exec "norm! 1GdG" | 187 silent exec "norm! 1GdG" |