Vim "Learning Notes"

Source: Internet
Author: User

"2017-02-04"

First put a few better information, look at this information is good:

1.Vim Primer Foundation Http://www.jianshu.com/p/bcbe916f97e1

2.vim Configuration http://blog.csdn.net/g_brightboy/article/details/14229139

3. The concise Vim practice level introduction http://coolshell.cn/articles/5426.html

4.http://blog.csdn.net/mu_zhou233/article/details/53045831

"Update:2017-02-18" has learned to replace

Spit Groove: Install vim on Mac OS trouble ah ..., and Mvim does not support shift selection of the whining and CTRL and command the Gvim do not know which to press, or the good

My configuration file

"Candy? MacOSSet NumberSetRulerSettabstop=4SetShiftwidth=4SetautoindentSetsmartindentfiletype onsyntax Oncolorscheme DesertSetShowmatchSetGuifont=Monaco:h20SetMouse=aSetselection=ExclusiveSetSelectmode=Mouse,keynnoremap<F7> <esc>:w<cr>:!g++%-wall-o nnoremap<F8> <esc>:!. /Nnoremap<F9> <esc>:w<cr>:!g++%-wall-o a<cr>Nnoremap<F10> <esc>:!. /a<cr>
"Candy? WindowsSet NumberSetRulerSettabstop=4SetShiftwidth=4SetautoindentSetsmartindentfiletype onsyntax Oncolorscheme DesertSetShowmatchSetGuifont=CONSOLAS:H17SetMouse=aSetselection=ExclusiveSetSelectmode=Mouse,keynnoremap<F7> <esc>:w<cr>:!g++%-wall-o nnoremap<F8> <esc>:!Nnoremap<F9> <esc>:w<cr>:!g++%-wall-o a<cr>Nnoremap<F10> <Esc>:!a<CR>

The last few are for easy compilation

Monaco 20th on the Font mac (Monaco font is too cute ), windows with Consolas 17th

environment variable path setting for computer room:

C:\Program Files (x86) \vim\vim80; C:\Program Files (x86) \dev-cpp\mingw64\bin;

Command Overview:

command before adding a number n can repeat the command (usually the next n rows/s characters to command)

Usually lowercase letters are related to the next, uppercase letters are related to the upper

[Appendix] Some commands:

k                上移;j                下移;h                左移;l                右移。
gg 将光标定位到文件第一行起始位置;
G 将光标定位到文件最后一行起始位置;
0             数字0,左移光标到本行的开始;
$ 右移光标,到本行的末尾;
^       移动光标,到本行的第一个非空字符。

Fc

Fc

<C+u>
<C+d>
Ctrl+e            Scroll Backward one line        ctrl+y            Scroll forward one line   //windows no?
 
*          当光标停留在一个单词上,* 键会在文件内搜索该单词,并跳转到下一处;
/str1                正向搜索字符串 str1;n                    继续搜索,找出 str1 字符串下次出现的位置;N                    继续搜索,找出 str1 字符串上一次出现的位置;?str2 反向搜索字符串 str2 。

 
  
x                  删除光标所指向的当前字符;nx                 删除光标所指向的前 n 个字符;

dd 删除光标所在行,并去除空隙;ndd 删除(剪切) n 行内容,并去除空隙;
d$                从当前光标起删除字符直到行的结束;d0                从当前光标起删除字符直到行的开始;

dt" → 删除所有的内容,直到遇到双引号—— "

Both D and Y can be used as both sides plus range .... (The default first range is the current position)

p               小写字母 p,将缓冲区的内容粘贴到光标的后面;P               大写字母 P,将缓冲区的内容粘贴到光标的前面。
yy              复制当前行到内存缓冲区;nyy             复制 n 行内容到内存缓冲区;
“+y             1 行到操作系统的粘贴板;“+nyy           复制 n 行到操作系统的粘贴板。

u               撤消前一条命令的结果;
<C+r>      恢复命令. 重复最后一条修改正文的命令。

i            在光标左侧插入正文a            在光标右侧插入正文o            在光标所在行的下一行增添新行O            在光标所在行的上一行增添新行I            在光标所在行的开头插入A            在光标所在行的末尾插入
:n             将光标移到第 n 行

Regular expression substitution:

:s/str1/str2/         用字符串 str2 替换当前行中首次出现的字符串 str1:s/str1/str2/g        用字符串 str2 替换当前行中所有出现的字符串 str1
:%s 所有行:.,$ s/str1/str2/g 用字符串 str2 替换当前行到末尾所有出现的字符串 str1:1,$ s/str1/str2/g 用字符串 str2 替换正文中所有出现的字符串 str1
:m,ns/str1/str2/g 将从m行到n行的str1替换成str2

:split(可用缩写 :sp)            上下分屏;:vsplit(可用缩写 :vsp)          左右分屏。
<C+w+w> 切换
:res 大小

:tabnew 新标签
gt gT    标签切换

<< >> Indent

Visual block

<C+v> <C+q>

Vim "Learning Notes"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.