Vim configuration file (available on the entire platform)

Source: Internet
Author: User
Tags imap setf

Link: http://www.oschina.net/code/snippet_103341_9644

Linux:

"----------------- Author: ruchee" ----------------- Email: my@ruchee.com "----------------- Website: http://www.ruchee.com" ----------------- Date: 2012-05-01 "Ctrl + H -- move the cursor to the beginning of the current row" Ctrl + j -- move the cursor to the beginning of the next row "Ctrl + k -- move the cursor to the end of the previous row" Ctrl + l -- move the cursor to the current "Ctrl + c -- compile [C/C ++, Java, Haskell]" Ctrl + r -- run [C/C ++, Java, Haskell, Lua, perl, Python, Ruby] "Ctrl +] -- go to function definition" Ctrl + T -- return to call function "Ctrl + e -- load the syntax template and Author, time information "<C-P> -- word completion" <C-X> <C-L> -- entire line completion "tab key -- full syntax structure completion in insert mode [snipmate plugin]" shift + insert -- paste the content copied elsewhere to VIM "U [lower case] -- one-step restore [non-insert mode]" U [upper case] -- restore the whole row [non-insert mode] "JJ -- save the file and stay in insert mode [insert mode]" KK -- return normal mode [insert mode] "NT -- open nerdtree [non-insert mode]" TL -- open taglist [non-insert mode] insert mode] "za -- open or close the current fold" ZM -- close all folds "ZR -- open all folds ": set syntax = CPP -- manually select syntax highlighting [or: Set filetype = CPP] ": %! Xxd -- dump the binary file and display it in hexadecimal format ": %! Xxd-r -- restore the binary file "---------- detailed usage instructions of the main plug-ins -------------------": tlist -- call out variables and function list [taglist plug-in] ": loadtemplate -- calling syntax template [load_template plugin] ": authorinfodetect -- add the author, time, and other information [nerd_commenter & authorinfo plugin]" ----------. vim [automatic switch C/C ++ header file with the same name] ---------- ": A -- switch the header file with the same name and exclusively occupy the entire screen": As -- switch the header file with the same name and vertically split the screen, the header file on ": av -- switch the header file of the same name and split it horizontally. the header file is on the left "---------- nerdtree [smart file browser] --------------" ": nerdtree -- start the nerdtree plug-in" O [small Write] -- switch the open or closed state of the current file or directory "u -- open the upper-level directory" P [lower-case] -- return the upper-level directory "P [upper-case] -- return the root directory" k -- go to the first node in the current directory "j -- go to the last node in the current directory" m -- display the file system menu [add, delete, and move] "? -- Pop up the Help menu "Q -- exit this plug-in" to render all documents ending with .html in Django template syntax "this configuration statement must be placed at the beginning of all configurations au bufnewfile, bufread *. html setf htmldjangocolorscheme elflord "coloring mode set guifont = Monaco: h10 "font & font size set tabstop = 4" set shiftwidth = 4 "use four spaces set autoindent" auto-aligned set backspace = 2 "to set the width of the tab key during line feed set cindent shiftwidth = 4 "auto indent 4 space set smartindent" Smart auto indent set Ai! "Set Nu! "Show row number" set showmatch "show matching of parentheses set mouse = A" enable mouse set rfound "show status line set incsearch at the cursor position in the lower right corner" enable real-time search function set hlsearch "enable highlight display result set nowrapscan: no re-search set nocompatible when both ends of the file are found "Disable compatibility mode set VB t_vb =" Disable tone "set cursorline" highlight the current row set hidden "allow when saving the changes, switch the buffer set list "to display the tab, use a highlighted vertical line to replace set listchars = tab: \ | \, syntax enable "Open syntax highlight syntax on" enable file type detection filetype indent on "use different indent formats for different file types filetype plugin on "Loading the corresponding plug-in filetype plugin indent on for different file types" enable auto-completion set writebackup "sets the file No backup file set nobackupset autochdir" sets the file browser directory to the current directory "set nowrap" set "set foldmethod = Syntax" to select the code foldlevel = 100 "to disable automatic folding of set laststatus = 2" to enable the status bar information set rows Height = 2 "to specify the height of the command line, the default value is 1. Here it is set to 2. If each line contains more than 80 characters, the AU bufread and bufnewfile * are marked with underscores *. S ,*. ASM ,*. H ,*. C ,*. CPP ,*. CC ,*. java ,*. CS ,*. ERL ,*. HS ,*. sh ,*. lua ,*. pl ,*. PM ,*. PHP ,*. PY ,*. RB ,*. erb ,*. vim, *. JS ,*. CSS ,*. XML ,*. HTML ,*. XHTML 2 match underlined /. \ % 81 v/" set encoding set fenc = utf-8set encoding = utf-8set fileencodings = UTF-8, GBK, cp936, Latin-1 "for Haskell: Let hs_highlight_delimiters = 1" highlight delimiter: let hs_highlight_boolean = 1 "recognize true and false as keywords: Let hs_highlight_types = 1" recognize basic type names as keywords: let hs_highlight_more_types = 1 "recognize more common types as keywords: Let hs_highlight_debug = 1" Name of the highlighted debugging function: Let hs_allow_hash_operator = 1 "block # from being highlighted as an error Incorrect "======== quotation marks & automatic matching of parentheses ======": inoremap () <ESC> I: inoremap) <c-r> = closepair (') <CR>: inoremap {{}< ESC> I: inoremap} <c-r >= closepair ('}') <CR>: inoremap [[] <ESC> I: inoremap] <c-r> = closepair (']') <CR> ": inoremap <> <ESC> I ": inoremap> <c-r> = closepair ('>') <CR>: inoremap" <ESC> I: inoremap ''' <ESC> I: inoremap ''' <ESC> ifunction closepair (char) If Getline ('. ') [col ('. ')-1] = A: Char return "\ <right> "Else return a: Char endifendf" minibufexplorer multiple file switches you can use the mouse to double-click the corresponding file name to switch to let G: minibufexplmapwindownavvim = 1let G: minibufexplmapwindownavarrows = 1let g: minibufexplmodseltarget = 1 ": tlist calls taglistlet tlist_show_one_file = 1 "only display the current file's tagslet records = 1" if the taglist window is the last window, exit vimlet tlist_use_right_window = 1 "show let records = 1 in the right window "Auto collapse" Txtbrowser highlights TXT text files au bufread and bufnewfile *. TXT setlocal Ft = TXT ": loadtemplate automatically loads the template Let G: template_path = '/home/ruchee/according to the file suffix /. vim/template/'": authorinfodetect automatically adds the author, time, and other information. In essence, it is the combination of nerd_commenter & authorinfo Let G: vimrc_author = 'ruchee' Let G: vimrc_email = 'my @ ruchee.com 'Let G: vimrc_homepage = 'HTTP: // www.ruchee.com '"Ctrl + H move the cursor to the beginning of the current line imap <c-h> <ESC> I" Ctrl + J move the cursor to the beginning of the next line imap <c-j> <ESC> Ji "Ctrl + K move the cursor to the end of the previous line imap <c-k> <ESC> ka "Ctrl + l move the cursor to the end of the current line imap <c-l> <ESC> "Ctrl + e load the syntax template and the author and time information map in one step <c-e> <ESC>: loadtemplate <CR> <ESC>: authorinfodetect <CR> <ESC> giimap <c-e> <ESC>: loadtemplate <CR> <ESC>: authorinfodetect <CR> <ESC> givmap <c-e> <ESC>: loadtemplate <CR> <ESC>: authorinfodetect <CR> <ESC> Gi "JJ saves the file and stays in insert mode [insert mode] imap jj <ESC>: W <CR> li "KK return normal mode [insertion mode] imap kk <ESC> L" nt enable nerdtree [non-insertion mode] map NT: nerdtree <CR> "TL open taglist [non-insert mode] map TL: tlist <CR> <c-l> "======= compile & run ======" "compile the source file func! Compilecode () EXEC "W" IF & filetype = "C" EXEC "! Gcc-wall-STD = c99 % <. C-o % <"elseif & filetype =" CPP "EXEC "! G ++-wall-STD = C ++ 98% <. cpp-o % <"elseif & filetype =" Java "EXEC "! Javac % <. Java "elseif & filetype =" Haskell "EXEC "! Ghc -- make % <. Hs-o % <"elseif & filetype =" Lua "EXEC "! Lua % <. Lua "elseif & filetype =" Perl "EXEC "! Perl % <. pl "elseif & filetype =" Python "EXEC "! Python % <. py "elseif & filetype =" Ruby "EXEC "! Ruby % <. RB "endifendfunc" run the executable file func! Runcode () EXEC "W" IF & filetype = "C" | & filetype = "CPP" | & filetype = "Haskell" EXEC "! ./% <"Elseif & filetype =" Java "EXEC "! Java % <"elseif & filetype =" Lua "EXEC "! Lua % <. Lua "elseif & filetype =" Perl "EXEC "! Perl % <. pl "elseif & filetype =" Python "EXEC "! Python % <. py "elseif & filetype =" Ruby "EXEC "! Ruby % <. RB "endifendfunc" Ctrl + C one-click Save and compile Map <c-c>: Call compilecode () <CR> imap <c-c> <ESC>: Call compilecode () <CR> vmap <c-c> <ESC>: Call compilecode () <CR> "Ctrl + R one-click Save and run Map <c-r>: Call runcode () <CR> imap <c-r> <ESC>: Call runcode () <CR> vmap <c-r> <ESC>: Call runcode () <CR>

Winodws:

"----------------- Author: ruchee" ----------------- Email: my@ruchee.com "----------------- Website: http://www.ruchee.com" ----------------- Date: 2012-05-01 "Ctrl + H -- move the cursor to the beginning of the current row" Ctrl + j -- move the cursor to the beginning of the next row "Ctrl + k -- move the cursor to the end of the previous row" Ctrl + l -- move the cursor to the current "Ctrl + c -- compile [C/C ++, Java, haskll]" Ctrl + r -- run [C/C ++, Java, Haskell, Lua, perl, Python, Ruby] "Ctrl +] -- go to function definition" Ctrl + T -- return to call function "Ctrl + e -- load the syntax template and, Time information "<C-P> -- word completion" <C-X> <C-L> -- entire line completion "tab key -- full syntax structure completion in insert mode [snipmate plugin]" shift + insert -- paste the content copied elsewhere to VIM "U [lower case] -- one-step restore [non-insert mode]" U [upper case] -- restore the whole row [non-insert mode] "JJ -- save the file and stay in insert mode [insert mode]" KK -- return normal mode [insert mode] "NT -- open nerdtree [non-insert mode]" TL -- open taglist [non-insert mode] insert mode] "za -- open or close the current fold" ZM -- close all folds "ZR -- open all folds ": set syntax = CPP -- manually select syntax highlighting [or: Set filetype = CPP] ": %! Xxd -- dump the binary file and display it in hexadecimal format ": %! Xxd-r -- restore the binary file "---------- detailed usage instructions of the main plug-ins -------------------": tlist -- call out variables and function list [taglist plug-in] ": loadtemplate -- calling syntax template [load_template plugin] ": authorinfodetect -- add the author, time, and other information [nerd_commenter & authorinfo plugin]" ----------. vim [automatic switch C/C ++ header file with the same name] ---------- ": A -- switch the header file with the same name and exclusively occupy the entire screen": As -- switch the header file with the same name and vertically split the screen, the header file on ": av -- switch the header file with the same name and split it horizontally. the header file is on the left "---------- mark. vim [specifies the keyword for tracking highlight] -------------- "" \ m -- normal mode, hitting \ m on the word to be highlighted can be high. Highlight the word ": Mark -- Cancel all highlight": Mark ABC -- specify the highlight word ABC or cancel highlighting ABC "---------- nerdtree [smart file browser] ----------------" ": nerdtree -- start the nerdtree plug-in "O [lower case] -- switch the current file or directory to the open or closed state" u -- open the upper directory "P [lower case] -- return to the upper directory" P [upper case] -- return to the root directory "k -- go to the first node of the current directory" j -- go to the last node of the current directory "m -- display the file system menu [add, delete, and move]"? -- Pop up the Help menu "Q -- exit this plug-in" to render all documents ending with .html in Django template syntax "this configuration statement must be placed at the beginning of all configurations au bufnewfile, bufread *. html setf htmldjangocolorscheme blackboard "color mode: blue background set guifont = Monaco: h10 "font & font size set tabstop = 4" set shiftwidth = 4 "use four spaces set autoindent" auto-aligned set backspace = 2 "to set the width of the tab key during line feed set cindent shiftwidth = 4 "auto indent 4 space set smartindent" Smart auto indent set Ai! "Set Nu! "Show row number" set showmatch "show matching of parentheses set mouse = A" enable mouse set rfound "show status line set incsearch at the cursor position in the lower right corner" enable real-time search function set hlsearch "enable highlight display result set nowrapscan: no re-search set nocompatible when both ends of the file are found "Disable compatibility mode set VB t_vb =" Disable tone "set cursorline" highlight the current row set hidden "allow when saving the changes, switch the buffer set list "to display the tab, use a highlighted vertical line to replace set listchars = tab: \ | \, syntax enable "Open syntax highlight syntax on" enable file type detection filetype indent on "use different indent formats for different file types filetype plugin on "Load the corresponding plug-in filetype plugin indent on for different file types" enable auto-completion if has ("gui_running") Au guienter * simalt ~ X "automatically maximizes the position of the window when the window starts" winpos 20 20 ". The coordinate origin is in the upper left corner of the screen." Set lines = 20 columns = 90 "specifies the window size. lines indicates the height, columns: width "set guioptions-= m" Hide menu bar "set guioptions-= T" Hide toolbar "set guioptions-= l" hide left-side scroll bar "set guioptions-= r" hide right-side scroll bar "set guioptions-= B" Hide bottom scroll bar "set showtabline = 0" Hide tab bar endifset writebackup "set no backup file set nobackupset autochdir" set file browser directory to current directory "Set nowrap "set not to automatically wrap set foldmethod = Syntax" Select Code folding type se T foldlevel = 100 "Disable Automatic folding set laststatus = 2" enable the status bar information set height Height = 2 "command line height, the default value is 1, here it is set to 2 "each line contains more than 80 characters and uses underscores to mark au bufread and bufnewfile *. S ,*. ASM ,*. H ,*. C ,*. CPP ,*. CC ,*. java ,*. CS ,*. ERL ,*. HS ,*. sh ,*. lua ,*. pl ,*. PM ,*. PHP ,*. PY ,*. RB ,*. erb ,*. vim ,*. JS ,*. CSS ,*. XML ,*. HTML ,*. XHTML 2 match underlined /. \ % 81 v/" set encoding set fenc = utf-8set encoding = utf-8set fileencodings = UTF-8, GBK, cp936, Latin-1 "Fix menu garbled source $ vimruntime/delmenu. VI Msource $ vimruntime/menu. vim "solves consystemic output garbled language messages zh_CN.utf-8" for Haskell: Let hs_highlight_delimiters = 1 "highlight: Let hs_highlight_boolean = 1" recognizes true and false as keywords: let hs_highlight_types = 1 "recognize basic types as keywords: Let hs_highlight_more_types = 1" recognize more common types as keywords: Let hs_highlight_debug = 1 "Name of the highlighted debugging function: let hs_allow_hash_operator = 1 "block # being highlighted as an error" ======== quotation marks & automatic matching of parentheses ====== ": inoremap (() <ESC> I: inoremap) <C-r> = closepair (') <CR>: inoremap {{}< ESC> I: inoremap} <c-r >= closepair ('}') <CR>: inoremap [[] <ESC> I: inoremap] <c-r> = closepair (']') <CR> ": inoremap <> <ESC> I ": inoremap> <c-r> = closepair ('>') <CR>: inoremap" <ESC> I: inoremap ''' <ESC> I: inoremap ''' <ESC> ifunction closepair (char) If Getline ('. ') [col ('. ')-1] = A: Char return "\ <right>" else return a: Char endifendf "minibufexplorer multiple file switches you can double-click the corresponding file with the mouse Name switch Let G: minibufexplmapwindownavvim = 1let G: minibufexplmapwindownavarrows = 1let G: minibufexplmapctabswitchbufs = 1let G: minibufexplmodseltarget = 1 ": tlist calls taglistlet tlist_show_one_file = 1 "only display the current file's tagslet records = 1" if the taglist window is the last window, exit vimlet tlist_use_right_window = 1 "show let records = 1 in the right window "Auto collapse" txtbrowser highlight TXT text file au bufread, bufnewfile *. TXT setlocal Ft = TXT": Loadtemplate automatically loads the template Let G: template_path = 'd:/apps/gvim/vimfiles/template/'based on the file suffix. ": authorinfodetect automatically adds the author, time, and other information, in essence, it is the combination of nerd_commenter & authorinfo Let G: vimrc_author = 'ruchee' Let G: vimrc_email = 'my @ ruchee.com 'Let G: vimrc_homepage = 'HTTP: // www.ruchee.com '"Ctrl + H move the cursor to the beginning of the current line imap <c-h> <ESC> I" Ctrl + J move the cursor to the beginning of the next line imap <c-j> <ESC> Ji "Ctrl + k move the cursor to the end of the previous line imap <c-k> <ESC> ka" Ctrl + l move the cursor to the row of the current line tail imap <c-l> <ESC> A "Ctrl + E: load the syntax template, author, and time map in one step. <c-e> <ESC>: loadtemplate <CR> <ESC>: authorinfodetect <CR> <ESC> giimap <c-e> <ESC>: loadtemplate <CR> <ESC>: authorinfodetect <CR> <ESC> givmap <c-e> <ESC>: loadtemplate <CR> <ESC>: authorinfodetect <CR> <ESC> Gi "JJ saves the file and stays in insert mode [insert mode] imap jj <ESC>: W <CR> li "KK return normal mode [insertion mode] imap kk <ESC> L" nt enable nerdtree [non-insertion mode] map NT: nerdtree <CR> "TL open taglist [non-insertion mode] map TL: tlist <CR> <c-l>" ======== Compile & run ==== "" compile the source file func! Compilecode () EXEC "W" IF & filetype = "C" EXEC "! Gcc-wall-STD = c99 % <. C-o % <"elseif & filetype =" CPP "EXEC "! G ++-wall-STD = C ++ 98% <. cpp-o % <"elseif & filetype =" Java "EXEC "! Javac % <. Java "elseif & filetype =" Haskell "EXEC "! Ghc -- make % <. Hs-o % <"elseif & filetype =" Lua "EXEC "! Lua % <. Lua "elseif & filetype =" Perl "EXEC "! Perl % <. pl "elseif & filetype =" Python "EXEC "! Python % <. py "elseif & filetype =" Ruby "EXEC "! Ruby % <. RB "endifendfunc" run the executable file func! Runcode () EXEC "W" IF & filetype = "C" | & filetype = "CPP" | & filetype = "Haskell" EXEC "! % <. EXE "elseif & filetype =" Java "EXEC "! Java % <"elseif & filetype =" Lua "EXEC "! Lua % <. Lua "elseif & filetype =" Perl "EXEC "! Perl % <. pl "elseif & filetype =" Python "EXEC "! Python % <. py "elseif & filetype =" Ruby "EXEC "! Ruby % <. RB "endifendfunc" Ctrl + C one-click Save and compile Map <c-c>: Call compilecode () <CR> imap <c-c> <ESC>: Call compilecode () <CR> vmap <c-c> <ESC>: Call compilecode () <CR> "Ctrl + R one-click Save and run Map <c-r>: Call runcode () <CR> imap <c-r> <ESC>: Call runcode () <CR> vmap <c-r> <ESC>: Call runcode () <CR>

The preceding two configuration files are attached:

Http://www.ruchee.com/download/Vim2012-04-01.7z

Thanks to the author

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.