VimThis keyword, I do not want to explain too much, I believe to see the colleagues here, the VIM has Seventeen-Eight points of understanding, if you do not know what Vim is, find a black room yourself ...
Needless to say, today here is mainly about vim, without the plug-in configuration, which is the most concise cross-platform editor;
First explain my system and version:
We step by step:
Before the configuration, the system needs to have vim first, the method is as follows:
Ubuntu System:
Normal user input command: sudo apt-get install VIM-GTK
CentOS System:
Normal user input command: yum-y install vim*
1. Since it is configuration, it must be configured in a file, Vim Editor is a tool, since it is a tool, then each user's preferences will be different, if said, under the Superuser ". VIMRC" under Configuration, then the multi-user login
Words, will be the same way, it is too limited, but, for the time being, this editor for your own use, so in the superuser or individual users under the same, but, here I take personal user as an example. In the personal user root directory
Under, whatever, first execute one:
CD ~
Back to the root of the individual user: Create a (. vimrc) file, in this note, do not reduce the point;
The user's own profile is established. VIMRC later configuration files are configured in. VIMRC, including later configurations with plug-ins, some of which need to be modified in this configuration file, and each entry into the. vimrc file is also using the VIM directive to
Below is the effect of my configuration:
That is, the effect is not only available for the C/s + + compilation environment, but even your vim operation. VIMRC is also practical, the above is the effect, as to what instructions do, online information a lot, here I list my own configuration:
"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "", "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "Winpos 5 5" Set window position set lines=40 columns=155 "Set window size set Nu" Display line number Set go= "Do not graphic button color asmanian2" Setting background theme set Guifont=courier_new:h10:cansi "setting font syntax on "Syntax highlighting autocmd insertleave * se nocul" highlight current line with light color autocmd insertenter * se cul "highlight current line set ruler with light color" display Ruler set showcmd "input command displayed, see clearly set cmdheight=1" command line (under the status line) height, set to 1 set whichwrap+=<,>,h,l "Allow Ba Ckspace and cursor keys span line boundaries (not recommended) Set scrolloff=3 "The cursor moves to the top and bottom of the buffer with 3 lines of distance set Novisualbell" Do not blink (do not understand) set statusline=%f% m%r%h%w\ [format=%{&ff}]\ [type=%y]\ [pos=%l,%v][%p%%]\%{strftime (\ "%d/%m/%y\-\%h:%m\")} "status line display contents set Laststatu S=1 "Start Display status line (1), always show status line (2) Set foldenable" Allow collapse set foldmethod=manual "Manually collapse set Background=dark" background using black SE T nocompatible "get rid of the nasty about VI consistency mode,Avoid some bugs and limitations of previous versions "show Chinese help if version >= 603 set HELPLANG=CN set ENCODING=UTF-8ENDIF" Set color scheme colorscheme Murphy "font if (Has ("gui_running")) set guifont=bitstream\ vera\ sans\ mono\ endif set FENCS=UTF-8,UCS-BOM,SHIFT-JIS,GB18030,GBK,GB 2312,cp936set termencoding=utf-8set encoding=utf-8set fileencodings=ucs-bom,utf-8,cp936set fileencoding=utf-8 "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Automatically inserts the file header Autocmd bufnewfile *.cpp,*. [Ch],*.sh,*.java exec]: Call Settitle () "" Define function Settitle, automatically insert file header func settitle () "If the file type is. sh file if &filetype = = ' SH ' Call Setline (1, "\#########################################################################") Call AppE nd ("."), "\# File Name:". Expand ("%")) call Append (".") +1, "\# author:ma6174") Call Append (".") +2, "\# Mail: [EMAIL&NBsp;protected] ") Call Append (". ") +3, "\# Created Time:". Strftime ("%c")) Call Append (".") +4, "\#########################################################################") Call Append (".") +5, "\#!/bin/bash") Call Append (".") +6, "") Else call Setline (1, "/*************************************************************************") Call Append ("."), "> File Name:" Expand ("%")) call Append (".") +1, "> author:ma6174") Call Append (".") +2, "> Mail: [email protected]") Call Append (".") +3, "> Created time:". Strftime ("%c")) Call Append (".") +4, "************************************************************************/") Call Append (".") +5, "") endif if &filetype = = ' cpp ' Call append (".") +6, "#include <iostream>") Call Append (".") +7, "using namespace std;") Call Append (".") +8, "") endif if &filetype = = ' C ' Call append (".") +6, "#include <stdio.h>") Call Append (".") +7, "") endif "after new file, automatically navigates to end of file autocmd Bufnewfile * Normal Gendfunc" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "Keyboard Commands," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" <cr> "Map Select all + copy Ctrl+amap <C-A> ggvgymap! <C-A> <esc>ggvgymap <F12> gg=g "Select Ctrl + C copy vmap <C-c>" +y "Go to Empty line Nnoremap <F2>: g/^\s*$/d& Lt Cr> "Compare files Nnoremap <C-F2>: Vert diffsplit" new label map <M-F2>:tabnew<cr> "lists the current directory file map <F3>: Tabnew .<cr> "Open tree file directory map <C-F3> \be" c,c++ Press F5 compile run map <F5>: Call COMPILERUNGCC () <cr>func! COMPILERUNGCC () Exec "W" if &filetype = = ' C ' exec "!g++%-o%<" exec "!./%< " ElseIf &filetype = = ' cpp ' EXEC "!g++%-o%<" exec "! ./%<" elseif &filetype = = ' java ' Exec "!javac%" exec "!java%<" elseif &filetype = = ' sh ':!. /% endifendfunc "c,c++ Debug map <F7>: Call Rungdb () <cr>func! Rungdb () Exec "W" exec "!g++%-g-o%<" exec "!gdb ./%<" Endfunc "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" CPP map <buffer> <leader><space>:w<cr>:make<cr> "code complement set Completeopt=preview,menu" Allow plugin filetype plugin on "share clipboard set clipboard+=unnamed" Never Back Up set Nobackup "make run: Set makeprg=g++\-wall\ \%" Automatically save set AUT Owriteset ruler "Open status bar ruler set Cursorline" highlight current line set Magic "set magic set Guio PtionS-=t "Hide Toolbar set guioptions-=m" Hide Menu bar set statusline=\%<%f[%1*%m%*%n%r%h]%=\%y\%0 (%{&fileform at}\%{&encoding}\%c:%l/%l%) " Set the information displayed in the status line set Foldcolumn=0set foldmethod=indent set foldlevel=3 set foldenable "Start folding" do not use the VI keyboard mode, but vim own s ET nocompatible "syntax highlighting set Syntax=on" Get rid of input error prompt sound set Noeb "when processing unsaved or read-only files, popup confirm set confirm" Auto indent set Autoindentset cindent "T The width of the AB key set tabstop=4 "Unified indentation is 4set softtabstop=4set shiftwidth=4" Do not use spaces instead of tab set noexpandtab "tab set Smarttab at the beginning of rows and segments" Display line numbers set number "history set history=1000" Prohibit generate temporary file set Nobackupset noswapfile "Search ignores case set ignorecase" Search Fugauliang set Hlsearchset Incsearch "Inline replace set Gdefault" encoding setting set Enc=utf-8set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936 "language setting set Langmenu=zh_cn. Utf-8set HELPLANG=CN "My status line displays the contents (including file type 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 show status line set Laststatus=2 "LifeThe height of the row (under the status line), the default is 1, here is 2set cmdheight=2 "reconnaissance file type filetype on" load file type plug-in filetype plugin on "load the relevant indentation file for a specific file type filetype indent on "Save global variable set viminfo+=!" The word with the following symbol does not break the line split set iskeyword+=_,$,@,%,#,-"word putting inserted pixel number of rows set linespace=0" enhanced mode command line AutoComplete operation set Wildmenu "Enable the BACKSPACE key (BACKSPACE) normal handling indent, EOL, start etc set backspace=2" Allow backspace and cursor keys to span the line boundary set Whichwrap+=<,>,h,l " You can use the mouse anywhere in buffer (similar to double-clicking the mouse in the workspace) set Mouse=aset selection=exclusiveset Selectmode=mouse,key "by using: Commands command , tell us which line of the file has been changed. Set report=0 "Display whitespace between split windows, easy to read set fillchars=vert:\, stl:\, STLNC:" Highlight matching parentheses set Showmatch " Matches the time of the brace highlighting (in a very second) set matchtime=1 "Keep 3 lines distance from set scrolloff=3" when the cursor moves to the top and bottom of the buffer "The C program provides auto indent set Smartindent" Highlight Plain TXT file (requires Txt.vim script) au bufread,bufnewfile * setfiletype txt "auto Complete: 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>ifunction! Closepair (char) if getline ('. ') [Col ('. ')-1] = = A:char return "\<right>" else return A:char Endifendfunctionfiletype plugin in Dent on "Open file type detection, add this sentence can be used with smart complement set Completeopt=longest,menu" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Ctags "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "Tlist_sort_type =" name "" Sort by name let Tlist_use_right_window = 1 "In the right-hand display window Let Tlist_compart_format = 1 "compression mode let Tlist_exist_onlywindow = 1" If there is only one buffer,kill window also kill buffer let Tlist_file_ Fold_auto_close = 0 "Do not close other files of tags let tlist_enable_fold_column = 0" Do not show collapsed tree Autocmd FileType Java set tags+=d:\to Ols\java\tags autocmd FileType h,cpp,cc,c set tags+=d:\tools\cpp\tags let tlist_show_one_file=1 "ta that does not display multiple files at the same time G, show only the current file "settings tags set tags=tags set autochdir" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """ "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" TagList Let tlist_auto_open= 1 "," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " Ctags ' Let Tlist_show_one_file = 1 ' does not display multiple file tags at the same time, only displays the current file's let Tlist_exit_onlywindow = 1 "If the TagList window is the last window, then exit vim let Tl Ist_use_right_window = 1 "Display TagList window in the right window" MINIBUFEXPL plug-in general settings let G:minibufexplmapwindownavvim = 1let g: Minibufexplmapwindownavarrows = 1let G:minibufexplmapctabswitchbufs = 1let G:minibufexplmodseltarget = 1
Basically these direct copies, glued to your. VIMRC, save, open with Vim. C or. cpp to see the effect:
Here is my effect: (General bar)
Basic concise version of So much, right, the picture of the split window is done with plug-ins, vim configuration, see the next blog:
Enlighten
Vim configuration powerful to attack