if version >= 603
set helplang=cn
set encoding=utf-8
endif
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plugin 'ycm-core/YouCompleteMe', { 'do': './install.py' }
Plugin 'rdnetto/YCM-Generator', { 'branch': 'stable'}
call vundle#end() " required
filetype plugin indent on " required
filetype on
inoremap
noremap
inoremap yy
inoremap
nnoremap
noremap
inoremap
inoremap
noremap
inoremap
noremap
imap jk
inoremap dd
nnoremap tn :tabnew
nnoremap tj :tabnext
nnoremap tk :tabprev
nnoremap tc :tabclose
"自动补全
""inoremap ( ()
inoremap )
inoremap { {
inoremap }
inoremap [ []
inoremap ]
inoremap " ""
inoremap ' ''
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\
else
return a:char
endif
endfunction
map
"共享剪贴板
set clipboard+=unnamed
"自动保存
set autowrite
" 在处理未保存或只读文件的时候,弹出确认
set confirm
"搜索逐字符高亮
set hlsearch
colorscheme industry
" 设置当文件被改动时自动载入
set autoread
set shortmess=atI
set showcmd " 输入的命令显示出来,看的清楚些
syntax on " 自动语法高亮
set number " 显示行号
set cursorline " 突出显示当前行
set ruler " 打开状态栏标尺
set shiftwidth=4 " 设定 << 和 >> 命令移动时的宽度为 4
set softtabstop=4 " 使得按退格键时可以一次删掉 4 个空格
set tabstop=4 " 设定 tab 长度为 4
set nobackup " 覆盖文件时不备份
"set autochdir " 自动切换当前目录为当前文件所在的目录
set backupcopy=yes " 设置备份时的行为为覆盖
set ignorecase smartcase " 搜索时忽略大小写,但在有一个或以上大写字母时仍保持对大小写敏感
set nowrapscan " 禁止在搜索到文件两端时重新搜索
set incsearch " 输入搜索内容时就显示搜索结果
set hlsearch " 搜索时高亮显示被找到的文本
set noerrorbells " 关闭错误信息响铃
set novisualbell " 关闭使用可视响铃代替呼叫
set t_vb= " 置空错误铃声的终端代码
set showmatch " 插入括号时,短暂地跳转到匹配的对应括号
set matchtime=2 " 短暂跳转到匹配括号的时间
set magic " 设置魔术
set hidden " 允许在有未保存的修改时切换缓冲区,此时的修改由 vim 负责保存
set guioptions-=T " 隐藏工具栏
set guioptions-=m " 隐藏菜单栏
set smartindent " 开启新行时使用智能自动缩进
set backspace=indent,eol,start
" 不设定在插入状态无法用退格键和 Delete 键删除回车符
set cmdheight=1 " 设定命令行的行数为 1
set laststatus=2 " 显示状态栏 (默认值为 1, 无法显示状态栏)
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\
" 设置在状态行显示的信息
set foldenable " 开始折叠
set foldmethod=syntax " 设置语法折叠
set foldcolumn=0 " 设置折叠区域的宽度
setlocal foldlevel=1 " 设置折叠层数为
" set foldclose=all " 设置为自动关闭折叠
nnoremap
" 用空格键来开关折叠
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
func SetTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(1,"\#########################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: limu")
call append(line(".")+2, "\# mail: [email protected]")
call append(line(".")+3, "\# Created Time: ".strftime("%c"))
call append(line(".")+4, "\#########################################################################")
call append(line(".")+5, "\#!/bin/bash")
call append(line(".")+6, "")
else
call setline(1, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+1, " > Author: limu")
call append(line(".")+2, " > Mail: [email protected] ")
call append(line(".")+3, " > Created Time: ".strftime("%c"))
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
endif
if &filetype == 'cpp'
call append(line(".")+6, "#include
" call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
" if &filetype == 'c'
" call append(line(".")+6, "#include
" call append(line(".")+7, "")
" endif
" "新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
map
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!gcc % -o %<"
exec "! ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!java %<"
elseif &filetype == 'sh'
:!./%
endif
endfunc
"set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
"imap fw
imap fd
nmap fw
nmap fd
"nnoremap
let g:ycm_auto_trigger=1
let g:ycm_min_num_of_chars_for_completion = 2
let g:ycm_min_num_identifier_candidate_chars = 10
let g:ycm_max_num_candidates = 50
let g:ycm_max_num_candidates_to_detail = 0
let g:ycm_max_num_identifier_candidates = 20
let g:ycm_filetype_whitelist = {'*': 1}
""let g:ycm_filepath_blacklist = {'*': 1}
let g:ycm_show_diagnostics_ui = 1
let g:ycm_error_symbol = '>>'
let g:ycm_warning_symbol = '**'
let g:ycm_enable_diagnostic_signs = 1
let g:ycm_enable_diagnostic_highlighting = 1
let g:ycm_echo_current_diagnostic = 1
"nmap
"augroup MyYCMCustom
" autocmd!
" autocmd FileType c,cpp let b:ycm_hover = {
" \ 'command': 'GetDoc',
" \ 'syntax': &filetype
" \ }
"augroup END
"let g:syntastic_always_populate_loc_list=1
let g:ycm_always_populate_location_list = 1
let g:ycm_open_loclist_on_ycm_diags = 1
let g:ycm_complete_in_comments = 0
let g:ycm_complete_in_strings = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_extra_conf_vim_data = []
let g:ycm_server_python_interpreter = ''
let g:ycm_keep_logfiles = 0
let g:ycm_add_preview_to_completeopt = 1
let g:ycm_autoclose_preview_window_after_completion = 0
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_max_diagnostics_to_display = 30
let g:ycm_key_list_select_completion = ['
let g:ycm_key_list_previous_completion = ['
let g:ycm_key_list_stop_completion = ['
let g:ycm_key_invoke_completion = '
let g:ycm_key_detailed_diagnostics = '
"let g:ycm_global_ycm_extra_conf=‘~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py‘
"let g:ycm_confirm_extra_conf = 1
let g:ycm_filepath_completion_use_working_dir = 1
let g:ycm_cache_omnifunc = 0
let g:ycm_use_ultisnips_completer = 1
let g:ycm_disable_for_files_larger_than_kb = 1000
let g:ycm_goto_buffer_command = 'same-buffer'
let g:ycm_use_clangd = 1
let g:ycm_clangd_binary_path = ''
let g:ycm_clangd_args = []
let g:ycm_clangd_uses_ycmd_caching = 1
""let g:ycm_language_server = []
" Disable signature help
let g:ycm_disable_signature_help = 0
let g:ycm_semantic_triggers = {
\ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'],
\ 'cs,lua,javascript': ['re!\w{2}'],
\ }
inoremap
inoremap
inoremap
"inoremap
nnoremap
nnoremap
nnoremap
nnoremap