学习Vim 时遇到了困难,所以想做点工作来减低一下门槛 ...
先一个例子来说明文档的表示结构和方法 ...
#vim
:help e117
内容如下:
:cal :call E107 E117 :[range]cal[l] {name}([arguments]) Call a function. The name of the function and its arguments are as specified with :function. Up to 20 arguments can be used. The returned value is discarded. Without a range and for functions that accept a range, the function is called once. When a range is given the cursor is positioned at the start of the first line before executing the function. When a range is given and the function doesn't handle it itself, the function is executed for each line in the range, with the cursor in the first column of that line. The cursor is left at the last line (possibly moved by the last function call). The arguments are re-evaluated for each line. Thus this works: function-range-example > :function Mynumber(arg) : echo line(".") . " " . a:arg :endfunction :1,5call Mynumber(getline(".")) < The "a:firstline" and "a:lastline" are defined anyway, they can be used to do something different at the start or end of the range. Example of a function that handles the range itself: > :function Cont() range : execute (a:firstline + 1) . "," . a:lastline . 's/^/\t\\ ' :endfunction :4,8call Cont() < This function inserts the continuation character "\" in front of all the lines in the range, except the first one. When the function returns a composite value it can be further dereferenced, but the range will not be used then. Example: > :4,8call GetDict().method() < Here GetDict() gets the range but method() does not.
每一个 >(包括前面的block(块))<(包括后面的block(块)),包括><中间的block(块),构成一个完整的模块。