史上最强的vimrc文件http://amix.dk/vim/vimrc.html, 据说有800行,还是作者精简后的结果.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Maintainer: amix the lucky stiff"             http://amix.dk - amix@amix.dk"" Version: 3.6 - 25/08/10 14:40:30"" Blog_post: 发布的博客地址"       http://amix.dk/blog/post/19486#The-ultimate-vim-configuration-vimrc" Syntax_highlighted: 带有语法高亮的html版本"       http://amix.dk/vim/vimrc.html" Raw_version: txt原始版本"       http://amix.dk/vim/vimrc.txt"" How_to_Install_on_Unix: 如何在Unix系统上安装"    $ mkdir ~/.vim_runtime"    $ svn co svn://orangoo.com/vim ~/.vim_runtime"    $ cat ~/.vim_runtime/install.sh"    $ sh ~/.vim_runtime/install.sh <system>"      <sytem> can be `mac`, `linux` or `windows`"" How_to_Upgrade:如何更新升级"    $ svn update ~/.vim_runtime"" Sections:目录/章节"    -> General 整体布局设置"    -> VIM user interface  用户界面设置"    -> Colors and Fonts  颜色和字体"    -> Files and backups 文件和备份"    -> Text, tab and indent related  文本缩进设置"    -> Visual mode related  视图模式相关设置"    -> Command mode related 命令模式相关设置"    -> Moving around, tabs and buffers  移动,制表符和缓冲区"    -> Statusline  状态栏"    -> Parenthesis/bracket expanding  括号扩展"    -> General Abbrevs 一般缩写"    -> Editing mappings  编辑映射""    -> Cope 帮助/应付"    -> Minibuffer plugin 迷你缓冲区 插件"    -> Omni complete functions"    -> Python section  Python设置"    -> JavaScript section  JavaScript设置

""" Plugins_Included: 用到的插件"     > minibufexpl.vim - http://www.vim.org/scripts/script.php?script_id=159"       Makes it easy to get an overview of buffers:"           info -> :e ~/.vim_runtime/plugin/minibufexpl.vim""     > bufexplorer - http://www.vim.org/scripts/script.php?script_id=42"       Makes it easy to switch between buffers:"           info -> :help bufExplorer""     > yankring.vim - http://www.vim.org/scripts/script.php?script_id=1234"       Emacs's killring, useful when using the clipboard:"           info -> :help yankring""     > surround.vim - http://www.vim.org/scripts/script.php?script_id=1697"       Makes it easy to work with surrounding text:"           info -> :help surround""     > snipMate.vim - http://www.vim.org/scripts/script.php?script_id=2540"       Snippets for many languages (similar to TextMate's):"           info -> :help snipMate""     > mru.vim - http://www.vim.org/scripts/script.php?script_id=521"       Plugin to manage Most Recently Used (MRU) files:管理最近使用的文件的一种插件"           info -> :e ~/.vim_runtime/plugin/mru.vim""     > Command-T - http://www.vim.org/scripts/script.php?script_id=3025"       Command-T plug-in provides an extremely fast, intuitive mechanism for opening filesa:"           info -> :help CommandT"           screencast and web-help -> http://amix.dk/blog/post/19501"""  Revisions: 修订"     > 3.6: Added lots of stuff (colors, Command-T, Vim 7.3 persistent undo etc.)
             "添加的东西很多(例如:颜色,- T的命令,Vim的7.3持久撤消等)"     > 3.5: Paste mode is now shown in status line  if you are in paste mode 在状态栏中增加了显示粘贴模式"     > 3.4: Added mru.vim 增加了mru.vim插件"     > 3.3: Added syntax highlighting for Mako mako.vim 为mako插件增加语法高亮"     > 3.2: Turned on python_highlight_all for better syntax"            highlighting for Python"     > 3.1: Added revisions ;) and bufexplorer.vim""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => General"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Sets how many lines of history VIM has to remember 记录历史的行数set history=700

" Enable filetype plugin 启用文件类型的插件filetype plugin onfiletype indent on

" Set to auto read when a file is changed from the outside 设置自动读取一个文件时,从外部改变set autoread

" With a map leader it's possible to do extra key combinations 设置额外的组合键" like <leader>w saves the current filelet mapleader = ","let g:mapleader = ","

" Fast saving 快速保存nmap <leader>w :w!<cr>

" Fast editing of the .vimrc map <leader>e :e! ~/.vim_runtime/vimrc<cr>

" When vimrc is edited, reload it 当 .vimrc 被修改时,自动生效autocmd! bufwritepost vimrc source ~/.vim_runtime/vimrc

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => VIM user interface"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Set 7 lines to the curors - when moving vertical..set so=7

set wildmenu "Turn on WiLd menu

set ruler "Always show current position

set cmdheight=2 "The commandbar height

set hid "Change buffer - without saving

" Set backspace configset backspace=eol,start,indentset whichwrap+=<,>,h,l

set ignorecase "Ignore case when searchingset smartcase

set hlsearch "Highlight search things

set incsearch "Make search act like search in modern browsersset nolazyredraw "Don't redraw while executing macros 

set magic "Set magic on, for regular expressions

set showmatch "Show matching bracets when text indicator is over themset mat=2 "How many tenths of a second to blink

" No sound on errors 关闭报错声音set noerrorbellsset novisualbellset t_vb=set tm=500

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Colors and Fonts"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""syntax enable "Enable syntax hl

" Set font according to system 根据系统改变字体if MySys() == "mac"  set gfn=Menlo:h14  set shell=/bin/bashelseif MySys() == "windows"  set gfn=Bitstream\ Vera\ Sans\ Mono:h10elseif MySys() == "linux"  set gfn=Monospace\ 10  set shell=/bin/bashendif

if has("gui_running")  set guioptions-=T  set t_Co=256  set background=dark  colorscheme peaksea  set nonuelse  colorscheme zellner  set background=dark

  set nonuendif

set encoding=utf8try    lang en_UScatchendtry

set ffs=unix,dos,mac "Default file types

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Files, backups and undo 文件,备份和撤销"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Turn backup off, since most stuff is in SVN, git anyway... 打开备份set nobackupset nowbset noswapfile

"Persistent undo 永久撤销try    if MySys() == "windows"      set undodir=C:\Windows\Temp    else      set undodir=~/.vim_runtime/undodir    endif

    set undofilecatchendtry

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Text, tab and indent related"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""set expandtabset shiftwidth=4set tabstop=4set smarttab

set lbrset tw=500

set ai "Auto indentset si "Smart indetset wrap "Wrap lines

""""""""""""""""""""""""""""""" => Visual mode related""""""""""""""""""""""""""""""" Really useful!"  In visual mode when you press * or # to search for the current selection
    "在可视模式下按*或#来搜索当前选择vnoremap <silent> * :call VisualSearch('f')<CR>vnoremap <silent> # :call VisualSearch('b')<CR>

" When you press gv you vimgrep after the selected text 设置当你按下GV vimgrep后选定的文本vnoremap <silent> gv :call VisualSearch('gv')<CR>map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>

function! CmdLine(str)    exe "menu Foo.Bar :" . a:str    emenu Foo.Bar    unmenu Fooendfunction

" From an idea by Michael Naumann  Michael Naumann的一些个人设置

function! VisualSearch(direction) range    let l:saved_reg = @"    execute "normal! vgvy"

    let l:pattern = escape(@", '\\/.*$^~[]')    let l:pattern = substitute(l:pattern, "\n$", "", "")

    if a:direction == 'b'        execute "normal ?" . l:pattern . "^M"    elseif a:direction == 'gv'        call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.')    elseif a:direction == 'f'        execute "normal /" . l:pattern . "^M"    endif

    let @/ = l:pattern    let @" = l:saved_regendfunction

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Command mode related"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Smart mappings on the command line 在命令行上的智能映射cno $h e ~/cno $d e ~/Desktop/cno $j e ./cno $c e <C-\>eCurrentFileDir("e")<cr>

" $q is super useful when browsing on the command linecno $q <C-\>eDeleteTillSlash()<cr>

" Bash like keys for the command linecnoremap <C-A>      <Home>cnoremap <C-E>      <End>cnoremap <C-K>      <C-U>

cnoremap <C-P> <Up>cnoremap <C-N> <Down>

" Useful on some European keyboardsmap ½ $imap ½ $vmap ½ $cmap ½ $

func! Cwd()  let cwd = getcwd()  return "e " . cwd endfunc

func! DeleteTillSlash()  let g:cmd = getcmdline()  if MySys() == "linux" || MySys() == "mac"    let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*", "\\1", "")  else    let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\]\\).*", "\\1", "")  endif  if g:cmd == g:cmd_edited    if MySys() == "linux" || MySys() == "mac"      let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*/", "\\1", "")    else      let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\\]\\).*\[\\\\\]", "\\1", "")    endif  endif  return g:cmd_editedendfunc

func! CurrentFileDir(cmd)  return a:cmd . " " . expand("%:p:h") . "/"endfunc

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Moving around, tabs and buffers"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Map space to / (search) and c-space to ? (backgwards search)map <space> /map <c-space> ?map <silent> <leader><cr> :noh<cr>

" Smart way to move btw. windows map <C-j> <C-W>jmap <C-k> <C-W>kmap <C-h> <C-W>hmap <C-l> <C-W>l

" Close the current buffer 关闭当前缓冲区map <leader>bd :Bclose<cr>

" Close all the buffers 关闭所有缓冲区

map <leader>ba :1,300 bd!<cr>

" Use the arrows to something usefullmap <right> :bn<cr>map <left> :bp<cr>

" Tab configurationmap <leader>tn :tabnew<cr>map <leader>te :tabeditmap <leader>tc :tabclose<cr>map <leader>tm :tabmove

" When pressing <leader>cd switch to the directory of the open buffer map <leader>cd :cd %:p:h<cr>

command! Bclose call <SID>BufcloseCloseIt()function! <SID>BufcloseCloseIt()   let l:currentBufNum = bufnr("%")   let l:alternateBufNum = bufnr("#")

   if buflisted(l:alternateBufNum)     buffer #   else     bnext   endif

   if bufnr("%") == l:currentBufNum     new   endif

   if buflisted(l:currentBufNum)     execute("bdelete! ".l:currentBufNum)   endifendfunction

" Specify the behavior when switching between buffers try  set switchbuf=usetab  set stal=2catchendtry

""""""""""""""""""""""""""""""" => Statusline""""""""""""""""""""""""""""""" Always hide the statuslineset laststatus=2

" Format the statuslineset statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c

function! CurDir()    let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")    return curdirendfunction

function! HasPaste()    if &paste        return 'PASTE MODE  '    else        return ''    endifendfunction

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Parenthesis/bracket expanding""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""vnoremap $1 <esc>`>a)<esc>`<i(<esc>vnoremap $2 <esc>`>a]<esc>`<i[<esc>vnoremap $3 <esc>`>a}<esc>`<i{<esc>vnoremap $$ <esc>`>a"<esc>`<i"<esc>vnoremap $q <esc>`>a'<esc>`<i'<esc>vnoremap $e <esc>`>a"<esc>`<i"<esc>

" Map auto complete of (, ", ', [inoremap $1 ()<esc>iinoremap $2 []<esc>iinoremap $3 {}<esc>iinoremap $4 {<esc>o}<esc>Oinoremap $q ''<esc>iinoremap $e ""<esc>iinoremap $t <><esc>i

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => General Abbrevs"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Editing mappings""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Remap VIM 0map 0 ^

"Move a line of text using ALT+[jk] or Comamnd+[jk] on macnmap <M-j> mz:m+<cr>`znmap <M-k> mz:m-2<cr>`zvmap <M-j> :m'>+<cr>`<my`>mzgv`yo`zvmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z

if MySys() == "mac"  nmap <D-j> <M-j>  nmap <D-k> <M-k>  vmap <D-j> <M-j>  vmap <D-k> <M-k>endif

"Delete trailing white space, useful for Python ;)func! DeleteTrailingWS()  exe "normal mz"  %s/\s\+$//ge  exe "normal `z"endfuncautocmd BufWrite *.py :call DeleteTrailingWS()

set guitablabel=%t

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Cope"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Do :help cope if you are unsure what cope is. It's super useful!map <leader>cc :botright cope<cr>map <leader>n :cn<cr>map <leader>p :cp<cr>

""""""""""""""""""""""""""""""" => bufExplorer plugin""""""""""""""""""""""""""""""let g:bufExplorerDefaultHelp=0let g:bufExplorerShowRelativePath=1map <leader>o :BufExplorer<cr>

""""""""""""""""""""""""""""""" => Minibuffer plugin""""""""""""""""""""""""""""""let g:miniBufExplModSelTarget = 1let g:miniBufExplorerMoreThanOne = 2let g:miniBufExplModSelTarget = 0let g:miniBufExplUseSingleClick = 1let g:miniBufExplMapWindowNavVim = 1let g:miniBufExplVSplit = 25let g:miniBufExplSplitBelow=1

let g:bufExplorerSortBy = "name"

autocmd BufRead,BufNew :call UMiniBufExplorer

map <leader>u :TMiniBufExplorer<cr>

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Omni complete functions"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""autocmd FileType css set omnifunc=csscomplete#CompleteCSS

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Spell checking""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Pressing ,ss will toggle and untoggle spell checkingmap <leader>ss :setlocal spell!<cr>

"Shortcuts using <leader>map <leader>sn ]smap <leader>sp [smap <leader>sa zgmap <leader>s? z=

""""""""""""""""""""""""""""""" => Python section""""""""""""""""""""""""""""""let python_highlight_all = 1au FileType python syn keyword pythonDecorator True None False self

au BufNewFile,BufRead *.jinja set syntax=htmljinjaau BufNewFile,BufRead *.mako set ft=mako

au FileType python inoremap <buffer> $r returnau FileType python inoremap <buffer> $i importau FileType python inoremap <buffer> $p printau FileType python inoremap <buffer> $f #--- PH ----------------------------------------------<esc>FP2xiau FileType python map <buffer> <leader>1 /classau FileType python map <buffer> <leader>2 /defau FileType python map <buffer> <leader>C ?classau FileType python map <buffer> <leader>D ?def

""""""""""""""""""""""""""""""" => JavaScript section"""""""""""""""""""""""""""""""au FileType javascript call JavaScriptFold()au FileType javascript setl fenau FileType javascript setl nocindent

au FileType javascript imap <c-t> AJS.log();<esc>hiau FileType javascript imap <c-a> alert();<esc>hi

au FileType javascript inoremap <buffer> $r returnau FileType javascript inoremap <buffer> $f //--- PH ----------------------------------------------<esc>FP2xi

function! JavaScriptFold()    setl foldmethod=syntax    setl foldlevelstart=1    syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend

    function! FoldText()    return substitute(getline(v:foldstart), '{.*', '{...}', '')    endfunction    setl foldtext=FoldText()endfunction

""""""""""""""""""""""""""""""" => MRU plugin""""""""""""""""""""""""""""""let MRU_Max_Entries = 400map <leader>f :MRU<CR>

""""""""""""""""""""""""""""""" => Command-T""""""""""""""""""""""""""""""let g:CommandTMaxHeight = 15set wildignore+=*.o,*.obj,.git,*.pycnoremap <leader>j :CommandT<cr>noremap <leader>y :CommandTFlush<cr>

""""""""""""""""""""""""""""""" => Vim grep""""""""""""""""""""""""""""""let Grep_Skip_Dirs = 'RCS CVS SCCS .svn generated'set grepprg=/bin/grep\ -nH

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => MISC"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Remove the Windows ^M - when the encodings gets messed upnoremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm

"Quickly open a buffer for scripbblemap <leader>q :e ~/buffer<cr>au BufRead,BufNewFile ~/buffer iab <buffer> xh1 ===========================================

map <leader>pp :setlocal paste!<cr>

map <leader>bb :cd ..<cr>

  

转载于:https://www.cnblogs.com/mo-beifeng/archive/2011/08/17/2143770.html

【译】史上最强的vimrc文件相关推荐

  1. 一、史上最强hadoop分布式集群的搭建

    史上最强hadoop分布式集群的搭建 @Author:by Runsen @data:2020-02-23 原创文章,禁止转载 人生最重要的不是所站的位置,而是内心所朝的方向.只要我在每篇博文中写得自 ...

  2. 【插件】史上最强编辑器通用ctags插件OpenCTags使用指南v1.2--开发者必备

    Changes Log: v1.2.0 2011-12-4 支持Java编写的可以设置用户配置的编辑工具 增加当前文件类查找Tags功能 增加设置当前目录参数 完善多种主流轻量级编辑器的配置 v1.1 ...

  3. 【整理】史上最强的娱乐大餐———九奔、汉澳、器普。。。。。。

    按: 本文内容来源于:http://shouji88.com/msg_list.cgi?bbs_id=000001                               http://shouj ...

  4. 史上最强GAN:训练费10万起,现在免费体验,画风鬼畜又逼真

    夏乙 郭一璞 安妮 晓查 发自 亚龙湾  量子位 报道 | 公众号 QbitAI ?好消息!好消息! 9月底轰动业界的史上最强GAN,也就是最高动用512个TPU训练的BigGAN,Demo已经正式放 ...

  5. 9月29日云栖精选夜读:武装到“牙齿”!阿里云发布史上最强企业云安全架构 11层防护...

    未来的企业都会基于云来搭建业务的安全系统,企业云安全架构(Cloud Security Compass)就是这么一份供上云企业参考的设计蓝图-- 企业可以像"建房子"一样,依据模块 ...

  6. node.js 腾讯镜像站_史上最强Sx05RE游戏整合镜像发布!FBA4ARM永久闭源并停止发布!...

    先来说第一件事. 经过两个多星期的编程和整合,史上最强Sx05RE游戏整合镜像终于发布了!此次的整合镜像在官方Sx05RE 2.3.1的基础上,添加了独立NDS模拟器Drasitc以及独立程序Open ...

  7. 史上最强ASR非特定人声语音识别模块,完爆LD3320

    史上最强ASR非特定人声语音识别模块 请大家不要再折腾LD3320了,最近我在玩一款离线语音识别模块,性能甩LD3320一众几条街了,真得太香了.功能岂能用强大来形容,简单就是yyds了.可以自定义命 ...

  8. 二十万字带你入门C语言-史上最强C语言教程(汇总篇)

    一.前言 至此,史上最强C语言教程系列已经全部完成,今天是给大家来做一个汇总,笔者目前已经完成了C语言阶段的学习,一直以来感谢大家的陪伴与支持,笔者后续还会继续更新C++.数据结构.Linux.Mys ...

  9. android 床头闹钟,史上最强"叫床"闹钟!让你再也睡不着啦~~(支持 Android)

    不论是夏天吹冷气还是冬天自然凉,都让人舍不得离开最舒服的床,每天总是在不断挣扎中醒来,以前没有手机闹钟的时候,铃铃叫的闹钟一定要设个三四五六个才起的来,后来我们有了手机贪睡功能,可以无限的 repea ...

最新文章

  1. 特斯拉化身电影院,马斯克:车自动开,你来看电影
  2. 小工匠聊架构-超高并发秒杀系统设计 07_Plan B 的设计
  3. Unicode和UTF-8的区别
  4. java布尔类型比较器_Java 8比较器类型推论非常困惑
  5. Linux 进程(二) 进程地址空间
  6. jquery 实现智能炫酷的翻页相册效果
  7. linux编译错误 程序中有游离的,操作系统实验报告 附思考题(24页)-原创力文档...
  8. 归纳(四):树链剖分
  9. 解释清楚智能指针二【用自己的话,解释清楚】
  10. 揭秘新的供应链攻击:一研究员靠它成功入侵微软、苹果等 35 家科技公司
  11. URL地址编码和解码
  12. Spring框架利用PropertyPlaceholderConfigurer初始化加载多properties文件
  13. 儿童智能手表方案/案列/APP/小程序/网站
  14. 缺陷报告【软件测试】
  15. 怎样屏蔽掉“网页对话框”
  16. Linux C语言编译警告:control reaches end of non-void function
  17. 光学系统像差的计算机模拟实验报告,RLE-ME01-光学系统像差测量实验-实验讲义要点.doc...
  18. 【牛客】前端工程师-HTML专项练习知识点整理(一)
  19. 忍者必须死3突然服务器维修,《忍者必须死3》3月25日停服维护公告
  20. Stack Overflow使用总结

热门文章

  1. golang中的strings.TrimRight
  2. muduo:高效整型转换为字符串
  3. DevOps笔记-10:金融行业分支策略的建议
  4. springmvc十五:数据输出
  5. django 内置 admin
  6. 把sqlserver中存储过程改写到oracle中
  7. 白话数字签名(番外篇)----签名EXE文件(下)
  8. node-sass安装失败解决方法
  9. ListView setOnItemClickListener无效原因分析
  10. 软件测试入门三年经验