set nocompatible " be iMproved
"filetype off " required!
"=============================================================================
" VIM Gernal Settings
"=============================================================================
" Tab related
set ts=4 "tabstop:tab键宽度"
set sw=4 "shiftwidth: tab+shift 移动宽度"
set et "expand tabs to spaces"
set smarttab "按 backspace 时,智能删除 tab 产生的4个空格"
set ambiwidth=double "防止特殊符号无法正常显示"
" Format related
"set tw=80 "textwidth 超过此宽度换行"
set lbr "linebreak: 防止程序在单词中间断行"
set fo+=mB "m 表示允许在两个汉字之间断行。B 表示将两行合并为一行的时候,汉字与汉字之间不要补空格。"
" Indent related
set cin "C indent C语言 "
set ai "autoindent 新行时,自动使用上一行的缩进方式"
"set cino=:0g0t0(susj1
" Editing related
set backspace=indent,eol,start "使回格键(backspace)正常处理indent, eol, start等
set whichwrap=b,s,<,>,[,]
set mouse=a
set selectmode=
set mousemodel=popup
set keymodel=
set selection=inclusive
" Misc
set wildmenu "命令模式tab自动补全时,弹出菜单"
" 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
"set list
"set listchars=tab:»\ ,trail:\ ,extends:»,precedes:«
"highlight SpecialKey ctermbg=Red guibg=Red
" File type related
filetype plugin indent on
" Persistent undo
if v:version >= 703
set undodir=$HOME/.vimundodir
set colorcolumn=+1
endif
" Display related
set ru "ruler 显示状态栏标尺
set sm "showmatch 显示括号配对"
set hls "hlsearch"
set nu! "number 显示行号
set is "incsearch 查找时动态匹配
if (has("gui_running"))
set guioptions-=m
set guioptions-=T
set guioptions+=b "启用水平滚动条"
if $USER == "root"
colo peachpuff
else
colo torte
endif
set nowrap
else
if $USER == "root"
colo shine
else
colo ron
endif
set wrap
endif
syntax on
set history=50
"=============================================================================
" VIM Color Scheme
"=============================================================================
"set fenc=gbk
"set encoding=utf8
set guifont=Consolas:h12:cGB2312
"set guifontwide=微软雅黑
"=============================================================================
" 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
"set langmenu=none
"=============================================================================
" vundle plugin
"=============================================================================
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
"
" original repos on github
"Bundle 'tpope/vim-fugitive'
"Bundle 'Lokaltog/vim-easymotion'
"Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
"Bundle 'tpope/vim-rails.git'
Bundle 'scrooloose/nerdtree.git'
Bundle 'fholgado/minibufexpl.vim.git'
"Bundle 'ervandew/supertab'
"Bundle 'othree/xml.vim'
Bundle 'gregsexton/MatchTag'
" Bundle 'vim-scripts/TabBar'
Bundle 'scrooloose/nerdcommenter'
Bundle 'vim-scripts/TxtBrowser'
" vim-scripts repos
Bundle 'L9'
Bundle 'FuzzyFinder'
"Bundle 'vimtips'
Bundle 'taglist.vim'
Bundle 'bufexplorer.zip'
Bundle 'winmanager'
Bundle 'matchit.zip'
" non github repos
" Bundle 'git://git.wincent.com/command-t.git'
" ...
filetype plugin indent on " required!
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
" ============================================================================
" Shortcuts
" ============================================================================
"Toggle Menu and Toolbar
map <silent> <F7> :if &guioptions =~# 'T' <Bar>
\set guioptions-=T <Bar>
\set guioptions-=m <bar>
\else <Bar>
\set guioptions+=T <Bar>
\set guioptions+=m <Bar>
\endif<CR>
" ============================================================================
" Plugins settings
" ============================================================================
" NERDTree
nnoremap <silent> <F6> :NERDTreeToggle<CR>
"nnoremap <silent> <F6> :q<CR>
"let NERDTreeWinPos='left'
"let NERDTreeWinSize=25
"let NERDChristmasTree=1
" Taglist
nnoremap <silent> <F5> :TlistToggle<CR>
let Tlist_Ctags_Cmd = 'ctags'
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let Tlist_File_Fold_Auto_Close=1
let Tlist_Use_Right_Window=0
let Tlist_Show_Menu=1
"let Tlist_Auto_Open=1
" winManager
let g:NERDTree_title='NERD Tree'
let g:winManagerWindowLayout='NERDTree|TagList'
function! NERDTree_Start()
exec 'NERDTree'
endfunction
function! NERDTree_IsValid()
return 1
endfunction
" 用 F4 打开
nmap <F2> :WMToggle<cr>:q<cr>
" 用 ctrl + F4 关闭
nmap <C-F2> :WMToggle<cr>
" MiniBufExplorer
let g:miniBufExplMapCTabSwitchBufs = 1 "Ctrl+Tab 切换文件"
let g:miniBufExplMapWindowNavVim = 1 "<C-h,j,k,l>切换到上下左右的窗口"
" SuperTab
" 0 - 不记录上次的补全方式
" 1 - 记住上次的补全方式,直到用其他的补全命令改变它
" 2 - 记住上次的补全方式,直到按ESC退出插入模式为止
"let g:SuperTabRetainCompletionType=2
" 设置按下<Tab>后默认的补全方式, 默认是<C-P>,
" 现在改为<C-X><C-O>. 关于<C-P>的补全方式,
"let g:SuperTabDefaultCompletionType="<C-X><C-O>"
" TxtBrowser
let tlist_txt_settings = 'txt;c:content;f:figures;t:tables'
au BufRead,BufNewFile *.txt setlocal ft=txt
" nerdcommenter
"n\cc : 为光标以下 n 行添加注释
"n\cu : 为光标以下 n 行取消注释
"n\cm : 为光标以下 n 行添加块注释
"=============================================================================
" Platform dependent settings
"=============================================================================
if (has("win32"))
"-------------------------------------------------------------------------
" Win32
"-------------------------------------------------------------------------
if (has("gui_running"))
set guifont=Consolas:h12:cANSI
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=DejaVu\ Sans\ Mono\ 9
endif
" For Viki
let g:vikiHomePage="~/Documents/Viki/index.viki"
let g:netrw_browsex_viewer="kfmclient exec"
set makeprg=build
function Term()
ConqueTermSplit bash
endfunction
command -nargs=0 Term call Term()
endif
vimrc 备份
最新推荐文章于 2022-10-04 17:08:09 发布