diff --git a/doc/tips.jax b/doc/tips.jax index c5293792a..485797496 100644 --- a/doc/tips.jax +++ b/doc/tips.jax @@ -1,4 +1,4 @@ -*tips.txt* For Vim バージョン 9.1. Last change: 2025 Nov 09 +*tips.txt* For Vim バージョン 9.1. Last change: 2025 Dec 02 VIM リファレンスマニュアル by Bram Moolenaar @@ -29,7 +29,7 @@ xterm でのスクリーンの切り替え |xterm-screens| バイナリ編集 |hex-editing| 自動コマンドで <> 表記を使う |autocmd-<>| 対応する括弧を強調する |match-parens| -カレントウィンドウでヘルプを開く |help-curwin| +カレントウィンドウでヘルプを開く |package-helpcurwin| ============================================================================== C のプログラムを編集する *C-editing* @@ -551,28 +551,22 @@ NOTE: これを利用するには 'cpoptions' から '<' フラグを外して < ============================================================================== -カレントウィンドウでヘルプを開く *help-curwin* +カレントウィンドウでヘルプを開く *package-helpcurwin* -デフォルトでは、ヘルプは分割したウィンドウに表示されます。カレントウィンドウで -開くのが好みであれば、このカスタム `:HelpCurwin` コマンドを試してください: -> - command -bar -nargs=? -complete=help HelpCurwin execute s:HelpCurwin() - let s:did_open_help = v:false - - function s:HelpCurwin(subject) abort - let mods = 'silent noautocmd keepalt' - if !s:did_open_help - execute mods .. ' help' - execute mods .. ' helpclose' - let s:did_open_help = v:true - endif - if !getcompletion(a:subject, 'help')->empty() - execute mods .. ' edit ' .. &helpfile - set buftype=help - endif - return 'help ' .. a:subject - endfunction -< +デフォルトでは、ヘルプは分割ウィンドウに表示される。状況によっては、カレント +ウィンドウでヘルプを開きたい場合もあるだろう。オプションの helpcurwin パッケー +ジを使用すると、これが可能になる。パッケージは手動で読み込むか、|vimrc| に以 +下を追加する: >vim + packadd helpcurwin +< +読み込み後: +- コマンド `:HelpCurwin` {subject} を使用すると、カレントウィンドウでヘルプを + 開くことができる。 +- カレントウィンドウに変更されたバッファが含まれている場合、プラグインはバッ + ファを置き換える前に確認を求める。確認された場合、バッファは非表示になる + (|hidden-buffer|)。 +- ヘルプファイル |helpcurwin.txt| が使用可能になり、プラグインについてより詳細 + に説明している。 vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/en/tips.txt b/en/tips.txt index cd3b5d052..8a0da1437 100644 --- a/en/tips.txt +++ b/en/tips.txt @@ -1,4 +1,4 @@ -*tips.txt* For Vim version 9.1. Last change: 2025 Nov 09 +*tips.txt* For Vim version 9.1. Last change: 2025 Dec 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -30,7 +30,7 @@ Executing shell commands in a window |shell-window| Hex editing |hex-editing| Using <> notation in autocommands |autocmd-<>| Highlighting matching parens |match-parens| -Opening help in the current window |help-curwin| +Opening help in the current window |package-helpcurwin| ============================================================================== Editing C programs *C-editing* @@ -544,28 +544,22 @@ A slightly more advanced version is used in the |matchparen| plugin. < ============================================================================== -Opening help in the current window *help-curwin* +Opening help in the current window *package-helpcurwin* -By default, help is displayed in a split window. If you prefer it opens in -the current window, try this custom `:HelpCurwin` command: -> - command -bar -nargs=? -complete=help HelpCurwin execute s:HelpCurwin() - let s:did_open_help = v:false - - function s:HelpCurwin(subject) abort - let mods = 'silent noautocmd keepalt' - if !s:did_open_help - execute mods .. ' help' - execute mods .. ' helpclose' - let s:did_open_help = v:true - endif - if !getcompletion(a:subject, 'help')->empty() - execute mods .. ' edit ' .. &helpfile - set buftype=help - endif - return 'help ' .. a:subject - endfunction -< +By default, help is displayed in a split window. In some scenarios, you may +prefer to open the help in the current window. The optional helpcurwin +package makes this possible. Load the package manually, or in your |vimrc|, +with: >vim + packadd helpcurwin +< +After it has loaded: +- The command `:HelpCurwin` {subject} can be used to open help in the current + window. +- If the current window contains a modified buffer, the plugin asks for + confirmation before replacing it. If confirmed, the buffer becomes + hidden |hidden-buffer|. +- The help file, |helpcurwin.txt|, will be available and describes the plugin + in more details. vim:tw=78:ts=8:noet:ft=help:norl: