vim支持nim學習筆記

一 :vim爲nim語言提供支持:

.語法高亮

.自動縮進

.vim中建立或跳轉到錯誤

.項目導航或跳轉到定義

二:安裝

安裝nimrod.vim很容易,但首先你需要安裝pathogen或vundle插件管理器。如果你已經安裝並使用pathogen或vundle開始工作了,則可以跳到最後一步。推薦你使用syntastic插件以獲得最佳的效果。


若你還沒有安裝pathogen,可以參考http://blog.csdn.net/dajiadexiaocao/article/details/49891641


三:Pathogen

step1:安裝pathogen,若你還沒有安裝,則可以參考上面的博客

step2:安裝nimrod.vim

使用下面的命令將nimrod.vim放到~/.vim/bundle/目錄中:

➜  ~  cd ~/.vim/bundle
➜  bundle  git clone git://github.com/zah/nimrod.vim.git

還要安裝synastic:

➜  bundle  git clone https://github.com/scrooloose/syntastic.git

四:Vundle

Vundle(Vim bundle)是一個Vim的插件管理器。它是把git操作整合進去,用戶需要做的只是去GitHub上找到自己想要的插件的名字,安裝、更新和卸載都可有vundle來完成了。

step1:安裝vundle

➜  ~  git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

修改用戶主目錄下的~/.vimrc,使vundle運行:

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" alternatively, pass a path where Vundle should install bundles
"let path = '~/some/path/here'
"call vundle#rc(path)

" let Vundle manage Vundle, required
Bundle 'gmarik/vundle'

filetype plugin indent on     " required

step2:安裝nimrod.vim

在上面配置的~/.vimrc文件的Bundle 'gmarik/vundle'之後,加上Bundle 'zah/nimrod.vim'和 Bundle 'scrooloose/syntastic'

保存~/.vimrc文件,然後重新啓動vim。 執行:BundleInstall,並且等待nimrod.vim安裝。


五:最後一步

最後需要將下面的配置添加到你的~/.vimrc中:

fun! JumpToDef()
  if exists("*GotoDefinition_" . &filetype)
    call GotoDefinition_{&filetype}()
  else
    exe "norm! \<C-]>"
  endif
endf

" Jump to tag
nn <M-g> :call JumpToDef()<cr>
ino <M-g> <esc>:call JumpToDef()<cr>i

其他一些vim插件:

https://github.com/scrooloose/syntastic

https://github.com/Shougo/neocomplcache


注:使用vim,源代碼可能有語法問題,調用一個外部工具,可能有它自己的錯誤。有時事情並不像預期那樣工作。在這種情況下,如果你想調試問題可以輸入e log://nimrod ,緩衝器將打開插件的調用日誌以及nimrod的idetool答案。

這可以給你一個提示問題出在哪裏,並且允許你複製vim插件生成的命令行的idetool參數,所以你可以爲這個插件或者nimrod編譯器準備一個測試用例。

 

參考資料:https://github.com/zah/nim.vim



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