1 Star 15 Fork 6

少林码僧 / vimplus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
.vimrc 12.53 KB
一键复制 编辑 原始数据 按行查看 历史
少林码僧 提交于 2017-05-14 15:12 . 添加插件配置
"
" __ _(_)_ __ ___ _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
" \ V /| | | | | | | | | (__
" (_)_/ |_|_| |_| |_|_| \___|
"
" Author: chxuan <2550702985@qq.com>
" Source: https://github.com/yongge666/vimplus
" genernal settings
syntax enable
syntax on
set paste
set t_Co=256
set cul
set shortmess=atI
autocmd InsertEnter * se cul
set ruler
set showcmd
set scrolloff=3
set laststatus=2
set autoindent
set smartindent
set cindent
set cinoptions=g0,:0,N-s,(0
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set smarttab
set number
set history=1000
set hlsearch
set incsearch
set langmenu=zh_CN.UTF-8
set helplang=cn
set cmdheight=2
set autoread
set completeopt=preview,menu
set autowrite
set magic
set guioptions-=T
set guioptions-=m
set nocompatible
set noeb
set confirm
set nobackup
set noswapfile
set ignorecase
set linespace=0
set wildmenu
set backspace=2
set whichwrap+=<,>,h,l
set mouse=a
set selection=exclusive
set selectmode=mouse,key
set report=0
set fillchars=vert:\ ,stl:\ ,stlnc:\
set showmatch
set matchtime=1
set scrolloff=3
set completeopt=longest,menu
set iskeyword+=.
set termencoding=utf-8
set encoding=utf8
set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030
filetype on
filetype plugin on
filetype indent on
" 定义函数SetTitle,自动插入文件头
func SetTitle()
call setline(1, "#/*************************************************************************")
call append(line("."), "# > File Name: ".expand("%"))
call append(line(".")+1, "# > Author: liyong")
call append(line(".")+2, "# > Mail: 2550702985@qq.com")
call append(line(".")+3, "# > Created Time: ".strftime("%Y-%m-%d %H:%M"))
call append(line(".")+4, "# > Last modified: ".strftime("%Y-%m-%d %H:%M"))
call append(line(".")+6, "# ************************************************************************/")
endfunc
"""""新文件标题""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp,*.[ch] exec ":call SetTitleC()"
autocmd BufNewFile *.sh exec ":call SetTitleSh()"
autocmd BufNewFile *.php exec ":call SetTitlePhp()"
autocmd BufNewFile *.py exec ":call SetTitlePy()"
autocmd BufNewFile *.html,*.htm,*.phtml exec ":call SetTitleHtml()"
autocmd BufNewFile *.css exec ":call SetTitleCss()"
autocmd BufNewFile *.java exec ":call SetTitleJava()"
autocmd BufNewFile * normal G
func SetTitleC()
call SetTitle()
call append(line(".")+6, "#include<stdio.h>")
call append(line(".")+7, "")
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
func SetTitleSh()
call SetTitle()
call append(line(".")+6, "\#!/bin/bash")
call append(line(".")+7, "")
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
func SetTitlePhp()
call SetTitle()
call append(line(".")+6, "<?php")
call append(line(".")+7, "")
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
func SetTitlePy()
call SetTitle()
call append(line(".")+6, "#!/usr/bin/env python")
call append(line(".")+7, "# -*- coding: utf-8 -*-")
call append(line(".")+7, "")
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
func SetTitleHtml()
call setline(1, "<!DOCTYPE HTML>")
call append(line(".")+1, "<html lang="en-US">")
call append(line(".")+2, "<head>")
call append(line(".")+3, " <meta charset="UTF-8">")
call append(line(".")+4, " <title></title>")
call append(line(".")+5, "</head>")
call append(line(".")+6, "<body>")
call append(line(".")+7, "</body>")
call append(line(".")+8, "</html>")
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
func SetTitleCss()
call setline(1, "@charset 'utf-8'")
call append(line("."), "")
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
func SetTitleJava()
call SetTitle()
call append(line(".")+6, "")
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
func SetFileTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(1,"\#########################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: ma6174")
call append(line(".")+2, "\# mail: ma6174@163.com")
call append(line(".")+3, "\# Created Time: ".strftime("%Y-%m-%d %H:%M"))
call append(line(".")+4, "\# Last modified: ".strftime("%Y-%m-%d %H:%M"))
call append(line(".")+4, "\# Description: "
call append(line(".")+5, "\#########################################################################")
call append(line(".")+6, "\#!/bin/bash")
call append(line(".")+7, "")
else
call setline(1, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+1, " > Author: liyong")
call append(line(".")+2, " > Mail: 2550702985@qq")
call append(line(".")+3, " > Created Time: ".strftime("%Y-%m-%d %H:%M"))
call append(line(".")+4, " >Last modified: ".strftime("%Y-%m-%d %H:%M"))
call append(line(".")+5, " ************************************************************************/")
call append(line(".")+6, "")
endif
"如果文件类型为.py文件
if &filetype == 'py'
call append(line(".")+7, "#!/usr/bin/env python")
call append(line(".")+8, "# -*- coding: utf-8 -*-")
endif
"如果文件类型为.php文件
if &filetype == 'php'
call append(line(".")+7, "<?php")
endif
"如果文件类型为.html文件
if &filetype == 'html'
call append(line(".")+1, "<!DOCTYPE HTML>")
call append(line(".")+2, "<html lang="en-US">")
call append(line(".")+3, "<head>")
call append(line(".")+4, " <meta charset="UTF-8">")
call append(line(".")+5, " <title></title>")
call append(line(".")+6, "</head>")
call append(line(".")+7, "<body>")
call append(line(".")+8, "</body>")
call append(line(".")+9, "</html>")
endif
"如果文件类型为.css文件
if &filetype == 'css'
call setline(1, "@charset 'utf-8'")
endif
if &filetype == 'cpp'
call append(line(".")+7, "#include<iostream>")
call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
if &filetype == 'c'
call append(line(".")+7, "#include<stdio.h>")
call append(line(".")+7, "")
endif
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
"将键盘上的F4功能键映射为添加作者信息的快捷键
map <F4> ms:call TitleDet()<cr>'s
function AddTitle()
call append(0,"/*******************************************************************************")
call append(1," * Author :liyong")
call append(2," * Email : 2550702985@qq.com")
call append(3," * Last modified : ".strftime("%Y-%m-%d %H:%M"))
call append(4," * Filename : ".expand("%:t"))
call append(5," * Description : ")
call append(6," * *****************************************************************************/")
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
function TitleDet()
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
" Vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'L9'
Plugin 'chxuan/change-colorscheme'
Plugin 'jiangmiao/auto-pairs'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'Valloric/MatchTagAlways'
Plugin 'Valloric/YouCompleteMe'
Plugin 'docunext/closetag.vim'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-endwise'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'majutsushi/tagbar'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'vim-scripts/a.vim'
Plugin 'vim-scripts/DoxygenToolkit.vim'
Plugin 'vim-scripts/SQLComplete.vim'
Plugin 'vim-scripts/txt.vim'
Plugin 'ryanoasis/vim-devicons'
Plugin 'gorodinskiy/vim-coloresque'
Plugin 'will133/vim-dirdiff'
Plugin 'haya14busa/incsearch.vim'
Plugin 'mhinz/vim-startify'
Plugin 'Lokaltog/vim-powerline'
Plugin 'vim-scripts/snipMate'
call vundle#end()
filetype plugin indent on
" load vim default plugin
runtime macros/matchit.vim
" change-colorscheme
map <F10> :NextColorScheme<CR>
imap <F10> <ESC> :NextColorScheme<CR>
map <F9> :PreviousColorScheme<CR>
imap <F9> <ESC> :PreviousColorScheme<CR>
" nerdtree
map <F3> :NERDTreeToggle<CR>
imap <F3> <ESC> :NERDTreeToggle<CR>
"autocmd vimenter * if !argc() | NERDTree | endif
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Doxygen
let g:DoxygenToolkit_authorName="chxuan, 787280310@qq.com"
let s:licenseTag = "Copyright(C)\<enter>"
let s:licenseTag = s:licenseTag . "For free\<enter>"
let s:licenseTag = s:licenseTag . "All right reserved\<enter>"
let g:DoxygenToolkit_licenseTag = s:licenseTag
let g:DoxygenToolkit_briefTag_funcName="yes"
let g:doxygen_enhanced_color=1
let g:DoxygenToolkit_commentType="Qt"
" YCM
let g:ycm_confirm_extra_conf = 0
let g:ycm_error_symbol = '>>'
let g:ycm_warning_symbol = '>*'
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_complete_in_comments = 1
let g:ycm_complete_in_strings = 1
"let g:ycm_cache_omnifunc = 0
let mapleader = ","
nnoremap <leader>u :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>i :YcmCompleter GoToDefinition<CR>
nnoremap <leader>o :YcmCompleter GoToInclude<CR>
nmap <F5> :YcmDiags<CR>
" ctags
set tags+=/usr/include/tags
set tags+=~/.vim/systags
set tags+=~/.vim/x86_64-linux-gnu-systags
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_semantic_triggers = {}
let g:ycm_semantic_triggers.c = ['->', '.', ' ', '(', '[', '&',']']
" a.vim: .h -> .cpp or .cpp -> .h
nnoremap <silent> <F2> :A<CR>
" tagbar
let g:tagbar_ctags_bin = '/usr/bin/ctags'
let g:tagbar_width = 30
map <F4> :TagbarToggle<CR>
imap <F4> <ESC> :TagbarToggle<CR>
" colorscheme
set background=dark
let g:solarized_termcolors=256
"colorscheme solarized
colorscheme monokai
" cpp_class_scope_highlight
let g:cpp_class_scope_highlight = 1
let g:cpp_experimental_template_highlight = 1
let c_no_curly_error = 1
" airline
let g:airline_theme="luna"
" let g:airline_theme="badwolf"
let g:airline_powerline_fonts = 1
"let g:airline_section_b = '%{strftime("%c")}'
"let g:airline_section_y = 'BN: %{bufnr("%")}'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
nnoremap <C-N> :bn<CR>
nnoremap <C-P> :bp<CR>
" ctrlp
let g:ctrlp_map = '<c-f>'
let g:ctrlp_cmd = ':CtrlP'
let g:ctrlp_working_path_mode = '0'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
" vim-devicons
set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Nerd\ Font\ Complete\ 12
" incsearch.vim
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
if has('mouse')
set mouse-=a
endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/phper95/vimplus.git
git@gitee.com:phper95/vimplus.git
phper95
vimplus
vimplus
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891