Not the most powerful VIMRC.

Source: Internet
Author: User
Tags set background

has always been using Vim as my main editor, which greatly improved my code editing efficiency. Vim configuration highly flexible, rich plug-ins, I am afraid that 100 people have 99 ways to configure, online about the vim configuration of the so-called "most powerful VIMRC" such articles many, Bo people eyeball, understandable, but I believe, never the most powerful configuration, only more reasonable configuration. After all, Vim's learning curve is still relatively steep, complex configuration is not necessarily suitable for beginners to learn, in addition, everyone on the editor's functional requirements are not the same, the purpose of using Vim is different for each person, some plug-ins and functions for one is very useful to another person may be useless. Aesthetic needs and habits are also diversified, the most typical is the color problem, no one color scheme can satisfy everyone's taste. Therefore, other people's configuration can only be used for reference, not to copy, take long to short, according to their preferences and habits slowly to create a suitable for their own personality vim, I think this is the fun.

First look at the diagram:

Here's how the individual is configured (and also based on other configuration changes):

1. Terminal color scheme: MOLOKAI2. Set terminal display mode to 256 colors

Method 1:
New File ~/.gnome-terminal-wrapper
Add the following to it:
Export Term=xterm-256color
EXEC $SHELL

Method 2: Add the following in the VIMRC:
Set t_co=256

3. My VIMRC Configuration
"Modeline and Notes {" Vim:ts=8 sts=2 fdm=marker nowrap "Vim:set foldmarker={,} foldlevel=0:"} "Basics {" Configuration changes from Dynamic Loading autocmd! Bufwritepost VIMRC Source ~/.VIMRC "Open file automatically jumps to last edited location au bufreadpost * if line (" ' \ "") > 1 && line ("' \" ") & Lt;= Line ("$") | EXE "normal! G ' \ "" | endif set nocompatible "explicitly get out of the vi-compatible mode set NOEXRC" Don t use local version of. (g) VIMRC,. EXRC set Background=dark "We plan to use a dark background set cpoptions=aabcefsmq" | | |    |||||| "| | | | | | | |      +–when joining lines, leave the cursor "| | | | | | | Between joined lines "| | | | | | | |      +–when a new match is created (showmatch) "| | | | | | Pause for. 5 "| | | | | |      +–set buffer options when entering the "| | | | | Buffer "| | | | | +–:write command Updates current file name "| | | |       +–automatically add to the last line "      ||| When using: @r "| | |      +–searching continues at the end of the match "| | At the cursor position "| |             +–a backslash have no special meaning in mappings "|+–:write updates alternative file name" +–:read updates alternative file name syntax on ' syntax highlighting on set HELPLANG=CN '} ' general {Filet Ype plugin indent on "Load filetype plugins/indent settings set Autochdir" Always switch to the current file director Y set Backspace=indent,eol,start "make backspace a more flexible set nobackup" Make Backup Files "set Backupdir =~/.vim/backup "Where to put backup files set clipboard+=unnamed" Share Windows Clipboard "set Directory=~/.vim/tm P "Directory to place swap files in set Fileformats=unix,dos,mac" support all three, in this order set hidden "yo u can change buffers without saving "(XXX: #VIM/tpope warns the line below could break things) seT iskeyword+=_,$,@,%,# "None of these is word dividers" set mouse=a "use mouse everywhere set mouse= set Noerr Orbells "Don ' t make noise set Sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize,slash,unix,    Resize set whichwrap=b,s,h,l,<,>,~,[,] "Everything Wraps" | | | | | | | | | "| | | | | | | | +– "]" Insert and Replace "| | | | | | | +– "[" Insert and Replace "| | | | | | +--"~" Normal "| | | | | +--Normal and Visual "| | | | +--Normal and Visual "| | | +--"L" Normal and Visual (not recommended) "| | +--"H" Normal and Visual (not recommended) "| +--normal and visual "+--Normal and visual set Wildmenu" Turn command line completion wild Styl E "Ignore these list file extensions set WILDIGNORE=*.DLL,*.O,*.OBJ,*.BAK,*.EXE,*.PYC, \*.jpg,*. gif,*.PNG set Wildmode=list:longest "Turn on wild mode huge list" Set key timeout to 100ms, set map timeout to 2000ms set timeout timeoutlen=20 XX ttimeoutlen=100 set tags+=./. /tags,./. /.. /tags,./. /.. /.. /tags,./. /.. /.. /.. /tags "}" Vim UI {if has ("autocmd") au Insertenter * Silent Execute "!gconftool-2--type string--set/apps/gnome-termin Al/profiles/default/cursor_shape ibeam "au insertleave * Silent Execute"!gconftool-2--type string--set/apps/gnome-ter Minal/profiles/default/cursor_shape block "au Vimleave * Silent Execute"!gconftool-2--type string--set/apps/gnome-ter    Minal/profiles/default/cursor_shape ibeam "endif colorscheme Molokai set Cursorcolumn" highlight the current column  Set Cursorline "Highlight current line set Incsearch" but does highlight as you type "search Phrase set laststatus=2 "Always show the status line set Lazyredraw" does not redraw while running macros set Li                Nespace=0 "Don ' t insert any extra pixel lines     "Betweens rows" set list "We do-to-show tabs, to ensure we get them" out of my Files "set L                     istchars=tab:>-,trail:-"Show tabs and trailing set matchtime=5" How many tenths of a second to blink "Matching brackets for set Nohlsearch" does not highlight searched for phrases set nostartofline "Leave my Cursor where it was set Novisualbell "Don't blink set number" Turn on line numbers set numberwidth=5 "We are g Ood up to 99999 lines set report=0 "Tell us when anything is changed via: ... set ruler" Always show current posit Ions along the bottom set scrolloff=10 "Keep lines (top/bottom) for scope set SHORTMESS=AOSTT" shortens message  s to avoid "' press a key ' prompt set ShowCmd" show the command being typed set Showmatch " Show matching brackets set sidescrolloff=10 "Keep 5 lines at the size" set Statusline=[%f]%y%r%m%*%=[line:%l/%l,co lumn:%c][%p%%] Set StATUSLINE=%F%M%R%H%W[%L][%{&AMP;FF}]%Y[%P%%][%04L,%04V] "| | | | |   |      |  |     |    |    |  "| | | | |   |      |  |     |    |  + current "| | | | |   |      |  |     |       |  Column "| | | | |   |      |  |     |  +–current Line "| | | | |   |      |  |  +–current% into file "| | | | |   |      |  +–current syntax in "| | | | | |   |          |  Square brackets "| | | | |   |  +–current FileFormat "| | | | | +–number of lines "| | | | +–preview flag in square brackets "| | | +–help flag in square brackets "| | +–readonly flag in square brackets "|    +–rodified flag in square brackets "+–full path to file in the buffer"} "Text formatting/layout { Set completeopt= "Don t use a pop up menu for completions set expandtab" no real tabS please! Set FORMATOPTIONS=RQ "Automatically insert comment leader on return," and let GQ format comment S set ignorecase "case insensitive by default set infercase" Case inferred by default set nowrap "does not wrap Line set Shiftround "When @ 3 spaces, and I hit > ... go to 4, not 5 set smartcase" If there is caps, go case-s Ensitive set shiftwidth=4 "auto-indent amount when using Cindent," &GT;&GT;, << and stuff Like this set softtabstop=4 "when hitting tab or BACKSPACE, how many spaces" should a tab is (SE e expandtab) Set tabstop=8 "Real tabs should be 8, and they would show with" set list on "}" Foldin                        G {Set foldenable "Turn on Folding set foldmarker={,}" Fold C style code (only with this as default "If you use a high Foldlevel) set Foldmethod=marker" Fold on the marker set foldlevel=100 "Don t Autofol D anything(But I can still "fold manually) set Foldopen=block,hor,mark,percent,quickfix,tag" What movement S "Open folds function! Simplefoldtext () "{return getline (v:foldstart). ' ' Endfunction '} set Foldtext=simplefoldtext () "Custom fold text function" (CLE Aner than default) '} ' Plugin Settings {' TagList Settings {let tlist_auto_open=0 ' let the tag list Open aut        omagically Let Tlist_compact_format = 1 "Show small menu Let Tlist_ctags_cmd = ' Ctags '" Location of Ctags Let Tlist_enable_fold_column = 0 "Does show folding tree let Tlist_show_one_file = 1" ta that does not display multiple files at the same time G, show only the current file's let Tlist_exist_onlywindow = 1 "If you're the last, kill" your        Self Let tlist_file_fold_auto_close = 0 "Fold closed other trees let Tlist_sort_type =" name "" Order BY " LeT Tlist_use_right_window = 1 "Split to the right side" of the "t  List_winwidth = "cols wide, so I can (almost always)" Read my functions Let Tlist_auto_highlight_tag = 1 "Let Tlist_auto_update = 1 let tlist_close_on_select = 0 Let Tlist_comp Act_format = 0 Let Tlist_display_prototype = 0 let Tlist_display_tag_scope = 1 let tlist_enable_fold_ Column = 0 Let Tlist_file_fold_auto_close = 0 let Tlist_gainfocus_on_toggleopen = 1 let Tlist_hightli Ght_tag_on_bufenter = 1 Let tlist_inc_winwidth = 0 let Tlist_max_submenu_items = 1 let tlist_max_tag_        Length = tlist_process_file_always = 0 Let Tlist_show_menu = 0 let Tlist_sort_type = "order"            Let Tlist_use_horiz_window = 0 "Language specifics {" Just functions and classes Let Tlist_aspjscript_settings = ' Asp;f:function;c:class ' "Just functions and subs please tlist_aspvbs_settings = ' A Sp;f:function;s:sub ' "Don ' t show variables in freaking php let tlist_php_settings = ' php;c:class;d: Constant;f:function ' "Just functions and classes please tlist_vb_settings = ' asp;f:function;c:c Lass ' "}"} "Lookupfile setting {Let G:lookupfile_minpatlength = 2" Enter a minimum of 2 characters  To start looking for let G:lookupfile_preservelastpattern = 0 "Do not save the last-looked-for-string-g:lookupfile_preservepatternhistory =  1 "Save find history let G:lookupfile_alwaysacceptfirst = 1" Enter Open first match item let G:lookupfile_allownewfiles = 0 "Do not allow creation of nonexistent files if Filereadable ("./filenametags ")" Set the name of the tag file let G:LOOKUPFI le_tagexpr = ' "./filenametags" ' EndIf "}" Nerdtree settings {"Let the tree decorate its own colorful and colourful highlights lets Nerdchris Tmastree=1 "Controls when the cursor moves over theAt a certain distance, whether to automatically adjust the focus to the screen center let nerdtreeautocenter=1 "Specify the bookmark file let nerdtreebookmarksfile= $VIMFILES. ' \nerdtree_bookmarks ' "Specifies the mouse mode (1. Double-click to open 2. Single-directory dual file 3. Click Open) Let nerdtreemousemode=2" whether the bookmark list is displayed by default let Nerdtreeshowboo Kmarks=1 "Default show file Let Nerdtreeshowfiles=1" whether to show hidden files by default let nerdtreeshowhidden=1 "show line numbers by default let Nerdtre Eshowlinenumbers=0 "window position (' left ' or ' right ') let nerdtreewinpos= ' left '" window width Let nerdtreewinsize=31 "}"} "M AP Settings {"Custom key mapping {Let Mapleader =", "Get G:mapleader =", "Nnoremap e:e ~/.VIMRC"} "collapses related fast    Czech key {"ZR Open all Folding" za open/close (toggle) a folded group of lines.    "ZA Open a Closed fold or close and Open fold recursively.     "Zi all expand/close Collapse" Zo on (open) collapse under cursor "ZC close (Close) collapse under cursor" ZC loop off (close) all folds under cursor "ZM Close all collapsible areas"} "Implemented Ctrl-c, ctrl-v copy and paste, Ctrl-s save operation Mappings {Vnoremap" +y inoremap "+pi imap:w"} "F12 Cancel highlight {Map:nohl Search "}" using Ctrl+[hjKL] Navigating between Windows map J {nnoremap k nnoremap h nnoremap L nnoremap J "}" using CTRL+[KJ] move the map up or down in insert mode {    Inoremap inoremap inoremap Inoremap "}" use the arrows to navigate the operation of the tab of buffer {map:bn map:bp "}" {    Map tn:tabnew Map Te:tabedit map tc:tabclose map Tm:tabmove "}" brackets match {"Vnoremap $ ' >a) ' <i ( "Vnoremap $ >a] ' <i[" Vnoremap $ ' >a} ' <i{"Vnoremap $$ ' >a" ' <i ' "Vnoremap $q ' >a ' <i ' "Vnoremap $e ' >a" ' <i "" very handy brace matching, which is actually automatically generated brackets "to achieve a compromise of convenience and compatibility" Inoremap $ () i "Inoremap $ []i" Inor Emap $}i "Inoremap $4 {o}o" Inoremap $q "i" Inoremap $e "" I "Inoremap $t <>i"} "TagList Plugin     Maps {Nnoremap Tl:tlisttoggle "}" lookup plugin maps {"Map lookupfile for, LK Nmap lk:lutags" map lubufs for, LL    Nmap Ll:lubufs "Mapping Luwalk for, LW nmap lw:luwalk" Nerdtree plugin maps nnoremap tt:nerdtree "}" comment Map { Nnoremap//i/* [JCLi: =strftime ("%y-%m-%d%h:%m:%s")] */"}" FreePBX {nnoremap, Fr Oecho "\n[]". __file__. ":". __line__. ": \    n "; Nnoremap, Ftag:set Tags=/usr/local/src/freepbx-2.9.0/tags "}" in the current directory load or unload tags file {"CTA load tags" CTD uninstall Tags map Cta:call add_tags () map Ctd:call del_tags () function! Add_tags () Let dir =expand ("%:p: H") Let Curtags = dir. " /tags "Let Curtags=substitute" (curtags, ' \ \ ', ' \ ', ' g ') if filereadable (curtags) Exec "set tags+=". Curta GS Echohl Warningmsg | echo "SUCC to add tags! [". Curtags."] "| Echohl None Else Echohl warningmsg | echo "Fail to add tags! No tags in this file ' s path. [". Curtags."] "| Echohl None endif endfunction function! Del_tags () Let dir =expand ("%:p: H") Let Curtags = dir. "           /tags "Let Curtags=substitute (curtags, ' \ \ ', ' \ ', ' G ') exec" set tags-= ". Curtags if Filereadable (curtags) Echohl warningmsg | echo "Succ to Del tags! [". CURtags. "]" | Echohl None Else Echohl warningmsg | echo "Succ to Del tags! But no tags in this file ' s path. [". Curtags."] "| Echohl None endif endfunction "}" changes cursor color according to state {"Let Color_normal = ' hotpink '" let Color_insert = ' royalblue1′ "Let Color_exit = ' green '" If &term =~ ' xterm\|rxvt ' "exe ' silent!echo-ne" \e]12; ". Shellescape (Color_normal, 1). ' "\007″ '" Let &t_si= "\e]12;". Color_insert. "\007″" let &t_ei= "\e]12;". Color_normal. "\007″" EXE ' autocmd vimleave *: Silent!echo-ne "\e]12;". Shellescape (Color_exit, 1). ' \007″ ' "ElseIf &term =~" Screen "" if Exists (' $TMUX ') "if &ttymouse = = ' Xterm '" Set Ttymouse=xterm2 "Endi F "exe ' silent!echo-ne" \033ptmux;\033\e]12; Shellescape (Color_normal, 1). ' "\007\033\\" ' "Let &t_si=" \033ptmux;\033\e]12; ". Color_insert. "\007\033\\" "Let &t_ei=" \033ptmux;\033\e]12; ". Color_normal. "\007\033\\" "EXE ' autocmd vimleave *: Silent!eCho-ne "\033PTMUX;\033\E]12;". Shellescape (Color_exit, 1). ' "\007\033\\" ' "ElseIf!exists (' $SUDO _uid ')" or it may still is in Tmux "EXE ' silent!echo-ne" \033p\e]12; ". Shellescape (Color_normal, 1). ' "\007\033\\" ' "Let &t_si=" \033p\e]12; ". Color_insert. "\007\033\\" "Let &t_ei=" \033p\e]12; ". Color_normal. "\007\033\\" "EXE ' autocmd vimleave *: Silent!echo-ne" \033p\e]12; ". Shellescape (Color_exit, 1). ' "\007\033\\" ' "endif" endif "Unlet color_normal" Unlet color_insert "Unlet color_exit" "}" "}

Not the most powerful VIMRC.

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.