2009年8月1日星期六

VIM , ctags and supertab

唔知大家用咩editor去寫programme,ultraedit?source insight?呢d都係要俾錢,雖然有得crack,但係唔好用,唔夠快!小弟數年前有人介紹vim我用,個位人兄就係mike少,唔知佢仲有無用或者仲係未好懶咁用呢..哈哈.....我都懶用嫁,只不過好既plugin就一定要用!咁0岩轉工都要執下,順便係度介紹下啦!

plugin:
bufexplorer.vim
getscriptPlugin.vim
gzip.vim
matchparen.vim
minibufexpl.vim
netrwPlugin.vim
rrhelper.vim
ShowFunc.vim
spellfile.vim
supertab.vim
taglist.vim
tarPlugin.vim
themes.vim
tohtml.vim
vimballPlugin.vim
zipPlugin.vim


當中taglist.vim 同supertab.vim 好用到不得了。

taglist.vim 跟ctags 一起用,裝好ctags,
$ ctags -R ./
把cursor移到variable,function,marco name,按下
'ctrl'+']'
就會跳去declartion
'ctrl'+'t'
就會返回。

supertab.vim
只要按一下'tab',就會自動幫你完成長長的variable/function/marco name.....
就好似係shell 按'tab'完成file名 一樣..真係好正呀!@0@

常用command
:Tlist
:set fileformat=unix
:WMToggle
ctrl+w s

最喜愛的color scheme
metacosm.vim


小弟的_vimrc
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\ let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
colorscheme MetaCosm

let g:Tlist_Auto_Open = 1
let g:showfuncctagsbin = 'E:\work\Ctags.exe'

4 則留言:

  1. 以前在U時冇人叫你用呢個program?
    我記得以前係用vim去做editor架

    回覆刪除
  2. No ar, they just ask me to use vi

    回覆刪除
  3. 我都有用Sourceinsight + gvim. 其實我覺得各有優點。Editor i tried: Editplus, ultraedit, sourceInsight, gvim
    都係gvim 同sourceInsight比較好用, 但係我見過一個高手佢係用Dos prompt write program, 所以我覺得無話邊個特別好用, 只要你用慣o左你就會快~~

    回覆刪除
  4. 係呀..最緊要自己慣..不過vim真係好用同埋唔洗錢麻....我要推崇無錢軟件=0=

    回覆刪除