本文共 9643 字,大约阅读时间需要 32 分钟。
" 关闭 vi 兼容模式set nocompatible" 自动语法高亮set syntax=on" 检测文件类型filetype on" 检测文件类型插件filetype plugin on" 不设定在插入状态无法用退格键和 Delete 键删除回车符set backspace=indent,eol,startset whichwrap+=<,>,h,l" 显示行号set number" 上下可视行数set scrolloff=6" replace tab with spaceset expandtab" 设定 tab 长度为 4set tabstop=4" 设置按BackSpace的时候可以一次删除掉4个空格set softtabstop=4" 设定 << 和 >> 命令移动时的宽度为 4set shiftwidth=4set smarttabset history=1024" 不突出显示当前行set nocursorline" 覆盖文件时不备份set nobackup" 自动切换当前目录为当前文件所在的目录set autochdir" 搜索时忽略大小写,但在有一个或以上大写字母时仍大小写敏感set ignorecaseset smartcase" 搜索到文件两端时不重新搜索set nowrapscan" 实时搜索set incsearch" 搜索时高亮显示被找到的文本set hlsearch" 关闭错误声音set noerrorbellsset novisualbell"set t_vb=" 不自动换行"set nowrap"How many tenths of a second to blinkset mat=2" 允许在有未保存的修改时切换缓冲区,此时的修改由 vim 负责保存set hidden" 智能自动缩进set smartindent" 设定命令行的行数为 1set cmdheight=1" 显示状态栏 (默认值为 1, 无法显示状态栏)set laststatus=2"显示括号配对情况set showmatch" 解决自动换行格式下, 如高度在折行之后超过窗口高度结果这一行看不到的问题set display=lastline" 设定配色方案colorscheme evening" 设置在状态行显示的信息set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ [%{(&fenc==\"\"?&enc:&fenc).(&bomb?\",BOM\":\"\")}]\ %c:%l/%L%)" 显示Tab符set listset listchars=tab:\|\ ,trail:.,extends:>,precedes:<"启动时不显示 捐赠提示set shortmess=atl"blank 空白"buffers 缓冲区"curdir 当前目录"folds 折叠"help 帮助"options 选项"tabpages 选项卡"winsize 窗口大小"slash 转换文件路径中的\为/以使session文件兼容unix"unix 设置session文件中的换行模式为unixset sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize,slash,unix,resize" 允许backspace和光标键跨越行边界set whichwrap+=<,>,h,l" backspaceset backspace=eol,start,indent" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)set mouse=aset selection=exclusiveset selectmode=mouse,key" 在被分割的窗口间显示空白,便于阅读set fillchars=vert:\ ,stl:\ ,stlnc:\" 高亮显示匹配的括号set showmatch" 匹配括号高亮的时间(单位是十分之一秒)set matchtime=5"编码设置set enc=utf-8set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936" set mapleaderlet mapleader=","nmap J 5jnmap K 5k" Ctrl+anmapggvG$" 选中状态下 Ctrl+c 复制vnoremap "+y" Ctrl+vnmap "+p" 窗口切换nnoremap hnnoremap lnnoremap jnnoremap k" 插入模式下上下左右移动光标inoremap inoremap inoremap gjinoremap gk" Ctrl+s" If the current buffer has never been saved, it will have no name," call the file browser to save it, otherwise just save it."nnoremap :if expand("%") == "" browse confirm w else confirm w endif "imap " Use CTRL-S for saving, also in Insert modenmap :update vmap :update imap :update " C++的编译和运行"map :call CompileRunGpp() "func! CompileRunGpp()"exec "w""exec "!g++ % -o %<""exec "! ./%<""endfuncmap :call RunGpp() func! RunGpp() exec "w" exec "! ./%<" endfunc "vim plugin setting"======================"set tags=tagsset tags+=~/.vim/my-tags/tagsset tags+=~/.vim/my-tags/stl-tagsset tags+=~/.vim/my-tags/sys-tagsset autochdir "Update ctags map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q """""""""""""""""""""""""""""" " Tag list (ctags)"""""""""""""""""""""""""""""""if MySys() == "windows" "设定windows系统中ctags程序的位置" let Tlist_Ctags_Cmd = 'ctags'"elseif MySys() == "linux" "设定Linux系统中ctags程序的位置 let Tlist_Ctags_Cmd = '/home/sphinx/.vim/ctags-5.8/ctags'"endiflet Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vimlet Tlist_Use_Right_Window = 0 "在右侧窗口中显示taglist窗口let Tlist_OnlyWindow=1"let Tlist_Use_Right_Window=0"let Tlist_Sort_Type='name'"let Tlist_Show_Menu=1"let Tlist_Max_Submenu_Items=10"let Tlist_Max_Tag_length=16 "20"let Tlist_Use_SingleClick=0"let Tlist_Auto_Open=0"let Tlist_Close_On_Select=0"let Tlist_File_Fold_Auto_Close=1"let Tlist_GainFocus_On_ToggleOpen=0"let Tlist_Process_File_Always=1"let Tlist_WinHeight=10"let Tlist_WinWidth=18"let Tlist_Use_Horiz_Window=0let Tlist_Auto_Highlight_Tag = 1"let Tlist_Auto_Open = 1let Tlist_Auto_Update = 1let Tlist_Close_On_Select = 0let Tlist_Compact_Format = 0let Tlist_Display_Prototype = 0let Tlist_Display_Tag_Scope = 1let Tlist_Enable_Fold_Column = 0let Tlist_File_Fold_Auto_Close = 0let Tlist_GainFocus_On_ToggleOpen = 1let Tlist_Hightlight_Tag_On_BufEnter = 1let Tlist_Inc_Winwidth = 0let Tlist_Max_Submenu_Items = 1let Tlist_Max_Tag_Length = 30let Tlist_Process_File_Always = 0let Tlist_Show_Menu = 0let Tlist_Sort_Type = "order"let Tlist_Use_Horiz_Window = 0let Tlist_WinWidth = 31map :TlistOpen "OMNI"omnicppcoplete "-- omnicppcomplete setting -- set completeopt=menu,menuone let OmniCpp_MayCompleteDot = 1 " autocomplete with . let OmniCpp_MayCompleteArrow = 1 " autocomplete with -> let OmniCpp_MayCompleteScope = 1 " autocomplete with :: let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert) let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype in popup window let OmniCpp_GlobalScopeSearch=1 let OmniCpp_DisplayMode=1 let OmniCpp_DefaultNamespaces=["std"] set nocp filetype plugin on "WinManagerlet g:winManagerWindowLayout='FileExplorer|TagList'"let g:winManagerWindowLayout='FileExplorer|BufExplorer|TagList'let g:persistentBehaviour=0let g:winManagerWidth=20let g:defaultExplorer=1nmap wm :WMToggle "QuickFixnmap :cn nmap :cp "MiniBufExplorer"let g:miniBufExplMapWindowNavVim = 1"let g:miniBufExplMapWindowNavArrows = 1let g:miniBufExplModSelTarget = 1let g:miniBufExplorerMoreThanOne = 2let g:miniBufExplModSelTarget = 0let g:miniBufExplUseSingleClick = 1let g:miniBufExplMapWindowNavVim = 1let g:miniBufExplVSplit = 15 "25let g:miniBufExplSplitBelow=1let g:bufExplorerSortBy = "name"autocmd BufRead,BufNew :call UMiniBufExplorermap u :TMiniBufExplorer "AutoClose"let g:AutoClosePairs = {'(': ')', '{': '}', '[': ']', '"': '"', "'": "'"}let g:AutoClosePairs = {'(': ')', '{': '}', '[': ']', '"': '"', "'": "'"}
Last
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Maintainer: " Geek SphinX" topcodersphinx@gmail.com"" Version:" 1.0 - Thu Nov 1 17:21:44 CST 2012"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Sets how many lines of history VIM has to rememberset history=1024" Auto syntax highlightset syntax=on" Check file formatfiletype on" Enable filetype pluginsfiletype plugin onfiletype indent on" Sets non VI compatible modeset nocompatible" Set to auto read when a file is changed from the outsideset autoread" With a map leader it's possible to do extra key combinations" likew saves the current filelet mapleader = ","let g:mapleader = ","" Fast savingnmap w :w nmap q :q """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => VIM user interface"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Replace J, Knmap J 5jnmap K 5k" Ctrl+A to select all content in visual modenmap ggvG$" Ctrl+C to copyvnoremap "+y" Ctrl+V to pastenmap "+p" Set 7 lines to the cursor - when moving vertically using j/kset so=7" Turn on the Wild menuset wildmenu" Ignore compiled filesset wildignore=*.o,*~,*.pyc"Always show current positionset ruler" Height of the command barset cmdheight=2" A buffer becomes hidden when it is abandonedset hid" Configure backspace so it acts as it should actset whichwrap+=<,>set backspace=indent,eol,start" Ignore case when searchingset ignorecase" When searching try to be smart about cases set smartcase" Highlight search resultsset hlsearch" Makes search act like search in modern browsersset incsearch" Don't redraw while executing macros (good performance config)set lazyredraw" For regular expressions turn magic onset magic" Show matching brackets when text indicator is over themset showmatch" How many tenths of a second to blink when matching bracketsset mat=2" No annoying sound on errors set noerrorbellsset novisualbellset t_vb=set tm=500" Show line numberset number" Highlight over 80 columnshighlight OverLength ctermbg=red ctermfg=white guibg=#592929match OverLength /\%81v.\+/" Show Tab symbolset listset listchars=tab:\|\ ,trail:.,extends:>,precedes:<" Switch windowsnnoremap hnnoremap lnnoremap jnnoremap k" Move cursor in insert modeinoremap hinoremap linoremap jinoremap k"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Colors and Fonts"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Enable syntax highlightingsyntax enable"colorscheme desertcolorscheme molokaiset background=dark" Set extra options when running in GUI modeif has("gui_running") set guioptions-=T set guioptions+=e set t_Co=256 set guitablabel=%M\ %tendif" Set utf8 as standard encoding and en_US as the standard languageset encoding=utf8" Use Unix as the standard file typeset ffs=unix,dos,mac" Use Inconsolata as the gui fontset guifont=Inconsolata\ 15"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Text, tab and indent related"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Use spaces instead of tabsset expandtab" Be smart when using tabs ;)set smarttab" 1 tab == 4 spacesset shiftwidth=4set tabstop=4" Linebreak on 500 charactersset lbrset tw=500set ai "Auto indentset si "Smart indentset wrap "Wrap lines""""""""""""""""""""""""""""""" => Status line""""""""""""""""""""""""""""""" Always show the status lineset laststatus=2" Format the status line"set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Mouse"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""set mouse=aset selection=exclusiveset selectmode=mouse,key"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Plugins"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
转载地址:http://kibqb.baihongyu.com/