资讯专栏INFORMATION COLUMN

Vim session

nanfeiyan / 2166人阅读

摘要:练级攻略的纵向编辑模式第一步修改将数列中第二段所有数字修改为将游标定位第一个行的进入纵向编辑模式移动游标到最后一行,可视块覆盖所要修改的列进入修改模式输入数字第二步前添加在所有行之前添加将游标定位到第一行第一列进入纵向编辑模式

vimtutor

intro

vim history (where I can use vim, vi, git diff)

how to install vim on atom/vs/chrome/terminal

edit a file with vi

vim/unix shortcut

vim tips

vim vs other editors

so fast and lite
can open big file
write code without mouse
pipe(compose) everything (command, text)

related

http://www.vim.org/
http://www.openvim.com/

VIM 练级攻略
http://coolshell.cn/articles/...

vim cheatsheet
https://kapeli.com/cheat_shee...…

vim notes
http://www.boydwang.com/2016/...

vimscript
http://learnvimscriptthehardw...

vim skills
http://vimcasts.org/

vim tips
http://vim.wikia.com/wiki/Bes...

meet surround
https://github.com/tpope/vim-...

Vim 的纵向编辑模式

Demo:
10.1.5.214
10.1.5.212
10.1.5.210
->
ping -c 4 10.5.5.214 >> result0
ping -c 4 10.5.5.212 >> result0
ping -c 4 10.5.5.210 >> result0

Solution:

第一步:修改

将 IP 数列中第二段所有数字“1” 修改为“5”,将游标定位第一个行的“1”,ctrl-v 进入纵向编辑模式,G 移动游标到最后一行,可视块覆盖所要修改的列,r 进入修改模式, 输入数字“5”

第二步:前添加

在所有行之前添加“ping – c 4 ”,将游标定位到第一行第一列,ctrl-v 进入纵向编辑模式,G 移动游标到最后一行第一列,可视块覆盖了第一列, I 进入行首插入模式,输入所要求字符“ping – c 4

第三步:后添加“>> result0”:

将游标定位到第一行最后一列, ctrl-v 进入纵向编辑模式, G 移动游标到最后一行最后一列,覆盖了最后一列, A 进入行尾插入模式输入所要求字符“>> result0”
以上三个步骤有一个共同特点,就是都纵向为编辑方向

vim class1 -basic motions and commands

vim class2 宏

g+g (go to beginning)

G(jump to the end of file)

shift+z+z (= Esc+ : +wq)

Esc+q+! (force quit)

Esc(ctrl + c)

Mode

Insert

Normal

Command(:w filename - save the file)

Visual

Insert -> Normal : ESC/Ctrl+[ Insert -> Command : (Insert -> Normal) -> : Command -> Normal : Enter
Pen to the page

(i=insert、a=append、r=replace)

i-Enter insert mode at cursor

I-Enter insert mode at first non-blank character

a-Enter insert mode after cursor

A-Enter insert mode at the end of the line

o-Enter insert mode on the next line

O-Enter insert mode on the previous line

s-Delete character under cursor and enter insert mode

S-Delete line and begin insert at beginning of same line

C-Delete from cursor to end of line and begin insert

Scanning the canvas

------k

h-----------L

------j
2j(move down two lines)
Basics

w - Forward to the beginning of next word(Example, cw-change word, diw-delete word)

W-Forward to the beginning of next WORD(after whiteSpace)

b-Backward to the next beginning of a word

B-Backward to the next beginning of a WORD

e-Forword to the next end of word

E-Forword to the next end of WORD

0/home-Move to the zeroth character of the line

$-Move to the last character of the line

^-Move to the first non-blank character of the line

H-光标移到当前屏幕最上方行的第一个字符

M-光标移到当前屏幕最中间行的第一个字符

L-光标移到当前屏幕最下方行的第一个字符

G-到此文件最后一行

nG-移动到第n行

gg-相当于1G, 即回到行首

块操作(ctrl + v)

ctrl + v(开启块操作)

hjkl移动光标

I— (插入—)

ESC键来使每一行生效

n+Enter - 光标下移n行

[n]f - Forward until (nth)(o) (Inclusive)

[n]F - Backward until (nth)(o) (Inclusive)

[n]t - Forward until (nth)(o) (Exclusive)

[n]T - Backward until (nth)(o) (Exclusive)

Search:

/ search forward

? search backward

"*" 聚焦当前cursor forword(bounded)

n-next result, forward

N-next result, backward

"#" 当前cursor下的指令 backward(bounded)

:set ignorecase -- will search ignore case /c forward -- will case insensitive to find forward
Replace

:%s/foo/bar/g (在当前文件查找foo替换成bar)

:s/foo/bar/g (在当前行查找foo替换成bar)

:%s/foo/bar/gc

:%s//bar/gci/I (foo only whole words, ask for confirmation, case insensitive/sensitive)

n1,n2s/foo/bar/g(在n1行n2行查找foo替换成bar)

Copy/Paste

y-Yank. Example: 2yy(copy current two lines)

p-将已复制的粘贴到光标所在下一行

P-将已复制的粘贴到光标所在上一行

v-visual selection

Delete:

x/X 删除光标处字符, 光标前的字符

dd(删除所在行)

ndd(删除光标所在行以下n行)

d1G(删除光标所在行到第一行所有数据)

dG(删除光标所在行到最后一行所有数据)

d$(删除光标所在行到同行最后一个字符)

d0(删除光标所在行到同行第一个字符)

:1,8d(删除1~8行) OR VggGd

Undo

u恢复前一次所做的删除

ctrl+R (undo change)

.(重复上一个操作)

Scroll

ctrl+f(屏幕向上滚动一页)

ctrl+b(屏幕向下滚动一页)

ctrl+u(屏幕向下滚动半页)

ctrl+d(屏幕向下滚动半页)

ifb

i向两侧扩张选择能match的string,Example,(, {, [

f/t向左侧扩张选择, cursor就在当前character下/前

b向右侧扩展选择 Example:yiw(delete word)

vim symmary |

动词 y p d
操作 i f b
选择 ( ) sentence(.)
选择 { } paragraphs(empty line)
选择 [[ ]] section
format =
convenient

zz center window

"+ y copy to system clipboard

*(search word)

:reg (look history copy record)

% (go to last matched braket)

VS

ctrl+"-"(last cursor)

ctrl+y(undo change in vs)

System

cmd+ctrl+f (maximum screen)

vim tips

:g/^/m0: reverse all lines http://vim.wikia.com/wiki/Rev...
= (indent)
copy to system clipboard "+y
clibboard history (:reg) "number p

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/25010.html

相关文章

  • Git全局忽略和Vim Session的结合

    摘要:全局忽略和有一个功能,可以用来保存现在打开的文件窗口布局等设置,相当于是很多编辑器的下次登陆自动打开上次未关闭的文件的功能。 Git的全局忽略功能 我知道这个功能也是通过Google来的,Stack Overflow上的一个回答给出了方案,地址是:http://stackoverflow.com/questions/7335420/global-git-ignore。我这里就当做是翻...

    Allen 评论0 收藏0
  • 用Nginx+Redis实现session共享的均衡负载

    摘要:于是乎,,,搜到最多的词就是均衡负载,搭配的一般都是。回头再看看,先换个浏览器首次访问再次访问带上首次访问带上再次次访问可见的确是达到了均衡负载同时共享的目的。 前言 大学三年多,也做个几个网站和APP后端,老是被人问到,如果用户多了服务器会不会挂,总是很尴尬的回答:哈哈,我们的用户还少,到了服务器撑不住的时候,估计都上市了吧。说是这么说,但是对于有强迫症的我,这个问题一直回响在我脑海...

    ZHAO_ 评论0 收藏0
  • 用Nginx+Redis实现session共享的均衡负载

    摘要:于是乎,,,搜到最多的词就是均衡负载,搭配的一般都是。回头再看看,先换个浏览器首次访问再次访问带上首次访问带上再次次访问可见的确是达到了均衡负载同时共享的目的。 前言 大学三年多,也做个几个网站和APP后端,老是被人问到,如果用户多了服务器会不会挂,总是很尴尬的回答:哈哈,我们的用户还少,到了服务器撑不住的时候,估计都上市了吧。说是这么说,但是对于有强迫症的我,这个问题一直回响在我脑海...

    jifei 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<