" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below. If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.javascript
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vimjava
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatiblepython
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
syntax on
endifgit
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=darkvim
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endifapp
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endifpython2.7
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set autowriteall
"set mouse=a " Enable mouse usage (all modes)jsp
"~/.vimrcide
" YouCompleteMe
set runtimepath+=~/.vim/bundle/YouCompleteMe
let g:ycm_collect_identifiers_from_tags_files = 1 " 開啓 YCM 基於標籤引擎
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 註釋與字符串中的內容也用於補全
let g:syntastic_ignore_files=[".*\.py$"]
let g:ycm_seed_identifiers_with_syntax = 1 " 語法關鍵字補全
let g:ycm_complete_in_comments = 1
let g:ycm_confirm_extra_conf = 0
let g:ycm_key_list_select_completion = ['<c-n>', '<Down>'] " 映射按鍵, 沒有這個會攔截掉tab, 致使其餘插件的tab不能用.
let g:ycm_key_list_previous_completion = ['<c-p>', '<Up>']
let g:ycm_complete_in_comments = 1 " 在註釋輸入中也能補全
let g:ycm_complete_in_strings = 1 " 在字符串輸入中也能補全
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 註釋和字符串中的文字也會被收入補全
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_show_diagnostics_ui = 0 " 禁用語法檢查
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | " 回車即選中當前項
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>| " 跳轉到定義處
"let g:ycm_min_num_of_chars_for_completion=2 " 從第2個鍵入字符就開始羅列匹配項ui
let g:ycm_server_python_interpreter='/usr/bin/python2.7'
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
set nocompatible " be iMproved
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
"let Vundle manage Vundle
" required!
Bundle 'indentLine/indentLine'
Bundle 'scrooloose/syntastic'
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'
" vim-scripts repos
Bundle 'L9'
Bundle 'FuzzyFinder'
" non-GitHub repos
Bundle 'git://git.wincent.com/command-t.git'
" Git repos on your local machine (i.e. when working on your own plugin)
Bundle 'file:///Users/gmarik/path/to/plugin'
" ...
Bundle 'Valloric/YouCompleteMe'
filetype plugin indent on " required!
"javacomplete
setlocal omnifunc=javacomplete#Complete
autocmd Filetype java set omnifunc=javacomplete#Complete
autocmd Filetype java set completefunc=javacomplete#CompleteParamsInf
inoremap <buffer> <C-X><C-U> <C-X><C-U><C-P>
inoremap <buffer> <C-S-Space> <C-X><C-U><C-P>
autocmd Filetype java,javascript,jsp inoremap <buffer> . .<C-X><C-O><C-P>
"增長橫線
"autocmd InsertLeave * se nocul " 用淺色高亮當前行
"autocmd InsertEnter * se cul " 用淺色高亮當前行
set cursorline
"highlight CursorLine guibg=lightblue ctermbg=lightgray
"去掉註釋看不清的效果
colorscheme desert
"tab 鍵顯示豎線
"set list lcs=tab:\|\
let g:indentLine_char='|'
let g:indentLine_enabled = 1
"let g:indentLine_setColors = 0
" Source a global configuration file if available
filetype plugin indent on
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
set fileencodings=utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
set fileformats=unix
"set encoding=prc
set encoding=utf-8
"
"顯示行號
set number
"修改vim的tab,使其佔4個空格
set tabstop=4
set tags=tags
set tags+=./tags "add current directory's generated tags file
set tags+=/usr/tags "add current directory's generated tags file
set laststatus=2
set softtabstop=4
set shiftwidth=4
set cindent
"set ff
set autowrite
set ruler
set previewwindow " 標識預覽窗口
set showcmd " 命令行顯示輸入的命令
set showmode " 命令行顯示vim當前模式
"--find setting--
set incsearch " 輸入字符串就顯示匹配點
" 設置狀態欄的顏色
highlight StatusLine cterm=bold ctermfg=yellow ctermbg=Darkblue
function! CurDir()
let curdir = substitute(getcwd(), $HOME, "~", "g")
return curdir
endfunction
set statusline=[%n]\ %f%m%r%h\ \|\ format:\ %{&fileformat}\ \|\ \ pwd:\ %{CurDir()}\ \ \|%=\|\ %l,%c\ %p%%\ \|\ ascii=%b,hex=0x%B%{((&fenc==\"\")?\"\":\"\ \|\ \".&fenc)}\ \|\ %{$USER}\ @\ %{hostname()}\
if &term=="xterm"
set t_Co=8
set t_Sb=^[[4%dm
set t_Sf=^[[3%dm
endif
"進行版權聲明的設置
"添加或更新頭
map <F4> :call TitleDet()<cr>'s
function AddTitle()
call append(line("."),"/*=============================================================================")
call append(line(".")+1,"#")
call append(line(".")+2,"# Author: dantezhu - dantezhu@vip.qq.com")
call append(line(".")+3,"#")
call append(line(".")+4,"# QQ : 327775604")
call append(line(".")+5,"#")
call append(line(".")+6,"# Last modified: ".strftime("%Y-%m-%d %H:%M"))
call append(line(".")+7,"#")
call append(line(".")+8,"# Filename: ".expand("%:t"))
call append(line(".")+9,"#")
call append(line(".")+10,"# Description: ")
call append(line(".")+11,"#")
call append(line(".")+12,"=============================================================================*/")
" echohl WarningMsg | echo "Successful in adding the copyright." | echohl None
endfunction
"更新最近修改時間和文件名
function UpdateTitle()
normal m'
execute '/# *Last modified:/s@:.*$@\=strftime(":\t%Y-%m-%d %H:%M")@'
normal ''
normal mk
execute '/# *Filename:/s@:.*$@\=":\t\t".expand("%:t")@'
execute "noh"
normal 'k
echohl WarningMsg | echo "Successful in updating the copy right." | echohl None
endfunction
"判斷前10行代碼裏面,是否有Last modified這個單詞,
"若是沒有的話,表明沒有添加過做者信息,須要新添加;
"若是有的話,那麼只須要更新便可
function TitleDet()
call AddTitle()
return
let n=1 "默認爲添加 while n < 10 let line = getline(n) if line =~ '^\#\s*\S*Last\smodified:\S*.*$' call UpdateTitle() return endif let n = n + 1 endwhile call AddTitle()endfunction