很多时候在用到vim的命令的时候,都会去网上搜索,殊不知,如果熟练使用VIM的help,可以达到事半功倍的效果。

下面介绍如何使用VIM的help:

1.      在vim的一般模式中输入:help可以进入vim的help界面

这里面注意:

Ctrl+]     在光标在链接位置的时候,可以直接跳到光标处

:q        退出help返回vim一般模式

其中的表示,要在命令行里输入“:helpi_<ESC>”,而不是输入“:help i_”后,再去按下ESC键。

4.在shell中输入“vimtutor”可以进入vim的 tutor。

其实,我感觉写的最好的vim的初级入门还是这篇文章。这里摘出其中的summary供参考。

vimtutor summary

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LESSON 1 SUMMARY

1.The cursor is moved using either the arrow keys or the hjkl keys.

h (left)  j(down)       k (up)      l(right)

2.To start Vim from the shell prompt type: vim FILENAME <ENTER>

3.To exit Vim type:      <ESC>  :q!   <ENTER>  to trash all changes.

OR type:          <ESC>  :wq  <ENTER>  to save the changes.

4.To delete the character at the cursor type: x

5.To insert or append text type:

i   typeinserted text   <ESC>        insert before the cursor

A   typeappended text   <ESC>         append after the line

NOTE: Pressing <ESC> will place youin Normal mode or will cancel

an unwanted and partially completed command.

Now continue with Lesson 2.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LESSON 2 SUMMARY

1.To delete from the cursor upto the next word type:    dw

2.To delete from the cursor to the end of a line type:    d$

3.To delete a whole line type:    dd

4.To repeat a motion prepend it with a number:  2w

5.The format for a change command is:

operator   [number]  motion

where:

operator - is what to do, such as d  for delete

[number] - is an optional count to repeat the motion

motion   - moves over the text tooperator on, such as  w (word),

$ (to the end of line), etc.

6.To move to the start of the line use a zero: 0

7.To undo previous actions, type:           u (lowercase u)

To undo all the changes on a line, type: U  (capital U)

To undo the undo's, type:                   CTRL-R

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LESSON 3 SUMMARY

1.To put back text that has just been deleted, type   p . This puts the

deleted text AFTER the cursor (if a line was deleted it will go on the

line below the cursor).

2.To replace the character under the cursor, type   r  and then the

character you want to have there.

3.The change operator allows you to change from the cursor to where the

motion takes you.  eg. Type  ce  tochange from the cursor to the end of

the word,  c$  to change to the end of a line.

4.The format for change is:

c  [number]   motion

Now go on to the next lesson.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LESSON 4 SUMMARY

1.CTRL-G  displays your location in thefile and the file status.

G  moves to the end of the file.

number  G  moves to that line number.

gg  moves to the first line.

2.Typing  /       followedby a phrase searches FORWARD for the phrase.

Typing  ?     followed by a phrase searches BACKWARD for the phrase.

After a search type  n  tofind the next occurrence in the same direction

or  N  to search in the opposite direction.

CTRL-O takes you back to older positions, CTRL-I to newer positions.

3.Typing  %     whilethe cursor is on a (,),[,],{, or } goes to its match.

4.To substitute new for the first old in a line type    :s/old/new

To substitute new for all 'old's on a line type         :s/old/new/g

To substitute phrases between two line #'s type      :#,#s/old/new/g

To substitute all occurrences in the file type          :%s/old/new/g

To ask for confirmation each time add 'c'              :%s/old/new/gc

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LESSON 5 SUMMARY

1.  :!command  executes an external command.

Some useful examples are:

(MS-DOS)      (Unix)

:!dir              :!ls              - shows a directory listing.

:!del FILENAME   :!rm FILENAME   - removes file FILENAME.

2.  :w FILENAME  writes the current Vim file to disk with nameFILENAME.

3.  v  motion :w FILENAME  saves the Visuallyselected lines in file

FILENAME.

4.  :r FILENAME  retrieves disk file FILENAME and puts itbelow the

cursor position.

5.  :r !dir  reads the output of the dir command and putsit below the

cursor position

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LESSON 6 SUMMARY

1.Type  o to open a line BELOW the cursor and start Insert mode.

Type  O  to open a line ABOVE the cursor.

2.Type  a to insert text AFTER the cursor.

Type  A  to insert text after the end of the line.

3.The  e command moves to the end of a word.

4.The  y operator yanks (copies) text, p  puts (pastes) it.

5.Typing a capital  R  enters Replace mode until  <ESC> is pressed.

6.Typing ":set xxx" sets the option "xxx".  Some options are:

'ic' 'ignorecase' ignore upper/lower case when searching

'is''incsearch'   show partial matches for asearch phrase

'hls''hlsearch'   highlight all matchingphrases

You can either use the long or the short option name.

7.Prepend "no" to switch an option off:   :set noic

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LESSON 7 SUMMARY

1.Type  :help  or press <F1> or <Help>  to open a help window.

2.Type  :help cmd  to find help on  cmd .

3.Type  CTRL-W CTRL-W  to jump to another window

4.Type  :q to close the help window

5.Create a vimrc startup script to keep your preferred settings.

6.When typing a  :  command, press CTRL-D to see possiblecompletions.

Press <TAB> to use one completion.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

如何使用VIM的Help相关推荐

  1. 初试linux编译(ubuntu+vim)+玩转智能蛇

    一.初试linux编译(ubuntu+vim) 步骤: ①下载vmware15+ubuntu桌面版映像 ②安装ubuntu ③下载vim+gcc 在ubuntu终端输入: sudo apt-get i ...

  2. Linux shell 学习笔记(6)— vim 编辑器使用方法及技巧

    1. 检查 vim 软件包 1.1 CentOS 发行版 $ alias vi alias vi='vim' $ $ which vim /usr/bin/vim $ $ ls -l /usr/bin ...

  3. linux高效办公环境配置(vim、tmux、bash_profile)

    文章目录 Vim 个人设置(.vimrc) tmux 安装参考 个人配置(.tmux.conf) bash_prifile 个人配置(.bash_profile) shell Vim 个人设置(.vi ...

  4. vim中tab键8空格换4空格

    前言 很多时候,都看不惯vim中tab键8个空格,觉得这个空格实在是太长了,浪费屏幕,那么现在就让你解决掉8个tab键8个空格,换成4个空格. 具体步骤 打开文件:/etc/vimrc vim /et ...

  5. Centos7 下安装VIM编辑器

    我们在安装完Centos后,它默认的是安装了VI编辑器,VIM是没有安装的,所以我们在使用vim test.txt时会提示: vim command not found ... 这就是说明我们的Lin ...

  6. VIM配置攻略(最强干货加强版)

    自己最近也在折腾这个VIM的配置,在网上也看了很多教程等,说真的看的一头雾水.主要是对于一个初学者来说对Vundle等根本没有什么了解,也不知道怎么用,并且由于本人的Linux系统是CentOs6.5 ...

  7. Vim 命令、操作、快捷键全集

    Vim是一个类似于Vi的著名的功能强大.高度可定制的文本编辑器,在Vi的基础上改进和增加了很多特性.Vim是自由软件. 命令历史 以:和/开头的命令都有历史纪录,可以首先键入:或/然后按上下箭头来选择 ...

  8. centos 6安装 vim

    centos 安装vim 1.首先查询当前当前vim所依赖的包存在不存在.检查缺少哪个几个依赖包 [root@bogon firstCopy]# rpm -qa|grep vivim vim-comm ...

  9. [skill] vim 操作多个window

    前言: 分辨率越来越高,屏幕越来越大,行最长80不变,屏幕利用空白越来越大. 开多个window吧! 开window的命令: 平行开一个window :split <//path/file> ...

  10. vim+vundle配置

    Linux环境下写代码虽然没有IDE,但通过给vim配置几个插件也足够好用.一般常用的插件主要包括几类,查找文件,查找符号的定义或者声明(函数,变量等)以及自动补全功能.一般流程都是下载需要的工具,然 ...

最新文章

  1. 如何制作自己的CocoaPod库
  2. HDLBits 系列(3)Priority Encoder(Case/Casez)
  3. AngularJS开发指南4:指令的详解
  4. python 带参数的多重继承
  5. js取消气泡事件、阻止浏览器的默认行为
  6. php 正则 尖括号,php使用正则表达式提取字符串中尖括号、小括号、中括号、大括号中的字符串...
  7. matlab中创建一个工程,从文件夹创建新工程
  8. bzoj1304 [CQOI2009]叶子的染色 dfs+树形dp
  9. 平面设计背景素材|打造超酷的炫彩光束光效海报!
  10. springcloud工作笔记101---强大的代码自动提示工具_aiXcoder智能编程_以及开源java工具大全_提升开发效率
  11. 有哪些行业或生意是电商无法取代的?
  12. tsql_TSQL的历史
  13. 不是吧?!程序员月入10w,原因竟然是这个......
  14. DevExpress统计图TextPattern说明
  15. UI自动化 win32 模拟键盘按键
  16. php带图片的每日单词,GRE背单词-每日十个单词(第一天) - 英语家园
  17. java播放MP3/APE音乐文件
  18. 10.12 SNK中国 游戏客户端 二面40min
  19. php 模拟蜘蛛,PHP实现使用CURL模拟百度蜘蛛进行采集
  20. 大数据在快狗打车中的应用与实践

热门文章

  1. webpack 配置详解
  2. Servlet 应用程序事件、监听器
  3. POJ 2353 DP
  4. window-memcache技术随笔
  5. 模板-1-模板类的特化
  6. 制作巴士电台彩蛋一枚
  7. 《子弹笔记术》[日]杉野干人(作者)epub+mobi+azw3格式下载
  8. 动态加载vs静态加载
  9. Mustache.js使用笔记(内容属于转载总结)
  10. C/C++预处理宏的总结