VIM cursor movement and copy and paste

Source: Internet
Author: User

Introduction to Vim

Vim is an upgraded version of VI, more than the VI features
Vim when editing the file is color display, vi is no color display
The default is no VIM installed, need to install Yum install-y vim-enhanced
Vim has three modes, namely General mode, edit mode, command mode
General mode: DD Delete command, yy copy command P paste command, etc.
Edit mode: After I was the editing mode, you can change the file additions and deletions,
Command mode: Do not press I before, or press ESC in edit mode to type Command mode to find replacements for files, and so on. Saving exits is also done in command mode.

Vim Quick Move Cursor position

When vim edits certain system files, the contents of the files are displayed in different colors in the directory of the environment variables specified by the system, so that they can be easily identified and modified.
such as:/etc/passwd and copy to/TMP/PASSWD configuration file is not the same, because the variable environment changes will not show multiple colors
Move cursor
Can be moved by the left or right key, can also be moved with letters

在普通模式下移动光标的快捷操作h 向左移动光标k 向上移动光标j 向下移动光标l 向右移动光标空格键也是向右移动光标数字加字母共同使用表示移动几行或几个字符位10h  向左移动10个字符10j  想下移动10行10k  向上移动10行10l  向右移动10个字符10空格键  向右移动10字符gg  文本的一行G 文本的最后一行^ 0 行首$ 行末3G  把光标定位到第三行ctrl+b/pageup    向上翻屏ctrl+f/pagedown  向下翻屏
Copy-cut paste in vim general mode
dd  删除一行,也属于剪切的,只可以剪切一行p   粘贴在光标所在位置的下一行P   粘贴在光标所在位置的上一行u   如果上次的操作有误,可以用u恢复一共可以恢复50次(距离上一次保存退出的结果为最初状态)ctrl+r  如果上次恢复多了想回到上一步,就用ctrl+ryy  复制 1yy复制一行x   向后删一个字符shift+x  大X向前删一个字符用v可以复制或者剪切从某个字符到某个字符的,点v然后移动光标选中需要复制或者剪切的内容,用yy是复制用x

VIM cursor movement and copy and paste

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.