# 配置vim-plug cp ~/.vim/autoload/plug_vim/plug.vim ~/.vim/autoload/ cd ~ touch .vimrc vim .vimrc
# 插件安装方法
" Specify a directory for plugins " - For Neovim: stdpath('data') . '/plugged' " - Avoid using standard Vim directory names like 'plugin' call plug#begin('~/.vim/plugged')
set autoread set autowrite set ai set bs=2 set backspace=eol,start,indent " set backspace=2 set nobackup set cindent set cinoptions=:0 set completeopt=longest,menuone set expandtab set encoding=utf-8 set fileencodings=utf-8,gbk,gb2312,gb18030 set fileformat=unix set fileencoding=utf-8 set guioptions-=T set guioptions-=m set guioptions-=r set guioptions-=l set helplang=cn set hidden set history=1000 set incsearch set ignorecase set laststatus=2 set linebreak set mouse=a set magic set nobackup set nu set noerrorbells set novisualbell set pumheight=10 set ruler set scrolloff=5 set softtabstop=4 set showcmd set smartindent set smartcase set sidescroll=1 set sidescrolloff=15 set showbreak=" " set showcmd set smartcase set so=7 set t_Co=256 set termencoding=utf-8 " Set the line max charcher. set textwidth=140 set whichwrap=h,l set wildignore=*.bak,*.o,*.e,*~ set wildmenu set wildmode=list:longest,full set nowrap
autocmd FileType c,cpp,py,cc set shiftwidth=4 | set expandtab
syntax enable
" Show line numbers set number
" Highlight matching brace set showmatch
" Highlight all search results set hlsearch
" Highlight the current cursor line set cursorline
" Highlight the 80 columns margin. set colorcolumn=140
" Trim the trailing white space on save. autocmd BufWritePre <buffer> :%s/\s\+$//e
" ---------- Indentation ---------- " Use spaces instead of tabs set expandtab " set noexpandtab
" Number of spaces that a <TAB> in the file counts for set tabstop=4
" Number of auto-indent spaces set shiftwidth=4 set autoindent
" ---------- Folding ---------- set foldenable set foldmethod=marker
快捷配置
.vimrc
1 2 3 4 5 6 7 8
"space to command mode. nnoremap <space> : vnoremap <space> : " Set mapleader let mapleader="," " "cd" to change to open directory. let OpenDir=system("pwd") nmap <silent> <leader>cd :exe 'cd ' . OpenDir<cr>:pwd<cr>
" ---------- YCM Auto Complete ---------- nnoremap <C-a> :YcmCompleter GoTo<CR>
let g:ycm_global_ycm_extra_conf = '~/.vim/REPO_DIRECTORY/.ycm_extra_conf.py' let g:ycm_confirm_extra_conf = 0
let g:ycm_python_binary_path = '/usr/bin/python3.5'
let g:ycm_key_list_previous_completion = ['<Down>'] let g:ycm_key_list_previous_completion = ['<Up>'] let g:ycm_collect_identifiers_from_tags_files = 1 let g:ycm_min_num_of_chars_for_completion = 2 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_collect_identifiers_from_comments_and_strings = 0
let g:ycm_add_preview_to_completeopt = 0 let g:ycm_show_diagnostics_ui = 0 let g:ycm_server_log_level = 'info' let g:ycm_min_num_identifier_candidate_chars = 2 " let g:ycm_collect_identifiers_from_comments_and_strings = 1 " let g:ycm_complete_in_strings=1 " let g:ycm_key_invoke_completion = '<c-z>'