From 4b7b1fc6b00a2568967fa2e02fa5b3bfa4088a19 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 23 Sep 2014 20:16:58 +0200 Subject: [PATCH] Added hex command to vimrc --- vimrc | 590 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 370 insertions(+), 220 deletions(-) diff --git a/vimrc b/vimrc index 4824406..539f390 100644 --- a/vimrc +++ b/vimrc @@ -1,220 +1,370 @@ -set history=700 -filetype plugin on -filetype indent on -set autoread -let mapleader = "," -let g:mapleader = "," -nmap w :w! -set so=7 -set wildmenu -set wildignore=*.o,*~,*.pyc -set ruler -set cmdheight=2 -set hid -set backspace=eol,start,indent -set whichwrap+=<,>,h,l -set ignorecase -set smartcase -set hlsearch -set incsearch -set lazyredraw -set magic -set showmatch -set mat=2 -set noerrorbells -set novisualbell -set t_vb= -set tm=500 -syntax enable -colorscheme desert -set background=dark -if has("gui_running") - set guioptions-=T - set guioptions+=e - set t_Co=256 - set guitablabel=%M\ %t -endif -set encoding=utf8 -set ffs=unix,dos,mac -set nobackup -set nowb -set noswapfile -set expandtab -set smarttab -set shiftwidth=4 -set tabstop=4 -set lbr -set tw=500 -set ai "Auto indent -set si "Smart indent -set wrap "Wrap lines -vnoremap * :call VisualSelection('f') -vnoremap # :call VisualSelection('b') -map j gj -map k gk -map / -map ? -map :noh -map j -map k -map h -map l -map bd :Bclose -map ba :1,1000 bd! -map tn :tabnew -map to :tabonly -map tc :tabclose -map tm :tabmove -map te :tabedit =expand("%:p:h")/ -map cd :cd %:p:h:pwd -try - set switchbuf=useopen,usetab,newtab - set stal=2 -catch -endtry -autocmd BufReadPost * - \ if line("'\"") > 0 && line("'\"") <= line("$") | - \ exe "normal! g`\"" | - \ endif -set viminfo^=% -set laststatus=2 -set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l/%L\ \ Column:\ %c -map 0 ^ -nmap mz:m+`z -nmap mz:m-2`z -vmap :m'>+`mzgv`yo`z -vmap :m'<-2`>my` - nmap - vmap - vmap -endif -func! DeleteTrailingWS() - exe "normal mz" - %s/\s\+$//ge - exe "normal `z" -endfunc -autocmd BufWrite *.py :call DeleteTrailingWS() -autocmd BufWrite *.coffee :call DeleteTrailingWS() -vnoremap gv :call VisualSelection('gv') -map g :vimgrep // **/*. -map :vimgrep // % -vnoremap r :call VisualSelection('replace') -map cc :botright cope -map co ggVGy:tabnew:set syntax=qfpgg -map n :cn -map p :cp -map ss :setlocal spell! -map sn ]s -map sp [s -map sa zg -map s? z= -noremap m mmHmt:%s///ge'tzt'm -map q :e ~/buffer -map pp :setlocal paste! -function! CmdLine(str) - exe "menu Foo.Bar :" . a:str - emenu Foo.Bar - unmenu Foo -endfunction -function! VisualSelection(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 == 'replace' - call CmdLine("%s" . '/'. l:pattern . '/') - elseif a:direction == 'f' - execute "normal /" . l:pattern . "^M" - endif - - let @/ = l:pattern - let @" = l:saved_reg -endfunction -function! HasPaste() - if &paste - return 'PASTE MODE ' - en - return '' -endfunction -command! Bclose call BufcloseCloseIt() -function! 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) - endif -endfunction -" Commenting blocks of code. -autocmd FileType c,cpp,java,scala,javascript let b:comment_leader = '// ' -autocmd FileType sh,ruby,python let b:comment_leader = '# ' -autocmd FileType conf,fstab let b:comment_leader = '# ' -autocmd FileType tex let b:comment_leader = '% ' -autocmd FileType vim let b:comment_leader = '" ' -noremap cc :s/^/=escape(b:comment_leader,'\/')/:nohlsearch -noremap cu :s/^\V=escape(b:comment_leader,'\/')//e:nohlsearch -vnoremap cc :s/^/=escape(b:comment_leader,'\/')/:nohlsearch -vnoremap cu :s/^\V=escape(b:comment_leader,'\/')//e:nohlsearch - -highlight ColorColumn ctermbg=magenta -call matchadd('ColorColumn', '\%80v', 100) - -nnoremap n n:call HLNext(0.4) -nnoremap N N:call HLNext(0.4) - -highlight WhiteOnRed ctermbg=red ctermfg=white - -function! HLNext(blinktime) - let [bufnum, lnum, col, off] = getpos('.') - let machlen = strlen(matchstr(strpart(getline('.'), col-1),@/)) - let target_pat = '\c\%#'.@/ - let blinks = 3 - for n in range(1, blinks) - let red = matchadd('WhiteOnRed', target_pat, 101) - redraw - exec 'sleep ' . float2nr(a:blinktime / (2*blinks) * 1000) . 'm' - call matchdelete(red) - redraw - exec 'sleep ' . float2nr(a:blinktime / (2*blinks) * 1000) . 'm' - endfor -endfunction - -" VimScript Highlighting is so fucking distracting -augroup VimNoHighlight - autocmd! - autocmd BufEnter .vimrc syntax off -augroup END - -augroup NoEdits - autocmd! - autocmd SwapExists * let v:swapchoice = 'o' - autocmd SwapExists * echomsg ErrorMsg - autocmd SwapExists * echo 'Duplicate edit session (you are now editing readonly)' - autocmd SwapExists * echohl None -augroup END - -inoremap ShowDigraphs - -function! ShowDigraphs() - digraphs - call getchar() - return "\" -endfunction +0000000: 7365 7420 6869 7374 6f72 793d 3730 300a set history=700. +0000010: 6669 6c65 7479 7065 2070 6c75 6769 6e20 filetype plugin +0000020: 6f6e 0a66 696c 6574 7970 6520 696e 6465 on.filetype inde +0000030: 6e74 206f 6e0a 7365 7420 6175 746f 7265 nt on.set autore +0000040: 6164 0a6c 6574 206d 6170 6c65 6164 6572 ad.let mapleader +0000050: 203d 2022 2c22 0a6c 6574 2067 3a6d 6170 = ",".let g:map +0000060: 6c65 6164 6572 203d 2022 2c22 0a6e 6d61 leader = ",".nma +0000070: 7020 3c6c 6561 6465 723e 7720 3a77 213c p w :w!< +0000080: 6372 3e0a 7365 7420 736f 3d37 0a73 6574 cr>.set so=7.set +0000090: 2077 696c 646d 656e 750a 7365 7420 7769 wildmenu.set wi +00000a0: 6c64 6967 6e6f 7265 3d2a 2e6f 2c2a 7e2c ldignore=*.o,*~, +00000b0: 2a2e 7079 630a 7365 7420 7275 6c65 720a *.pyc.set ruler. +00000c0: 7365 7420 636d 6468 6569 6768 743d 320a set cmdheight=2. +00000d0: 7365 7420 6869 640a 7365 7420 6261 636b set hid.set back +00000e0: 7370 6163 653d 656f 6c2c 7374 6172 742c space=eol,start, +00000f0: 696e 6465 6e74 0a73 6574 2077 6869 6368 indent.set which +0000100: 7772 6170 2b3d 3c2c 3e2c 682c 6c0a 7365 wrap+=<,>,h,l.se +0000110: 7420 6967 6e6f 7265 6361 7365 0a73 6574 t ignorecase.set +0000120: 2073 6d61 7274 6361 7365 0a73 6574 2068 smartcase.set h +0000130: 6c73 6561 7263 680a 7365 7420 696e 6373 lsearch.set incs +0000140: 6561 7263 680a 7365 7420 6c61 7a79 7265 earch.set lazyre +0000150: 6472 6177 0a73 6574 206d 6167 6963 0a73 draw.set magic.s +0000160: 6574 2073 686f 776d 6174 6368 0a73 6574 et showmatch.set +0000170: 206d 6174 3d32 0a73 6574 206e 6f65 7272 mat=2.set noerr +0000180: 6f72 6265 6c6c 730a 7365 7420 6e6f 7669 orbells.set novi +0000190: 7375 616c 6265 6c6c 0a73 6574 2074 5f76 sualbell.set t_v +00001a0: 623d 0a73 6574 2074 6d3d 3530 300a 7379 b=.set tm=500.sy +00001b0: 6e74 6178 2065 6e61 626c 650a 636f 6c6f ntax enable.colo +00001c0: 7273 6368 656d 6520 6465 7365 7274 0a73 rscheme desert.s +00001d0: 6574 2062 6163 6b67 726f 756e 643d 6461 et background=da +00001e0: 726b 0a69 6620 6861 7328 2267 7569 5f72 rk.if has("gui_r +00001f0: 756e 6e69 6e67 2229 0a20 2020 2073 6574 unning"). set +0000200: 2067 7569 6f70 7469 6f6e 732d 3d54 0a20 guioptions-=T. +0000210: 2020 2073 6574 2067 7569 6f70 7469 6f6e set guioption +0000220: 732b 3d65 0a20 2020 2073 6574 2074 5f43 s+=e. set t_C +0000230: 6f3d 3235 360a 2020 2020 7365 7420 6775 o=256. set gu +0000240: 6974 6162 6c61 6265 6c3d 254d 5c20 2574 itablabel=%M\ %t +0000250: 0a65 6e64 6966 0a73 6574 2065 6e63 6f64 .endif.set encod +0000260: 696e 673d 7574 6638 0a73 6574 2066 6673 ing=utf8.set ffs +0000270: 3d75 6e69 782c 646f 732c 6d61 630a 7365 =unix,dos,mac.se +0000280: 7420 6e6f 6261 636b 7570 0a73 6574 206e t nobackup.set n +0000290: 6f77 620a 7365 7420 6e6f 7377 6170 6669 owb.set noswapfi +00002a0: 6c65 0a73 6574 2065 7870 616e 6474 6162 le.set expandtab +00002b0: 0a73 6574 2073 6d61 7274 7461 620a 7365 .set smarttab.se +00002c0: 7420 7368 6966 7477 6964 7468 3d34 0a73 t shiftwidth=4.s +00002d0: 6574 2074 6162 7374 6f70 3d34 0a73 6574 et tabstop=4.set +00002e0: 206c 6272 0a73 6574 2074 773d 3530 300a lbr.set tw=500. +00002f0: 7365 7420 6169 2022 4175 746f 2069 6e64 set ai "Auto ind +0000300: 656e 740a 7365 7420 7369 2022 536d 6172 ent.set si "Smar +0000310: 7420 696e 6465 6e74 0a73 6574 2077 7261 t indent.set wra +0000320: 7020 2257 7261 7020 6c69 6e65 730a 766e p "Wrap lines.vn +0000330: 6f72 656d 6170 203c 7369 6c65 6e74 3e20 oremap +0000340: 2a20 3a63 616c 6c20 5669 7375 616c 5365 * :call VisualSe +0000350: 6c65 6374 696f 6e28 2766 2729 3c43 523e lection('f') +0000360: 0a76 6e6f 7265 6d61 7020 3c73 696c 656e .vnoremap # :call Visua +0000380: 6c53 656c 6563 7469 6f6e 2827 6227 293c lSelection('b')< +0000390: 4352 3e0a 6d61 7020 6a20 676a 0a6d 6170 CR>.map j gj.map +00003a0: 206b 2067 6b0a 6d61 7020 3c73 7061 6365 k gk.map /.map ?.map +00003d0: 203c 6c65 6164 6572 3e3c 6372 3e20 3a6e :n +00003e0: 6f68 3c63 723e 0a6d 6170 203c 432d 6a3e oh.map +00003f0: 203c 432d 573e 6a0a 6d61 7020 3c43 2d6b j.map k.map h.map l.map < +0000430: 6c65 6164 6572 3e62 6420 3a42 636c 6f73 leader>bd :Bclos +0000440: 653c 6372 3e0a 6d61 7020 3c6c 6561 6465 e.map ba :1,1000 bd! +0000460: 3c63 723e 0a6d 6170 203c 6c65 6164 6572 .map tn :tabnew. +0000480: 6d61 7020 3c6c 6561 6465 723e 746f 203a map to : +0000490: 7461 626f 6e6c 793c 6372 3e0a 6d61 7020 tabonly.map +00004a0: 3c6c 6561 6465 723e 7463 203a 7461 6263 tc :tabc +00004b0: 6c6f 7365 3c63 723e 0a6d 6170 203c 6c65 lose.map tm :tabmove +00004d0: 0a6d 6170 203c 6c65 6164 6572 3e74 6520 .map te +00004e0: 3a74 6162 6564 6974 203c 632d 723e 3d65 :tabedit =e +00004f0: 7870 616e 6428 2225 3a70 3a68 2229 3c63 xpand("%:p:h")/.map +0000510: 6364 203a 6364 2025 3a70 3a68 3c63 723e cd :cd %:p:h +0000520: 3a70 7764 3c63 723e 0a74 7279 0a20 2073 :pwd.try. s +0000530: 6574 2073 7769 7463 6862 7566 3d75 7365 et switchbuf=use +0000540: 6f70 656e 2c75 7365 7461 622c 6e65 7774 open,usetab,newt +0000550: 6162 0a20 2073 6574 2073 7461 6c3d 320a ab. set stal=2. +0000560: 6361 7463 680a 656e 6474 7279 0a61 7574 catch.endtry.aut +0000570: 6f63 6d64 2042 7566 5265 6164 506f 7374 ocmd BufReadPost +0000580: 202a 0a20 2020 2020 5c20 6966 206c 696e *. \ if lin +0000590: 6528 2227 5c22 2229 203e 2030 2026 2620 e("'\"") > 0 && +00005a0: 6c69 6e65 2822 275c 2222 2920 3c3d 206c line("'\"") <= l +00005b0: 696e 6528 2224 2229 207c 0a20 2020 2020 ine("$") |. +00005c0: 5c20 2020 6578 6520 226e 6f72 6d61 6c21 \ exe "normal! +00005d0: 2067 605c 2222 207c 0a20 2020 2020 5c20 g`\"" |. \ +00005e0: 656e 6469 660a 7365 7420 7669 6d69 6e66 endif.set viminf +00005f0: 6f5e 3d25 0a73 6574 206c 6173 7473 7461 o^=%.set laststa +0000600: 7475 733d 320a 7365 7420 7374 6174 7573 tus=2.set status +0000610: 6c69 6e65 3d5c 2025 7b48 6173 5061 7374 line=\ %{HasPast +0000620: 6528 297d 2546 256d 2572 2568 5c20 2577 e()}%F%m%r%h\ %w +0000630: 5c20 5c20 4357 443a 5c20 2572 257b 6765 \ \ CWD:\ %r%{ge +0000640: 7463 7764 2829 7d25 685c 205c 205c 204c tcwd()}%h\ \ \ L +0000650: 696e 653a 5c20 256c 2f25 4c5c 205c 2043 ine:\ %l/%L\ \ C +0000660: 6f6c 756d 6e3a 5c20 2563 0a6d 6170 2030 olumn:\ %c.map 0 +0000670: 205e 0a6e 6d61 7020 3c4d 2d6a 3e20 6d7a ^.nmap mz +0000680: 3a6d 2b3c 6372 3e60 7a0a 6e6d 6170 203c :m+`z.nmap < +0000690: 4d2d 6b3e 206d 7a3a 6d2d 323c 6372 3e60 M-k> mz:m-2` +00006a0: 7a0a 766d 6170 203c 4d2d 6a3e 203a 6d27 z.vmap :m' +00006b0: 3e2b 3c63 723e 603c 6d79 603e 6d7a 6776 >+`mzgv +00006c0: 6079 6f60 7a0a 766d 6170 203c 4d2d 6b3e `yo`z.vmap +00006d0: 203a 6d27 3c2d 323c 6372 3e60 3e6d 7960 :m'<-2`>my` +00006e0: 3c6d 7a67 7660 796f 607a 0a69 6620 6861 . +0000720: 6e6d 6170 203c 442d 6b3e 203c 4d2d 6b3e nmap +0000730: 0a20 2076 6d61 7020 3c44 2d6a 3e20 3c4d . vmap . vmap +0000750: 203c 4d2d 6b3e 0a65 6e64 6966 0a66 756e .endif.fun +0000760: 6321 2044 656c 6574 6554 7261 696c 696e c! DeleteTrailin +0000770: 6757 5328 290a 2020 6578 6520 226e 6f72 gWS(). exe "nor +0000780: 6d61 6c20 6d7a 220a 2020 2573 2f5c 735c mal mz". %s/\s\ +0000790: 2b24 2f2f 6765 0a20 2065 7865 2022 6e6f +$//ge. exe "no +00007a0: 726d 616c 2060 7a22 0a65 6e64 6675 6e63 rmal `z".endfunc +00007b0: 0a61 7574 6f63 6d64 2042 7566 5772 6974 .autocmd BufWrit +00007c0: 6520 2a2e 7079 203a 6361 6c6c 2044 656c e *.py :call Del +00007d0: 6574 6554 7261 696c 696e 6757 5328 290a eteTrailingWS(). +00007e0: 6175 746f 636d 6420 4275 6657 7269 7465 autocmd BufWrite +00007f0: 202a 2e63 6f66 6665 6520 3a63 616c 6c20 *.coffee :call +0000800: 4465 6c65 7465 5472 6169 6c69 6e67 5753 DeleteTrailingWS +0000810: 2829 0a76 6e6f 7265 6d61 7020 3c73 696c ().vnoremap gv :call Vi +0000830: 7375 616c 5365 6c65 6374 696f 6e28 2767 sualSelection('g +0000840: 7627 293c 4352 3e0a 636e 6f72 6561 6262 v').cnoreabb +0000850: 7265 7620 6865 7820 2521 7878 640a 6d61 rev hex %!xxd.ma +0000860: 7020 3c6c 6561 6465 723e 6720 3a76 696d p g :vim +0000870: 6772 6570 202f 2f20 2a2a 2f2a 2e3c 6c65 grep // **/*.< +0000890: 6c65 6674 3e3c 6c65 6674 3e3c 6c65 6674 left>.map :vim +00008c0: 6772 6570 202f 2f20 3c43 2d52 3e25 3c43 grep // %< +00008f0: 7269 6768 743e 3c72 6967 6874 3e3c 7269 right>.vnoremap r : +0000930: 6361 6c6c 2056 6973 7561 6c53 656c 6563 call VisualSelec +0000940: 7469 6f6e 2827 7265 706c 6163 6527 293c tion('replace')< +0000950: 4352 3e0a 6d61 7020 3c6c 6561 6465 723e CR>.map +0000960: 6363 203a 626f 7472 6967 6874 2063 6f70 cc :botright cop +0000970: 653c 6372 3e0a 6d61 7020 3c6c 6561 6465 e.map co ggVGy:tabne +0000990: 773c 6372 3e3a 7365 7420 7379 6e74 6178 w:set syntax +00009a0: 3d71 663c 6372 3e70 6767 0a6d 6170 203c =qfpgg.map < +00009b0: 6c65 6164 6572 3e6e 203a 636e 3c63 723e leader>n :cn +00009c0: 0a6d 6170 203c 6c65 6164 6572 3e70 203a .map p : +00009d0: 6370 3c63 723e 0a6d 6170 203c 6c65 6164 cp.map ss :setlocal +00009f0: 7370 656c 6c21 3c63 723e 0a6d 6170 203c spell!.map < +0000a00: 6c65 6164 6572 3e73 6e20 5d73 0a6d 6170 leader>sn ]s.map +0000a10: 203c 6c65 6164 6572 3e73 7020 5b73 0a6d sp [s.m +0000a20: 6170 203c 6c65 6164 6572 3e73 6120 7a67 ap sa zg +0000a30: 0a6d 6170 203c 6c65 6164 6572 3e73 3f20 .map s? +0000a40: 7a3d 0a6e 6f72 656d 6170 203c 4c65 6164 z=.noremap m mmHmt:%s///ge' +0000a70: 747a 7427 6d0a 6d61 7020 3c6c 6561 6465 tzt'm.map q :e ~/buffer< +0000a90: 6372 3e0a 6d61 7020 3c6c 6561 6465 723e cr>.map +0000aa0: 7070 203a 7365 746c 6f63 616c 2070 6173 pp :setlocal pas +0000ab0: 7465 213c 6372 3e0a 6675 6e63 7469 6f6e te!.function +0000ac0: 2120 436d 644c 696e 6528 7374 7229 0a20 ! CmdLine(str). +0000ad0: 2020 2065 7865 2022 6d65 6e75 2046 6f6f exe "menu Foo +0000ae0: 2e42 6172 203a 2220 2e20 613a 7374 720a .Bar :" . a:str. +0000af0: 2020 2020 656d 656e 7520 466f 6f2e 4261 emenu Foo.Ba +0000b00: 720a 2020 2020 756e 6d65 6e75 2046 6f6f r. unmenu Foo +0000b10: 0a65 6e64 6675 6e63 7469 6f6e 0a66 756e .endfunction.fun +0000b20: 6374 696f 6e21 2056 6973 7561 6c53 656c ction! VisualSel +0000b30: 6563 7469 6f6e 2864 6972 6563 7469 6f6e ection(direction +0000b40: 2920 7261 6e67 650a 2020 2020 6c65 7420 ) range. let +0000b50: 6c3a 7361 7665 645f 7265 6720 3d20 4022 l:saved_reg = @" +0000b60: 0a20 2020 2065 7865 6375 7465 2022 6e6f . execute "no +0000b70: 726d 616c 2120 7667 7679 220a 0a20 2020 rmal! vgvy".. +0000b80: 206c 6574 206c 3a70 6174 7465 726e 203d let l:pattern = +0000b90: 2065 7363 6170 6528 4022 2c20 275c 5c2f escape(@", '\\/ +0000ba0: 2e2a 245e 7e5b 5d27 290a 2020 2020 6c65 .*$^~[]'). le +0000bb0: 7420 6c3a 7061 7474 6572 6e20 3d20 7375 t l:pattern = su +0000bc0: 6273 7469 7475 7465 286c 3a70 6174 7465 bstitute(l:patte +0000bd0: 726e 2c20 225c 6e24 222c 2022 222c 2022 rn, "\n$", "", " +0000be0: 2229 0a0a 2020 2020 6966 2061 3a64 6972 ").. if a:dir +0000bf0: 6563 7469 6f6e 203d 3d20 2762 270a 2020 ection == 'b'. +0000c00: 2020 2020 2020 6578 6563 7574 6520 226e execute "n +0000c10: 6f72 6d61 6c20 3f22 202e 206c 3a70 6174 ormal ?" . l:pat +0000c20: 7465 726e 202e 2022 5e4d 220a 2020 2020 tern . "^M". +0000c30: 656c 7365 6966 2061 3a64 6972 6563 7469 elseif a:directi +0000c40: 6f6e 203d 3d20 2767 7627 0a20 2020 2020 on == 'gv'. +0000c50: 2020 2063 616c 6c20 436d 644c 696e 6528 call CmdLine( +0000c60: 2276 696d 6772 6570 2022 202e 2027 2f27 "vimgrep " . '/' +0000c70: 2e20 6c3a 7061 7474 6572 6e20 2e20 272f . l:pattern . '/ +0000c80: 2720 2e20 2720 2a2a 2f2a 2e27 290a 2020 ' . ' **/*.'). +0000c90: 2020 656c 7365 6966 2061 3a64 6972 6563 elseif a:direc +0000ca0: 7469 6f6e 203d 3d20 2772 6570 6c61 6365 tion == 'replace +0000cb0: 270a 2020 2020 2020 2020 6361 6c6c 2043 '. call C +0000cc0: 6d64 4c69 6e65 2822 2573 2220 2e20 272f mdLine("%s" . '/ +0000cd0: 272e 206c 3a70 6174 7465 726e 202e 2027 '. l:pattern . ' +0000ce0: 2f27 290a 2020 2020 656c 7365 6966 2061 /'). elseif a +0000cf0: 3a64 6972 6563 7469 6f6e 203d 3d20 2766 :direction == 'f +0000d00: 270a 2020 2020 2020 2020 6578 6563 7574 '. execut +0000d10: 6520 226e 6f72 6d61 6c20 2f22 202e 206c e "normal /" . l +0000d20: 3a70 6174 7465 726e 202e 2022 5e4d 220a :pattern . "^M". +0000d30: 2020 2020 656e 6469 660a 0a20 2020 206c endif.. l +0000d40: 6574 2040 2f20 3d20 6c3a 7061 7474 6572 et @/ = l:patter +0000d50: 6e0a 2020 2020 6c65 7420 4022 203d 206c n. let @" = l +0000d60: 3a73 6176 6564 5f72 6567 0a65 6e64 6675 :saved_reg.endfu +0000d70: 6e63 7469 6f6e 0a66 756e 6374 696f 6e21 nction.function! +0000d80: 2048 6173 5061 7374 6528 290a 2020 2020 HasPaste(). +0000d90: 6966 2026 7061 7374 650a 2020 2020 2020 if &paste. +0000da0: 2020 7265 7475 726e 2027 5041 5354 4520 return 'PASTE +0000db0: 4d4f 4445 2020 270a 2020 2020 656e 0a20 MODE '. en. +0000dc0: 2020 2072 6574 7572 6e20 2727 0a65 6e64 return ''.end +0000dd0: 6675 6e63 7469 6f6e 0a63 6f6d 6d61 6e64 function.command +0000de0: 2120 4263 6c6f 7365 2063 616c 6c20 3c53 ! Bclose call BufcloseClose +0000e00: 4974 2829 0a66 756e 6374 696f 6e21 203c It().function! < +0000e10: 5349 443e 4275 6663 6c6f 7365 436c 6f73 SID>BufcloseClos +0000e20: 6549 7428 290a 2020 206c 6574 206c 3a63 eIt(). let l:c +0000e30: 7572 7265 6e74 4275 664e 756d 203d 2062 urrentBufNum = b +0000e40: 7566 6e72 2822 2522 290a 2020 206c 6574 ufnr("%"). let +0000e50: 206c 3a61 6c74 6572 6e61 7465 4275 664e l:alternateBufN +0000e60: 756d 203d 2062 7566 6e72 2822 2322 290a um = bufnr("#"). +0000e70: 0a20 2020 6966 2062 7566 6c69 7374 6564 . if buflisted +0000e80: 286c 3a61 6c74 6572 6e61 7465 4275 664e (l:alternateBufN +0000e90: 756d 290a 2020 2020 2062 7566 6665 7220 um). buffer +0000ea0: 230a 2020 2065 6c73 650a 2020 2020 2062 #. else. b +0000eb0: 6e65 7874 0a20 2020 656e 6469 660a 0a20 next. endif.. +0000ec0: 2020 6966 2062 7566 6e72 2822 2522 2920 if bufnr("%") +0000ed0: 3d3d 206c 3a63 7572 7265 6e74 4275 664e == l:currentBufN +0000ee0: 756d 0a20 2020 2020 6e65 770a 2020 2065 um. new. e +0000ef0: 6e64 6966 0a0a 2020 2069 6620 6275 666c ndif.. if bufl +0000f00: 6973 7465 6428 6c3a 6375 7272 656e 7442 isted(l:currentB +0000f10: 7566 4e75 6d29 0a20 2020 2020 6578 6563 ufNum). exec +0000f20: 7574 6528 2262 6465 6c65 7465 2120 222e ute("bdelete! ". +0000f30: 6c3a 6375 7272 656e 7442 7566 4e75 6d29 l:currentBufNum) +0000f40: 0a20 2020 656e 6469 660a 656e 6466 756e . endif.endfun +0000f50: 6374 696f 6e0a 2220 436f 6d6d 656e 7469 ction." Commenti +0000f60: 6e67 2062 6c6f 636b 7320 6f66 2063 6f64 ng blocks of cod +0000f70: 652e 0a61 7574 6f63 6d64 2046 696c 6554 e..autocmd FileT +0000f80: 7970 6520 632c 6370 702c 6a61 7661 2c73 ype c,cpp,java,s +0000f90: 6361 6c61 2c6a 6176 6173 6372 6970 7420 cala,javascript +0000fa0: 6c65 7420 623a 636f 6d6d 656e 745f 6c65 let b:comment_le +0000fb0: 6164 6572 203d 2027 2f2f 2027 0a61 7574 ader = '// '.aut +0000fc0: 6f63 6d64 2046 696c 6554 7970 6520 7368 ocmd FileType sh +0000fd0: 2c72 7562 792c 7079 7468 6f6e 2020 206c ,ruby,python l +0000fe0: 6574 2062 3a63 6f6d 6d65 6e74 5f6c 6561 et b:comment_lea +0000ff0: 6465 7220 3d20 2723 2027 0a61 7574 6f63 der = '# '.autoc +0001000: 6d64 2046 696c 6554 7970 6520 636f 6e66 md FileType conf +0001010: 2c66 7374 6162 2020 2020 2020 206c 6574 ,fstab let +0001020: 2062 3a63 6f6d 6d65 6e74 5f6c 6561 6465 b:comment_leade +0001030: 7220 3d20 2723 2027 0a61 7574 6f63 6d64 r = '# '.autocmd +0001040: 2046 696c 6554 7970 6520 7465 7820 2020 FileType tex +0001050: 2020 2020 2020 2020 2020 206c 6574 2062 let b +0001060: 3a63 6f6d 6d65 6e74 5f6c 6561 6465 7220 :comment_leader +0001070: 3d20 2725 2027 0a61 7574 6f63 6d64 2046 = '% '.autocmd F +0001080: 696c 6554 7970 6520 7669 6d20 2020 2020 ileType vim +0001090: 2020 2020 2020 2020 206c 6574 2062 3a63 let b:c +00010a0: 6f6d 6d65 6e74 5f6c 6561 6465 7220 3d20 omment_leader = +00010b0: 2722 2027 0a6e 6f72 656d 6170 203c 6c65 '" '.noremap cc :s/^/=esc +00010e0: 6170 6528 623a 636f 6d6d 656e 745f 6c65 ape(b:comment_le +00010f0: 6164 6572 2c27 5c2f 2729 3c43 523e 2f3c ader,'\/')/< +0001100: 4352 3e3a 6e6f 686c 7365 6172 6368 3c43 CR>:nohlsearch.noremap cu :s/^\V=esca +0001140: 7065 2862 3a63 6f6d 6d65 6e74 5f6c 6561 pe(b:comment_lea +0001150: 6465 722c 275c 2f27 293c 4352 3e2f 2f65 der,'\/')//e +0001160: 3c43 523e 3a6e 6f68 6c73 6561 7263 683c :nohlsearch< +0001170: 4352 3e0a 766e 6f72 656d 6170 203c 6c65 CR>.vnoremap cc :s/^/=esc +00011a0: 6170 6528 623a 636f 6d6d 656e 745f 6c65 ape(b:comment_le +00011b0: 6164 6572 2c27 5c2f 2729 3c43 523e 2f3c ader,'\/')/< +00011c0: 4352 3e3a 6e6f 686c 7365 6172 6368 3c43 CR>:nohlsearch.vnoremap cu :s/^\V=esc +0001200: 6170 6528 623a 636f 6d6d 656e 745f 6c65 ape(b:comment_le +0001210: 6164 6572 2c27 5c2f 2729 3c43 523e 2f2f ader,'\/')// +0001220: 653c 4352 3e3a 6e6f 686c 7365 6172 6368 e:nohlsearch +0001230: 3c43 523e 0a0a 6869 6768 6c69 6768 7420 ..highlight +0001240: 436f 6c6f 7243 6f6c 756d 6e20 6374 6572 ColorColumn cter +0001250: 6d62 673d 6d61 6765 6e74 610a 6361 6c6c mbg=magenta.call +0001260: 206d 6174 6368 6164 6428 2743 6f6c 6f72 matchadd('Color +0001270: 436f 6c75 6d6e 272c 2027 5c25 3830 7627 Column', '\%80v' +0001280: 2c20 3130 3029 0a0a 6e6e 6f72 656d 6170 , 100)..nnoremap +0001290: 203c 7369 6c65 6e74 3e20 6e20 6e3a 6361 n n:ca +00012a0: 6c6c 2048 4c4e 6578 7428 302e 3429 3c63 ll HLNext(0.4).nnoremap N N:call HL +00012d0: 4e65 7874 2830 2e34 293c 6372 3e0a 0a68 Next(0.4)..h +00012e0: 6967 686c 6967 6874 2057 6869 7465 4f6e ighlight WhiteOn +00012f0: 5265 6420 6374 6572 6d62 673d 7265 6420 Red ctermbg=red +0001300: 6374 6572 6d66 673d 7768 6974 650a 0a66 ctermfg=white..f +0001310: 756e 6374 696f 6e21 2048 4c4e 6578 7428 unction! HLNext( +0001320: 626c 696e 6b74 696d 6529 0a20 2020 206c blinktime). l +0001330: 6574 205b 6275 666e 756d 2c20 6c6e 756d et [bufnum, lnum +0001340: 2c20 636f 6c2c 206f 6666 5d20 3d20 6765 , col, off] = ge +0001350: 7470 6f73 2827 2e27 290a 2020 2020 6c65 tpos('.'). le +0001360: 7420 6d61 6368 6c65 6e20 3d20 7374 726c t machlen = strl +0001370: 656e 286d 6174 6368 7374 7228 7374 7270 en(matchstr(strp +0001380: 6172 7428 6765 746c 696e 6528 272e 2729 art(getline('.') +0001390: 2c20 636f 6c2d 3129 2c40 2f29 290a 2020 , col-1),@/)). +00013a0: 2020 6c65 7420 7461 7267 6574 5f70 6174 let target_pat +00013b0: 203d 2027 5c63 5c25 2327 2e40 2f0a 2020 = '\c\%#'.@/. +00013c0: 2020 6c65 7420 626c 696e 6b73 203d 2033 let blinks = 3 +00013d0: 0a20 2020 2066 6f72 206e 2069 6e20 7261 . for n in ra +00013e0: 6e67 6528 312c 2062 6c69 6e6b 7329 0a20 nge(1, blinks). +00013f0: 2020 2020 2020 206c 6574 2072 6564 203d let red = +0001400: 206d 6174 6368 6164 6428 2757 6869 7465 matchadd('White +0001410: 4f6e 5265 6427 2c20 7461 7267 6574 5f70 OnRed', target_p +0001420: 6174 2c20 3130 3129 0a20 2020 2020 2020 at, 101). +0001430: 2072 6564 7261 770a 2020 2020 2020 2020 redraw. +0001440: 6578 6563 2027 736c 6565 7020 2720 2e20 exec 'sleep ' . +0001450: 666c 6f61 7432 6e72 2861 3a62 6c69 6e6b float2nr(a:blink +0001460: 7469 6d65 202f 2028 322a 626c 696e 6b73 time / (2*blinks +0001470: 2920 2a20 3130 3030 2920 2e20 276d 270a ) * 1000) . 'm'. +0001480: 2020 2020 2020 2020 6361 6c6c 206d 6174 call mat +0001490: 6368 6465 6c65 7465 2872 6564 290a 2020 chdelete(red). +00014a0: 2020 2020 2020 7265 6472 6177 0a20 2020 redraw. +00014b0: 2020 2020 2065 7865 6320 2773 6c65 6570 exec 'sleep +00014c0: 2027 202e 2066 6c6f 6174 326e 7228 613a ' . float2nr(a: +00014d0: 626c 696e 6b74 696d 6520 2f20 2832 2a62 blinktime / (2*b +00014e0: 6c69 6e6b 7329 202a 2031 3030 3029 202e links) * 1000) . +00014f0: 2027 6d27 0a20 2020 2065 6e64 666f 720a 'm'. endfor. +0001500: 656e 6466 756e 6374 696f 6e0a 0a22 2056 endfunction.." V +0001510: 696d 5363 7269 7074 2048 6967 686c 6967 imScript Highlig +0001520: 6874 696e 6720 6973 2073 6f20 6675 636b hting is so fuck +0001530: 696e 6720 6469 7374 7261 6374 696e 670a ing distracting. +0001540: 6175 6772 6f75 7020 5669 6d4e 6f48 6967 augroup VimNoHig +0001550: 686c 6967 6874 0a20 2020 2061 7574 6f63 hlight. autoc +0001560: 6d64 210a 2020 2020 6175 746f 636d 6420 md!. autocmd +0001570: 4275 6645 6e74 6572 202e 7669 6d72 6320 BufEnter .vimrc +0001580: 7379 6e74 6178 206f 6666 0a61 7567 726f syntax off.augro +0001590: 7570 2045 4e44 0a0a 6175 6772 6f75 7020 up END..augroup +00015a0: 4e6f 4564 6974 730a 2020 2020 6175 746f NoEdits. auto +00015b0: 636d 6421 0a20 2020 2061 7574 6f63 6d64 cmd!. autocmd +00015c0: 2053 7761 7045 7869 7374 7320 2a20 6c65 SwapExists * le +00015d0: 7420 763a 7377 6170 6368 6f69 6365 203d t v:swapchoice = +00015e0: 2027 6f27 0a20 2020 2061 7574 6f63 6d64 'o'. autocmd +00015f0: 2053 7761 7045 7869 7374 7320 2a20 6563 SwapExists * ec +0001600: 686f 6d73 6720 4572 726f 724d 7367 0a20 homsg ErrorMsg. +0001610: 2020 2061 7574 6f63 6d64 2053 7761 7045 autocmd SwapE +0001620: 7869 7374 7320 2a20 6563 686f 2027 4475 xists * echo 'Du +0001630: 706c 6963 6174 6520 6564 6974 2073 6573 plicate edit ses +0001640: 7369 6f6e 2028 796f 7520 6172 6520 6e6f sion (you are no +0001650: 7720 6564 6974 696e 6720 7265 6164 6f6e w editing readon +0001660: 6c79 2927 0a20 2020 2061 7574 6f63 6d64 ly)'. autocmd +0001670: 2053 7761 7045 7869 7374 7320 2a20 6563 SwapExists * ec +0001680: 686f 686c 204e 6f6e 650a 6175 6772 6f75 hohl None.augrou +0001690: 7020 454e 440a 0a69 6e6f 7265 6d61 7020 p END..inoremap +00016a0: 3c65 7870 723e 203c 432d 4b3e 2053 686f Sho +00016b0: 7744 6967 7261 7068 730a 0a66 756e 6374 wDigraphs..funct +00016c0: 696f 6e21 2053 686f 7744 6967 7261 7068 ion! ShowDigraph +00016d0: 7328 290a 2020 2020 6469 6772 6170 6873 s(). digraphs +00016e0: 0a20 2020 2063 616c 6c20 6765 7463 6861 . call getcha +00016f0: 7228 290a 2020 2020 7265 7475 726e 2022 r(). return " +0001700: 5c3c 432d 4b3e 220a 656e 6466 756e 6374 \".endfunct +0001710: 696f 6e0a ion.