史上最强的 Vim 配置文件?-纯文本版
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" _" __ | \" / | /" \__ | \" by Amix - http://amix.dk/"" Maintainer:Amir Salihefendic <amix3k at gmail.com>" Version: 2.7" Last Change: 12/10/06 00:09:21"" Sections:" ----------------------" *> General" *> Colors and Fonts" *> Fileformats" *> VIM userinterface" ------ *> Statusline" *> Visual" *> Moving around and tabs" *> General Autocommands" *> Parenthesis/bracket expanding" *> General Abbrevs" *> Editing mappings etc." *> Command-line config" *> Buffer realted" *> Files and backups" *> Folding" *> Text options" ------ *> Indent" *> Spell checking" *> Plugin configuration" ------ *> Yank ring" ------ *> File explorer" ------ *> Minibuffer" ------ *> Tag list (ctags) - not used" ------ *> LaTeX Suite things" *> Filetype generic" ------ *> Todo" ------ *> VIM" ------ *> HTML related" ------ *> Ruby & PHP section" ------ *> Python section" ------ *> Cheetah section" ------ *> Vim section" ------ *> Java section" ------ *> JavaScript section" ------ *> C mappings" ------ *> SML" ------ *> Scheme bindings" *> Snippets" ------ *> Python" ------ *> javaScript" *> Cope" *> MISC""Tip:" If you find anything that you can't understand than do this:" help keyword OR helpgrep keywords"Example:" Go into command-line mode and type helpgrep nocompatible, ie." :helpgrep nocompatible" then press <leader>c to see the results, or :botright cw""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => General""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Get out of VI's compatible mode..set nocompatible"Sets how many lines of history VIM har to rememberset history=400"Enable filetype pluginfiletype plugin onfiletype indent on"Set to auto read when a file is changed from the outsideset autoread"Have the mouse enabled all the time:set mouse=a"Set mapleaderlet mapleader = ","let g:mapleader = ",""Fast savingnmap <leader>w :w!<cr>nmap <leader>f :find<cr>"Fast reloading of the .vimrcmap <leader>s :source ~/vim_local/vimrc<cr>"Fast editing of .vimrcmap <leader>e :e! ~/vim_local/vimrc<cr>"When .vimrc is edited, reload itautocmd! bufwritepost vimrc source ~/vim_local/vimrc"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Colors and Fonts""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Enable syntax hlsyntax enable"Set font to Monaco 10ptif MySys() == "mac"set gfn=Bitstream\ Vera\ Sans\ Mono:h14set nomacatsuiset termencoding=macromanelseif MySys() == "linux"set gfn=Monospace\ 11endifif has("gui_running")set guioptions-=Tlet psc_style='cool'colorscheme ps_colorelseset background=darkcolorscheme zellnerendif"Some nice mapping to switch syntax (useful if one mixes different languages in one file)map <leader>1 :set syntax=cheetah<cr>map <leader>2 :set syntax=xhtml<cr>map <leader>3 :set syntax=python<cr>map <leader>4 :set ft=javascript<cr>map <leader>$ :syntax sync fromstart<cr>autocmd BufEnter * :syntax sync fromstart"Highlight currentif has("gui_running")set cursorlinehi cursorline guibg=#333333hi CursorColumn guibg=#333333endif"Omni menu colorshi Pmenu guibg=#333333hi PmenuSel guibg=#555555 guifg=#ffffff"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Fileformats""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Favorite filetypesset ffs=unix,dos,macnmap <leader>fd :se ff=dos<cr>nmap <leader>fu :se ff=unix<cr>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => VIM userinterface""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Set 7 lines to the curors - when moving vertical..set so=7"Turn on WiLd menuset wildmenu"Always show current positionset ruler"The commandbar is 2 highset cmdheight=2"Show line numberset nu"Do not redraw, when running macros.. lazyredrawset lz"Change buffer - without savingset hid"Set backspaceset backspace=eol,start,indent"Bbackspace and cursor keys wrap toset whichwrap+=<,>,h,l"Ignore case when searchingset ignorecaseset incsearch"Set magic onset magic"No sound on errors.set noerrorbellsset novisualbellset t_vb="show matching bracetsset showmatch"How many tenths of a second to blinkset mat=2"Highlight search thingsset hlsearch""""""""""""""""""""""""""""""" => Statusline"""""""""""""""""""""""""""""""Always hide the statuslineset laststatus=2function! CurDir()let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")return curdirendfunction"Format the statuslineset statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c""""""""""""""""""""""""""""""" => Visual""""""""""""""""""""""""""""""" From an idea by Michael Naumannfunction! VisualSearch(direction) rangelet 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"elseexecute "normal /" . l:pattern . "^M"endiflet @/ = l:patternlet @" = l:saved_regendfunction"Basically you press * or # to search for the current selection !! Really usefulvnoremap <silent> * :call VisualSearch('f')<CR>vnoremap <silent> # :call VisualSearch('b')<CR>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Moving around and tabs""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Map space to / and c-space to ?map <space> /map <c-space> ?"Smart way to move btw. windowsmap <C-j> <C-W>jmap <C-k> <C-W>kmap <C-h> <C-W>hmap <C-l> <C-W>l"Actually, the tab does not switch buffers, but my arrows"Bclose function ca be found in "Buffer related" sectionmap <leader>bd :Bclose<cr>map <down> <leader>bd"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 :tabmovetryset switchbuf=usetabset stal=2catchendtry"Moving fast to front, back and 2 sides ;)imap <m-$> <esc>$aimap <m-0> <esc>0iimap <D-$> <esc>$aimap <D-0> <esc>0i"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => General Autocommands""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Switch to current dirmap <leader>cd :cd %:p:h<cr>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => 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 $w <esc>`>a"<esc>`<i"<esc>"Map auto complete of (, ", ', <esc>:let leavechar="]"<cr>iinoremap $4 {<esc>o}<esc>:let leavechar="}"<cr>Oinoremap $3 {}<esc>:let leavechar="}"<cr>iinoremap $q ''<esc>:let leavechar="'"<cr>iinoremap $w ""<esc>:let leavechar='"'<cr>iau BufNewFile,BufRead *.\(vim\)\@! inoremap " ""<esc>:let leavechar='"'<cr>iau BufNewFile,BufRead *.\(txt\)\@! inoremap ' ''<esc>:let leavechar="'"<cr>iimap <m-l> <esc>:exec "normal f" . leavechar<cr>aimap <d-l> <esc>:exec "normal f" . leavechar<cr>a"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => General Abbrevs""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""My informationiab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>iab xname Amir Salihefendic"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Editing mappings etc.""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Remap VIM 0map 0 ^"Move a line of text using controlnmap <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`zif MySys() == "mac"nmap <D-j> <M-j>nmap <D-k> <M-k>vmap <D-j> <M-j>vmap <D-k> <M-k>endiffunc! DeleteTrailingWS()exe "normal mz"%s/\s\+$//geexe "normal `z"endfuncautocmd BufWrite *.py :call DeleteTrailingWS()set completeopt=menu"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Command-line config"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""func! Cwd()let cwd = getcwd()return "e " . cwdendfuncfunc! DeleteTillSlash()let g:cmd = getcmdline()if MySys() == "linux" || MySys() == "mac"let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*", "\\1", "")elselet g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\]\\).*", "\\1", "")endifif g:cmd == g:cmd_editedif MySys() == "linux" || MySys() == "mac"let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*/", "\\1", "")elselet g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\\]\\).*\[\\\\\]", "\\1", "")endifendifreturn g:cmd_editedendfuncfunc! CurrentFileDir(cmd)return a:cmd . " " . expand("%:p:h") . "/"endfunc"Smart mappings on the command linecno $h e ~/cno $d e ~/Desktop/cno $j e ./cno $q <C-\>eDeleteTillSlash()<cr>cno $c e <C-\>eCurrentFileDir("e")<cr>cno $tc <C-\>eCurrentFileDir("tabnew")<cr>cno $th tabnew ~/cno $td tabnew ~/Desktop/"Bash likecnoremap <C-A><Home>cnoremap <C-E><End>cnoremap <C-K><C-U>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Buffer realted""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Fast open a buffer by search for a namemap <c-q> :sb"Open a dummy buffer for pastemap <leader>q :e ~/buffer<cr>"Restore cursor to file position in previous editing sessionset viminfo='10,\"100,:20,%,n~/.viminfoau BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif" Buffer - reverse everything ... :)map <F9> ggVGg?" Don't close window, when deleting a buffercommand! Bclose call <SID>BufcloseCloseIt()function! <SID>BufcloseCloseIt()let l:currentBufNum = bufnr("%")let l:alternateBufNum = bufnr("#")if buflisted(l:alternateBufNum)buffer #elsebnextendifif bufnr("%") == l:currentBufNumnewendifif buflisted(l:currentBufNum)execute("bdelete! ".l:currentBufNum)endifendfunction"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Files and backups""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Turn backup offset nobackupset nowbset noswapfile"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Folding""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Enable folding, I find it very usefulset nofenset fdl=0"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Text options"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""set expandtabset shiftwidth=2map <leader>t2 :set shiftwidth=2<cr>map <leader>t4 :set shiftwidth=4<cr>au FileType html,python,vim,javascript setl shiftwidth=2au FileType html,python,vim,javascript setl tabstop=2au FileType java setl shiftwidth=4au FileType java setl tabstop=4set smarttabset lbrset tw=500""""""""""""""""""""""""""""""" => Indent"""""""""""""""""""""""""""""""Auto indentset ai"Smart indetset si"C-style indetingset cindent"Wrap linesset wrap"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Spell checking"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""map <leader>sn ]smap <leader>sp <esc>O"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Filetype generic""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Todo"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""au BufNewFile,BufRead *.todo so ~/vim_local/syntax/amido.vim""""""""""""""""""""""""""""""" => VIM""""""""""""""""""""""""""""""autocmd FileType vim map <buffer> <leader><space> :w!<cr>:source %<cr>""""""""""""""""""""""""""""""" => HTML related""""""""""""""""""""""""""""""" HTML entities - used by xml edit pluginlet xml_use_xhtml = 1"let xml_no_auto_nesting = 1"To HTMLlet html_use_css = 1let html_number_lines = 0let use_xhtml = 1""""""""""""""""""""""""""""""" => Ruby & PHP section""""""""""""""""""""""""""""""autocmd FileType ruby map <buffer> <leader><space> :w!<cr>:!ruby %<cr>autocmd FileType php compiler phpautocmd FileType php map <buffer> <leader><space> <leader>cd:w<cr>:make %<cr>""""""""""""""""""""""""""""""" => Python section"""""""""""""""""""""""""""""""Run the current buffer in python - ie. on leader+spaceau FileType python so ~/vim_local/syntax/python.vimautocmd FileType python map <buffer> <leader><space> :w!<cr>:!python %<cr>autocmd FileType python so ~/vim_local/plugin/python_fold.vim"Set some bindings up for 'compile' of pythonautocmd FileType python set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"autocmd FileType python set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m"Python iMapsau FileType python set cindentau FileType python inoremap <buffer> $r returnau FileType python inoremap <buffer> $s selfau FileType python inoremap <buffer> $c ##<cr>#<space><cr>#<esc>klaau FileType python inoremap <buffer> $i importau FileType python inoremap <buffer> $p printau FileType python inoremap <buffer> $d """<cr>"""<esc>O"Run in the Python interpreterfunction! Python_Eval_VSplit() rangelet src = tempname()let dst = tempname()execute ": " . a:firstline . "," . a:lastline . "w " . srcexecute ":!python " . src . " > " . dstexecute ":pedit! " . dstendfunctionau FileType python vmap <F7> :call Python_Eval_VSplit()<cr>""""""""""""""""""""""""""""""" => Cheetah section"""""""""""""""""""""""""""""""autocmd FileType cheetah set ft=xmlautocmd FileType cheetah set syntax=cheetah"""""""""""""""""""""""""""""""" => Vim section"""""""""""""""""""""""""""""""autocmd FileType vim set nofen"""""""""""""""""""""""""""""""" => Java section"""""""""""""""""""""""""""""""au FileType java inoremap <buffer> <C-t> System.out.println();<esc>hi"Java commentsautocmd FileType java source ~/vim_local/macros/jcommenter.vimautocmd FileType java let b:jcommenter_class_author='Amir Salihefendic (amix@amix.dk)'autocmd FileType java let b:jcommenter_file_author='Amir Salihefendic (amix@amix.dk)'autocmd FileType java map <buffer> <F2> :call JCommentWriter()<cr>"Abbr'zautocmd FileType java inoremap <buffer> $pr privateautocmd FileType java inoremap <buffer> $r returnautocmd FileType java inoremap <buffer> $pu publicautocmd FileType java inoremap <buffer> $i importautocmd FileType java inoremap <buffer> $b booleanautocmd FileType java inoremap <buffer> $v voidautocmd FileType java inoremap <buffer> $s String"Foldingfunction! JavaFold()setl foldmethod=syntaxsetl foldlevelstart=1syn region foldBraces start=/{/ end=/}/ transparent fold keepend extendsyn match foldImports /\(\n\?import.\+;\n\)\+/ transparent foldfunction! FoldText()return substitute(getline(v:foldstart), '{.*', '{...}', '')endfunctionsetl foldtext=FoldText()endfunctionau FileType java call JavaFold()au FileType java setl fenau BufEnter *.sablecc,*.scc set ft=sablecc""""""""""""""""""""""""""""""" => JavaScript section"""""""""""""""""""""""""""""""au FileType javascript so ~/vim_local/syntax/javascript.vimfunction! JavaScriptFold()setl foldmethod=syntaxsetl foldlevelstart=1syn region foldBraces start=/{/ end=/}/ transparent fold keepend extendfunction! FoldText()return substitute(getline(v:foldstart), '{.*', '{...}', '')endfunctionsetl foldtext=FoldText()endfunctionau FileType javascript call JavaScriptFold()au FileType javascript setl fenau FileType javascript imap <c-t> console.log();<esc>hiau FileType javascript imap <c-a> alert();<esc>hiau FileType javascript setl nocindentau FileType javascript inoremap <buffer> $r returnau FileType javascript inoremap <buffer> $d //<cr>//<cr>//<esc>ka<space>au FileType javascript inoremap <buffer> $c /**<cr><space><cr>**/<esc>ka""""""""""""""""""""""""""""""" => HTML"""""""""""""""""""""""""""""""au FileType html,cheetah set ft=xmlau FileType html,cheetah set syntax=html""""""""""""""""""""""""""""""" => C mappings"""""""""""""""""""""""""""""""autocmd FileType c map <buffer> <leader><space> :w<cr>:!gcc %<cr>"""""""""""""""""""""""""""""""" => SML"""""""""""""""""""""""""""""""autocmd FileType sml map <silent> <buffer> <leader><space> <leader>cd:w<cr>:!sml %<cr>""""""""""""""""""""""""""""""" => Scheme bidings""""""""""""""""""""""""""""""autocmd BufNewFile,BufRead *.scm map <buffer> <leader><space> <leader>cd:w<cr>:!petite %<cr>autocmd BufNewFile,BufRead *.scm inoremap <buffer> <C-t> (pretty-print )<esc>iautocmd BufNewFile,BufRead *.scm vnoremap <C-t> <esc>`>a)<esc>`<i(pretty-print <esc>""""""""""""""""""""""""""""""" => SVN section"""""""""""""""""""""""""""""""map <F8> :new<CR>:read !svn diff<CR>:set syntax=diff buftype=nofile<CR>gg""""""""""""""""""""""""""""""" => Snippets""""""""""""""""""""""""""""""""You can use <c-j> to goto the next <++> - it is pretty smart ;)"""""""""""""""""""""""""""""""" => Python"""""""""""""""""""""""""""""""autocmd FileType python inorea <buffer> cfun <c-r>=IMAP_PutTextWithMovement("def <++>(<++>):\n<++>\nreturn <++>")<cr>autocmd FileType python inorea <buffer> cclass <c-r>=IMAP_PutTextWithMovement("class <++>:\n<++>")<cr>autocmd FileType python inorea <buffer> cfor <c-r>=IMAP_PutTextWithMovement("for <++> in <++>:\n<++>")<cr>autocmd FileType python inorea <buffer> cif <c-r>=IMAP_PutTextWithMovement("if <++>:\n<++>")<cr>autocmd FileType python inorea <buffer> cifelse <c-r>=IMAP_PutTextWithMovement("if <++>:\n<++>\nelse:\n<++>")<cr>"""""""""""""""""""""""""""""""" => JavaScript"""""""""""""""""""""""""""""""autocmd FileType cheetah,html,javascript inorea <buffer> cfun <c-r>=IMAP_PutTextWithMovement("function <++>(<++>) {\n<++>;\nreturn <++>;\n}")<cr>autocmd filetype cheetah,html,javascript inorea <buffer> cfor <c-r>=IMAP_PutTextWithMovement("for(<++>; <++>; <++>) {\n<++>;\n}")<cr>autocmd FileType cheetah,html,javascript inorea <buffer> cif <c-r>=IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}")<cr>autocmd FileType cheetah,html,javascript inorea <buffer> cifelse <c-r>=IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}\nelse {\n<++>;\n}")<cr>"""""""""""""""""""""""""""""""" => HTML"""""""""""""""""""""""""""""""autocmd FileType cheetah,html inorea <buffer> cahref <c-r>=IMAP_PutTextWithMovement('<a href="<++>"><++></a>')<cr>autocmd FileType cheetah,html inorea <buffer> cbold <c-r>=IMAP_PutTextWithMovement('<b><++></b>')<cr>autocmd FileType cheetah,html inorea <buffer> cimg <c-r>=IMAP_PutTextWithMovement('<img src="<++>" alt="<++>" />')<cr>autocmd FileType cheetah,html inorea <buffer> cpara <c-r>=IMAP_PutTextWithMovement('<p><++></p>')<cr>autocmd FileType cheetah,html inorea <buffer> ctag <c-r>=IMAP_PutTextWithMovement('<<++>><++></<++>>')<cr>autocmd FileType cheetah,html inorea <buffer> ctag1 <c-r>=IMAP_PutTextWithMovement("<<++>><cr><++><cr></<++>>")<cr>"""""""""""""""""""""""""""""""" => Java"""""""""""""""""""""""""""""""autocmd FileType java inorea <buffer> cfun <c-r>=IMAP_PutTextWithMovement("public<++> <++>(<++>) {\n<++>;\nreturn <++>;\n}")<cr>autocmd FileType java inorea <buffer> cfunpr <c-r>=IMAP_PutTextWithMovement("private<++> <++>(<++>) {\n<++>;\nreturn <++>;\n}")<cr>autocmd FileType java inorea <buffer> cfor <c-r>=IMAP_PutTextWithMovement("for(<++>; <++>; <++>) {\n<++>;\n}")<cr>autocmd FileType java inorea <buffer> cif <c-r>=IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}")<cr>autocmd FileType java inorea <buffer> cifelse <c-r>=IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}\nelse {\n<++>;\n}")<cr>autocmd FileType java inorea <buffer> cclass <c-r>=IMAP_PutTextWithMovement("class <++> <++> {\n<++>\n}")<cr>autocmd FileType java inorea <buffer> cmain <c-r>=IMAP_PutTextWithMovement("public static void main(String[] argv) {\n<++>\n}")<cr>"Presse c-q insted of space (or other key) to complete the snippetimap <C-q> <C-]>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Cope""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""For Copemap <silent> <leader><cr> :noh<cr>"Orginal for allmap <leader>n :cn<cr>map <leader>p :cp<cr>map <leader>c :botright cw 10<cr>map <c-u> <c-l><c-j>:q<cr>:botright cw 10<cr>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => MISC""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Remove the Windows ^Mnoremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm"Paste toggle - when pasting something in, don't indent.set pastetoggle=<F3>"Remove indenting on empty linesmap <F2> :%s/\s*$//g<cr>:noh<cr>''"Super pasteinoremap <C-v> <esc>:set paste<cr>mui<C-R>+<esc>mv'uV'v=:set nopaste<cr>"A function that inserts links & anchors on a TOhtml export." Notice:" Syntax used is:" *> Link" => Anchorfunction! SmartTOHtml()TOhtmltry%s/&quot;\s\+\*&gt; \(.\+\)</" <a href="#\1" style="color: cyan">\1<\/a></g%s/&quot;\(-\|\s\)\+\*&gt; \(.\+\)</" \&nbsp;\&nbsp; <a href="#\2" style="color: cyan;">\2<\/a></g%s/&quot;\s\+=&gt; \(.\+\)</" <a name="\1" style="color: #fff">\1<\/a></gcatchendtryexe ":write!"exe ":bd"endfunction
页:
[1]