Vim 用户手册阅读导览

Linux大全评论683 views阅读模式

学习Vim 时遇到了困难,所以想做点工作来减低一下门槛 ...

先一个例子来说明文档的表示结构和方法 ...
#vim
  :help e117
内容如下:

  1.                                                 :cal :call E107 E117  
  2. :[range]cal[l] {name}([arguments])  
  3.                 Call a function.  The name of the function and its arguments  
  4.                 are as specified with :function.  Up to 20 arguments can be  
  5.                 used.  The returned value is discarded.  
  6.                 Without a range and for functions that accept a range, the  
  7.                 function is called once.  When a range is given the cursor is  
  8.                 positioned at the start of the first line before executing the  
  9.                 function.  
  10.                 When a range is given and the function doesn't handle it  
  11.                 itself, the function is executed for each line in the range,  
  12.                 with the cursor in the first column of that line.  The cursor  
  13.                 is left at the last line (possibly moved by the last function  
  14.                 call).  The arguments are re-evaluated for each line.  Thus  
  15.                 this works:  
  16.                                                 function-range-example  >  
  17.         :function Mynumber(arg)  
  18.         :  echo line(".") . " " . a:arg  
  19.         :endfunction  
  20.         :1,5call Mynumber(getline("."))  
  21. <  
  22.                 The "a:firstline" and "a:lastline" are defined anyway, they  
  23.                 can be used to do something different at the start or end of  
  24.                 the range.  
  25.   
  26.                 Example of a function that handles the range itself: >  
  27.   
  28.         :function Cont() range  
  29.         :  execute (a:firstline + 1) . "," . a:lastline . 's/^/\t\\ '  
  30.         :endfunction  
  31.         :4,8call Cont()  
  32. <  
  33.                 This function inserts the continuation character "\" in front  
  34.                 of all the lines in the range, except the first one.  
  35.   
  36.                 When the function returns a composite value it can be further  
  37.                 dereferenced, but the range will not be used then.  Example: >  
  38.         :4,8call GetDict().method()  
  39. <               Here GetDict() gets the range but method() does not.  

每一个 >(包括前面的block(块))<(包括后面的block(块)),包括><中间的block(块),构成一个完整的模块。

命令详解:

:代表 命令模式

[range]代表范围,[]表示option(可选)。

cal 表示调用,固定且必备。

{name}代表所要调用的函数名,name 是一个非固定值且必备。

([arguments]) 表示参数 左右括号是必须的,[arguments] 是非固定的并且是可选的。

接下来开始对学习进行导航 :

在命令模式下:

:help user-manual

打开用户手册,这或者vim最好的教程吧,嘻嘻 ,把光标 hjkl 移动到usr_02.txt 等高亮标签上面去,按着 <C-]>是跳转过去,<C-o>是跳转回来(按键为Ctrl + o),<C-t>是返回。

:help usr_02.txt 是一个quicktutor

接下来是如何产看现有的映射情况:

:map 是查看映射情况

:nmap 是查看normal模式下的映射情况

:vmap 是查看visual模式下的映射情况

:imap 是查看insert 模式下的映射情况
:set 则可以看到一些现有的设置,例如runtimepath

说起来英文真是半桶水,有些地方看来一知半解,所以还是要借助一下中文翻译。

http://vimcdoc.sourceforge.net/  (下载中文文档)

#wget http://prdownloads.sourceforge.net/vimcdoc/vimcdoc-1.8.0.tar.gz?download

#tar zxvf vimcdoc-1.8.0.tar.gz

此时注意要用普通用户身份运行安装脚本.它会把文档拷贝到$HOME/.vim 下。

#cd vimcdoc-1.8.0

#./vimcdoc.sh -i

这样就ok 了 ,接下来就可以使用 :set helplang=en 和  :set helplang=cn进行切换了 。

而在线的中文用户手册可以在这里,可以查看手册的目录树,还有检索:
http://vimcdoc.sourceforge.net/doc/help.html  
通过google 搜索来进行检索 例如 : “乌干达 site:vimcdoc.sourceforge.net”

而学习了部分基本操作之后,就需要进行配置和鼓捣插件了,这里有两个小技巧分享一下 .

1." 配置文件.vimrc更改后自动重新载入使设置生效,而不需要重新启动vim
autocmd! bufwritepost .vimrc source ~/.vimrc  

2.同时用插件管理系统 vbundle , 来对插件进行更新和安装

企鹅博客
  • 本文由 发表于 2020年10月6日 12:09:48
  • 转载请务必保留本文链接:https://www.qieseo.com/210614.html

发表评论