Vim & Emacs

13 篇文章 0 订阅
精读:
Learn Vim Progressively:
[url]http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/[/url]
Vim Tips and Tricks:
[url]http://www.unix.com/unix-dummies-questions-answers/132518-vim-tips-tricks.html[/url]


[b]必读:
Vi Cheat Sheet:
[url]http://www.lagmonster.org/docs/vi.html[/url]
Advanced Vi Cheat Sheet:
[url]http://www.lagmonster.org/docs/vi2.html[/url]
Vim wiki - Getting started:
[url]http://vim.wikia.com/wiki/Category:Getting_started[/url]
Vim Introduction and Tutorial:
[url]http://blog.interlinked.org/tutorials/vim_tutorial.html[/url][/b]
V I M T u t o r - Version 1.7:
[url]http://www.cse.msu.edu/~cse232/General/vim.tutorial[/url]
Vim wiki - Tutorial:
[url]http://vim.wikia.com/wiki/Tutorial#Vim_tutor[/url]
Vim tips: The basics of search and replace:
[url]http://www.linux.com/learn/tutorials/8255-vim-tips-the-basics-of-search-and-replace[/url]
Managing set options:
[url]http://vim.wikia.com/wiki/Managing_set_options[/url]
Vim documentation: options:
[url]http://vimdoc.sourceforge.net/htmldoc/options.html[/url]
Dictionary completions:
[url]http://vim.wikia.com/wiki/Dictionary_completions[/url]
Using tab pages:
[url]http://vim.wikia.com/wiki/Using_tab_pages[/url]
What is vimrc?
[url]http://vim.wikia.com/wiki/Open_vimrc_file[/url]
vim Searching:
[url]http://vim.wikia.com/wiki/VimTip1[/url]
Copy, cut and paste:
[url]http://vim.wikia.com/wiki/Copy,_cut_and_paste[/url]
Search and replace:
[url]http://vim.wikia.com/wiki/Search_and_replace[/url]
[b]Quick tips:
[url]http://vim.wikia.com/wiki/Quick_tips[/url]
Best Vim Tips:
[url]http://vim.wikia.com/wiki/Best_Vim_Tips[/url][/b]

关于vim中的tab键:
Secrets of tabs in vim:
[url]http://tedlogan.com/techblog3.html[/url]
Converting tabs to spaces:
[url]http://vim.wikia.com/wiki/Converting_tabs_to_spaces[/url]


关于 filetype:
[url]http://vimdoc.sourceforge.net/htmldoc/filetype.html#filetype[/url]
[url]http://vim.wikia.com/wiki/Keep_your_vimrc_file_clean[/url]


关于 autocmd:
[url]http://www.math.technion.ac.il/Site/computing/docs/vim/autocmd.html#autocmd-list[/url]
[url]http://www.thegeekstuff.com/2008/12/vi-and-vim-autocommand-3-steps-to-add-custom-header-to-your-file/#more-291[/url]


[b]常用快捷键及命令:[/b]
Normal Mode下:[quote][b]快捷键:[/b]
0 - 将光标移至当前行的行首
^ - 将光标移至当前行的首字符处(非whitespace字符)
$ - 将光标移至当前行的行尾
gg - 将光标移至文件首
G(aka. shift + g) - 将光标移至文件尾
ctrl + G (aka. ctrl + shift + g) - 查看文件及当前光标状态
q: - 在一个独立的窗口中查看执行过的vim命令历史( :q 退出该独立的命令历史窗口)
. - 重复执行上一个命令
'. or `' - 将光标定位到该文件最后被修改的行的行首
`" - 将光标定位到该文件最后一个被修改的字母处
42gg or 42G - 将光标定位到第42行的行首(也可以使用 :42 命令)
u - undo
ctrl + r(大写R也可) - redo
>> & << - 向后缩进 和 向前缩进
~ - 切换光标所在字母的大小写
[b]命令:[/b]
查看vim的版本 - :version
查看命令历史 - :history
写文件并退出 - :wq 或 [b]:x[/b] 或 使用快捷键ZZ
Save changes in Vim even if you forgot to sudo - [b]:w !sudo tee %[/b]
在当前缓冲区中打开一个新的文件 - :e fileName (e 代表 edit,若不知文件名字可以先 :ls)
在一个新的 tab 中打开一个新的文件 - :tabe fileName
查看vim的所有设置项option - :set all
显示某个option目前的值 - :set option?
将某个option设置为其默认值 - :set option&
Toggle boolean option - :set bool_option! or :set invbool_option
显示行号 - :set nu (or :set number)
(搜索前设置)忽略大小写 - :set ic (ic stands for ignorecase)
恢复为大小写敏感 - :set noic
Shows tabs (^l) and end of line ($) - :set list
查看被vim识别出来的当前文件的filetype - :set ft? (or filetype?)
查看当前 filetype 的状态 - :filetype
list the scripts that Vim has loaded - :scriptnames ([url]http://vim.wikia.com/wiki/List_loaded_scripts[/url])
执行外部shell命令 - :!command
forward direction search - /searchStr
backward direction search - ?searchStr
highlights all matches when searching - :set hlsearch
remove highlights - :nohl
替换整个文档中的指定文字 - :% s/old/new/gc (% 表示整个文档,s表示substitute,用new替换old,g表示global,c表示confirm;confirm时的选项 y/n/a/q/l/^E/^Y 分别表示 yes/no/all/quit/last/Ctrl+e:向下滚屏/Ctrl+y:向上滚屏)
替换当前行中的指定文字 - : s/old/new/g
将当前窗口切分成两个 - :split filename 。切分完后,ctrl+w+j 选择下面的窗口,ctrl+w+k 选择上面一个窗口。
使用替换功能,在所有行的行尾添加字符 “,” - :% s/$/,/g
将文本中所有的双引号 " 替换为 \"(注意\需要转义) - :% s/"/\\"/g
[/quote] insert mode下:[quote]Ctrl + p 或者 ctrl + n - autocomplete a word,p代表previous,n代表next
先ctrl + x,后ctrl + l - autocomplete the whole line
先在normal mode下 :set spell 将 spell设置为true,然后在insert mode下就可以:<ctrl + x> <ctrl + k> - 根据字典来做单词的autocomplete;这个功能在拼写复杂的或自己不会拼写的单词时特别有用!
[/quote]


删除一片:
[url]http://stackoverflow.com/questions/5362363/vim-how-to-delete-a-large-block-of-text-without-counting-the-lines[/url][quote]m a, d ' a
:10,290d [/quote]


常用 plugins:
NERD tree:
[url]http://www.vim.org/scripts/script.php?script_id=1658[/url]
[url]http://www.catonmat.net/blog/vim-plugins-nerdtree-vim/[/url]


[b]问题释疑:[/b]
1 insert mode下 退格键backspace 不起作用:
[url]http://tech.groups.yahoo.com/group/vim/message/84409[/url]
:set backspace=indent,eol,start



[url]http://blogger.org.cn/blog/more.asp?name=hongrui&id=29210[/url]


vi vim 快捷键
[url]http://nffish.com/archives/375[/url]
[url]http://www.ohlinux.com/?p=125[/url]
[img]http://dl.iteye.com/upload/attachment/217910/cf6c066c-6c7d-334a-967b-ddd2af2f70b6.gif[/img]
[img]http://dl.iteye.com/upload/attachment/217912/2e461ce1-6f8c-347c-a694-ecab65c7ee04.png[/img]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值