vim tips
来源:互联网 发布:three.js 顶点数 编辑:程序博客网 时间:2024/05/17 21:47
In my mind, vim is one tool, just to use it and be an expert step by step if needs.
---------------------------------------------------------
First step: open and edit
To one newer, we only need to know little commands to use vi/vim. There are 2 modes when we start it.
-- command mode : it is default mode, and we can't input characters as other text editors. We can input commands in this mode.
-- insert mode: we can edit text.
To switch from [command mode] to [insert mode], press "i".
To return [commnad mode], press "Esc"
There are some other modes in some documents, don't care about them. The others can be classified into [command mode] in someway.
Now, there are some useful commands in the [command mode]
--"dd", delete current cursor line
--"yy", copy current cursor line
--"nx", n is a number(1, 2, ....), delete n characters from the cursor
--"p", paste. maybe to below line for one line, maybe to follow the current cursor for characters
--"h"/"j"/"k"/"l", h: move left, j: move down, k: move up, l: move right. in the lastest version, the direction arrows work also.
--":q!" quit vim without save
--":w"/":wq" save(/save and quit) file
--"/words" search word, words respresents the string
Now we can edit file thought without efficiently.
---------------------------------------------------------
Further step: tips
--ctags
installation: don't use the package "elvis-tools", use the "exuberant-ctags"
preparation: to create one tags file for vim
---ctags -R *
---:set tags=tagsfilepath
usage:
---ctrl+] goto the defination
---ctrl+o go back
--plugins
To install plugin, just put vim file into ~/.vim/plugin, and help text to ~/.vim/doc. Use :helptags ~/.vim/doc in vim to create helps.
Here is one alternate plugin, it is useful, it was written by Michael Sharpe
please refer to:
http://www.vim.org/scripts/script.php?script_id=31
A few of quick commands to swtich between source files and header files quickly.
:A switches to the header file corresponding to the current file being edited (or vise versa)
:AS splits and switches
:AV vertical splits and switches
:AT new tab and switches
:AN cycles through matches
:IH switches to file under cursor
:IHS splits and switches
:IHV vertical splits and switches
:IHT new tab and switches
:IHN cycles through matches
--switch in files
--:e filename add new file into buffer
--:bn/bN switch to next/previous file
--:b(number) switch to nth file
--:bd remove current file from buffer
--:ls list files in buffer
---------------------------------------------------------
- Vim Tips
- VIM tips
- Vim Tips
- VIM Tips
- vim tips
- vim tips
- vim tips
- VIM Tips
- Vim Tips
- VIM Tips
- Vim tips
- vim tips
- vim tips
- vim tips
- Vim Tips
- vim tips
- VIM Tips
- Vim tips
- 我的Blog
- 最近三个月的阅读计划
- 实例解析:设计一个完全可扩展的应用
- JavaScript定义类的几种方式
- 关于使用showModalDialog传递参数出现中文乱码问题
- vim tips
- Oracle学习笔记八:安全管理
- WPF/Silverlight中的Command
- 呃,好晚了
- SQL2005下字符串字段内的字符排序
- 我的Emacs配置存放
- 090117.成长日记
- 有点sexy的iPhone应用程序
- Flash P2P 通信技巧(AS-Java-AS)