验证中...
语言: VimL
分类: 其他
最后更新于 2018-12-09 10:02
.vimrc
原始数据 复制代码
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
filetype off
call plug#begin('~/.vim/plugged') " {{{ 插件管理器
" 功能 "
Plug 'Chiel92/vim-autoformat',{'on':'Autoformat'} " 代码排版工具
Plug 'kristijanhusak/vim-multiple-cursors' " 多光标编辑
Plug 'lilydjwg/fcitx.vim' " normal模式自动切换输入法
Plug 'mhinz/vim-startify' " 启动界面
Plug 'ludovicchabant/vim-gutentags' " 自动生成ctags标签
Plug 'junegunn/vim-easy-align' " 等号对齐
Plug 'jistr/vim-nerdtree-tabs',{'on': 'NERDTreeTabsToggle'} " 文件目录树,多标签强化
Plug 'jiangmiao/auto-pairs' " 快速括号引号优化输入
Plug 'iamcco/dict.vim',{ 'on':['Dict', 'DictW'] } " 在线有道翻译
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' } " 文件搜索
Plug 'maralla/completor.vim' " vim8 补全
Plug 'SirVer/ultisnips' " 预定义代码片段
Plug 'MaiLunJiye/Snips-backup' " 自己的UltiSnips模板
Plug 'asins/vimcdoc' " 中文doc
Plug 'dyng/ctrlsf.vim' " 跨文本查找
Plug 'honza/vim-snippets' " 别人的的UltiSnips模板
Plug 'majutsushi/tagbar',{'on':'TagbarToggle'} " 标签窗口
Plug 'nathanaelkane/vim-indent-guides' " 缩进着色
Plug 'mbbill/undotree',{'on':'UndotreeToggle'} " 强化撤销
Plug 'scrooloose/nerdcommenter' " 注释
Plug 'scrooloose/nerdtree',{'on': 'NERDTreeTabsToggle'} " 文件目录树
Plug 'tpope/vim-surround' " 快速更改括号,引号
Plug 'w0rp/ale' " 异步代码检测,支持多语言
"Plug 'easymotion/vim-easymotion' " vim 快速移动
"Plug 'terryma/vim-expand-region' " visual 强化 快速选择
"Plug 'skywind3000/asyncrun.vim',{'on':'AsyncRun'} " 异步运行插件
"Plug 'Shougo/vimproc.vim', {'do' : 'make'} " Shougo插件的 异步依赖
"Plug 'Shougo/neocomplete.vim' " 补全(轻量级)
"Plug 'Shougo/unite.vim' " 文件搜索,命令集中
"Plug 'thinca/vim-quickrun' " 一键运行
"Plug 'Valloric/YouCompleteMe', { 'do': './install.py --all' } " 补全引擎
"Plug 'rdnetto/YCM-Generator', { 'branch': 'stable'} " ycm补全引擎自动生成 .ycm_extra_conf
"Plug 'oplatek/Conque-Shell' " buffer 跑终端
"Plug 'octol/vim-cpp-enhanced-highlight' " cpp 新标准高亮
"Git "
"Plug 'tpope/vim-fugitive' " git 工具
" 界面 "
"Plug 'iCyMind/NeoSolarized' " 新版配色
Plug 'altercation/vim-colors-solarized' " 经典配色
Plug 'tomasr/molokai' " 主题
Plug 'joshdick/onedark.vim' " atom 风格配色
"Plug 'shawncplus/skittles_berry' " 配色
Plug 'vim-airline/vim-airline' " 彩色状态栏,内置多窗口页 的功能
Plug 'vim-airline/vim-airline-themes' " airline 的主题
Plug 'ryanoasis/vim-devicons' " 图标包
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " 图标包高亮
Plug 'itchyny/vim-cursorword' " 变量下划线
Plug 'sheerun/vim-polyglot' " 大部分语言高亮
"Plug 'Yggdroot/indentLine' " 缩进着色,高度自定义版
"Plug 'ctrlpvim/ctrlp.vim',{'on':'CtrlP'} " 文件跳转
" Perl "
"Plug 'mvgrimes/vim-trackperlvars',{'for':['perl','perl6']} " perl 变量变色
"Plug 'c9s/perlomni.vim',{ 'do': 'make install', 'for':['perl','perl6'] } " perl 补全引擎
"Plug 'vim-perl/vim-perl' " perl 语法 高亮
" C / Cpp "
"Plug 'derekwyatt/vim-fswitch',{'for':['c','cpp']} " 切换 .h .cpp
"Plug 'derekwyatt/vim-protodef',{'for':['c','cpp']} " C++ .h 文件成 .cpp文件,依赖 fswitch
"Plug 'vim-scripts/DoxygenToolkit.vim',{'on':'Dox'} " 注释生成doc
" html "
"Plug 'mattn/emmet-vim',{'for':['html','javascript','php']} " HTML 快速填充代码
" markdown "
"Plug 'sat1993/markdown-preview.vim' " 中国人写的md预览插件,支持UML
"Plug 'xolox/vim-session' " session 管理
"Plug 'iamcco/markdown-preview.vim' " 中国人写的md预览插件,界面漂亮
"Plug 'iamcco/mathjax-support-for-mkdp' " md 插件 显示数学表达式
call plug#end() "}}}
filetype plugin indent on " 自适应不同语言的智能缩进
autocmd BufWritePost $MYVIMRC source $MYVIMRC " 让配置变更立即生效
" 基础设置 {{{
set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936 "文件编码格式检测检测
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set completeopt=menuone,longest
let helptags=$VIM.".vim/doc"
set helplang=cn
set termencoding=utf-8
set encoding=utf-8
set history=500 " 操作记录保存数
set splitright " 纵向分屏时候 右侧新建窗口
set autoread " 自动加载
au FocusLost * :up " 自动保存
set incsearch " 开启实时搜索功能
set ignorecase " 搜索时大小写不敏感
set nocompatible " 关闭兼容模式
set wildmenu " vim 自身命令行模式智能补全
let mapleader="," " 定义快捷键的前缀,即<Leader>
"set colorcolumn=81 " 单行长度提醒
set belloff=all " 关闭错误音效
"set fixendofline
"set langmap
set termguicolors
" 禁止显示滚动条
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
" 禁止显示菜单和工具条
set guioptions-=m
set guioptions-=T
set laststatus=2 " 总是显示状态栏
set ruler " 显示光标当前位置
" 开启行号显示
set relativenumber
set number
" 高亮显示当前行/列
"set cursorline
"set cursorcolumn
set hidden
set hlsearch " 高亮显示搜索结果
set wrap " 折行
syntax enable " 开启语法高亮功能
syntax on " 允许用指定语法高亮配色方案替换默认方案
" 缩进----
set expandtab " 将制表符扩展为空格
set tabstop=4 " 设置编辑时制表符占用空格数
set shiftwidth=4 " 设置格式化时制表符占用空格数
set softtabstop=4 " 让 vim 把连续数量的空格视为一个制表符
" 折叠相关
set nofoldenable " 启动 vim 时关闭折叠代码
"set foldmethod=manual " 折叠规则
autocmd FileType c,cpp,perl set foldmethod=syntax
autocmd FileType vim set foldmethod=marker
autocmd FileType python set foldmethod=indent
" 光标移动到底部时候保持一定距离
set scrolloff=3
set sidescrolloff=6
if exists('$TMUX')
set term=xterm-256color
endif
"if &term =~ '256color'
""Page keys http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/FAQ
"set t_ut=
"endif
"}}}
" 快捷键修改 {{{
" <leader> y / p 复制/粘贴 到系统剪切板
nnoremap <Leader>y "+y
nmap <Leader>p "+p
" [[ 移动操作优化
map [[ ?{<CR>w99[{
map ][ /}<CR>b99]}
map ]] j0[[%/{<CR>
map [] k$][%?}<CR>
" 窗口跳转
nnoremap <C-l> <C-W>l
nnoremap <C-h> <C-W>h
nnoremap <C-k> <C-W>k
nnoremap <C-j> <C-W>j
" }}}
" 字体 相关 {{{
"set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 13.5
set guifont=DroidSansMono\ Nerd\ Font\ Mono\ 15
"set guifont=Fira\ Mono\ for\ Powerline\ 16
" 配色方案
if has('gui_running')
"set background=light
set background=dark
"colorscheme skittles_berry
"colorscheme onedark
colorscheme solarized
"colorscheme vim-material
"set lines=40 columns=141
else
set background=dark
"colorscheme solarized
colorscheme onedark
"colorscheme molokai
endif
if has('gui_running')
"gui 下 F11 全屏
"将外部命令 wmctrl 控制窗口最大化的命令行参数封装成一个 vim 的函数
fun! ToggleFullscreen()
call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")
endf
"全屏开/关快捷键
map <silent> <F11> :call ToggleFullscreen()<CR>
"启动 vim 时自动全屏
"autocmd VimEnter * call ToggleFullscreen()
endif
" }}}
" airline 彩色状态栏 {{{
" 设置状态栏主题风格 <https://github.com/vim-airline/vim-airline/wiki/Screenshots>
let g:airline_theme="light"
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
" 标签页
let g:airline#extensions#tabline#enabled = 1
" Buffer队列
let g:airline#extensions#bufferline#overwrite_variables = 1
let g:airline#extensions#bufferline#enabled = 1
" 关闭状态显示空白符号计数
let g:airline#extensions#whitespace#enabled = 0
let g:airline#extensions#whitespace#symbol = '!'
" }}}
"{{{ NERDTree, NERDTreeTabs
" 根目录文件类型
let gutentags_project_root = [".git/","build/" ]
" 使用 NERDTree 插件查看工程文件。设置快捷键,速记:file list
nmap <Leader>fl :NERDTreeTabsToggle<cr>
" 设置NERDTree子窗口宽度
let NERDTreeWinSize=32
" 设置NERDTree子窗口位置
let NERDTreeWinPos="right"
" 显示隐藏文件
let NERDTreeShowHidden=1
" NERDTree 子窗口中不显示冗余帮助信息
let NERDTreeMinimalUI=1
" 删除文件时自动删除文件对应 buffer
let NERDTreeAutoDeleteBuffer=1
" 仅当打开目录时候才弹出 nerdtree窗口
let g:nerdtree_tabs_open_on_gui_startup = 2
let g:nerdtree_tabs_startup_cd = 1
"}}}
"tabbar 大纲预览{{{
" 设置 tagbar 子窗口的位置出现在主编辑区的左边
let tagbar_left=1
" 设置显示/隐藏标签列表子窗口的快捷键。速记:identifier list by tag
nnoremap <Leader>tl :TagbarToggle<CR>
" 设置标签子窗口的宽度
let tagbar_width=27
" tagbar 子窗口中不显示冗余帮助信息
let g:tagbar_compact=1
"设置 ctags 对哪些代码标识符生成标签
let g:tagbar_type_cpp = {
\ 'kinds' : [
\ 'c:classes:0:1',
\ 'd:macros:0:1',
\ 'e:enumerators:0:0',
\ 'f:functions:0:1',
\ 'g:enumeration:0:1',
\ 'l:local:0:1',
\ 'm:members:0:1',
\ 'n:namespaces:0:1',
\ 'p:functions_prototypes:0:1',
\ 's:structs:0:1',
\ 't:typedefs:0:1',
\ 'u:unions:0:1',
\ 'v:global:0:1',
\ 'x:external:0:1'
\ ],
\ 'sro' : '::',
\ 'kind2scope' : {
\ 'g' : 'enum',
\ 'n' : 'namespace',
\ 'c' : 'class',
\ 's' : 'struct',
\ 'u' : 'union'
\ },
\ 'scope2kind' : {
\ 'enum' : 'g',
\ 'namespace' : 'n',
\ 'class' : 'c',
\ 'struct' : 's',
\ 'union' : 'u'
\ }
\ }
" perl的tagbar格式
let g:tagbar_type_perl = {
\ 'ctagstype' : 'Perl',
\ 'kinds' : [
\ 'p:packages:1:0',
\ 'u:uses:1:0',
\ 'r:requires:1:0',
\ 'e:extends',
\ 'w:roles',
\ 'o:ours:1:0',
\ 'c:constants:1:0',
\ 'f:formats:1:0',
\ 'a:attributes',
\ 's:subroutines',
\ 'x:around:1:0',
\ 'l:aliases',
\ 'd:pod:1:0',
\ ],
\ }
"}}}
"{{{ Ctrlsf 跨文本查找
let g:ctrlsf_ackprg = 'ag' " 使用ag插件
nnoremap <Leader>sp :CtrlSF<CR>
nmap <C-F>f <Plug>CtrlSFPrompt
vmap <C-F>f <Plug>CtrlSFVwordPath
vmap <C-F>F <Plug>CtrlSFVwordExec
nmap <C-F>n <Plug>CtrlSFCwordPath
nmap <C-F>p <Plug>CtrlSFPwordPath
nnoremap <C-F>o :CtrlSFOpen<CR>
nnoremap <C-F>t :CtrlSFToggle<CR>
inoremap <C-F>t <Esc>:CtrlSFToggle<CR>
" 可以指定选项
" :CtrlSF -i -C 1 [pattern] /my/path/
"}}}
"{{{UltiSnips 代码模板
" UltiSnips 的 tab 键与 YCM 冲突,重新设定
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<C-l>"
let g:UltiSnipsJumpBackwardTrigger="<C-h>"
let g:UltiSnipsListSnippets="<C-tab>"
" 模板文件位置
let g:UltiSnipsSnippetDirectories=["UltiSnips"]
"}}}
"{{{Emmet html 快速填充 插件
let g:user_emmet_mode='inv'
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
"修改触发键,一般不建议
let g:user_emmet_leader_key='<C-y>' " 进入emmet监听状态
"let g:user_emmet_expandabbr_key = '<Tab>' " 展开键,默认是 英文逗号
" 自定义响应的文件类型
let g:user_emmet_settings = {
\ 'php' : {
\ 'extends' : 'html',
\ 'filters' : 'c',
\ },
\ 'xml' : {
\ 'extends' : 'html',
\ },
\ 'haml' : {
\ 'extends' : 'html',
\ },
\}
"}}}
"{{{ 等号对齐
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap <leader>ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap <leader>ga <Plug>(EasyAlign)
"}}}
"{{{----新插件
let g:SysTags#ModulePATH = {
\ 'perl':[
\ '/etc/perl',
\ '/usr/local/lib/x86_64-linux-gnu/perl/5.26.0',
\ '/usr/local/share/perl/5.26.0',
\ '/usr/lib/x86_64-linux-gnu/perl5/5.26',
\ '/usr/share/perl5',
\ '/usr/lib/x86_64-linux-gnu/perl/5.26',
\ '/usr/share/perl/5.26',
\ '/usr/local/lib/site_perl',
\ '/usr/lib/x86_64-linux-gnu/perl-base',
\ ]
\}
"let g:SysTags#GetModuleFun =
"function! getPerlModule(num)
"let l:res = substitue(getline(a:num),'use\s\([ [:alnum:] : ]*\).*','\1', '')
"endfunction
"}}}
"{{{ ale静态代码分析
let g:ale_sign_column_always = 1
let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '⬥ ok']
let g:ale_python_flake8_options = '--ignore=W391,E231,E501,F401, E303, C0111, C0103'
let g:ale_linters = {
\ 'python':['autopep8', 'flake8','isort']
\}
"}}}
" 其他 配置 {{{
" perl 语法优化 vim-perl
autocmd BufNewFile,BufRead *.p? compiler perl
"撤销树
nnoremap <leader>ul :UndotreeToggle<cr>
" Dox 注释快速生成
nnoremap <leader>ld :Dox<cr>
" vim-fswitch protodef
let g:protodefprotogetter='~/.vim/plugged/vim-protodef/pullproto.pl'
let g:disable_protodef_sorting=1 " 定义与声明顺序一致
nmap <silent> <Leader>sw :FSHere<cr>
" 缩进着色
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
" 排版 vim-autofomat
nnoremap <leader>== :Autoformat<CR>
nmap <f3> <Plug>(quickrun)
" }}}
" {{{ completor
let g:completor_python_binary = '/bin/python3'
let g:completor_clang_binary = '/bin/clang'
" }}}
" {{{ leaderF
let g:Lf_WildIgnore = {
\ 'dir': ['.svn','.git','.hg','build','dist'],
\ 'file': ['*.sw?','~$*','*.bak','*.exe','*.o','*.so','*.py[co]']
\}
let g:Lf_StlSeparator = { 'left': '', 'right': '' }
" }}}
"let g:mkdp_path_to_chrome = "google-chrome-stable"
"=================[依赖]====================: {{{
" vim-plug
"curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" md ~\vimfiles\autoload
"$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
"(New-Object Net.WebClient).DownloadFile($uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\autoload\plug.vim"))
" ctags
" cmake
" silversearcher-ag
" build-essential
" python-dev python3-dev
" wmctrl
" clang-fomate
" }}}

评论列表( 0 )

你可以在登录后,发表评论

搜索帮助

14_float_left_people 14_float_left_close