Configuration of Gvim under Windows (VIMRC)

Source: Internet
Author: User

When learning Python, you want to configure the Python compilation environment in Gvim, and find a useful VIMRC configuration on the Web to save it for the next time.

Set Encoding=utf-8set Termencoding=utf-8set fileencodings=utf-8,chinese,latin-1if has ("Win32") set fileencoding= Chineseelse set Fileencoding=utf-8endiflanguage messages Zh_cn.utf-8 "set not with previous version and set nocompatible" color scheme colorscheme Murphy "show line number set NU" detect file type filetype on "set automatically load set Autoread" record history rows set history=100 "show syntax highlighting syntax enablesyntax on" in place when file is changed When the file is not saved or read-only, pop-up confirm set confirm "share clipboard with Windows set clipboard+=unnamed" 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+=!" word with the following symbol do not be wrapped split set iskeyword+=_,$,@,%,#,-"Set mouse always available set mouse =a "Highlight current row set Cursorline" command line height set cmdheight=1 "Do not show the aid Somalia children's prompt set Shortmess=ati" Do not let vim emit annoying drops set noerrorbells " Display whitespace between divided windows for easy reading of set fillchars=vert:\, Stl:\, STLNC: "," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "Do not back up files (overwrite files without backing up) set Nobackup" Do not generate swap files, hide it when buffer is discarded setlocal noswapfileset bufhidden=hide "Word putting the number of pixel rows inserted set Linespace=0 "enhanced mode command line AutoComplete operation set Wildmenu" Paste mode, so that the paste is not misplaced "set paste" Save the file, used to Ctrl+s "Nmap < c-s> <esc>:w<CR> "IMAP <C-s> <esc>:w<cr>noremap <C-S>:update<cr> Vnoremap <C-S> <c-c>:update<cr>inoremap <C-S> <C-O>:update<CR> "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Search "" "" "" "" "" "" "" "" "" "" and Matches "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" highlight matching parentheses set Showmatch "highlighting the found sentence (phrases)" set Hlsearch "in the search, input the words of the word Fugauliang (similar to Firefox search), That is, when you enter a search, the search results are displayed set Incsearch "Search ignores case set ignorecase" Do not blink set Novisualbell "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Auto-format Set FORMATOPTIONS=TCRQN "inherits the indentation of the previous line, especially for multiline comment set autoindent" provides auto indent set smartindent for C programs "Use C-style indent set cindent" tab is 4set tabstop=4 "Unified indentation is 4" so that when you press BACKSPACE, you can delete 4 spaces at a time set softtabstop=4 "Settings << and >> command width 4set shiftwidth=4" Do not use empty Grid instead of tab set Noexpandtab "set 120 character wrap per line set textwidth=120" automatically switches the current directory to the directory where the current file is set Autochdir"Collapsed code set foldmethod=syntax" file is open without collapsing set foldlevel=100 "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "Inoremap (() <esc>iinoremap) <c-r>=closepair (') ') <CR> Inoremap {{}<esc>iinoremap} <c-r>=closepair ('} ') <cr>inoremap [[]<esc>iinoremap] <c-r >=closepair ('] ') <cr>inoremap ' <esc>iinoremap "" "<esc>ifunction Closepair (char) if getline ('. ') [Col ('. ')-1] = = A:char return "\<right>" else return A:char endifendf "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Mapleader Mysys () If has ("Win32") return "Windows" else Return "Linux" Endifendfu Nction "If file not opened, create a new tab, or switch to the opened filefunction!     SWITCHTOBUF (filename)   "Find in current tab let Bufwinnr = Bufwinnr (a:filename) if Bufwinnr! =-1 exec Bufwinnr . "Wincmd W" return else "search each tab Tabfirst let T                        b = 1 while TB <= tabpagenr ("$") Let Bufwinnr = Bufwinnr (a:filename) If Bufwinnr! =-1 Exec "normal". TB. "GT" exec Bufwinnr.                        "Wincmd W" return endif Tabnext Let TB = TB +1 endwhile "not exist, new tab exec" Tabnew ".  A:filename endifendfunction "Fast edit. Vimrcif Mysys () = = ' Linux '" fast reloading of the. VIMRC map <silent> <leader>ss:source ~/.vimrc<cr> "Fast editing of the. VIMRC map <silent> <leader>ee:callSwitchtobuf ("~/.VIMRC") <cr> "when. VIMRC is edited, reload it autocmd!  Bufwritepost. VIMRC source ~/.vimrcelseif mysys () = = ' Windows ' "set Helplang set HELPLANG=CN" Fast reloading Of the _VIMRC map <silent> <leader>ss:source ~/_vimrc<cr> "Fast editing of _VIMRC map <sil ent> <leader>ee:call switchtobuf ("~/_VIMRC") <cr> "when _VIMRC is edited, reload it autocmd! Bufwritepost _VIMRC Source ~/_vimrcendifif mysys () = = ' windows ' source $VIMRUNTIME/mswin.vim behave mswinendif "" "" "" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "Project1" set Tags=tagsset Autochdir "After the project is added to the tags variable" "" "" "" "" """" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "TagList" " Left_window = 1 "If only one Buffer,kill window is killed bufferlet Tlist_exist_onlywindow = 1" so that TagList only displays the current file tag, the tags of the other files are folded up ( When displaying tags in multiple files) let Tlist_file_fold_auto_close = 1 "Do not show collapsed tree make Tlist_enable_fold_column = 1" does not display multiple files at the same time, only display the current file Tlist_show_one_file = 1 "Keyboard mapping Nmap tl:tlisttoggle<cr>" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Winmanager Winmanager Management netrw and TagList. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " TagList "Let G:persistentbehaviour = 0let g:winmanagerwidth = 30let g:defaultexplorer = 0nmap <C-W><C-F>: Firs Texplorerwindow<cr>nmap <C-W><C-B>:bottomexplorerwindow<cr> "Nmap <silent> <f8 >: Wmtoggle<cr>nmap wm:wmtoggle<cr> "Set NETRW" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Let G:netrw_winsize = 30 " Nmap <silent> <leader>fe:Sexplore!<cr> "Let Tlist_file_fold_auto_close=1 "Quick Switch header file/source file" Nnoremap <silent><F12>:A<cr> "" Nmap <silent><f12 >:A<CR> Quick Find in projects Nnoremap <silent><F3>:Grep<cr> "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Minibufexploer "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Quickfix mode autocmd FileType c,cpp map <buffer> <leader>< space>:w<cr>:make<cr> "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "F5 compile and run C + + program" F6 Compile and Run Program "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" the Compile and run of "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Map <F6>: Call COMPILERUNGCC () <cr>func! COMPILERUNGCC () Exec "W" exec "!gcc%-o%<" exec "! ./%<" Endfunc "C + + compile and run map <F5>: Call COMPILERUNGPP () &LT;CR >func! COMPILERUNGPP () Exec "W" exec "!g++%-o%<" exec "! ./%<" Endfunc Source $VIMRUNTIME/vimrc_example.vimsource $ Vimruntime/mswin.vimbehave Mswinset Diffexpr=mydiff () function Mydiff () Let opt = '-a--binary ' if &diffopt =~ ' icase ' | Let opt = opt. '-I ' | endif if &diffopt =~ ' Iwhite ' | Let opt = opt. '-B ' | endif let arg1 = v:fname_in if arg1 =~ ' | Let arg1 = ' "'. Arg1. ' ' ' | endif Let arg2 = v:fname_new if arg2 =~ ' | Let arg2 = ' "'. Arg2. ' ' ' | endif Let Arg3 = v:fname_out if Arg3 =~ ' | Let Arg3 = ' "'. Arg3. ' ' ' | endif Let eq = ' if $VIMRUNTIME =~ ' if &sh =~ ' \<cmd ' let cmd = ' "". $VIMRUNTIME. ' \diff ' ' let's eq = ' ' else let cmd = substitute ($VIMRUNTIME, ' ', ' "', '). ' \diff "' endif else let cmd = $VIMRUNTIME. ' \diff ' endif silent execute '! '. Cmd. ‘ ‘ . Opt. Arg1. ‘ ‘ . Arg2. ' > '. Arg3. Eqendfunction "Auto-complete (ctrl-p) when some of the options: more than one item when the display menu, the longest selection; Displays the additional information currently selected if V:version >= set Completeopt=menu,longest,preview endif "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "unable to display status bar) set laststatus=2" status line Color Highlight Statusline guifg=slateblue guibg=yellowhighlight Statuslinenc guifg=gray guibg=whitefunction! CurDir () Let CurDir = Substitute (GETCWD (), '/users/amir/', "~/", "G") return Curdirendfunction "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""     "" "" "" "Status Line" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""%F    The current file encoding "%b the ASCII value of the character at the current cursor"%b the hexadecimal value of the character at the current cursor "%l current cursor line number"%c current cursor column number "%V the current Cursor virtual column number (calculated based on the number of bytes of the character)"%p                            The current row is the percentage of total rows "percent percent semicolon"%l the total number of current file rows set statusline=\%f%m%r%h\%w\ \ cwd:\%r%{curdir ()}%h\ \ line:\%l/%l:%c                                                     "Set the information displayed in the status line as follows:" Set Nowrapscan "Highlight Currentif has (" gui_running ") set Cursorline Hi cursorline guibg= #333333 hi cursorcolumn guibg= #333333endif "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "+ VIM UserInterface" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " Curors-when moving vertical. Set so=7 redraw, when running macros. Lazyredrawset LZ "Change buffer-without savingset hid" Set Magic onset Magic "what many tenths of a second to Blinkset mat=2 Set Lines=40set columns=100 "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Toolbar display with hidden toggle "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "Set Guioptions-=tset guioptions-=mmap <silent> <F4>: If &guioptions        =~# ' T ' <Bar> \set guioptions-=t <Bar> \set guioptions-=m <bar> \else <Bar> \set guioptions+=t <Bar> \set guioptions+=m <Bar> \endif<cr> "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" G:calenDar_diary =/calendar "Map ca:calendar<cr>" lets Gvim support alt+n to toggle tabs function! Bufpos_activatebuffer (num) Let L:count = 1 for i in range (1, BUFNR ("$")) if buflisted (i) && Getbufvar (I, "&modifiable") if L:count = = A:num exe "buffer". I return endif let L:count = l:count + 1 endif endfor echo "No buffer!" endfunctionfunction! Bufpos_initialize () for I in range (1, 9) exe "Map <m-". I. ">: Call Bufpos_activatebuffer (". I. ") <CR>" endfor exe "map <M-0>: Call Bufpos_activatebuffer (Ten) <CR>" Endfunctionautocmd Vimenter * CA ll Bufpos_initialize () "Press F11 to let vim fullscreen if has (' gui_running ') && have (" Win32 ") map <F11> <esc>:call LIBCALLNR ("Gvimfullscreen.dll", "Togglefullscreen", 0) <cr>endif "Auto Load _vimrcautocmd! Bufwritepost _VIMRC Source%

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.