什么是以g开头的vim命令?

时间:2017-07-13 17:02:14

标签: vim

g是几个命令的前缀。例如转到移动光标,还可以gqip格式化段落。所有以g为前缀的命令的参考位置在哪里?

2 个答案:

答案 0 :(得分:12)

Vim的文档是http://vimdoc.sourceforge.net/。如果您使用的是HTML文档,则会找到|reference_toc| More detailed information for all commands,其中包含|index.txt| alphabetical index of all commands,其中包含一个名为index.txt且名为index.html的doc文件的不幸怪癖} - 实际上并没有导致你期望它领导的地方。

长话短说,http://vimdoc.sourceforge.net/htmldoc/vimindex.html#g是您要查找的文档(“以'g'开头的命令”)。

或者,在Vim中输入:help *g*

(对不起merlin2011,但你的清单有点不完整......)

应用了一些重新格式化:

2.4 Commands starting with 'g'

 char        note action in Normal mode
------------------------------------------------------------------
g CTRL-A          only when compiled with MEM_PROFILE
                  defined: dump a memory profile
g CTRL-G          show information about current cursor
                  position
g CTRL-H          start Select block mode
g CTRL-]          |:tjump| to the tag under the cursor
g#             1  like "#", but without using "\<" and "\>"
g$             1  when 'wrap' off go to rightmost character of
                  the current line that is on the screen;
                  when 'wrap' on go to the rightmost character
                  of the current screen line
g&             2  repeat last ":s" on all lines
g'{mark}       1  like |'| but without changing the jumplist
g`{mark}       1  like |`| but without changing the jumplist
g*             1  like "*", but without using "\<" and "\>"
g0             1  when 'wrap' off go to leftmost character of
                  the current line that is on the screen;
                  when 'wrap' on go to the leftmost character
                  of the current screen line
g8                print hex value of bytes used in UTF-8
                  character under the cursor
g<                display previous command output
g?             2  Rot13 encoding operator
g??            2  Rot13 encode current line
g?g?           2  Rot13 encode current line
gD             1  go to definition of word under the cursor
                  in current file
gE             1  go backwards to the end of the previous
                  WORD
gH                start Select line mode
gI             2  like "I", but always start in column 1
gJ             2  join lines without inserting space
["x]gP         2  put the text [from register x] before the
                  cursor N times, leave the cursor after it
gQ                switch to "Ex" mode with Vim editing
gR             2  enter Virtual Replace mode
gU{motion}     2  make Nmove text uppercase
gV                don't reselect the previous Visual area
                  when executing a mapping or menu in Select
                  mode
g]                :tselect on the tag under the cursor
g^             1  when 'wrap' off go to leftmost non-white
                  character of the current line that is on
                  the screen; when 'wrap' on go to the
                  leftmost non-white character of the current
                  screen line
ga                print ascii value of character under the
                  cursor
gd             1  go to definition of word under the cursor
                  in current function
ge             1  go backwards to the end of the previous
                  word
gf                start editing the file whose name is under
                  the cursor
gF                start editing the file whose name is under
                  the cursor and jump to the line number
                  following the filename.
gg             1  cursor to line N, default first line
gh                start Select mode
gi             2  like "i", but first move to the |'^| mark
gj             1  like "j", but when 'wrap' on go N screen
                  lines down
gk             1  like "k", but when 'wrap' on go N screen
                  lines up
gm             1  go to character at middle of the screenline
go             1  cursor to byte N in the buffer
["x]gp         2  put the text [from register x] after the
                  cursor N times, leave the cursor after it
gq{motion}     2  format Nmove text
gr{char}       2  virtual replace N chars with {char}
gs                go to sleep for N seconds (default 1)
gu{motion}     2  make Nmove text lowercase
gv                reselect the previous Visual area
gw{motion}     2  format Nmove text and keep cursor
gx                execute application for file name under the
                  cursor (only with |netrw| plugin)
g@{motion}        call 'operatorfunc'
g~{motion}     2  swap case for Nmove text
g<Down>        1  same as "gj"
g<End>         1  same as "g$"
g<Home>        1  same as "g0"
g<LeftMouse>      same as <C-LeftMouse>
g<MiddleMouse>    same as <C-MiddleMouse>
g<RightMouse>     same as <C-RightMouse>
g<Up>          1  same as "gk"

note: 1 = cursor movement command; 2 = can be undone/redone

答案 1 :(得分:3)

打开vim。输入:help g

2.4 Commands starting with 'g'                                          g

tag             char          note action in Normal mode
------------------------------------------------------------------------------
g_CTRL-A        g CTRL-A           only when compiled with MEM_PROFILE
                                   defined: dump a memory profile
g_CTRL-G        g CTRL-G           show information about current cursor
                                   position
g_CTRL-H        g CTRL-H           start Select block mode
g_CTRL-]        g CTRL-]           :tjump to the tag under the cursor
g#              g#              1  like "#", but without using "\<" and "\>"
g$              g$              1  when 'wrap' off go to rightmost character of
                                   the current line that is on the screen;
                                   when 'wrap' on go to the rightmost character
                                   of the current screen line
g&              g&              2  repeat last ":s" on all lines
g'              g'{mark}        1  like ' but without changing the jumplist
g`              g`{mark}        1  like ` but without changing the jumplist
gstar           g*              1  like "*", but without using "\<" and "\>"
g+              g+                 go to newer text state N times
g,              g,              1  go to N newer position in change list
g-              g-                 go to older text state N times
g0              g0              1  when 'wrap' off go to leftmost character of
                                   the current line that is on the screen;
                                   when 'wrap' on go to the leftmost character
                                   of the current screen line
g8              g8                 print hex value of bytes used in UTF-8
                                   character under the cursor
g;              g;              1  go to N older position in change list
g<              g<                 display previous command output

上面的列表已被截断以便于阅读。