evol128[Blog]

I am the bone of my code

Vim攻略 <2> Basic Operations

evol128 posted @ 2012年8月06日 15:05 in language with tags textditor vim , 3591 阅读

好吧,其实<1>差不多写完了,只是我对自个儿的文笔非常不满意,所以等润色下再发

下面这张列表,是笔者使用vim editor时经常用回到的一些按键,可以说,这些已经涵盖了90%的日常使用

虽然是用英文写的,不过原作者一定肯定坚决是我~ 吐槽我的英语:evol128@gmail.com

 

[n]<key>   means that this command takes an numeric argument, which repeats the function of the command by n times. n can be omitted. e.g. 3w means move cursor to the beginning of 3rd next words.

<key>· means this key should be followed by another key

# means a line number

All commands except Ctrl commands are case sensitive.

 

mode selection

esc normal mode

v viusal mode

i insert mode

: command mode

 

movement

h move 1 char left

l move 1 char right

j move 1 char down

k move 1 char up

当然,十字键也是同样的效果,那为什么我们需要这四个按键呢?我的理解,用这四个键可以省去把手从字母区移开的时间,将工作效率提升至极限

0 begin of line

$ end of line

同样,和home/end是重复的

[n]w move cursor to the begin of next word

[n]e move cursor to the end of current word

G go to last line

#G go to # line

gg go to first line

Ctrl+d scroll half window down

Ctrl+u scroll half window up

Ctrl+f scroll full window down

Ctrl+b scroll full window up

%  if coursor on (,),[,] or{,}, go to corresponding braket. else search backwards for the first (, [, or {

简单来讲就是找括号。。。

 

edit

x delete a char at cursor

used with movement operation, delete from cursor to the movement char. e.g. d$ delete from cursor to end of line 

s change a char at cursor

used with movement operation, delete from cursor position to the movement char,then get into insert mode. e.g. c3w changes from cursor position to next 3 words

i  enter insert mode, then you can insert chars into file

 

undo/redo

u undo

ctrl+r redo

 

copy/paste

y yank(copy)

p paste

*y/*p yank/paste from clipboard

 

search/replace

/<pattern> search for pattern

?<pattern> search for pattern backwards

n goto next occurrence of search pattern

N goto previous occurrence of search pattern

%s/<old>/<new>/g replace old pattern with new pattern

 

file operation

:q  quit

:q! quit without save

:w [filename]  save file

 

最后送大家一张图吧  基本上上面这些都标出来了

Avatar_small
LoveDavid 说:
2012年9月18日 22:28

汗,没想到你第二篇就换成英语了...

开头就承认自己的文章写的不好,
倒是事实呵呵...
有时候人就是看别人的好文章很容易,自己写出来却不容易,

Avatar_small
evol128 说:
2012年9月19日 01:19

@LoveDavid: 没有办法,一直试图找一个学中文的mm,可惜不得

Avatar_small
LoveDavid 说:
2012年9月19日 03:42

@evol128:
什么意思?难道你对中文不熟?你是在国外长大的来着?

还是仅仅是学中文的mm帮你改写文章什么?

Avatar_small
evol128 说:
2012年9月19日 04:45

@LoveDavid: 没 我是土生土长的中国人 只是国外呆的有点久了= =

Avatar_small
某SSD 说:
2012年10月30日 13:05

连夜火速拜读文章

Avatar_small
seo service UK 说:
2023年11月02日 16:25

I am very happy to finally read about the Thank you very much. Your post was of great help to me. If you are interested in the column I wrote, please visit my site . You’re brilliant! Thank you! I experience the beneficial data you offer for your articles. Fantastic blog! I dont assume ive visible all the angles of this situation the way youve pointed

Avatar_small
seo service UK 说:
2024年1月16日 17:17

Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you includ


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter