vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

helpcurwin.txt (2052B)


      1 *helpcurwin.txt*	For Vim version 9.1.	Last change: 2025 Dec 02
      2 
      3 The helpcurwin optional package enables opening help in the current window.
      4 
      5 1. :HelpCurwin			|helpcurwin-command|
      6 2. helpcurwin#Open()		|helpcurwin-function|
      7 3. <Plug>HelpCurwin;		|helpcurwin-mapping|
      8 
      9 
     10 ==============================================================================
     11 1. :HelpCurwin				     *:HelpCurwin* *helpcurwin-command*
     12 
     13 :HelpCurwin		Use the current window to display the help file,
     14 			|help.txt| in read-only mode.  It leaves any other
     15 			windows as-is (including when there is another
     16 			help window(s)).
     17 
     18 :HelpCurwin {subject}	Like ":HelpCurwin" but, additionally open the
     19 			applicable help file at the tag {subject}.
     20 			For example: >
     21 
     22 			  :HelpCurwin version9.2
     23 <
     24 			It should otherwise behave like :help {subject}.
     25 
     26 You may also want to save typing with a command line abbreviation,
     27 for example: >vi
     28 
     29   cnoreabbrev <expr> hc getcmdtype() == ":" &&
     30     \ getcmdline() == 'hc' ? 'HelpCurwin' : 'hc'
     31 <
     32 
     33 ==============================================================================
     34 2. helpcurwin#Open()					*helpcurwin-function*
     35 
     36 The underlying `:def` function may also be used, for example: >vim
     37 
     38 	:vim9cmd helpcurwin#Open('version9.2')
     39 <
     40 This may be useful from other scripts where you want to bring up help on
     41 {subject} in the current window.
     42 
     43 
     44 ==============================================================================
     45 3. <Plug>HelpCurwin;					*helpcurwin-mapping*
     46 
     47 There may be times when you want to get the help for a WORD, such as when it
     48 is in a Vim9 script.  If you want to open it in the same window, you can map
     49 <Plug>HelpCurwin; to keys of your choosing to enable that.  For example: >vim9
     50 
     51 	nnoremap <Leader>hc <Plug>HelpCurwin;
     52 
     53 Once sourced (in this instance, when <Leader>hc is typed), the applicable
     54 help file will be opened in the current window at the tag for <cWORD> (that
     55 is, the |WORD| under the cursor), if it exists.
     56 
     57 
     58 ==============================================================================
     59  vim:tw=78:ts=8:noet:ft=help:norl: