A common sequence of events when editing files is to make a change and then need to test by executing the file you edited in a shell. If you're using vim, you could suspend your session (ctrl-Z), and then run the command in your shell. That's a lot o…
1.光标移动: (1).NG -> 移动到第N行,或者使用:N (2).gg -> 移动到第一行 (3).G -> 移动到最后一行 (4).单词移动: w -> 移动到下一个单词的开头 e -> 移动到下一个单词的结尾 (注:使用小写的e和w,如果认为单词由字母,数字,下划线组成,即程序变量,否则用大写的E和W,若认为单词由blank字符分隔,即程序语句) (5).%匹配括号移动,包括( , { , [ (6).#和*:匹配光标当前所在单词,#表示移动到上一个匹配单词,*表示…
删除文件中的空行 :g/^$/d g 表示 global,全文件 ^ 是行开始,$ 是行结束 d 表示删除该 这里只能匹配到没有白空符的空行,假如要删除有空白符的空行,则使用: :g/^\s*$/d \s* 表示 0 个或多个空白符.空符包包括空格.tab. 删除行尾空白符 :%s/\s*$//g 删除至少行尾多余空白符. 或: :%s/\ \s*$//g 要求行尾至少有一个空格,这样避免替换完之后,行尾符$ 被高亮.…
最佳vim技巧----------------------------------------# 信息来源----------------------------------------www.vim.org         : 官方站点comp.editors        : 新闻组http://www.newriders.com/books/opl/ebooks/0735710015.html : Vim书籍http://vimdoc.sourceforge.net/cgi-bin/vim…
Command Action Notes vim file +54 open file and go to line 54 any : command can be run using + on command line vim -O file1 file2 open file1 and file2 side by side   Insert enter insert mode so you can start typing. Alternatively one can use i ora. E…
发现了一个很棒的vim配置方法,现在共享给大家. https://github.com/kepbod/ivim   ivim - The Vim Distribution of Xiao-Ou Zhang See ivim's states on GitEgo Installation Manual Install A Vim/MacVim/gVim with version higher than 7.3 has been installed on your computer, and bac…
Source : This article is part of the ongoing Vi / Vim Tips and Tricks Series. As a Linux sysadmin or programmer, you may do following repetitive tasks while coding bash shell script: Adding file header Adding function/frame comment Including default…
键盘移动 (Move) 一切都从键盘的移动k -> 上 upj -> 下 downh -> 左 leftl -> 右 rightz -> 重画屏幕,当前光标变成屏幕的第一行 (redraw current line at top of window)CTRL-f -> 跳到下一页 (page down)CTRL-b -> 跳到上一页 (page up) 跳跃指令 (jumps) 跳跃指令类似于游览器中的<前进><后退>按钮CTRL-] -&…
ctrl + w + h 光标 focus 左侧树形目录 ctrl + w + l 光标 focus 右侧文件显示窗口 ctrl + w + w 光标自动在左右侧窗口切换 ctrl + w + r 移动当前窗口的布局位置 o 在已有窗口中打开文件.目录或书签,并跳到该窗口 go 在已有窗口 中打开文件.目录或书签,但不跳到该窗口 t 在新 Tab 中打开选中文件/书签,并跳到新 Tab T 在新 Tab 中打开选中文件/书签,但不跳到新 Tab i split 一个新窗口打开选中文件,并跳到该窗…
vim vimtutor ================================================================================ W e l c o m e t o t h e V I M T u t o r - Version 1.7 =欢迎使用VIM教程 1.7版=============================================================================== Vim is…