以下是滇狐自己的
.vimrc,有许多根据滇狐自己的习惯做的设置,如果你要在自己机器上使用的话,请根据你自己的习惯作出相应修改。
另外,这份 .vimrc
里面有许多设置是针对插件的,只有安装了相应插件后,这些配置才会起作用。这里有滇狐使用的全部插件打包,如果需要的话可以直接下载,Linux
用户将该压缩包解压到 $HOME 目录下即可使用,Windows
用户可以将压缩包解压后,将解压得到的 .vim
文件夹改名为 vimfiles,然后复制到 VIM
的安装路径下,覆盖原有文件。
set nocp
set ts=4
set sw=4
set smarttab
set et
set ambiwidth=double
set tw=80
set lbr
set nojs
set fo+=mB
set cin
set ai
set cino=:0g0t0(susj1
set backspace=indent,eol,start
set whichwrap=b,s,<,>,[,]
set mouse=a
set selectmode=
set mousemodel=popup
set keymodel=
set selection=inclusive
set wildmenu
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
set list
set listchars=tab:»\ ,trail:\ ,extends:»,precedes:«
highlight SpecialKey ctermbg=Red guibg=Red
filetype plugin indent on
if (has("win32"))
let &dir=expand("~/vimcache")."//,".&dir
else
let &dir=expand("~/.cache/vim")."//,".&dir
endif
let &backupdir=&dir
if v:version >= 703
set undofile
let &undodir=&dir
set colorcolumn=+1
endif
set ru
set sm
set hls
if has("gui_running")
set guioptions-=m
set guioptions-=T
set guioptions+=b
set nowrap
else
set wrap
endif
syntax on
if has("gui_running") || &t_Co == 256
if $USER == "root"
colo peachpuff
else
colo torte
endif
set spell
else
if $USER == "root"
colo shine
else
colo ron
endif
set nospell
endif
if !has("gui_running") && &t_Co == 256
highlight SpellBad ctermbg=52
highlight SpellCap ctermbg=17
highlight SpellLocal ctermbg=23
highlight SpellRare ctermbg=53
endif
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
function EnglishMode()
setlocal spell
setlocal formatexpr=
endfunction
command EnglishMode call EnglishMode()
function ChineseMode()
setlocal nospell
setlocal formatexpr=autofmt#japanese#formatexpr()
endfunction
command ChineseMode call ChineseMode()
function TextMode()
setlocal nocin
setlocal nosi
setlocal noai
setlocal tw=80
endfunction
command TextMode call TextMode()
function CodeMode()
setlocal cin
setlocal si
setlocal ai
setlocal tw=80
endfunction
command CodeMode call CodeMode()
function MailMode()
call TextMode()
setlocal tw=70
endfunction
command MailMode setlocal ft=mail
function BBSMode()
call MailMode()
call ChineseMode()
setlocal tw=76
endfunction
command BBSMode setlocal ft=bbs
function VikiMode()
call ChineseMode()
setlocal ft=viki
endfunction
command VikiMode call VikiMode()
function ConqueTermMode()
setlocal tw=0
setlocal nolist
setlocal nospell
inoremap <buffer> <c-w>h <esc><c-w>h
inoremap <buffer> <c-w>j <esc><c-w>j
inoremap <buffer> <c-w>k <esc><c-w>k
inoremap <buffer> <c-w>l <esc><c-w>l
inoremap <buffer> <esc><c-w>h <esc><c-w>h
inoremap <buffer> <esc><c-w>j <esc><c-w>j
inoremap <buffer> <esc><c-w>k <esc><c-w>k
inoremap <buffer> <esc><c-w>l <esc><c-w>l
endfunction
command ConqueTermMode call ConqueTermMode()
function QuoteFix()
%s/^\(> \?\)*>/\=substitute(submatch(0), " ", "", "g")/ge
g/^\(> \?\)\+\s*$/d
endfunction
command QuoteFix call QuoteFix()
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
%s/Created: *$/\=strftime("Created: %Y-%m-%d %H:%M:%S")/ge
call RestoreWinPosn(curposn)
endfunction
command TimeStamp call TimeStamp()
function AutoTimeStamp()
augr tagdate
au!
au BufWritePre,FileWritePre * call TimeStamp()
augr END
endfunction
command AutoTimeStamp call AutoTimeStamp()
function NoAutoTimeStamp()
augr tagdate
au!
augr END
endfunction
command NoAutoTimeStamp call NoAutoTimeStamp()
function CodeLayout()
call CodeMode()
WManager
Tlist
endfunction
command CodeLayout call CodeLayout()
function CodeLayoutSmall(c)
call CodeLayout()
let &columns=a:c
exec "norm \<c-w>t"
set winfixwidth
exec "norm \<c-w>j"
set winfixwidth
set winfixheight
exec "norm \<c-w>l"
set nu
set lines=56
exec "norm \<c-w>b"
set winfixwidth
exec "norm \<c-w>t"
exec "norm \<c-w>l"
Term
endfunction
command CodeLayoutSmall call CodeLayoutSmall(141)
function CodeLayoutLarge(c)
call CodeLayout()
let &columns=a:c
exec "norm \<c-w>t"
set winfixwidth
exec "norm \<c-w>j"
set winfixwidth
set winfixheight
exec "norm \<c-w>l"
set nu
vsplit
set lines=76
exec "norm \<c-w>b"
set winfixwidth
exec "norm \<c-w>t"
exec "norm \<c-w>l"
exec "norm \<c-w>l"
Term
endfunction
command CodeLayoutLarge call CodeLayoutLarge(226)
function TtySize()
set columns=80
set lines=24
endfunction
command TtySize call TtySize()
function GetWindowFilenames()
let filenames = []
let curwin = winnr()
windo call add(filenames, expand("%:p"))
exec "norm " . curwin . "\<c-w>\<c-w>"
return filenames
endfunction
command ToggleSketch call ToggleSketch()
let Tlist_Use_Right_Window=1
let Tlist_File_Fold_Auto_Close=1
let g:alternateNoDefaultAlternate=1
let g:alternateRelativeFiles=1
let g:vikiNameSuffix=".viki"
let g:fencview_autodetect=0
let g:showmarks_enable=0
let g:showmarks_include="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
let g:showmarks_hlline_lower=1
let g:showmarks_hlline_upper=1
let s:unicode = unicode#import()
let s:orig_prop_line_break = s:unicode.prop_line_break
function! s:unicode.prop_line_break(char)
if a:char == "\u201c" || a:char == "\u2018"
return "OP"
elseif a:char == "\u201d" || a:char == "\u2019"
return "CL"
endif
return call(s:orig_prop_line_break, [a:char], self)
endfunction
set completeopt=menu,longest
let g:clang_complete_auto=0
command ClangUpdateQuickFix call g:ClangUpdateQuickFix()
let g:ConqueTerm_CWInsert = 1
let g:ConqueTerm_InsertOnEnter = 1
let g:ConqueTerm_ReadUnfocused = 1
augr filetype
au! BufRead,BufNewFile *.bbs BBSMode
au! FileType mail call MailMode()
au! BufRead,BufNewFile *.viki VikiMode
au! FileType conque_term ConqueTermMode
augr end
if (has("win32"))
if (has("gui_running"))
set guifont=DejaVu_Sans_Mono:h9:cANSI
set guifontwide=NSimSun:h9:cGB2312
endif
let g:netrw_browsex_viewer="start"
set shellpipe=2>&1\|\ tee
if (has("gui_running"))
command -nargs=1 SetAlpha call libcallnr("vimtweak.dll",
\"SetAlpha", <args>)
command TopMost call libcallnr("vimtweak.dll","EnableTopMost", 1)
command NoTopMost call libcallnr("vimtweak.dll","EnableTopMost", 0)
endif
else
if (has("gui_running"))
set guifont=DejaVu\ Sans\ Mono\ 9
endif
let g:vikiHomePage="~/Documents/Viki/index.viki"
let g:netrw_browsex_viewer="xdg-open"
set makeprg=build
function Term()
ConqueTermSplit bash
endfunction
command Term call Term()
endif
if filereadable(expand("~/.vimrc_extra"))
so ~/.vimrc_extra
endif