configuration file
Vim has multiple configuration file vimrc, such as/ETC/VIMRC, which affects vim throughout the system. And ~/.VIMRC, this file only affects the vim of the user. Also, the configuration in the ~/.VIMRC file overrides the configuration in/ETC/VIMRC. Here we only modify the ~/.VIMRC file. If not, build a file in the user's home directory. VIMRC.
The plug-in is installed in the user's home directory under the ~/.vim directory, after decompression will have ~/.vim/plugin and ~/.vim/doc directory (also can be created on their own).
(1) Implement VIM under ~/.vim/doc, Input: helptags command, this step will add the Help document under Doc to Vim's help topic, so that we can view TagList Help by running "helps Taglist.txt" in vim.
(2) The ~/.vim/plugin directory is a. Vim form of plug-ins.
Current ~/.vim Plug-in configuration:
Http://pan.baidu.com/s/1eQpj3xg
The currently used VIM configuration effect is as follows:
This VIM configuration has the following features:
1, press F5 can directly compile and execute C, C + +, Java code and execute shell script, press "F8" can do C, C + + code debugging
2, automatically insert the file header, new C, C + + source files automatically insert the header: including file name, author, contact, build time, etc., the reader can change according to the requirements
3, press "F2" to eliminate the blank line in the code directly
4,ctags function: Position the cursor on a function name, press Ctar +], VIM can automatically switch to the function definition, to return only need to press CTRL + T.
5, press F3 left to open the tree file directory and tlist display variables and functions, F4 the right open function, by class distinction, folding display
6,:as split the window horizontally and open the c/h file
7, code folding operation: za, turn on or off the current fold; ZM, close all folds; ZR, open all folding
8, press "Ctrl + P" to automatically fill the full keyword
9, Quick Find: Vim input/(Find keywords)
9, the pointer input-> and object input. Automatically pops up all its definition functions
9,[], {}, (), "," and so on are automatically filled
10, Map Ctrl + A to select all and copy shortcut keys. The most basic is to press v after the Move cursor key selection by v copy, press D cut, press p paste. yy copies an entire line.
11, code highlighting, automatic indentation, display line number, show status line
12, support mouse selection, the direction of the key to move
To start creating a configuration file:
Use gedit editing to make code copy and paste easy:
The contents are as follows:
"" "" "" "" "" "" "" "" "" "" "" "" "" "" Winpos 5 5 "Set window position" set lines=40 columns=155 "Set window size set Nu" Show line number "set Go= "Do not graph button" color asmanian2 "Set background theme" Set Guifont=courier_new:h10:cansi "set font syntax on" syntax highlighting autocmd insertleave * SE Nocul "Highlight the current line with a light color autocmd insertenter * se cul" highlight the current line with a light color, set ruler "show ruler set ShowCmd" The command displayed, see the Set Cmdheight=1 " The height of the command line (under the status line), set to 1 "Set Whichwrap+=<,>,h,l" allows backspace and cursor keys to cross line boundaries (not recommended) set scrolloff=3 " The cursor moves to the top and bottom of the buffer to keep 3 lines away from set Novisualbell "Do not blink set statusline=%f%m%r%h%w\ [format=%{&ff}]\ [type=%y]\ [Pos=%l,%v] [%p%%]\%{strftime (\%d/%m/%y\-\%h:%m\)} ' status line display content set Laststatus=1 ' launches Display status line (1), always shows status line (2) Set foldenable "Allow folding set F Oldmethod=manual "Manually collapse set Background=dark" background using black set nocompatible "remove annoying about VI consistency mode, avoid some bugs and limitations from previous versions" show Chinese help if version & Gt;= 603 Set HELPLANG=CN set encoding=utf-8 endif "Set color scheme colorscheme Desert" font set Fencs=utf-8,ucs-bom,shift-ji s,gb18030,gbk,gb2312,cp936 Set Termencoding=utf-8 Set Encoding=utf-8 set fileencodings=ucs-bom,utf-8,cp936 set Fileencoding=utf-8 "" "" "" "" "" "" "" "" "" "" "" "", "" [Ch],*.sh,*.java exec: Call Settitle () "" "Define function Settitle, automatically insert file header func settitle () if file type is. sh file if &filetype = ' SH ' call Setline (1, "\#########################################################################") Call app End (Line ("."), "\# File Name:". Expand ("%")) called Append (Line (".") +1, "\# author:zlk") Call Append (Line (".") +2, "\# mail:zlk@mail.ustc.edu.cn</a>") Call Append (Line (".") +3, "\# Created Time:". Strftime ("%c")) called Append (Line (".") +4, "\#########################################################################") Call Append (Line (".") +5, "\#!/bin/bash") Call Append (Line (".")
+6, "") Else call Setline (1, "/*************************************************************************") Call Append ("."), "> File Name:". Expand ("%")) called Append (Line (".") +1, "> author:zlk") Call Append (Line (".") +2, "> mail:zlk@mail.ustc.edn.cn") Call Append (Line (".") +3, "> Created time:". Strftime ("%c")) called Append (Line (".") +4, "************************************************************************/") Call Append (Line (".") +5, "") endif if &filetype = = ' cpp ' Call Append (Line (".") +6, "#include <iostream>") Call Append (Line (".")
+7, "using namespace std;") Call Append (Line (".") +8, "") endif if &filetype = = ' C ' Call Append (Line (".") +6, "#include <stdio.h>") Call Append (Line (".") +7, "" "EndIf" "" "," "" "" "" "" "" "", "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "
"" "" "" "" "" "" "" "" "" "" "" "" Nmap <leader>w:w!<cr> nmap <leader>f:find<cr> " Map <C-A> ggvgy map! <c-a> <esc>ggvgy Map <F12> gg=g "Select Ctrl + C copy vmap <C-c>" +y "Go to Empty line Nnoremap <F2>:g/^\s*$/d<
Cr> "Compare files Nnoremap <C-F2>: Vert diffsplit" new label map <M-F2>:tabnew<cr> "lists current directory files map <C-F3> \be "C,c++ F5 compile run map <F5>: Call COMPILERUNGCC () <CR> func! COMPILERUNGCC () Exec "W" if &filetype = = ' C ' exec '!g++%-o%< "exec"! ./%< "Elsei"
F &filetype = = ' cpp ' EXEC '!g++%-o%< ' exec '! ./%< elseif &filetype = ' java ' Exec "!javac%" exec "!java%<" elseif &filetype = ' sh ':!. /% endif endfunc "c,c++ Debug map <F8>: Call Rungdb () <CR> func! Rungdb () Exec "W" "Exec"!g++%-g-o%< "exec"!gdb ./%< "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "for code folding based on indentation or syntax" set foldmethod=indent set Foldmethod=syntax turn off the collapse code "set nofoldenable" setting when you start vim Automatically load set Autoread when file is changed "QUICKFIX-mode autocmd FileType c,cpp map <buffer> <leader><space>:w<cr>:make<cr> "code completion set Completeopt=preview,menu "Allow plugin filetype plugin on" share clipboard set clipboard+=unnamed "Never Back Up set Nobackup" to run: Set makeprg=g
++\-wall\ \% Auto Save set Autowrite set ruler open status bar ruler set Cursorline highlight current line set magic set Magic set guioptions-=t Hide Toolbar Set guioptions-=m "Hide Menu bar" Set statusline=\%<%f[%1*%m%*%n%r%h]%=\%y\%0%{&fileformat}\%{&encoding}\ /%l%) \ Set the information displayed on the status line set foldcolumn=0 set foldmethod=indent set foldlevel=3 set foldenable "Start folding" do not use VI keyboard mode, but vim own s ET nocompatible "get rid of the input error prompt sound set Noeb" when processing unsaved or read-only files, pop up to confirm set confirm "Auto indent set autoindent set cindent" tab width set t Abstop=4 "Unified indent to 4 set softtabstop=4 set shiftwidth=4" Do not use spaces instead of tab set Noexpandtab "Use tab" set SMARTTABR "history number at the beginning of rows and segments SE T history=1000 "prohibit generation of temporary files set nobackup set Noswapfile" Search ignores case set ignorecase "search verbatim Fugauliang set Hlsearch set Incsearch" to replace set Gdefault "encoding setting set Enc=utf-8 set Fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936 the language setting set LANGMENU=ZH_CN. UTF-8 set HELPLANG=CN "The contents of my status line (including file types and decoding)" Set statusline=%f%m%r%h%w\ [format=%{&ff}]\ [type=%y]\] [pos=%l,%v][% P%%]\%{strftime (\%d/%m/%y\-\%h:%m\)} "set statusline=[%f]%y%r%m%*%=[line:%l/%l,column:%c][%p%%]" always shows the status line set laststatus=2 the height of the command line (under the status line), defaults to 1, here is the 2 set cmdheight=2 "Reconnaissance file type filetype on" load file type plug-in filetype plugin on "load related indents for specific file types Piece filetype indent on "Save global variable set viminfo+=!" words with the following symbols do not wrap the set iskeyword+=_,$,@,%,#,-"word Fu inserted number of pixel rows set linespace=0" command line completion in enhanced mode operation set Wildmenu "Make the Back key (BACKSPACE) normal processing indent, EOL, start, etc. set backspace=2" Allow backspace and cursor keys across the line boundary set Whichwra P+=<,>,h,l "You can use the mouse anywhere in the buffer (similar to double-clicking in office in the workspace) set mouse=a set selection=exclusive set Selectmode=mouse,
Key "by using: Commands command, tell us which line of the file has been changed by set report=0" to show gaps between the separated windows to facilitate reading set fillchars=vert:\, Stl:\, Stlnc:\ "Highlight matching bracket set Showmatch" Match bracket highlight time (unit is very second) set matchtime=1 "cursor moves to the top and bottom of buffer to keep 3 lines away from set SCRolloff=3 "provide automatic indent set smartindent for C program" highlighting plain TXT file (requires Txt.vim script) au bufread,bufnewfile * setfiletype txt "automatic completion: Inoremap (() <esc>i:inoremap) <c-r>=closepair (') <CR>: inoremap {<cr>}<esc>o:inoremap} < C-r>=closepair ('} ') <CR>: Inoremap [[]<esc>i:inoremap] <c-r>=closepair ('] ') <CR>: Inoremap "" "<esc>i:inoremap ' <esc>i function! Closepair (char) if getline ('. ') [Col ('. ')-1] = = A:char return "\<right>" else return A:char endif endfunction filetype Gin indent on "Open file type detection, add this to the smart fill set Completeopt=longest,menu" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "," "" "Let Tlist_auto_open=1" by default, taglist let Tlist_show_one_file = 1 "does not display the tag of multiple files at the same time, only the let Tl for the current file is displayed Ist_exit_onlywindow = 1 "If the TagList window is the last window, then exit Vim" "" "" "" "" "" "" "" "" "" "" "" """" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Minibufexpl,nedrtree,winmanager "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " Plmapctabswitchbufs = 1 Let G:minibufexplmodseltarget = 1 let g:minibufexplmorethanone=0 let g:nerdtree_title= "[N Erdtree] "Let g:winmanagerwindowlayout=" nerdtree| TagList "function! Nerdtree_start () exec ' nerdtree ' endfunction function! Nerdtree_isvalid () return 1 endfunction map<f3>:wmtoggle<cr> "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
Omnicppcomplete "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " Let Omnicpp_globalscopesearch = 1 let omnicpp_showaccess = 1 let omnicpp_showprototypeinabbr = 1 let omnicpp_maycompleted OT = 1 Let Omnicpp_maycompletearrow = 1 let Omnicpp_maycompletescope = 1 let omnicpp_defaultnamespaces = ["Std", "_GL IBCXX_STD "] Let OmniCpp_selectfirstitem = 2 let omnicpp_displaymode=1 au cursormovedi,insertleave * if pumvisible () = = 0|silent! Pclose|endif set Tags+=tags set Tags+=/home/zlk/test/q/tags/lib_tags "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "ycm the general settings of the plug-in" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""