There are a lot of programmers using VIM, and here is a VIMRC that provides a lot of automated functions, such as highlighting code, auto-completion, and so on.
"Setlocal Omnifunc=python3complete#complete" an example for a VIMRC file. "" Maintainer:bram Moolenaar <[email protected]> "Last change:2000 Jan" "To use it, copy it to" for Unix an D OS/2: ~/.VIMRC ' for AMIGA:S:.VIMRC ' for MS-dos and Win32: $VIM \_vimrc ' for VMS:SYS$LOGIN:.VIMRC ' use VIM sett Ings, rather then Vi settings (much better!). " This must is first, because it changes other options as a side effect.set nocompatible "Let &termencoding=&encoding "Set Fileencodings=utf-8,gbk,ucs-bom,cp936set bs=2" Allow backspacing over everything in insert mode "set AI" always set AU Toindenting on "Set backup" Keep a backup fileset viminfo= ' 20,\ "read/write A. viminfo file, and don ' t store more" than Ines of Registersset History=50 "keep lines of command line Historyset ruler" show the cursor position all the Timeset Nu "Set Bdir=~/.vimbackupset nowrapset bg=darkset smarttabset expandtabset tabstop=4" for Win32 gui:remove ' t ' flag from ' Guioptions ': No Tearoff Menu Entries "let &guioptions = Substitute (&guioptions," T "," "", "G") "Don ' t use Ex mode, use Q for Formattingmap Q GQ "make p in Visual mode replace the selected text with the" "Register.vnoremap p <esc>:let current_reg = @" < ; Cr>gvdi<c-r>=current_reg<cr><esc> "Switch syntax highlighting on while the terminal has colors" Also switch on highlighting the last used search Pattern.syntax onif &t_co > 2 | | Have ("gui_running") syntax onset HLSEARCHENDIF "only do the" if compiled with the support for autocommands. "If have (" Auto CMD ")" Autocmd bufread *.txt set Tw=78fun settitle () call Setline (1, "#coding =GBK") Call Append ("."), "Import OS ") Call Append (". ") + 1," import sys ") call append (". ") + 2," import Argparse ") Call Append (" .") + 3, "import Commands") Call Append (".") + 4, "Import Logging") Call Append (".") + 5, "") Call Appen D (Line (".") + 6, "logging.basicconfig (level = Logging.deBUG, ") Call Append (". ") + 7," format= '% (asctime) s% (filename) s[line:% (lineno) d]% (levelname) s% (message) s ', ') call Append (".") + 8, "datefmt = '%y-%m-%d%h:%m:%s ',") Call Append (".") + 9, "filename = Os.path.basename (__file__) + '. Log ',") Call Append (".") + ten, "FileMode = ' a ')") Call Append (".") + One, "") Call Append (".") +, "def perror_and_exit (message, status =-1):") Call Append (".") +, "sys.stderr.write (message + ' \\n ')" Call Append (".") + +, "logging.info (message + ' SYS exit ')") Call Append (".") + +, "Sys.exit (St ATUs) Call Append (".") + +, "") Call Append (".") + +, "if __name__ = = ' __main__ ':") call Append (".") + +, "") Call Append (".") + +, "pass") call cursor (5) Endfuncif have ("Autocmd") autocmd bufnewfile *.py exec ": Call Settitle () '" in text Files, always limit the width of text to CharactersautOcmd bufread *.txt Set Tw=78augroup cprog "Remove all Cprog autocommandsau!" When starting to edit a file: "For C and C + + files set formatting of comments and set c-indenting on." For other files switch it off. " Don ' t change the order, it's important that's the line with * comes first.autocmd FileType * Set FORMATOPTIONS=TCQL NOC Indent comments&autocmd FileType c,cpp set FORMATOPTIONS=CROQL cindent comments=sr:/*,mb:*,el:*/,://augroup Endaugroup gzip "Remove all gzip autocommandsau!" Enable editing of gzipped files "set binary mode before reading the Fileautocmd bufreadpre,filereadpre*.gz,*.bz2 set Binau Tocmd bufreadpost,filereadpost*.gz Call Gzip_read ("Gunzip") autocmd bufreadpost,filereadpost*.bz2 call GZIP_read (" Bunzip2 ") Autocmd bufwritepost,filewritepost*.gz call Gzip_write (" GZIP ") Autocmd bufwritepost,filewritepost*.bz2 Call Gzip_write ("bzip2") autocmd fileappendpre*.gz call Gzip_appre ("Gunzip") autocmd fileappendpre*.bz2 call Gzip_appre (" Bunzip2 ") Autocmd fileappendpost*. GZ Call Gzip_write ("GZIP") autocmd fileappendpost*.bz2 call Gzip_write ("bzip2") "After reading compressed file: Uncompress text in buffer with "cmd" fun! Gzip_read (cmd) "Set ' Cmdheight" to "avoid the Hit-return promptlet ch_save = &chset ch=3" When filtering the WH OLE buffer, it would become emptylet empty = line ("' [") = = 1 && line ("']") = = Line ("$") Let TMP = Tempname () let Tmpe = tmp. "." . Expand ("<afile>:e") "write the Just read lines to a temp file" ' [, ']w tmp.gz ' execute ' ' [, ']w ']. Tmpe "uncompress the temp file"!gunzip tmp.gz "execute"! ". A:cmd. " " . Tmpe "Delete the compressed Lines" [, ']d ' read in the uncompressed Lines "' [ -1r tmp" Set Nobinexecute "' [ -1r]. TMP "If buffer became empty, delete trailing blank lineif emptynormal Gdd" ' endif "delete the temp filecall Delete (TMP) let &ch = Ch_save "When uncompressed the whole buffer, do autocommandsif emptyexecute":d oautocmd bufreadpost ". Expand ("%:r") Endifendfun "after writing compressed file:compreSS written file with "cmd" fun! Gzip_write (cmd) if rename (expand ("<afile>"), expand ("<afile>:r")) = = 0execute "!". A:cmd. "<afile>:r" Endifendfun "before appending to compressed file:uncompress file with" cmd "fun! Gzip_appre (CMD) Execute "!". A:cmd. "<afile>" Call Rename (expand ("<afile>:r"), expand ("<afile>")) Endfunaugroup END "This is disabled, Because it changes the jumplist. Can ' t use Ctrl-o to go "back to positions in previous files + than Once.if 0" when editing a file, always jump to the L AST cursor position. " This must is after the uncompress commands.autocmd Bufreadpost * If line ("' \" ") && line (" ' \ "") <= Line ("$") | EXE "normal" \ "" | Endifendifendif "has (" Autocmd ") set shiftwidth=4" Set Cindentset wrapset ts=4set sw=4set showcmdmap <F8> ggVG= <C R>map <F9>: Set Nonu <cr>map <F10>: Set nu <cr>map <F11>: silent! Tlist<cr>map,,: A<cr>map,-: as<cr>map, =:av<cr> "OMnicppcomplete configset Nocpfiletype plugin onfiletype indent onset tags=tags; " Set Tags+=~/home/work/tags "Set Tags+=~/install/tags/wbl_tags" Set Tags+=~/station/tags "set tags+=~/qqcard_publish/ Tags "set tags+=~/esales_publish/tags" au bufwritepost *.c,*.cpp,*.cc,*.h!ctags-r--c++-kinds=+p--fields=+iaS--extra =+q-f ~/station/tags ~/station/"au bufwritepost *.c,*.cpp,*.cc,*.h!ctags-r--c++-kinds=+p--fields=+iaS--extra=+q-f ~ /qqcard_publish/tags ~/qqcard_publish/"au bufwritepost *.c,*.cpp,*.cc,*.h!ctags-r--c++-kinds=+p--fields=+iaS-- Extra=+q-f ~/esales_publish/tags ~/esales_publish/"au bufwritepost *.c,*.cpp,*.cc,*.h!ctags-r--c++-kinds=+p-- Fields=+ias--extra=+q. Map <F12>:!ctags-r--c++-kinds=+p--fields=+ias--extra=+q .<cr> "Let OmniCpp_ SHOWPROTOTYPEINABBR = 1let G:neocomplcache_enable_at_startup = 1 "taglist configlet tlist_ctags_cmd = '/usr/bin/ctags '" Set the location of the Ctags program in the Linux system let Tlist_show_one_file = 1 "Do not display multiple files at the same time tag, only show the current file of let Tlist_exit_onlywindow = 1" IfTagList window is the last window, exit Vimlet Tlist_use_right_window = 0 "show TagList window in the right window" Csope "cscope add ~/cip_esales_related/ Cscope/cscope.out "Nmap <[email protected]>s:cs find S <c-r>=expand (" <cword> ") <CR>< Cr> "Only does this" if compiled with support for Autocommandsif have ("Autocmd") "In text files, always limit the Width of text to characters Autocmd bufread *.txt set tw=78 "When editing a file, always jump to the last cursor POS ition autocmd Bufreadpost * \ If line ("' \" ") > 0 && line (" ' \ "") <= Line ("$") | \ exe "normal! G ' \ "" | \ endifendif
VIMRC builds powerful vim with a wide range of IDE-powerful features