首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >以g开头的vim命令是什么?

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

Stack Overflow用户
提问于 2017-07-14 01:02:14
回答 2查看 16.9K关注 0票数 28

g是几个命令的前缀。例如,goto用于移动光标,也可以使用gqip设置段落格式。其中是以g为前缀的所有命令的引用

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-07-14 01:10:36

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的文档文件的一个不幸的怪癖,它实际上并没有指向您期望的结果。

长话短说,http://vimdoc.sourceforge.net/htmldoc/vimindex.html#g就是您正在寻找的文档(“以‘g’开头的命令”)。

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

(抱歉,merlin2011,但您的列表有些不完整...)

应用了一些重新格式化:

代码语言:javascript
运行
复制
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
票数 33
EN

Stack Overflow用户

发布于 2017-07-14 01:10:25

打开vim。键入:help g

代码语言:javascript
运行
复制
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

出于可读性考虑,上面的列表已被截断。

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45086981

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档