public
Created

my _vimrc

  • Download Gist
gistfile1.vim
VimL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
set nocompatible " 非兼容模式
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
 
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "honza/snipmate-snippets"
Bundle "garbas/vim-snipmate"
Bundle "vim-ruby/vim-ruby"
Bundle "fholgado/minibufexpl.vim"
Bundle "vim-scripts/taglist.vim"
Bundle "vim-scripts/winmanager--Fox"
Bundle "scrooloose/nerdtree"
Bundle "hukl/Smyck-Color-Scheme"
" Bundle "plasticboy/vim-markdown"
Bundle "hallison/vim-markdown"
Bundle "majutsushi/tagbar"
Bundle "hallettj/jslint.vim"
 
if has("win32")
set guifont=Monaco:h10
lcd C:\Sites\demo "设置GVIM默认目录
else
set guifont=Monaco\ 10 " 字体
color blackboard " 颜色
endif
 
"解决编码
if has("win32")
set langmenu=en_US.UTF-8 " sets the language of the menu (gvim)
language en " sets the language of the messages / ui (vim)
else
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,chinese
"set langmenu=zh_CN.utf-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"language messages zh_cn.utf-8
"language messages zh_cn.utf-8
endif
 
let g:jslint_command = '"C:\RailsInstaller\Ruby1.9.3\bin\jslint.exe"'
 
set nu " 行号
set autoindent " 自动对齐,使用 noautoindent 取消设置:
set smartindent " 依据上面的格式,智能对齐
set tabstop=4 " 设置tab键的宽度
set backspace=indent,eol,start " 退格键有效
" set backspace=2
set cindent shiftwidth=4 " 自换行时行间交错使用4个空格
set expandtab " To enter a real tab character use Ctrl-V<Tab> key sequence.
set smartindent " 智能自动缩进
set ruler " 右下角显示光标位置的状态行
set incsearch " 查找book时,当输入/b时会自动找到
set hlsearch " 开启高亮显示结果
set incsearch " 开启实时搜索功能
set nowrapscan " 搜索到文件两端时不重新搜索
set nocompatible " 关闭兼容模式
set vb t_vb= " 关闭提示音
" set ruler " 在编辑过程中,在右下角显示光标位置的状态行
set hidden " 允许在有未保存的修改时切换缓冲区
set list " 显示Tab符,使用一高亮竖线代替
set listchars=tab:\|\ ,
syntax enable " 打开语法高亮
syntax on " 开启文件类型侦测
" set ofu=syntaxcomplete#Complete " Omni-complete
" filetype on
filetype indent on " 针对不同的文件类型采用不同的缩进格式
filetype plugin on " 针对不同的文件类型加载对应的插件
filetype plugin indent on " 启用自动补全
set nobackup " 不生成备份文件
autocmd BufNewFile,BufRead *.html.erb set filetype=html.eruby " 识别ruby文件
set lines=33 columns=87 " 启动gvim时窗口的大小
 
"设定文件浏览器目录为当前目录
set bsdir=buffer
"自动切换目录
set autochdir
 
" gvim e303 无法打开 “***“的交换文件,恢复将不可能
" set directory=.,$TEMP
 
"Toggle Menu and Toolbar gvim 菜单栏与工具栏隐藏与显示动态切换
set guioptions-=m
set guioptions-=T
map <silent> <F2> :if &guioptions =~# 'T' <Bar>
\set guioptions-=T <Bar>
\set guioptions-=m <bar>
\else <Bar>
\set guioptions+=T <Bar>
\set guioptions+=m <Bar>
\endif<CR>
 
"minibufexpl
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
 
" Taglist
let Tlist_Enable_Fold_Column = 0
let Tlist_Compact_Format = 1
let Tlist_File_Fold_Auto_Close = 0
let Tlist_GainFocus_On_ToggleOpen = 1
 
 
if has("autocmd")
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading=1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global=1
endif
"improve autocomplete menu color
highlight Pmenu ctermfg=2 ctermbg=0 gui=bold
highlight PmenuSel ctermfg=0 ctermbg=7
 
"omnicomplete settings
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_DisplayMode = 1
let OmniCpp_ShowScopeInAbbr = 0 " do not show namespace in pop-up
let OmniCpp_ShowPrototypeInAbbr = 1 " show prototype in pop-up
let OmniCpp_ShowAccess = 1 " show access in pop-up
let OmniCpp_SelectFirstItem = 1 " select first item in pop-up
set completeopt=menuone,menu,longest
 
nmap <silent> <C-k> <C-W><C-k>
nmap <silent> <C-j> <C-W><C-j>
nmap <silent> <C-h> <C-W><C-h>
nmap <silent> <C-l> <C-W><C-l>
 
" Nerdtree
let Tlist_Use_Right_Window = 1
map <F3> :NERDTreeToggle<cr>
vmap <F3> <esc>:NERDTreeToggle<cr>
imap <F3> <esc>:NERDTreeToggle<cr>
 
map <F4> :TagbarToggle<cr>
vmap <F4> <esc>:TagbarToggle<cr>
imap <F4> <esc>:TagbarToggle<cr>
 
nmap <silent><F7> :w<CR>:!ruby %<CR>
imap <F4> <Esc><F4>
imap <F5> <Esc><F5>
imap <F6> <Esc><F6>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.