vim 用戶手冊閱讀導覽

學習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(塊),構成一個完整的模塊。

命令詳解:

:代表 命令模式
[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 , 來對插件進行更新和安裝

https://github.com/gmarik/vundle

配置方法也在這個頁面裏面有。


其實還是有灰常多困難,只能慢慢摸索了 ...


QQ羣:213572677,剛建,有興趣就來交流吧 




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章