求助一个大佬的vimrc文件,自己被改得一塌糊涂,不想用了!
大佬!!!!!求助一个大佬的vimrc文件,自己被改得一塌糊涂,不想用了! ^_^set number " 显示行号
set laststatus=2 " 总是显示状态栏
set cursorline " 高亮显示当前行
set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离
set nowrap " 禁止折行
set ruler " 显示光标当前位置
set hlsearch " 高亮显示搜索结果
set incsearch " 开启实时搜索
set ignorecase " 搜索时大小写不敏感
set nocompatible " 关闭兼容模式
set wildmenu " vim自身命令行模式智能补全
set noshowmatch " 不要高亮匹配括号
" 缩进
set tabstop=8
set softtabstop=8
set shiftwidth=8
set noexpandtab
set cindent
set smartindent
set autoindent
let g:python_recommended_style="0" " 关闭Python的tab
" 关键字高亮
syntax on
" 定义快捷键的前缀,即<Leader>
let mapleader=";"
" 编码格式
set encoding=utf-8
set fileencodings=utf-8,default,gb18030,gbk,gb2312
" 禁止生成临时文件
set nobackup
set noswapfile
" 折叠
set foldmethod=indent " 缩进折叠
set foldlevel=99 " 启动vim默认不折叠
" 添加C语言标识符文件
set tags+=~/.vim/dict/c.dict
" 设置快捷键将文本复制至系统剪贴板
vnoremap <Leader>y "+y " 复制选中文本
" 设置快捷键将系统剪贴板内容粘贴至vim
nmap <Leader>p "+p
nmap <Leader>P "+P
" 自动跳到上一次的光标位置
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" vundle 环境
set rtp+=~/.vim/bundle/Vundle.vim
"set rtp+=~/Vundle.vim
filetype off " required
set nocompatible " required
call vundle#begin()
Plugin 'gmarik/Vundle.vim' " 自己
Plugin 'asins/vimcdoc' " 中文帮助
Plugin 'tomasr/molokai' " 主题
Plugin 'Lokaltog/vim-powerline' " 状态栏
Plugin 'scrooloose/nerdcommenter' " 快速开关注释
Plugin 'Lokaltog/vim-easymotion' " 快速移动光标
Plugin 'mbbill/undotree' " 支持分支的undo
Plugin 'octol/vim-cpp-enhanced-highlight' " 额外的C++语法高亮
Plugin 'majutsushi/tagbar' " 基于标签的标识符列表插件
Plugin 'dyng/ctrlsf.vim' " 全局文本搜索的插件
Plugin 'terryma/vim-multiple-cursors' " 多光标编辑插件
" C/C++补全
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'davidhalter/jedi-vim' " Python补全
Plugin 'Valloric/YouCompleteMe' " YCM
call vundle#end()
filetype plugin indent on " required
" 主题
colorscheme ron
"colorscheme molokai
" 将开启tagbar的快捷键设置为<Leader>tb
nmap <Leader>tb :TagbarToggle<CR>
" 设置 tagbar 子窗口的位置出现在主编辑区的左边
let tagbar_left=1
" 设置标签子窗口的宽度
let tagbar_width=32
" tagbar 子窗口中不显示冗余帮助信息
let g:tagbar_compact=1
" 全局文本搜索的插件
nnoremap <Leader>sp :CtrlSF<CR>
" C/C++补全快捷键
let g:UltiSnipsExpandTrigger="<Leader><TAB>"
let g:UltiSnipsJumpForwardTrigger="<Leader><TAB>"
let g:UltiSnipsJumpBackwardTrigger="<Leader><S-TAB>"
" Python补全
let g:jedi#completions_command=""
let g:jedi#goto_assignments_command=""
let g:jedi#goto_definitions_command=""
let g:jedi#goto_command=""
let g:jedi#rename_command="<Leader>r"
let g:jedi#show_call_signatures="0"
let g:jedi#popup_select_first="0"
" YCM
autocmd FileType cpp :let g:ycm_global_ycm_extra_conf='~/.vim/ycm_extra_conf/ycm_extra_conf_cpp.py'
autocmd FileType c :let g:ycm_global_ycm_extra_conf='~/.vim/ycm_extra_conf/ycm_extra_conf_c.py'
let g:ycm_server_python_interpreter='/usr/bin/python2'
let g:ycm_confirm_extra_conf=0 " 载入ycm_extra_conf文件,是否提示确认 默认 1
let g:ycm_always_populate_location_list=1 " 是否显示自动补全诊断location list,默认 0
let g:ycm_seed_identifiers_with_syntax=1 " 语法关键字补全,默认 0
let g:ycm_min_num_of_chars_for_completion=1 " 开启自动补全输入的最少字符数,默认 2
let g:ycm_complete_in_comments=1 " 在注释中实现自动补全,默认 0
let g:ycm_error_symbol='✗' " 警告符号
let g:ycm_warning_symbol='⚠' " 错误符号
let g:ycm_goto_buffer_command='new-tab' " GoTo*命令的打开方式,默认 'same-buffer'
let g:ycm_key_list_select_completion=['<Leader><Leader><TAB>', '<Down>'] " 选择自动补全信息的按键,默认 ['<TAB>', '<Down>']
let g:ycm_collect_identifiers_from_tags_files=1 " 允许使用tags指定的文件中的标识符
" 关闭补全时的 preview 窗口
set completeopt-=preview
let g:ycm_add_preview_to_completeopt=0
nnoremap <leader>gc :YcmCompleter GoToDeclaration<CR> " 转到声明
nnoremap <leader>gf :YcmCompleter GoToDefinition<CR> " 转到定义
nnoremap <Leader>gt :YcmCompleter GetType<CR> " 获取变量类型
" 新建文件,自动插入文件头
autocmd BufNewFile *.sh,*.py,*.c,*.cpp,*.h,*.hpp exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'sh'
call setline(1, "\#!/bin/bash")
call append(line("$"), "")
exec ":2"
elseif expand("%:e") == 'py'
call setline(1, "#!/usr/bin/env python")
call append(line("$"), "#coding=utf-8")
call append(line("$"), "")
exec ":3"
elseif expand("%:e") == 'c'
if expand("%") == "main.c"
call setline(1, "#include <stdio.h>")
call append(line("$"), "")
call append(line("$"), "int main(void)")
call append(line("$"), "{")
call append(line("$"), "\treturn 0;")
call append(line("$"), "}")
exec ":5"
endif
elseif expand("%:e") == 'cpp'
if expand("%") == "main.cpp"
call setline(1, "#include <iostream>")
call append(line("$"), "")
call append(line("$"), "int main(void)")
call append(line("$"), "{")
call append(line("$"), "\treturn 0;")
call append(line("$"), "}")
exec ":5"
endif
elseif expand("%:e") == 'h' || expand("%:e") == 'hpp'
call setline(1, "#ifndef _".toupper(expand("%:r"))."_".toupper(expand("%:e"))."_")
call append(line("$"), "#define _".toupper(expand("%:r"))."_".toupper(expand("%:e"))."_")
call append(line("$"), "")
call append(line("$"), "#endif")
exec ":3"
endif
endfunc
set noesckeys " 关闭插入模式识别 <Esc> 开始的功能键
人造人 发表于 2019-9-10 13:06
^_^
谢谢大佬
页:
[1]