我尝试了一些 vim 命令,发现该gh
命令将启动一个新的命令模式,它显示--select--
在我的屏幕上。就像--visual--
命令模式一样,此--select--
模式可以选择一些文本。
我想了解更多关于这个命令模式的信息,然后我按下F1在 vi 中显示 vim 帮助文件。
我如何才能gh
在此帮助文件中找到该命令?
答案1
一般来说,要在 Vim 中查找命令的帮助,请使用命令模式(键入:wq
以退出的模式):
:help gh
输入完这些内容后,你可以按Ctrld显示可能补全的列表,
:he gh
gh c_<Right> -menuheight zip-copyright match-highlight Vimball-copyright
ghc i_<Right> :belowright 'cmdwinheight' netrw-copyright <ScrollWheelRight>
'ghr' c_<C-Right> 'helpheight' 'nosplitright' 'nowinfixheight' <C-ScrollWheelRight>
g:ghc c_<S-Right> 'splitright' 'winfixheight' shift-left-right <S-ScrollWheelRight>
正如您所见,gh
已列出,因此只需按Enter:
gh
gh Start Select mode, characterwise. This is like "v",
but starts Select mode instead of Visual mode.
Mnemonic: "get highlighted".
答案2
使用:h select-mode
后,您会看到选择模式的描述。以下是摘录:
==============================================================================
8. Select mode *Select* *Select-mode*
Select mode looks like Visual mode, but the commands accepted are quite
different. This resembles the selection mode in Microsoft Windows.
When the 'showmode' option is set, "-- SELECT --" is shown in the last line.
Entering Select mode:
- Using the mouse to select an area, and 'selectmode' contains "mouse".
'mouse' must also contain a flag for the current mode.
- Using a non-printable movement command, with the Shift key pressed, and
'selectmode' contains "key". For example: <S-Left> and <S-End>. 'keymodel'
must also contain "startsel".
- Using "v", "V" or CTRL-V command, and 'selectmode' contains "cmd".
- Using "gh", "gH" or "g_CTRL-H" command in Normal mode.
- From Visual mode, press CTRL-G. *v_CTRL-G*
...
*gh*
gh Start Select mode, characterwise. This is like "v",
but starts Select mode instead of Visual mode.
Mnemonic: "get highlighted".
...