First, attach a rendering

Enter vim ~/. Vimrc to enter the vim configuration file


"""""""""""""""""""""""""""""""""""""""""""Basic Settings"""""""""""""""""""""""""""""""""""""""""""""
filetype on	"Enable file type detection
filetype indent on	"Accommodate indentation in different languages
syntax enable	"Turn on syntax highlighting
syntax on 	"User color matching is allowed


"""""""""""""""""""""""""""""""""""""""""""Display Settings"""""""""""""""""""""""""""""""""""""""""""""
set laststatus=2        	"Always show the status bar
set ruler               	"Display cursor position
set number              	"Display line number
set cursorline          	"Highlight the current row
set cursorcolumn            "Highlight the current column
set hlsearch                "Highlight search results
exec "nohlsearch"
set incsearch               "Highlight as you type
set ignorecase              "Ignore case when searching
set smartcase

set relativenumber          "Other lines display relative line numbers
"set scrolloff=5 "Position of cursor from bottom when scrolling vertically"""""""""""""""""""""""""""""""""""""""""""Encoding Settings"""""""""""""""""""""""""""""""""""""""""""""
set fileencodings=utf-8,gb2312,gbk,gb18030,cp936    "Checks the fileencoding and sets fileencoding to the final encoding
set fileencoding=utf-8                              "The file encoding at the time of saving
set termencoding=utf-8                              "The output character encoding of the terminal
set encoding=utf-8                                  "Internal encoding used by VIM to open files


"""""""""""""""""""""""""""""""""""""""""""Edit Settings"""""""""""""""""""""""""""""""""""""""""""""
set expandtab   	"Extension tabs are Spaces
set tabstop=4   	"Number of tabs in Spaces
set softtabstop=4	"Treat a contiguous number of Spaces as a single TAB character
set shiftwidth=4	"The number of Spaces used for automatic indentation
"set textwidth=79	"Number of characters per line of the editorset wrap            "Set automatic line folding
set linebreak       "Prevent words from folding inside
set wrapmargin=5      "Specifies the number of Spaces at the fold and right edge
set autoindent  	"Turn on auto indent
set wildmenu    	"Vim command auto-complete


"""""""""""""""""""""""""""""""""Key mapping (Just for Colemak user)"""""""""""""""""""""""""""""""

"^
" u
" < n i >
" e
" v

"Exit key in insert mode
inoremap tt <Esc>"The direction keynoremap n h
noremap u k
noremap e j
noremap i l
noremap N 7h
noremap U 5k
noremap E 5j
noremap I 7l"Jump to the beginning/end of the linenoremap <C-n> 0
noremap <C-i> $
noremap k i
noremap K I
noremap l u

map s <nop>
map S :w<CR>
map Q :q<CR>
map R :source $MYVIMRC<CR>
map ; :

map si :set splitright<CR>:vsplit<CR>
map sn :set nosplitright<CR>:vsplit<CR>
map su :set nosplitbelow<CR>:split<CR>
map se :set splitbelow<CR>:split<CR>

let mapleader = "\<Space>"
map <LEADER>i <C-w>l
map <LEADER>u <C-w>k
map <LEADER>n <C-w>h
map <LEADER>e <C-w>j

"map <up> :res +5<CR>
"map <down> :res -5<CR>
"map <left> :vertical -5<CR>
"map <right> :vertical +5<CR>

map tu :tabe<CR>
map tn: -tabnext<CR>
map ti :+tabnext<CR>

map sv <C-w>t<C-w>H
map sh <C-w>t<C-w>K


""""""""""""""""""""""""""""""""""""""""""""The plugin Settings""""""""""""""""""""""""""""""""""""""""""""

set nocompatible    "Disable compatibility mode
filetype off    "File type detection disabled


call plug#begin('~/.vim/plugged')
"Plug-ins that need to be configured are placed between begin and end

Plug 'scrooloose/nerdcommenter' "Multi-line comment
Plug 'jiangmiao/auto-pairs'     "Parentheses and quotation marks are automatically completed
Plug 'ycm-core/YouCompleteMe'   "Code completion
Plug 'scrooloose/nerdtree' 	"Tree directory
Plug 'Yggdroot/indentLine'      "Auto indent plug-in
Plug 'vim-airline/vim-airline'  "Status bar subject
Plug 'vim-scripts/Solarized'    "Theme
Plug 'honza/vim-snippets'       "Code fragment completion
Plug 'SirVer/ultisnips'

"Plug 'mhinz/vim-startify' "vimStart screen recent files"Plug 'connorholyday/vim-snazzy' "Theme plan"Plug 'tpope/vim-commentary' "Code comments"Plug 'ryanoasis/vim-devicons' "File icon"Plug 'Lokaltog/vim-powerline' "Status bar subjectcall plug#end()
filetype plugin indent on
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"solarized
set background=dark
colorscheme solarized   "Simple but elegant
"hi Normal ctermbg=none "Setting background transparency"vim-airline
let g:airline_powerline_fonts=1


"Lokaltog
"let g:Powerline_colorscheme='solarized256' "Set the status bar theme style"nerdtree
"autocmd vimenter * NERDTree
map <F2> :NERDTreeToggle<CR>
let NERDTreeWinSize=25
let NERDTreeWinPos="right"

"indentLine
let g:indentLine_char='┆       "Indent indicating line character
let g:indentLine_enabled = 1    "Turn on indent indicator

"YouCompleteMe
let g:ycm_global_ycm_extra_conf='~/.vim/plugged/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py'
let g:ycm_server_python_interpreter='/usr/bin/python'
let g:ycm_semantic_triggers= {\'c' : ['- >'.'. '], and \'objc' : ['- >'.'. '.'re! \[[_a-zA-Z]+\w*\s'.'re! ^\s*[^\W\d]\w*\s',
  \             're! \[.*\]\s'], and \'ocaml' : ['. '.The '#'], and \'cpp,objcpp' : ['- >'.'. '.'... '], and \'perl' : ['- >'], and \'php' : ['- >'.'... '], and \'cs,java,javascript,typescript,d,python,perl6,scala,vb,elixir,go' : ['. '], and \'ruby' : ['. '.'... '], and \'lua' : ['. '.':'], and \'erlang' : [':'], and \'c,cpp,python,java,go,erlang,perl': ['re! \w{2}'], and \'cs,lua,javascript': ['re! \w{2}'], and \}set completeopt=menu,menuone
let g:ycm_add_preview_to_completeopt = 0


"Snippet
let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/plugged/vim-snippets/UltiSnips']
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsListSnippets = "<c-tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
let g:UltiSnipsEditSplit="vertical"

"YouCompleteMe and Snippet shortcuts clash
"Use the following function to make peace with YouCompleteMe and Snippet

function! g:UltiSnips_Complete(a)
  call UltiSnips#ExpandSnippet()
  if g:ulti_expand_res= =0
    if pumvisible(a)return "\<C-n>"
    else
      call UltiSnips#JumpForwards()
      if g:ulti_jump_forwards_res= =0
        return "\<TAB>"
      endif
    endif
  endif
  return ""
endfunction

function! g:UltiSnips_Reverse(a)
  call UltiSnips#JumpBackwards()
  if g:ulti_jump_backwards_res= =0
    return "\<C-P>"
  endif

  return ""
endfunction

if! exists("g:UltiSnipsJumpForwardTrigger")
  let g:UltiSnipsJumpForwardTrigger = "<tab>"
endif
if! exists("g:UltiSnipsJumpBackwardTrigger")
  let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
endif
au InsertEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger     . " <C-R>=g:UltiSnips_Complete()<cr>"
au InsertEnter * exec "inoremap <silent> " .     g:UltiSnipsJumpBackwardTrigger . " <C-R>=g:UltiSnips_Reverse()<cr>"

Copy the code