1. Ci "(composed of change operator and text-object i")
This command will find the next "enclosed string" in the line where the current cursor is located, clear the contents of the quotation marks, and enter insert mode for easy modification
You can use the const char* hello = "Hello World", which is simpler than the explanation. Code like this to test
2, YaB (composed of Yank operator and Text-object AB)
This command copies the code block where the current cursor is located (the contents of {}, including the curly brace itself) to the default register,
It is convenient to use p in other places (of course, write code does not encourage copy and paste), you can use any one {} to test, and then find another place p
3, GUIW (composed of make uppercase operator and Text-object IW)
This command will capitalize the word in which the current cursor is located
If you turn max_size into max_size
4. Enter Insert mode edit (enter insert mode only with I, to be used depending on the situation, use I a a o O s C)
5. Align gg=g to quickly align the entire file
6, Tabnew Mytab Create a new label MYTAB,:TABN jump to the next tab,: TABP jump to the previous tab, in the GT or GT in normal mode jump to the next and previous label
7, cutting window operation: Split horizontal direction cutting a window,: vsplit Vertical cutting a window, with the ctrl-w+ arrow key in each cutting window switch.
8. Macro operation
QA (Record command to a on this clipboard {Vim has a lot of clipboard, such as ABCDEFG ... }) 3x (repeat three times delete operation, the Foo is deleted, you can actually use the F command to match, more suitable for complex situations) 0 (move to the beginning of the line) J (move to the next row) Q (stop recording) [email protected] (repeat three times the command you just recorded, 3 is to repeat the command 3 times, @ Just run, A is the Clipboard that you just saved)
10, configuration. VIMRC
"=========================================================================" dessription:. vimrc file, for Linux " create:2015 August 02 15:13 "email:[email protected" "Author:kevin" =========================================== ============================== "History set history=10000" displays line number set number "Status column, preset line, recommended set to two lines set cmdheight=3" Save global Variables! A global variable that starts with a capital letter and does not contain a lowercase set viminfo+=! " Allow Chinese characters to display set ambiwidth=double "Fill space" in 2 widths between Windows displays white space between partitioned windows for easy reading of set fillchars=stl:\, Stlnc:\, vert: "Show rulers The line number and column number where the cursor is located on the status line set Rulerset rulerformat=%20 (%2*%<%f%=\%m%r\%3l\%c\%p%%%) "Displays the current mode in the Status column, and the command line displays the vim current mode set Showmode "The input command is displayed, look at the set ShowCmd" the cursor moves to the top and bottom of the buffer to keep 3 lines away from set scrolloff=3 "status line displays the contents set statusline=%f%m%r%h%w\ [ format=%{&ff}]\ [type=%y]\ [pos=%l,%v][%p%%]\%{strftime (\ "%d/%m/%y\-\%h:%m\")} "Start Display status line (1), always show status line (2) Set laststatus=2 "Get rid of nasty about VI consistency mode, avoid some bugs and limitations of previous versions set nocompatible" Do not show that aid Somalia children's tips set Shortmess=ati "code completion set Completeopt=preview,menu "setting automatically load set when file is changed Autoread" automatically writes the contents back to the file: If the file has been modified, in each: Next,: Rewind,: Last,: First,:p revious,: Stop,: Suspend,: Tag,:!,: Make, Ctrl], and ctrl-^ command, with: Buffer, Ctrl-o, Ctrl-i, ' { A-z0-9} or ' {a-z0-9} ' command to go to another file. Set Autowrite "setting Magic Match control, you can view more detailed help by: H Magic" set Magic "when processing unsaved or read-only files, pop-up confirm set confirm" word putting insert the number of pixel lines set linespace=0 " Command-line AutoComplete in enhanced mode set Wildmenu "You can use the mouse anywhere in buffer (similar to double-clicking the mouse in the workspace in office) 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" Do not let vim emit annoying drops set noerrorbells "Do not display redraw when macro command is executed ; After the macro command finishes, a one-time redraw is performed to improve performance. Set Lazyredraw "=================== syntax ======================================================" Open syntax highlighting syntax enable " Allows syntax highlighting by a specified theme instead of the default highlight theme syntax on "Set color ColorScheme desertset background=darkcolor ron" Desert torte "highlight current line with tints Autocmd Inse Rtenter * SE cul "set highlighting current line set Cursorline" Turn on Highlight cursor column set Cursorcolumn "Make the BACKSPACE (BACKSPACE) normal processing indent, EOL, start, etc. set backspace=2 "Allow backspace and cursor keys to span row boundaries set whichwrap+=<,>,h,l" ===================tab and indent============================== ================= "Do not use spaces instead of tab set ExpandtAB "Use tab set Smarttab at the beginning of the line and segment" Unified indentation to 4set Shiftwidth=4set tabstop=4set softtabstop=4 "set auto indent set Autoindent" Cindent the indentation of C syntax is more intelligent and flexible set cindent "is slightly smarter than autoindent auto indent, in which each line has the same indent as the previous line when pasting with set Pasteset smartindent" ====== ======== file backup and encoding =========================================================== "Do not automatically save backup files set Nobackup" Prevents the creation of temporary file set Noswapfile "Automatically switches the current directory to the directory where the current file is set Autochdir" sets the default decoding set Fileencodings=utf-8set Fileformats=unix,dos,macset fenc= Utf-8set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936 "====================text Search and replace========== =========================== "Highlight matching parentheses set Showmatch" matches the time of the brace highlighting (in very one second) set matchtime=2 "Highlight lookup search value set Hlsearch" when searching , the literal Fugauliang of the input words (similar to Firefox's search set Incsearch "ignores case when searching, but is still case sensitive when there is one or more capital letters set ignorecase" If the search pattern contains uppercase characters, do not use the ' ignorecase ' option. A word with the following symbol does not break the set iskeyword+=_,$,@,%,#,-, when you enter the search mode and open the ' ignorecase ' option when you use Set Smartcase "search without looping through set Nowrapscan" . Set Helplang=cnset list listchars=tab:\|\,trail:.,extends:>,precedes:< "status line color highlight statusline guIfg=slateblue guibg=yellow "status line Color highlight Statuslinenc guifg=gray guibg=white" status line Color "highlight character, so that it is not restricted by 100 columns highlight Overle Ngth ctermbg=red ctermfg=white guibg=red guifg=whitematch overlength ' \%101v.* ' "share clipboard set clipboard+=unnamed with Windows" Automatic format set FORMATOPTIONS=TCRQN "============ctags settings ============================================================= Let Tlist_ctags_cmd = '/usr/bin/ctags ' "Sort by name let Tlist_sort_type =" name "" Show window on right let Tlist_use_right_window = 1 "Compression let Tlist_compart_format = 1 "If only one Buffer,kill window is killed bufferlet Tlist_exist_onlywindow = 1" Do not close other files Tagslet Tlist_file_ Fold_auto_close = 0 "Do not show collapsed tree let Tlist_enable_fold_column = 0" does not display multiple file tags at the same time, only show the current file's let Tlist_show_one_file = 1 "======== ====autocommands ============================================================= "Displays line numbers only when the following file types are detected, and normal text files do not display if Has ("Autocmd") autocmd FileType Xml,html,c,cs,java,perl,shell,bash,cpp,python,vim,php,ruby set number Autocmd FileTy PE xml,html vmap <C-o> <ESC> ' <i<!--<esc>o<esc> ' >o--> autocmd FileType java,c,cpp,cs vmap <C-o> <ESC> ' <o/*<ESC> ' >o*/aut Ocmd FileType html,text,php,vim,c,java,xml,bash,shell,perl,python setlocal textwidth=100 autocmd FileType html,xml, XSL source $VIMRUNTIME/plugin/closetag.vim \ If line ("' \" ") > 0 && line (" ' \ "") <= line ("{1}qu OT;) | \ exe "normal g ' \" "| \ Endifendif "has (" Autocmd ")" with SPACEBAR to switch folding set foldenable "set Foldmethod=manualset foldmethod=syntaxset foldlevel= 100nnoremap <space> @= ((foldclosed line ('. ')) < 0)? ' Zc ': ' zo ') <CR> "set shortcut sets Mapleaderlet Mapleader =", "" "Shortcut load when input", SS ", load. vimrc file Map <silent> <LEADER&G T;ss:source ~/.vimrc<cr> "Quick open Edit. VIMRC Profile--->", ee "map <silent> <leader>ee:e ~/.VIMRC<CR > "Fast Save File--->", w "map <silent> <leader>w:w<cr>" Fast Save and Exit file---> ", w" Map <silent> < Leader>wq:wq<cr>map <silent> <F9>:Tlisttoggle<cr> "Use the leading key plus W to achieve accelerated file saving, instead of: w! plus return nmap w:w!<cr>nmap z:x<cr>" ctages map autocmd! Bufwritepost. VIMRC source ~/.VIMRC "Highlight ordinary 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 endifendfunction "detect file type load file type plug-in F Iletype plugin indent on "Turn off smart Completion when the preview window set Completeopt=longest,menu
Ctags Installation
Ctags plugin Download
Cd/usr/local/srcwget HTTP://WWW.VIM.ORG/SCRIPTS/DOWNLOAD_SCRIPT.PHP?SRC_ID=19574MV download_script.php\?src_id\= 19574 vimtag.zipunzip VIMTAG.ZIPCP Doc plugin ~/.vim/
Use the following command to generate the Help label (the following operation is done in vim)
Reference
http://easwy.com/blog/archives/advanced-vim-skills-omin-complete/comment-page-1/
http://www.vim.org/scripts/script.php?script_id=273
Https://github.com/ma6174/vim
Advanced usage of vim,vimrc,viminfo for editing sharp weapon under Linux