我嘗試了一些 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".
...