Original Eco vim using shortcut keys

Source: Internet
Author: User

My first blog, 2 o'clock in the morning overtime do not want to sleep, casually write points. I rookie one, study hard, strive to become a great God.

The first article to write something, I am currently engaged in the operation of the dimension, as the saying goes, "工欲善其事 its prerequisite", vim as the most basic tool, just this two days finishing a bit, write a bit about vim.

The title is called the original ecological vim, what is the meaning of the original ecology, that is to say do not install any plug-in meaning .... Okay, nonsense don't say, on dry!!!!!

RELATED links:

1.http://coolshell.cn/articles/1679.html Vim split screen usage related introduction

2.http://coolshell.cn/articles/11312.html-free VIM programming Tips

3.http://coolshell.cn/articles/5426.html/comment-page-9#comments Vim Practice Level Guide

Vim training in the introduction of the use of vim in four stages, so this document will be sorted according to the four stages, four stages are:

1. Survival (beginner entry);

2. Feel good;

3. Feel better, stronger, faster;

4. The ability to use VIM;

I. Survival (Beginner entry)

1.vim Mode Introduction

  1) Normal模式, 启动vim以后自动进入Normal模式  2) Insert模式, 按下i键进入insert模式,此时屏幕左下角出现 -- INSERT -- 字样。在此模式下你可以像用"笔记本"那样,      ESC键返回Normal模式2.快捷键介绍  i     -> insert模式, 按ESC返回Normal模式  x     -> 删除当前光标所在的一个字符  :wq   -> 保存并退出  dd    -> 剪切光标所在的行  p     -> 粘贴剪贴板推荐:  hjkl在Normal模式下,使用hjkl分别代表←, ↓, ↑,方向键进行光标移动。  :help <command> -> 显示相关命令的帮助。你也可以就输入:help而不跟命令,使用:q退出

Two. Feel Good stage

本阶段介绍的命令全部都在Normal模式下使用。若果你不知道什么是Normal模式,请看第一阶段,或者多按几次ESC键1.各种插入模式快捷键  a -> 在光标后插入
A -> 在光标行最后插入 o -> 在当前行后插入新的一行 O -> 在当前行前插入新的一样 I -> 在当前行的最前面插入 cw -> 替换从光标所在位置后到一个单词结尾的字符2.简单的移动光标 0 -> 数字零, 到行头 ^ -> 到本行第一个不是blank字符的位置(所谓blank字符就是空格, tab, 换行, 回车等) $ -> 到本行行尾 g_ -> 到本行最后一个不是blank字符的位置 /pattern -> 搜索pattern的字符串(如果搜索出多个匹配, 可按n键到下一个, N键到上一个)3.拷贝/黏贴 P -> 粘贴,当前光标行的上一行 p -> 粘贴,当前光标行的下一行 yy -> 拷贝当前行

Three. Better, stronger, faster

1.更好  . -> 小数点,可以重复上一次的命令  N<command> -> 重复某个命令N次2.更强  NG -> 到第N行,也可以使用:N,比如:3,跳到第三行  gg -> 到第一行  G  -> 到最后一行  w -> 到下一个单词的开头  e -> 到下一个单词的结尾    如果你认为单词是默认方式,那就么就用小写e和w。默认上来说,一个单词有字母,数字和下划线组成    如果认为单词是由blank字符分隔, 那么你需要使用大写的E和W  *和# -> 匹配光标当前行所在的单词, 移动光标到下一个(或上一个)匹配单词3.更快  一定要记住光标的移动,因为很多命令都可以和这些移动光标的命令连动。  <start position><command><end position>  例如: 0y$命令意味着  0 -> 先到行头  y$ -> 从这里开始拷贝, 到本行最后一个字符结束  ye -> 从当前位置拷贝到本单词的最后一个字符  y$ -> 从当前位置拷贝到本行最后一个字符  v$ -> 选中当前位置到本行最后一个字符  gU -> 选中的字符变大写  gu -> 选中的字符边小写  字符含义介绍:  d -> 删除  v -> 可视化的选择

Four. Vim Super Power

1. Move the cursor on the current line: 0, ^, $, F, F, T, T 0 and Digital Zero, to the position of the first line not the blank character (the so-called blank character is a space, tab, line break, carriage return, etc.) $--to the end of the bank FA--to the next character of a, you can also fs to the next character T,--the first character before the comma. Commas can also be other characters 3FA--in the current line to find out the third occurrence of a f and T-and F and T action is the same, except that the cursor moves in the opposite direction of the DTD----delete all content until the D character 2 is encountered. Regional Selection <action>a< Object> or <action>i<object> action can be any command, such as D (delete), Y (copy), V (Visual mode Selection) object may be: W A word, w a word separated by a space, s a sentence, p a paragraph, can also be a special character),], and so on the assumption that you have a character string (map (+) ("foo")).  And the cursor key is at the first O's position.  Select "foo" ("foo") ("foo") v2i)--Choose foo (+) ("foo")--will select the map (+) v2a) Select (Map (+) ("foo")) 3. Block operation typical block operation: 0 Ctrl + V ctrl+d I enters insert mode ESC4. Automatically prompts CTRL + N and ctrl+p in insert mode, you can enter a word that opens  Head, and then press CTRL + N or CTRL+P, the auto-completion function appears. 5.vim split screen operation 1) split screen start a. Use the uppercase O parameter to split the screen vertically vim-on file1 file2 file3 ... b. Use the lowercase o parameter to split the screen horizontally vim-on file1 file2 file3    ... Note: N is a number that represents divided into several screens 2) Turn off split screen ctrl+w c 3) split screen A. Split the currently open file up and down ctrl+w s B. Split up and down and open a new textParts: SP filename c. Split the currently open file Ctrl+w v D. Split right and left, and open a new file: VSP filename 4) Move cursor A. Move the cursor to the screen Ctr L+w h B. Move the cursor to the left of the screen ctrl+w L C. Move the cursor to the screen above Ctrl+w K D. Move the cursor to the screen below Ctrl+w J 5) split screen sync move to make the files in the two split screen  Step move, very simple, you need to synchronize the mobile two screen to enter the following command: Set SCB if you need to untie, enter the following command: Set scb!    6.vim operation a directory directly vim a directory, you will enter a page, through the J,k key to move up and down, into a directory or open a file.    ---up to the top level directory D-delete file (uppercase) R--Change to file name (uppercase) s----Files sorted by X-: CD <dir> changes current directory :P WD--View current directory 7. Save session If you open a number of files, but also set a variety of scrolling synchronization, or line numbers and so on, then you can use the following command to save the session: Mksession ~/.mysession.vim If the file is heavy      , vim defaults to error, if you want to forcibly write, you can add after mksession! : mksession! ~/.mysession.vim so next time, you can open this session like this: Vim-s ~/.mysession.vim

Almost all of these mastered the use of vim is very smooth, do not recommend a one-time full remember, you can learn 2 shortcut keys every day.
Next, prepare to introduce tmux this operation and maintenance artifact.

Original Eco vim using shortcut keys

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.