|
1 | | -*tips.txt* For Vim version 9.1. Last change: 2025 Nov 09 |
| 1 | +*tips.txt* For Vim version 9.1. Last change: 2025 Dec 02 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -30,7 +30,7 @@ Executing shell commands in a window |shell-window| |
30 | 30 | Hex editing |hex-editing| |
31 | 31 | Using <> notation in autocommands |autocmd-<>| |
32 | 32 | Highlighting matching parens |match-parens| |
33 | | -Opening help in the current window |help-curwin| |
| 33 | +Opening help in the current window |package-helpcurwin| |
34 | 34 |
|
35 | 35 | ============================================================================== |
36 | 36 | Editing C programs *C-editing* |
@@ -544,28 +544,22 @@ A slightly more advanced version is used in the |matchparen| plugin. |
544 | 544 | < |
545 | 545 |
|
546 | 546 | ============================================================================== |
547 | | -Opening help in the current window *help-curwin* |
| 547 | +Opening help in the current window *package-helpcurwin* |
548 | 548 |
|
549 | | -By default, help is displayed in a split window. If you prefer it opens in |
550 | | -the current window, try this custom `:HelpCurwin` command: |
551 | | -> |
552 | | - command -bar -nargs=? -complete=help HelpCurwin execute s:HelpCurwin(<q-args>) |
553 | | - let s:did_open_help = v:false |
554 | | -
|
555 | | - function s:HelpCurwin(subject) abort |
556 | | - let mods = 'silent noautocmd keepalt' |
557 | | - if !s:did_open_help |
558 | | - execute mods .. ' help' |
559 | | - execute mods .. ' helpclose' |
560 | | - let s:did_open_help = v:true |
561 | | - endif |
562 | | - if !getcompletion(a:subject, 'help')->empty() |
563 | | - execute mods .. ' edit ' .. &helpfile |
564 | | - set buftype=help |
565 | | - endif |
566 | | - return 'help ' .. a:subject |
567 | | - endfunction |
568 | | -< |
| 549 | +By default, help is displayed in a split window. In some scenarios, you may |
| 550 | +prefer to open the help in the current window. The optional helpcurwin |
| 551 | +package makes this possible. Load the package manually, or in your |vimrc|, |
| 552 | +with: >vim |
569 | 553 |
|
| 554 | + packadd helpcurwin |
| 555 | +< |
| 556 | +After it has loaded: |
| 557 | +- The command `:HelpCurwin` {subject} can be used to open help in the current |
| 558 | + window. |
| 559 | +- If the current window contains a modified buffer, the plugin asks for |
| 560 | + confirmation before replacing it. If confirmed, the buffer becomes |
| 561 | + hidden |hidden-buffer|. |
| 562 | +- The help file, |helpcurwin.txt|, will be available and describes the plugin |
| 563 | + in more details. |
570 | 564 |
|
571 | 565 | vim:tw=78:ts=8:noet:ft=help:norl: |
0 commit comments