Vim configuration file (No plug-in version)

Source: Internet
Author: User
Tags imap
" -------------------- Copyright Header Begin ---------------------------------" Descripation : Facilitates vim settings " Version      : 2.0" Author       : RollStone,[email protected]" Copyright    : RollStone (2007-2014)." -------------------- Copyright Header End -----------------------------------"" Overview for maintainers :" The file is divided into following sections. You may add yours or update these" if/when you choose to enhance this setting file."" + General Settings" + Tips(just need to how use these functions)" + Autocmds" + Mappings"{{{ ---------------- General Settings Begin ---------------------------------"MC: My Contactionabbr mc RollStone,[email protected]"Leaderlet g:mapleader=‘;‘let g:leader=‘;‘"Just more like vim,less viset nocompatible"backupset nobackup"dirsset autochdirset autoreadset autowrite"completeset complete+=kset completeopt=longest,menu"encodesset fileencodings=utf-8,gbk,gb18030,chinese"indentset autoindentset smartindentset noexpandtabset tabstop=4set shiftwidth=4set formatoptions+=mMset cinoptions=:0,l1,t0,g0"searchset showmatchset hlsearchset smartcaseset ignorecaseset incsearch"statuslineset titleset showcmdset laststatus=2set statusline=%F%m%r%h%w,%{&ff},Type:%y,[ASCII:\%03.3b,HEX:0x\%02.2B][%l,%v][Total:%L][Rate:%p%%]\ %*%=\ %{strftime(\"%d-%m-%y\ %H:%M\")}set wildmenu"tabulationset rulerset numberset cursorline"set cursorcolumn"highlight cursorline ctermbg=lightgray"highlight cursorcolumn ctermbg=lightgray"wrapset nowrapset nowrapscan"othersset backspace=indent,eol,startset wildignore=*.bak,*.o,*.e,*~set browsedir=currentset sessionoptions-=curdirset ttimeoutlen=150set vb t_vb="some common gatessyntax onfiletype plugin indent on"}}} ---------------- General Settings End -----------------------------------"{{{ ---------------- Tips Begin ---------------------------------------------"notice: n just be in normal mode"tip1. match ()/{}/[]"n: % (first chang into normal mode,and press shift + 5)"tip2. find the manual content"n: K (first chang into normal mode,and press shift + K)"}}} ---------------- Tips End -----------------------------------------------"{{{ ---------------- Autocmds Begin -----------------------------------------if has("autocmd")"when modifies vimrc or .vimrc reload itau! BufWritePost [ _.]vimrc source ~/.vimrc"auto chdir to curdirau BufEnter * :lchdir %:p:h"change to the lastest cursor positionau BufReadPost * if line("‘\"") > 0 && line("‘\"") <= line("$") | exe "normal! g`\"" | endif endif " has (autocmd)""}}} ---------------- Autocmds End -------------------------------------------"{{{ ---------------- Mappings Begin -----------------------------------------"display line number or notnnoremap <leader> sn :set nu!<cr>"F1 - overrule Linux F1map <silent> <F1> <esc>:exec "help ".expand("<cword>")<cr>"F2 - call file explorer Exmap  <silent> <F2>        :Explorerimap <silent> <F2>   <esc>:Explorer"F3 - write file without confirmationmap  <silent> <F2>        :write<cr>imap <silent> <F2>   <esc>:write<cr>"F4 - remove trail white-spacemap  <silent> <F2>        :%s/[ \t\r]\+$//g<cr>imap <silent> <F2>   <esc>:%s/[ \t\r]\+$//g<cr>"F5-F8 :quickfix :open/close error windows,display prev/next errormap  <silent> <F5>        :copen<cr>map  <silent> <F6>        :cclose<cr>map  <silent> <F7>        :cp<cr>map  <silent> <F8>        :cn<cr>imap <silent> <F5>   <esc>:copen<cr>imap <silent> <F6>   <esc>:cclose<cr>imap <silent> <F7>   <esc>:cp<cr>imap <silent> <F8>   <esc>:cn<cr>"autocomplete parenthesis, brackets and bracesinoremap ( ()<Left>inoremap [ []<Left>inoremap { {}<Left>vnoremap ( s()<Esc>P<Right>%vnoremap [ s[]<Esc>P<Right>%vnoremap { s{}<Esc>P<Right>%"autocomplete quotes (select mode)xnoremap  ‘  s‘‘<Esc>P<Right>xnoremap  "  s""<Esc>P<Right>xnoremap  `  s``<Esc>P<Right>"Open includes files in a new split windowset path=.,include,../include,/usr/include,/usr/local/includenmap gf <c-w><c-f>"{{User defines functions and its‘ map"Format C/CPP codes,and return current linefunction! UDFormatCppCode()    let s:backupCurLine=line(‘.‘)    exec "normal! gg=G <cr>"    exec ":".s:backupCurLineendfuncnmap fmt :call UDFormatCppCode()<cr>imap fmt <esc>:call UDFormatCppCode()<cr>o"}}"}}} ---------------- Mappings End -------------------------------------------

 

Vim configuration file (No plug-in version)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.