Improve dialog in package helpcurwin

13 views
Skip to first unread message

Hernán Ibarra Mejia

unread,
May 20, 2026, 3:06:11 AM (12 days ago) May 20
to vim...@vim.org
Dear Vim community,

I like the recently added package helpcurwin, which displays help pages in the
current window (rather than a split). However, there is a confirmation dialog
that appears using `:HelpCurWin` when the current buffer is modified. This is
annoying and inconsistent with the behaviour of other commands that have to
solve the same problem—`:edit` being the prime example.

In pseudo-vimscript, the command currently behaves like this:

```
if (&modified)
confirmation dialog
else
display help in current window
endif
```

At a minimum, it should behave like this:

```
if (&modified && !&hidden)
if (&confirm)
confirmation dialog
else
error
endif
else
display help in current window
endif
```

This is closer to how commands that discard the buffer operate. There is more
room for improvement:

- Support for `<bang>` so that `:HelpCurWin!` forces the operation.
- Take into account special buffer options like 'buftype' and 'bufhidden'.

I am open to discussion and possibly submitting a patch.

Best wishes,
Hernán Ibarra Mejia
(www.nagbu.net)

Christian Brabandt

unread,
May 20, 2026, 3:19:58 AM (12 days ago) May 20
to vim...@googlegroups.com, vim...@vim.org

On Sa, 16 Mai 2026, Hernán Ibarra Mejia wrote:

> Dear Vim community,
>
> I like the recently added package helpcurwin, which displays help pages in the
> current window (rather than a split). However, there is a confirmation dialog
> that appears using `:HelpCurWin` when the current buffer is modified. This is
> annoying and inconsistent with the behaviour of other commands that have to
> solve the same problem—`:edit` being the prime example.
>
> In pseudo-vimscript, the command currently behaves like this:
>
> ```
> if (&modified)
> confirmation dialog
> else
> display help in current window
> endif
> ```
>
> At a minimum, it should behave like this:
>
> ```
> if (&modified && !&hidden)
> if (&confirm)
> confirmation dialog
> else
> error
> endif
> else
> display help in current window
> endif
> ```

I am not so sure about it.
>
> This is closer to how commands that discard the buffer operate. There is more
> room for improvement:
>
> - Support for `<bang>` so that `:HelpCurWin!` forces the operation.

That probably makes sense.

> - Take into account special buffer options like 'buftype' and 'bufhidden'.

Not sure what you have in mind here.

>
> I am open to discussion and possibly submitting a patch.

Please do.

Thanks,
Christian
--
A public debt is a kind of anchor in the storm; but if the anchor be
too heavy for the vessel, she will be sunk by that very weight which
was intended for her preservation.
-- Colton

Hernán Ibarra Mejia

unread,
May 30, 2026, 9:38:44 AM (2 days ago) May 30
to vim...@googlegroups.com
Dear Vim community,

On Saturday, 16 May 2026, Hernán Ibarra Mejia wrote:
> I like the recently added package helpcurwin, which displays help pages in the
> current window (rather than a split). However, there is a confirmation dialog
> that appears using `:HelpCurWin` when the current buffer is modified. This is
> annoying and inconsistent with the behaviour of other commands that have to
> solve the same problem—`:edit` being the prime example.

I attach a patch to solve this issue. It is my first time contributing to Vim
(apart from bug reports and trivial changes) so please tell me if I need to
correct something.

I noticed other issues with the package that I didn't address in this patch.

- The `-bar` option is on for HelpCurwin but this makes `:HelpCurwin |` not
work, whereas `:help |` does. I think the `-bar` option should be removed.

- The new buffer is currently created with `keepalt noautocmd enew` but I don't
know why noautocmd should be included, and I'd like for the alternate buffer
to change so that after `:HelpCurwin` one can use CTRL-^ to go back

- The <Plug>HelpCurwin; mapping uses <cWORD> when I think it should use <cword>,
since the latter is configurable and is supposed to match keywords.

I am happy to include fixes for these in my patch or open separate threads if
needed.

Best wishes,
Hernán
0001-helpcurwin-wrong-behaviour-if-buffer-is-modified.patch
Reply all
Reply to author
Forward
0 new messages