Skip to content

Instantly share code, notes, and snippets.

@jamiesun
Created July 14, 2012 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamiesun/3109161 to your computer and use it in GitHub Desktop.
Save jamiesun/3109161 to your computer and use it in GitHub Desktop.
vim config

Talkincode.org @codeid:44def9aa87254bd7836abdfff3c06825 "@tags:vim set nocompatible
set backspace=2
source $VIMRUNTIME/vimrc_example.vim
if has('win32')
source $VIMRUNTIME/mswin.vim
behave mswin
endif
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
set fileencoding=utf-8 " 新建文件使用的编码
" set makeprg=python -u %
" 解决菜单乱码
set langmenu=zh_CN
let $LANG = 'zh_CN.UTF-8'
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim

" 自动补全命令时候使用菜单式匹配列表
set wildmenu
" 允许退格键删除
set backspace=2
" 启用鼠标
set mouse=a
" 文件类型
filetype on
filetype plugin on
filetype indent on
set ai "自动对齐
set sw=4 "设置Tab宽度
set sm "sm会在你敲},]或)显示出对应匹配的{,[或(来
set nobackup "不备份
set tabstop=4 "tab->空格
set expandtab
set linespace=2
set ve=all
"set tw=140
set autochdir
set ignorecase smartcase
set number
set cindent
set smartindent
colo koehler
let g:winManagerWindowLayout = "FileExplorer"
let Tlist_Use_Right_Window=1
let g:pydiction_location = 'vimfiles/ftplugin/complete-dict'
let g:pydiction_menu_height = 20
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1

"python配置
autocmd BufRead *.py set makeprg=python\ -c\ "import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')"
autocmd BufRead *.py set efm=%C\ %.%#,%A\ \ File\ "%f"\,\ line\ %l%.%#,%Z%[%^\ ]%\@=%m
autocmd BufRead *.py nmap :!python %
autocmd BufRead *.py nmap :make
"autocmd BufRead *.py copen "如果是py文件,则同时打开编译信息窗口
"map :BufExplorer
map :browse confirm e
map :tabnew
map :tabclose
map :call RunScala()
"浏览标签
nnoremap :Tlist
"浏览文件
nnoremap :WMToggle
"map :call CompileRunJava()
map : bn
map : bp
map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q *

" File Explorer
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:explVertical=1 " should I split verticially
let g:explWinSize=20 " width of 35 pixels

" Win Manager
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:winManagerWidth=20 " How wide should it be( pixels)
"let g:winManagerWindowLayout = 'FileExplorer,TagsExplorer|BufExplorer' " What windows should it
" CTags
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let Tlist_Ctags_Cmd = 'ctags' " Location of ctags
let Tlist_Sort_Type = "name" " order by
let Tlist_Use_Right_Window = 1 " split to the right side of the screen
let Tlist_Compart_Format = 1 " show small meny
let Tlist_Exist_OnlyWindow = 1 " if you are the last, kill yourself
let Tlist_File_Fold_Auto_Close = 0 " Do not close tags for other files
let Tlist_Enable_Fold_Column = 0 " Do not show folding tree
let g:ctags_path='ctags'
let g:ctags_statusline=1
" Minibuf
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:miniBufExplTabWrap = 1 " make tabs show complete (no broken on two lines)
let g:miniBufExplModSelTarget = 1

func! CompileRunGcc()
exec "w"
exec "!gcc % -o %<"
exec "! ./%<"
endfunc

func! CompileRunJava()
exec "w"
exec "!javac % "
exec "!java %<"
endfunc
func! RunScala()
exec "w"
exec "!scala % "
endfunc
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 =~ '<cmd' let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
endfunction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment