在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 7521|回复: 20

[原创] 个人整理的gvim常用命令

[复制链接]
发表于 2018-12-3 10:14:05 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
#--------------------Vim Basic-----------------------------------------------
#file name
: vim_basic
#author
: LGP
#date
: 2018-07-11
#contact
: lgp_0615@163.com
#------------------------------------------------------------------------------

#---------------------summary--------------------------------------------------
vi is an powerful file editor for programming in Linux OS.
vim
: vi improved
gvim
: GUI of vi
.vim
: highlight word file
(语法高亮)
.vimrc
: configuration file of VI
(字体、背景颜色)
two mode
: editing(insert) and command mode

#------------------file operation----------------------------------------------

#--------open a file-------------------------------------
vi file_name
: open a file for editing on a terminal
vim file_name
:
gvim file_name
: gvim is a GUI of vi

ctrl + 6
: 两个文件之间切换
:bn
: 下一个文件
:bp
: 上一个文件
:ls
: 打卡文件列表
:b1-n
: 切换至第n个文件

# when open a file, vi is in insert mode by default

i
: go to insert mode(before
cursor)
a
: go to insert mode(after
cursor)
s
:
o
: go to insert mode(next
line)
esc
: go to command mode
:w
: write into the file (save)
:q
: quit vi
:q!
: force to quit and abort the modification
:wq
: save and quit

#----------------move cursor ------------------------------------

->/<-
: left/right/up/down
h|j|k|l
: h(left)| j(down)| k(up)| l(right)

: 3h | 4j | 5k | 6l
w
: move forward on word  
eg. 3w
b
: move backward one word
eg. 4b
$
: move to the end of line  
^|0         : move to the beginning of a line
#------------------------------------

gg
: go to the first line
G
: go to the last line
nG
: go to n line
eg. 1G
:number
: go to n line
:set nu
: set number line
:set nonu

CTRL + G   
: display the current line and total numbers of lines
CTRL + U
: page up
CTRL + D
: page down

#----------delete copy and paste---------------------------------
d = delete, y = copy, p = paste

dd
: delete a line
eg. 5dd
dw

: delete a word
eg. d3w
d0
: delete to beginning of line
d$
: delete to end of line

yy
: copy a line
eg. 5yy
yw

y0
y$
Y
: copy
:5,10y
: copy 5 - 10 line

:,10y
: copy cursor - 10 line
:5,y
: copy 5 - cursor line

p
: paste
.
: repeate last operation
x
: delete a character
eg.3x

#------------undo the editing ------------------------------------
u|U
: undo | redo
CTRL + r
: undo

#-------------insert cursor --------------------------------------
a|A
: after the cursor | end of a line
o|O
: input one new line under the current line | up the current line
:help a


#------------search ---------------------------------------------
:/pattern
: go to the pattern

: n|N
:?pattern
:
SHIFT + *
: match the word before marked cursor
SHIFT + #
: match the word after marked cursor

:number_line: go to the number line

#-------------replace----------------------------------------------
:r|R
: replace
:%s/x/y/g
: x change to y all of them
:s/x/y/g
: x change to y on the current line
:s/x/y/
: x change to y on the current character
:10,23s/x/y/g
:10 - 23 line,x change to y

#--------------special operation-----------------------------------
:sp file(tab)
: split horizontally; put some files into one terminal
:vsp file
: visual splite vertically
CTRL + w
: change file in split command
:ZZ|q     
: quit a split file

:set diff
: compare two files
gvimdiff file1 file2
: compare two files

CTRL + v
: visual mode

: d|D, y|Y, r|R

SHIFT + i
: insert mode for editing
ESC
: Match visual mode


gf
: go into file
CTRL + o
: return the original file

#---------------key completion------------------------------------
ctrl + n

tab

#---------------automatic matching parentheses-------------------
%

#---------------call shell command--------------------------------
:sh
:!cmd

#-------------other command---------------------------------------
J
: merge the under line and the current line
eg.3J
~
: change case-sensitive character
发表于 2018-12-6 10:01:49 | 显示全部楼层
谢谢分享
发表于 2018-12-8 17:27:03 | 显示全部楼层
Thanks
发表于 2018-12-11 10:52:10 | 显示全部楼层
Thanks
发表于 2018-12-20 17:44:34 | 显示全部楼层
thanks
发表于 2018-12-21 15:36:41 | 显示全部楼层
谢谢分享
发表于 2019-3-28 17:10:37 | 显示全部楼层
楼主辛苦了,你要是弄到文档里面还能得些积分!1
发表于 2019-8-31 15:21:59 | 显示全部楼层
Good information
发表于 2019-9-2 18:55:39 | 显示全部楼层
谢谢分享
发表于 2019-9-2 18:57:03 | 显示全部楼层
好东西  谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-11-8 06:12 , Processed in 0.026757 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表