文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>滇狐的.vimrc与插件

滇狐的.vimrc与插件

时间:2010-10-19  来源:xiaolzz

以下的资料全部来源于作者滇狐,如果想访问滇狐的主页请点击 滇狐主页

想获取滇狐在vim所用的插件请点这里, 下载后解压,将文件名改为.vim并复制到根目录下即可。
滇狐的.vimrc内容如下,下载请点这里,下载解压后将文件名改为.vimrc(另一种方法是:在根目录下新建.vimrc文件,将下面的内容复制到.vimrc中)
备注:一些设置与插件有关

"=============================================================================
" General settings
"=============================================================================

set nocp

" Tab related
set ts=4
set sw=4
set smarttab
set et
set ambiwidth=double

" Format related
set tw=78
set lbr
set fo+=mB

" Indent related
set cin
set ai
set cino=:0g0t0(susj1

" Editing related
set backspace=indent,eol,start
set whichwrap=b,s,<,>,[,]
set mouse=a
set selectmode=
set mousemodel=popup
set keymodel=
set selection=inclusive

" Misc
set wildmenu
set spell

" Encoding related
set encoding=utf-8
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1

" File type related
filetype plugin indent on

" Display related
set ru
set sm
set hls
if (has("gui_running"))
    set guioptions+=b
    colo torte
    set nowrap
else
    colo ron
    set wrap
endif
syntax on

" ============================================================================
" Shortcuts
" ============================================================================

" Move lines
nmap <C-Down> :<C-u>move .+1<CR>
nmap <C-Up> :<C-u>move .-2<CR>

imap <C-Down> <C-o>:<C-u>move .+1<CR>
imap <C-Up> <C-o>:<C-u>move .-2<CR>

vmap <C-Down> :move '>+1<CR>gv
vmap <C-Up> :move '<-2<CR>gv

" Toggle line number
nmap <C-F12> :set nu!>
imap <C-F12> <C-o>:set nu!>

" Toggle spell check
" For VIM7 only
nmap <C-F11> :setlocal spell!>
imap <C-F11> <C-o>:setlocal spell!>

"=============================================================================
" Modes
"=============================================================================

function EnglishMode()
    "set imactivatekey=
    "set noimcmdline
    "set iminsert=0
    "set imsearch=0
    setlocal spell
endfunction
command -nargs=0 EnglishMode call EnglishMode()

function ChineseMode()
    "set imactivatekey=C-space
    "set noimcmdline
    "set iminsert=2
    "set imsearch=2
    setlocal nospell
endfunction
command -nargs=0 ChineseMode call ChineseMode()

function TextMode()
    setlocal nocin
    setlocal nosm
    setlocal noai
    setlocal tw=78
endfunction
command -nargs=0 TextMode call TextMode()

function CodeMode()
    setlocal cin
    setlocal sm
    setlocal ai
    setlocal tw=78
endfunction
command -nargs=0 CodeMode call CodeMode()

function MailMode()
    call TextMode()
    setlocal ft=mail
    setlocal tw=70
endfunction
command -nargs=0 MailMode call MailMode()

function BBSMode()
    call MailMode()
    call ChineseMode()
    setlocal ft=bbs
    setlocal fenc=cp936
    setlocal tw=78
endfunction
command -nargs=0 BBSMode call BBSMode()

function VikiMode()
    call ChineseMode()
    setlocal ft=viki
endfunction
command -nargs=0 VikiMode call VikiMode()

"=============================================================================
" Functions
"=============================================================================

function TimeStamp()
    let curposn= SaveWinPosn()
    %s/\$Date: .*\$/\=strftime("$Date: %Y-%m-%d %H:%M:%S$")/ge
    %s/Last Change: .*$/\=strftime("Last Change: %Y-%m-%d %H:%M:%S")/ge
    %s/Last Modified: .*$/\=strftime("Last Modified: %Y-%m-%d %H:%M:%S")/ge
    " Replace once and never update.
    %s/Created: *$/\=strftime("Created: %Y-%m-%d %H:%M:%S")/ge
    call RestoreWinPosn(curposn)
endfunction
command -nargs=0 TimeStamp call TimeStamp()

function AutoTimeStamp()
    augr tagdate
    au!
    au BufWritePre,FileWritePre * call TimeStamp()
    augr END
endfunction
command -nargs=0 AutoTimeStamp call AutoTimeStamp()

function NoAutoTimeStamp()
    augr tagdate
    au!
    augr END
endfunction
command -nargs=0 NoAutoTimeStamp call NoAutoTimeStamp()

command -nargs=1 Margin exec "match Error /.\\%>" . (<args> + 1) . "v/"
command -nargs=0 NoMargin match none

function CodeLayout()
    call CodeMode()
    WManager
    Tlist
endfunction
command -nargs=0 CodeLayout call CodeLayout()

function CodeLayoutSmall()
    call CodeLayout()
    set columns=141
    exec "norm \<c-w>l"
    set nu
    set lines=100
endfunction
command -nargs=0 CodeLayoutSmall call CodeLayoutSmall()

function CodeLayoutLarge()
    call CodeLayout()
    set columns=226
    exec "norm \<c-w>l"
    set nu
    vsplit
    set lines=100
endfunction
command -nargs=0 CodeLayoutLarge call CodeLayoutLarge()

" ============================================================================
" Plugins settings
" ============================================================================

" Sketch
command -nargs=0 ToggleSketch call ToggleSketch()

" Tlist
let Tlist_Use_Right_Window=1
let Tlist_File_Fold_Auto_Close=1

" A
let g:alternateNoDefaultAlternate=1
let g:alternateRelativeFiles=1

" Viki
let g:vikiNameSuffix=".viki"
 BufRead,BufNewFile *.viki call VikiMode()

" BBS
autocmd! BufRead,BufNewFile *.bbs call BBSMode()

" Mail
 FileType mail call MailMode()

" FencView
let g:fencview_autodetect=0

"=============================================================================
" Platform dependent settings
"=============================================================================

if (has("win32"))

    "-------------------------------------------------------------------------
    " Win32
    "-------------------------------------------------------------------------

    if (has("gui_running"))
        set guifont=Bitstream_Vera_Sans_Mono:h9:cANSI
        set guifontwide=NSimSun:h9:cGB2312
    endif

    " For Viki
    let g:netrw_browsex_viewer="start"

    " For tee
    set shellpipe=2>&1\|\ tee

    " VimTweak
    if (has("gui_running"))
        command -nargs=1 SetAlpha call libcallnr("vimtweak.dll",
            \"SetAlpha", <args>)
        command -nargs=0 TopMost call libcallnr("vimtweak.dll",
            \"EnableTopMost", 1)
        command -nargs=0 NoTopMost call libcallnr("vimtweak.dll",
            \"EnableTopMost", 0)
    endif

else

    "-------------------------------------------------------------------------
    " Linux
    "-------------------------------------------------------------------------

    if (has("gui_running"))
        set guifont=Bitstream\ Vera\ Sans\ Mono\ 9
    endif

    " For Viki
    let g:vikiHomePage="~/document/Viki/index.viki"
    let g:netrw_browsex_viewer="kfmclient exec"

    set makeprg=build

endif



错误说明:
我在操作以上步骤之后出现了以下的错误,不知道其他人会不会遇到我这样的情况。

xiaolluo@ubuntu:~/workspace$ vim
处理 /home/xiaolluo/.vimrc 时发生错误:
第 219 行:
E492: 不是编辑器的命令: BufRead,BufNewFile *.viki call VikiMode()
第 225 行:
E492: 不是编辑器的命令: FileType mail call MailMode()
Taglist: Exuberant ctags (http://ctags.sf.net) not found in PATH. Plugin is not loaded.


解决方法是:将219, 225所在的行注释掉, 然后安装ctags。ubuntu中的命令为 sudo apt-get install ctags
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载