From 8a7b15cf35f9873395916487c33b817673c56d86 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Wed, 10 Aug 2016 23:52:25 -0400 Subject: vim-patch:7.4.1898 Problem: User commands don't support modifiers. Solution: Add the item. (Yegappan Lakshmanan, closes vim/vim#829) https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90 --- runtime/doc/map.txt | 21 ++++++ src/nvim/ex_docmd.c | 124 ++++++++++++++++++++++++++++++--- src/nvim/testdir/Makefile | 1 + src/nvim/testdir/test_usercommands.vim | 46 ++++++++++++ src/nvim/version.c | 2 +- 5 files changed, 182 insertions(+), 12 deletions(-) create mode 100644 src/nvim/testdir/test_usercommands.vim diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index c1eef398e2..4561020d22 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1406,6 +1406,27 @@ The valid escape sequences are (See the '-bang' attribute) Expands to a ! if the command was executed with a ! modifier, otherwise expands to nothing. + ** + The command modifiers, if specified. Otherwise, expands to + nothing. Supported modifiers are |aboveleft|, |belowright|, + |botright|, |browse|, |confirm|, |hide|, |keepalt|, + |keepjumps|, |keepmarks|, |keeppatterns|, |lockmarks|, + |noswapfile|, |silent|, |tab|, |topleft|, |verbose|, and + |vertical|. + Examples: > + command! -nargs=+ -complete=file MyEdit + \ for f in expand(, 0, 1) | + \ exe ' split ' . f | + \ endfor + + function! SpecialEdit(files, mods) + for f in expand(a:files, 0, 1) + exe a:mods . ' split ' . f + endfor + endfunction + command! -nargs=+ -complete=file Sedit + \ call SpecialEdit(, ) +< ** ** (See the '-register' attribute) The optional register, if specified. Otherwise, expands to nothing. diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 1e54f03ba0..001ac404e9 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5154,6 +5154,24 @@ static char_u *uc_split_args(char_u *arg, size_t *lenp) return buf; } +static size_t add_cmd_modifier(char_u *buf, char *mod_str, bool *multi_mods) +{ + size_t result = STRLEN(mod_str); + if (*multi_mods) { + result++; + } + + if (buf != NULL) { + if (*multi_mods) { + STRCAT(buf, " "); + } + STRCAT(buf, mod_str); + } + + *multi_mods = true; + return result; +} + /* * Check for a <> code in a user command. * "code" points to the '<'. "len" the length of the <> (inclusive). @@ -5178,8 +5196,8 @@ uc_check_code ( char_u *p = code + 1; size_t l = len - 2; int quote = 0; - enum { ct_ARGS, ct_BANG, ct_COUNT, ct_LINE1, ct_LINE2, ct_REGISTER, - ct_LT, ct_NONE } type = ct_NONE; + enum { ct_ARGS, ct_BANG, ct_COUNT, ct_LINE1, ct_LINE2, ct_MODS, + ct_REGISTER, ct_LT, ct_NONE } type = ct_NONE; if ((vim_strchr((char_u *)"qQfF", *p) != NULL) && p[1] == '-') { quote = (*p == 'q' || *p == 'Q') ? 1 : 2; @@ -5187,23 +5205,26 @@ uc_check_code ( l -= 2; } - ++l; - if (l <= 1) + l++; + if (l <= 1) { type = ct_NONE; - else if (STRNICMP(p, "args>", l) == 0) + } else if (STRNICMP(p, "args>", l) == 0) { type = ct_ARGS; - else if (STRNICMP(p, "bang>", l) == 0) + } else if (STRNICMP(p, "bang>", l) == 0) { type = ct_BANG; - else if (STRNICMP(p, "count>", l) == 0) + } else if (STRNICMP(p, "count>", l) == 0) { type = ct_COUNT; - else if (STRNICMP(p, "line1>", l) == 0) + } else if (STRNICMP(p, "line1>", l) == 0) { type = ct_LINE1; - else if (STRNICMP(p, "line2>", l) == 0) + } else if (STRNICMP(p, "line2>", l) == 0) { type = ct_LINE2; - else if (STRNICMP(p, "lt>", l) == 0) + } else if (STRNICMP(p, "lt>", l) == 0) { type = ct_LT; - else if (STRNICMP(p, "reg>", l) == 0 || STRNICMP(p, "register>", l) == 0) + } else if (STRNICMP(p, "reg>", l) == 0 || STRNICMP(p, "register>", l) == 0) { type = ct_REGISTER; + } else if (STRNICMP(p, "mods>", l) == 0) { + type = ct_MODS; + } switch (type) { case ct_ARGS: @@ -5311,6 +5332,87 @@ uc_check_code ( break; } + case ct_MODS: + { + result = quote ? 2 : 0; + if (buf != NULL) { + if (quote) { + *buf++ = '"'; + } + *buf = '\0'; + } + + bool multi_mods = false; + + // :aboveleft and :leftabove + if (cmdmod.split & WSP_ABOVE) { + result += add_cmd_modifier(buf, "aboveleft", &multi_mods); + } + // :belowright and :rightbelow + if (cmdmod.split & WSP_BELOW) { + result += add_cmd_modifier(buf, "belowright", &multi_mods); + } + // :botright + if (cmdmod.split & WSP_BOT) { + result += add_cmd_modifier(buf, "botright", &multi_mods); + } + + typedef struct { + bool *set; + char *name; + } mod_entry_T; + static mod_entry_T mod_entries[] = { + { &cmdmod.browse, "browse" }, + { (bool *)&cmdmod.confirm, "confirm" }, + { (bool *)&cmdmod.hide, "hide" }, + { (bool *)&cmdmod.keepalt, "keepalt" }, + { (bool *)&cmdmod.keepjumps, "keepjumps" }, + { (bool *)&cmdmod.keepmarks, "keepmarks" }, + { (bool *)&cmdmod.keeppatterns, "keeppatterns" }, + { (bool *)&cmdmod.lockmarks, "lockmarks" }, + { &cmdmod.noswapfile, "noswapfile" } + }; + // the modifiers that are simple flags + for (size_t i = 0; i < ARRAY_SIZE(mod_entries); i++) { + if (*mod_entries[i].set) { + result += add_cmd_modifier(buf, mod_entries[i].name, &multi_mods); + } + } + + // TODO(vim): How to support :noautocmd? + // TODO(vim): How to support :sandbox + + // :silent + if (msg_silent > 0) { + result += add_cmd_modifier(buf, emsg_silent > 0 ? "silent!" : "silent", + &multi_mods); + } + // :tab + if (cmdmod.tab > 0) { + result += add_cmd_modifier(buf, "tab", &multi_mods); + } + // :topleft + if (cmdmod.split & WSP_TOP) { + result += add_cmd_modifier(buf, "topleft", &multi_mods); + } + + // TODO(vim): How to support :unsilent + + // :verbose + if (p_verbose > 0) { + result += add_cmd_modifier(buf, "verbose", &multi_mods); + } + // :vertical + if (cmdmod.split & WSP_VERT) { + result += add_cmd_modifier(buf, "vertical", &multi_mods); + } + if (quote && buf != NULL) { + buf += result - 2; + *buf = '"'; + } + break; + } + case ct_REGISTER: result = eap->regname ? 1 : 0; if (quote) diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 4979aae57a..b7aacc7b3b 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -36,6 +36,7 @@ NEW_TESTS = \ test_help_tagjump.res \ test_langmap.res \ test_syntax.res \ + test_usercommands.res \ test_timers.res \ test_viml.res \ test_visual.res \ diff --git a/src/nvim/testdir/test_usercommands.vim b/src/nvim/testdir/test_usercommands.vim new file mode 100644 index 0000000000..e8e9b6c18d --- /dev/null +++ b/src/nvim/testdir/test_usercommands.vim @@ -0,0 +1,46 @@ +" Tests for user defined commands + +" Test for in user defined commands +function Test_cmdmods() + let g:mods = '' + + command! -nargs=* MyCmd let g:mods .= ' ' + + MyCmd + aboveleft MyCmd + belowright MyCmd + botright MyCmd + browse MyCmd + confirm MyCmd + hide MyCmd + keepalt MyCmd + keepjumps MyCmd + keepmarks MyCmd + keeppatterns MyCmd + lockmarks MyCmd + noswapfile MyCmd + silent MyCmd + tab MyCmd + topleft MyCmd + verbose MyCmd + vertical MyCmd + aboveleft belowright botright browse confirm hide keepalt keepjumps + \ keepmarks keeppatterns lockmarks noswapfile silent tab + \ topleft verbose vertical MyCmd + call assert_equal(' aboveleft belowright botright browse confirm ' . + \ 'hide keepalt keepjumps keepmarks keeppatterns lockmarks ' . + \ 'noswapfile silent tab topleft verbose vertical aboveleft ' . + \ 'belowright botright browse confirm hide keepalt keepjumps ' . + \ 'keepmarks keeppatterns lockmarks noswapfile silent tab topleft ' . + \ 'verbose vertical ', g:mods) + let g:mods = '' + + command! -nargs=* MyQCmd let g:mods .= ' ' + vertical MyQCmd + call assert_equal('"vertical" ', g:mods) + + delcommand MyCmd + delcommand MyQCmd + + unlet g:mods +endfunction diff --git a/src/nvim/version.c b/src/nvim/version.c index 978bc2e228..6060654bb5 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -378,7 +378,7 @@ static int included_patches[] = { // 1901 NA // 1900, // 1899 NA - // 1898, + 1898, // 1897, // 1896, // 1895, -- cgit From 728d5823331cf9d36ffa8389e5819e67324735d8 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Thu, 11 Aug 2016 10:20:44 -0400 Subject: man.vim: support for command modifiers Closes #5235 --- runtime/autoload/man.vim | 24 ++++++++++++------------ runtime/plugin/man.vim | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 6c2d4eae8e..072b8a2cd9 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -26,7 +26,7 @@ endtry " by the user. count defaults to 0 which is a valid section and " count1 defaults to 1 which is also a valid section. Only when they " are equal was the count explicitly set. -function! man#open_page(count, count1, ...) abort +function! man#open_page(count, count1, mods, ...) abort if a:0 > 2 call s:error('too many arguments') return @@ -56,20 +56,20 @@ function! man#open_page(count, count1, ...) abort endtry call s:push_tag() let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')') - let found_man = s:find_man() - if getbufvar(bufname, 'manwidth') ==# s:manwidth() - if found_man - silent execute 'buf' bufnr(bufname) - else - execute 'split' bufname + if a:mods !~# 'tab' && s:find_man() + if s:manwidth() ==# getbufvar(bufname, 'manwidth') + silent execute 'buf' bufname + keepjumps 1 + return endif - keepjumps 1 + noautocmd execute 'edit' bufname + call s:read_page(sect, name) return endif - if found_man - noautocmd execute 'edit' bufname - else - noautocmd execute 'split' bufname + noautocmd execute a:mods 'split' bufname + if s:manwidth() ==# get(b:, 'manwidth') + keepjumps 1 + return endif call s:read_page(sect, name) endfunction diff --git a/runtime/plugin/man.vim b/runtime/plugin/man.vim index d49276047f..f3fe7151ca 100644 --- a/runtime/plugin/man.vim +++ b/runtime/plugin/man.vim @@ -5,9 +5,9 @@ if exists('g:loaded_man') endif let g:loaded_man = 1 -command! -range=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, ) +command! -range=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, , ) -nnoremap (Man) :call man#open_page(v:count, v:count1, &filetype ==# 'man' ? expand('') : expand('')) +nnoremap (Man) :call man#open_page(v:count, v:count1, '', &filetype ==# 'man' ? expand('') : expand('')) augroup man autocmd! -- cgit From 10b014ca7bbf72d68f82803bc58f35127ff904f6 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Fri, 12 Aug 2016 06:07:13 -0400 Subject: man.vim: set window local options when reusing buffer This is necessary incase the buffer was previously opened in a different tab, in which the window options there do not carry over. It is not explicitly documented in ':help local-options' but that is how it works. --- runtime/autoload/man.vim | 11 +++++++++++ runtime/ftplugin/man.vim | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 072b8a2cd9..349ab1ded5 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -59,6 +59,7 @@ function! man#open_page(count, count1, mods, ...) abort if a:mods !~# 'tab' && s:find_man() if s:manwidth() ==# getbufvar(bufname, 'manwidth') silent execute 'buf' bufname + call man#set_window_local_options() keepjumps 1 return endif @@ -68,6 +69,7 @@ function! man#open_page(count, count1, mods, ...) abort endif noautocmd execute a:mods 'split' bufname if s:manwidth() ==# get(b:, 'manwidth') + call man#set_window_local_options() keepjumps 1 return endif @@ -203,6 +205,15 @@ function! s:manwidth() abort return $MANWIDTH endfunction +function! man#set_window_local_options() abort + setlocal nonumber + setlocal norelativenumber + setlocal foldcolumn=0 + setlocal colorcolumn=0 + setlocal nolist + setlocal nofoldenable +endfunction + function! s:man_args(sect, name) abort if empty(a:sect) return shellescape(a:name) diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index 6a9ad27956..fddfee3c31 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -33,12 +33,7 @@ setlocal tabstop=8 setlocal softtabstop=8 setlocal shiftwidth=8 -setlocal nonumber -setlocal norelativenumber -setlocal foldcolumn=0 -setlocal colorcolumn=0 -setlocal nolist -setlocal nofoldenable +call man#set_window_local_options() if !exists('g:no_plugin_maps') && !exists('g:no_man_maps') nmap (Man) -- cgit From f5d3f3da6f7b42783bccebebafe5e1c00d368bfa Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Sun, 14 Aug 2016 04:58:55 -0400 Subject: use bool type for flag mod_entry_T members --- src/nvim/ex_cmds_defs.h | 24 ++++++++++++------------ src/nvim/ex_docmd.c | 28 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h index 421c14b495..c2e7add287 100644 --- a/src/nvim/ex_cmds_defs.h +++ b/src/nvim/ex_cmds_defs.h @@ -164,18 +164,18 @@ typedef struct expand { /// flag. This needs to be saved for recursive commands, put them in a /// structure for easy manipulation. typedef struct { - int hide; ///< TRUE when ":hide" was used - int split; ///< flags for win_split() - int tab; ///< > 0 when ":tab" was used - int confirm; ///< TRUE to invoke yes/no dialog - int keepalt; ///< TRUE when ":keepalt" was used - int keepmarks; ///< TRUE when ":keepmarks" was used - int keepjumps; ///< TRUE when ":keepjumps" was used - int lockmarks; ///< TRUE when ":lockmarks" was used - int keeppatterns; ///< TRUE when ":keeppatterns" was used - bool noswapfile; ///< true when ":noswapfile" was used - bool browse; ///< TRUE to invoke file dialog - char_u *save_ei; ///< saved value of 'eventignore' + int split; ///< flags for win_split() + int tab; ///< > 0 when ":tab" was used + bool browse; ///< true to invoke file dialog + bool confirm; ///< true to invoke yes/no dialog + bool hide; ///< true when ":hide" was used + bool keepalt; ///< true when ":keepalt" was used + bool keepjumps; ///< true when ":keepjumps" was used + bool keepmarks; ///< true when ":keepmarks" was used + bool keeppatterns; ///< true when ":keeppatterns" was used + bool lockmarks; ///< true when ":lockmarks" was used + bool noswapfile; ///< true when ":noswapfile" was used + char_u *save_ei; ///< saved value of 'eventignore' } cmdmod_T; #endif // NVIM_EX_CMDS_DEFS_H diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 001ac404e9..0a20f540b4 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1325,24 +1325,24 @@ static char_u * do_one_cmd(char_u **cmdlinep, case 'c': if (!checkforcmd(&ea.cmd, "confirm", 4)) break; - cmdmod.confirm = TRUE; + cmdmod.confirm = true; continue; case 'k': if (checkforcmd(&ea.cmd, "keepmarks", 3)) { - cmdmod.keepmarks = TRUE; + cmdmod.keepmarks = true; continue; } if (checkforcmd(&ea.cmd, "keepalt", 5)) { - cmdmod.keepalt = TRUE; + cmdmod.keepalt = true; continue; } if (checkforcmd(&ea.cmd, "keeppatterns", 5)) { - cmdmod.keeppatterns = TRUE; + cmdmod.keeppatterns = true; continue; } if (!checkforcmd(&ea.cmd, "keepjumps", 5)) break; - cmdmod.keepjumps = TRUE; + cmdmod.keepjumps = true; continue; /* ":hide" and ":hide | cmd" are not modifiers */ @@ -1350,11 +1350,11 @@ static char_u * do_one_cmd(char_u **cmdlinep, || *p == NUL || ends_excmd(*p)) break; ea.cmd = p; - cmdmod.hide = TRUE; + cmdmod.hide = true; continue; case 'l': if (checkforcmd(&ea.cmd, "lockmarks", 3)) { - cmdmod.lockmarks = TRUE; + cmdmod.lockmarks = true; continue; } @@ -5363,13 +5363,13 @@ uc_check_code ( } mod_entry_T; static mod_entry_T mod_entries[] = { { &cmdmod.browse, "browse" }, - { (bool *)&cmdmod.confirm, "confirm" }, - { (bool *)&cmdmod.hide, "hide" }, - { (bool *)&cmdmod.keepalt, "keepalt" }, - { (bool *)&cmdmod.keepjumps, "keepjumps" }, - { (bool *)&cmdmod.keepmarks, "keepmarks" }, - { (bool *)&cmdmod.keeppatterns, "keeppatterns" }, - { (bool *)&cmdmod.lockmarks, "lockmarks" }, + { &cmdmod.confirm, "confirm" }, + { &cmdmod.hide, "hide" }, + { &cmdmod.keepalt, "keepalt" }, + { &cmdmod.keepjumps, "keepjumps" }, + { &cmdmod.keepmarks, "keepmarks" }, + { &cmdmod.keeppatterns, "keeppatterns" }, + { &cmdmod.lockmarks, "lockmarks" }, { &cmdmod.noswapfile, "noswapfile" } }; // the modifiers that are simple flags -- cgit From 470883d7054b6145f0c233a8ff3d64db8cd887b9 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Mon, 22 Aug 2016 09:03:37 -0400 Subject: man.vim: slight refactoring Addresses problem one in #5240 --- runtime/autoload/man.vim | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 349ab1ded5..5413037dc3 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -1,12 +1,9 @@ " Maintainer: Anmol Sethi -" Ensure Vim is not recursively invoked (man-db does this) -" by forcing man to use cat as the pager. -" More info here http://comments.gmane.org/gmane.editors.vim.devel/29085 if &shell =~# 'fish$' - let s:man_cmd = 'man -P cat ^/dev/null' + let s:man_cmd = 'man ^/dev/null' else - let s:man_cmd = 'man -P cat 2>/dev/null' + let s:man_cmd = 'man 2>/dev/null' endif let s:man_find_arg = "-w" @@ -49,7 +46,7 @@ function! man#open_page(count, count1, mods, ...) abort " user explicitly set a count let sect = string(a:count) endif - let [sect, name] = s:verify_exists(sect, name) + let [sect, name, path] = s:verify_exists(sect, name) catch call s:error(v:exception) return @@ -64,7 +61,7 @@ function! man#open_page(count, count1, mods, ...) abort return endif noautocmd execute 'edit' bufname - call s:read_page(sect, name) + call s:read_page(path) return endif noautocmd execute a:mods 'split' bufname @@ -73,26 +70,29 @@ function! man#open_page(count, count1, mods, ...) abort keepjumps 1 return endif - call s:read_page(sect, name) + call s:read_page(path) endfunction function! man#read_page(ref) abort try let [sect, name] = s:extract_sect_and_name_ref(a:ref) - let [sect, name] = s:verify_exists(sect, name) + " The third element is the path. + call s:read_page(s:verify_exists(sect, name)[2]) catch call s:error(v:exception) return endtry - call s:read_page(sect, name) endfunction -function! s:read_page(sect, name) abort +function! s:read_page(path) abort setlocal modifiable setlocal noreadonly keepjumps %delete _ let b:manwidth = s:manwidth() - silent execute 'read!env MANWIDTH='.b:manwidth s:man_cmd s:man_args(a:sect, a:name) + " Ensure Vim is not recursively invoked (man-db does this) + " by forcing man to use cat as the pager. + " More info here http://comments.gmane.org/gmane.editors.vim.devel/29085 + silent execute 'read!env MANPAGER=cat MANWIDTH='.b:manwidth s:man_cmd a:path " remove all the backspaced text silent execute 'keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g') while getline(1) =~# '^\s*$' @@ -136,7 +136,7 @@ function! s:verify_exists(sect, name) abort if a:name =~# '\/' " We do not need to extract the section/name from the path if the name is " just a path. - return ['', a:name] + return ['', a:name, path] endif " We need to extract the section from the path because sometimes " the actual section of the manpage is more specific than the section @@ -144,7 +144,8 @@ function! s:verify_exists(sect, name) abort " Also on linux, it seems that the name is case insensitive. So if one does " ':Man PRIntf', we still want the name of the buffer to be 'printf' or " whatever the correct capitilization is. - return s:extract_sect_and_name_path(path[:len(path)-2]) + let path = path[:len(path)-2] + return s:extract_sect_and_name_path(path) + [path] endfunction let s:tag_stack = [] @@ -282,11 +283,11 @@ function! man#complete(arg_lead, cmd_line, cursor_pos) abort return uniq(sort(map(globpath(s:mandirs,'man?/'.name.'*.'.sect.'*', 0, 1), 's:format_candidate(v:val, sect)'), 'i')) endfunction -function! s:format_candidate(c, sect) abort - if a:c =~# '\.\%(pdf\|in\)$' " invalid extensions +function! s:format_candidate(path, sect) abort + if a:path =~# '\.\%(pdf\|in\)$' " invalid extensions return endif - let [sect, name] = s:extract_sect_and_name_path(a:c) + let [sect, name] = s:extract_sect_and_name_path(a:path) if sect ==# a:sect return name elseif sect =~# a:sect.'[^.]\+$' -- cgit From db2aa27df17742a46f2861a53f8b61826e0318ea Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Wed, 24 Aug 2016 14:02:25 -0400 Subject: man.vim: if reusing a buffer, do not use noautocmd The commit that added support for modifiers regressed #5168 causing #5172. This commit fixes it again. --- runtime/autoload/man.vim | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 5413037dc3..968a7dc8f4 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -61,14 +61,13 @@ function! man#open_page(count, count1, mods, ...) abort return endif noautocmd execute 'edit' bufname - call s:read_page(path) - return - endif - noautocmd execute a:mods 'split' bufname - if s:manwidth() ==# get(b:, 'manwidth') + elseif s:manwidth() ==# getbufvar(bufname, 'manwidth') + execute a:mods 'split' bufname call man#set_window_local_options() keepjumps 1 return + else + noautocmd execute a:mods 'split' bufname endif call s:read_page(path) endfunction -- cgit