[vimtutor] h->left, j->down, k->up , L->right,
x,删除一个位
0,到行最前行
$, 到行的最后面
w,跳到下面一个单词头
e,调掉下一个单词后
3e, 跳到后面第三个词尾
2w, 跳到后面树第二个词头
dw (delete a word) 删除一个单词
d2w, 往后删除两个单词
dd, 删除整行
d$( del to until the line), 删除到行尾
u (undo once ), 返回上一次操作
U( undo all on the line), 返回整行的操作
CTRL + r ( re-undo the undo's ), 撤销返回操作
p ( put things here from "d" operations), 把d操作得到的东西,贴到这里
r (replace a bite), 替换一个位
ce(change to Word End) 从这里改变到词尾
c$ ( change to line end ) 从这里改变到行尾
"Text find Section "寻找文字会话
CTL+g(display ur location of the file), 显示光标位置,打开寻找文字会话
then "gg" points to head of the file, 光标至文件头
"G" to End of file,光标至文件尾
[
"/" phrase search forward, 词段搜索由光标处向前
"?" phrase search backward, 词段搜索光标处向后
then
"n" finds next occurrence, 按n找到下一个符合位
"N" in opposite direction. 输入N逆方向找到一个符合位
[
CTRL+"o" back where u from, 光标返回原来地方一次
Ctl+"i" forward 上面的反向方向定位光标
##注意这个光标可以运用到整个文字操作会话中
]
]
%, to find a matching parenthesis bracket 找到符合括号的处 (用于debug很给力)
substitute command:替换命令
在需要的那行里面输入输入
:s/thee/the (只会替换那行的第一个发现的thee成the)
:s/thee/the/g (加个g,就把整行中的所有的thee替换成the)
4. 要替换两行之间出现的每个匹配串,请输入 :#,#s/old/new/g (#,#代表的是
两行的行号)。输入 :%s/old/new/g 则是替换整个文件中的每个匹配串。
在两行内替换所有的字符串 old 为新的字符串 new,请输入 :#,#s/old/new/g
在文件内替换所有的字符串 old 为新的字符串 new,请输入 :%s/old/new/g (有了%就整个文件全部替换鸟)
进行全文替换时询问用户确认每个替换需添加 c 选项,请输入 :%s/old/new/gc (有c的时候会提醒你是否要替换)
:!是个好东西。可以运行shell, 返回shell里面的内容
v for visual selection, 按v之后,通过移动光标可以起到选择特定文本的作用
这时如果输入
:w /home/root/TEST (就将选定的内容写入到TEST文件中)
也可以在选择特定文本后,用d删除特定的文本,用p安放到特定的位置。
:r /home/root/TEST (将一个文件复制到光标处)
:r !ls (*将主目录的内容输入到光标处)
:r !df -h (*将硬盘信息输入到光标处)这里只要有探号!,后面的就是shell脚本的语法了
o (to open a line below the cursor, and input) o 在光标下面新开一行,插入
O ( to open a line above the cursor, and input) O在光标上面新开一行,插入
e ( move cursor to the end of next word) e 光标指到下个词词尾
w ( move cursor to the start of next word) w 光标指到下个词头
a ( to append some letters at the cursor region) a在光标处插入数据
A ( to append at the end of the line) A在行的最后面插入数据
R ( to replace more than one bite as following) R 用来替换更多的字符,连续
————————
y ( to yank letters) ( when using "v" to visual-token things, "y" copies things to memory) y用来猛抽选定的内容
yw (从光标处选定一个单词)
y2w (从光标处选择两个单词)好爽的说!!!
:set ic ( 设定搜索忽略大小写 ignore case )
:set noic ( 设定不忽略大小写 , 大小写区分 )
:set is ( show partial matches for a search phrase )
:set nois ( not)
:set hls (全局搜索高亮)
:set nohls ( 取消全局搜索高亮)
:set hls is (这样全局搜索的时候能全部高亮,并忽略大小写) 此时再输入:nohlsearch 在屏幕上过滤掉highlight高亮内容,但再全局搜索,高亮仍然有效
/helloworld\c (这个方法的意思是向下搜索helloworld, \c是 只在这一次里面取消case大小写搜索,并不是以后全局搜索也取消了大小写,这样用起来相对爽!)
---------------------------------------------------------
下面的是vim帮助部分啦!!!
:help 进入帮助界面 或者F1按钮
:help w (进入关于主题为w的帮助 )
:help user-manual (进入用户使用菜单的方面的帮助)
Ctrl + w , Ctrl + w (连击两次w,能在各个窗口中选择)#在Vim做IDE的时候很有效果
:r $VIMRUNTIME/vimrc_example.vim ( r是读一下这个vimrc启动脚本的例子)可以根据这个例子,自己指定一个vimrc.vim
:e (这时候输入ctrl + D, 输出命令以e开头的有那些, TAB键是补全)
这就是按了ctrl + D 的后果
:e
earlier echomsg elseif endif ex
echo echon emenu endtry execute
echoerr edit endfor endwhile exit
echohl else endfunction enew exusage
然后再选择就好了
然后这就差不多,把vim tutorial 学习完毕了,看起来也挺简单的。联系完毕后,明显感觉到打字速度与效率有高度提升,哈哈~