diff options
Diffstat (limited to 'Editor/vim')
-rw-r--r-- | Editor/vim/boxdraw/bdua2b.pl | 91 | ||||
-rw-r--r-- | Editor/vim/boxdraw/bdub2a.pl | 30 | ||||
-rw-r--r-- | Editor/vim/boxdraw/boxdraw.txt | 164 | ||||
-rw-r--r-- | Editor/vim/boxdraw/boxdraw.vim | 291 | ||||
-rw-r--r-- | Editor/vim/boxdraw/outline.pl | 74 | ||||
-rw-r--r-- | Editor/vim/boxdraw/sampler.txt | 13 | ||||
m--------- | Editor/vim/bundle/Vundle.vim | 0 | ||||
m--------- | Editor/vim/bundle/syntastic | 0 | ||||
m--------- | Editor/vim/bundle/ultisnips | 0 | ||||
m--------- | Editor/vim/bundle/vim-snippets | 0 | ||||
m--------- | Editor/vim/bundle/vim-surround | 0 | ||||
-rw-r--r-- | Editor/vim/doc/DrawIt.txt | 489 | ||||
l--------- | Editor/vim/doc/imaps.txt.gz | 1 | ||||
l--------- | Editor/vim/doc/latex-suite-quickstart.txt.gz | 1 | ||||
l--------- | Editor/vim/doc/latex-suite.txt.gz | 1 | ||||
l--------- | Editor/vim/doc/latexhelp.txt.gz | 1 | ||||
-rw-r--r-- | Editor/vim/doc/surround.txt | 205 | ||||
-rw-r--r-- | Editor/vim/doc/tags | 56 | ||||
-rw-r--r-- | Editor/vim/filetype.vim | 4 | ||||
-rw-r--r-- | Editor/vim/plugin/cecutil.vim | 536 | ||||
-rw-r--r-- | Editor/vim/plugin/surround.vim | 588 |
21 files changed, 0 insertions, 2545 deletions
diff --git a/Editor/vim/boxdraw/bdua2b.pl b/Editor/vim/boxdraw/bdua2b.pl deleted file mode 100644 index 2e94b9a..0000000 --- a/Editor/vim/boxdraw/bdua2b.pl +++ /dev/null @@ -1,91 +0,0 @@ -# Convert +-| style drawings into utf characters
-# BoxDraw-unicode-ascii to box
-# 2003-11-24 10:12:22 created by nsg
-# 2003-11-25 13:16:17 renamed and small fix in "intelligence"
-# 2004-06-18 14:18:11 boxsets
-# 2004-06-21 21:41:30 hex input codes
-use strict;
-use utf8;
-use 5.8.0;
-use Getopt::Std;
-
-our (
- $opt_s, # boxset 's', 'd', 'v' or 'h'
- $opt_x, # convert hex digits into appropriate bd characters
- $opt_t, # ternary codes ' ' .. 'p'
-);
-getopts("s:xt");
-$opt_s||='s';
-
-my $o_utf8='--0251--001459--50585a----------0202----0c1c----525e------------51--51--53--5f--54--60------------------------------------------00185c--003468------------------1024----2c3c--------------------56--62--65--6b--------------------------------------------------505b5d----------506769----------5561------------646a------------57--63----------66--6c------------------------------------------------------------------01';
-
-binmode (STDOUT, ":utf8");
-my %boxset=(
-# 1|.,'}\u{25',"1 (_2 ]\ o_utf8) {~ 4#.2*#:i.16
- 's'=>" \x{2502}\x{2500}\x{2514}\x{2502}\x{2502}\x{250c}\x{251c}\x{2500}\x{2518}\x{2500}\x{2534}\x{2510}\x{2524}\x{252c}\x{253c}\n",
- 'd'=>" \x{2551}\x{2550}\x{255a}\x{2551}\x{2551}\x{2554}\x{2560}\x{2550}\x{255d}\x{2550}\x{2569}\x{2557}\x{2563}\x{2566}\x{256c}\n",
- 'h'=>" \x{2502}\x{2550}\x{2558}\x{2502}\x{2502}\x{2552}\x{255e}\x{2550}\x{255b}\x{2550}\x{2567}\x{2555}\x{2561}\x{2564}\x{256a}\n",
- 'v'=>" \x{2551}\x{2500}\x{2559}\x{2551}\x{2551}\x{2553}\x{255f}\x{2500}\x{255c}\x{2500}\x{2568}\x{2556}\x{2562}\x{2565}\x{256b}\n",
-);
-
-my $BOX=$boxset{$opt_s} || $boxset{'s'};
-
-my $prev='';
-my $pprev='';
-while(<STDIN>) {
- process_line();
-}
-process_line();
-
-sub process_line
-{
- my $out='';
- for(my $i=0; $i<length($prev); ++$i) {
- my $code=0;
- my $c=substr($prev,$i,1);
- if( $opt_x ) {
- $code=0;
- $code=hex($c) if $c=~/[[:xdigit:]]/;
- } elsif( $opt_t ) {
- $code=0;
- if( ord($c)>32 ) {
- $c=ord($c)-32;
- for(0..3){$code =($code>>2)+(($c%3)<<6); $c=int($c/3);}
- $c=chr(hex('25'.substr($o_utf8, $code*2,2)));
- }
- $code=0;
- } else {
- if( $c=~/[-+\|]/ ) {
- $code |= 1 if substr($pprev,$i ,1)=~/[\|+]/ ;
- $code |= 2 if substr($prev ,$i+1,1)=~/[-+]/ ;
- $code |= 4 if substr($_ ,$i ,1)=~/[\|+]/ ;
- $code |= 8 if substr($prev ,$i-1,1)=~/[-+]/ ;
-
- $code = 10 if $code && '-' eq $c;
- $code = 5 if $code && '|' eq $c;
- }
- }
- $out.=$code?substr($BOX,$code,1):$c;
- }
- print $out;
- $pprev=$prev;
- $prev=$_;
-}
-
-#
-#
-# 0001 02
-# 0010 00
-# 0011 14
-# 0100 02
-# 0101 02
-# 0110 0c
-# 0111 1c
-# 1000 00
-# 1001 18
-# 1010 00
-# 1011 34
-# 1100 10
-# 1101 24
-# 1110 2c
-# 1111 3c
diff --git a/Editor/vim/boxdraw/bdub2a.pl b/Editor/vim/boxdraw/bdub2a.pl deleted file mode 100644 index 4482923..0000000 --- a/Editor/vim/boxdraw/bdub2a.pl +++ /dev/null @@ -1,30 +0,0 @@ -# Convert +-| style drawings into utf characters
-# BoxDraw-unicode-box to ascii
-# 2003-11-25 12:48:17 -- created by nsg
-
-use 5.8.0;
-use strict;
-use utf8;
-# binmode (STDOUT, ":utf8"); # incompatible with perl 5.6.1
-# binmode (STDIN, ":utf8"); # incompatible with perl 5.6.1
-
-while(<STDIN>) {
- my $l=length;
- tr/┌┬┐╓╥╖╒╤╕╔╦╗├┼┤╟╫╢╞╪╡╠╬╣└┴┘╙╨╜╘╧╛╚╩╝/++++++++++++++++++++++++++++++++++++/;
- tr/═─│║/\-\-\|\|/;
- printf "%03d ",$l;
- print ;
-}
-
-# corners/splits:
-# ┌┬┐╓╥╖╒╤╕╔╦╗ 6ec
-# ├┼┤╟╫╢╞╪╡╠╬╣ 7fd
-# └┴┘╙╨╜╘╧╛╚╩╝ 3b9
-# round corners:
-# 256d 256e
-# 2570 256f
-# horizontal
-# ═ ─
-# vertical
-# │ ║
-
diff --git a/Editor/vim/boxdraw/boxdraw.txt b/Editor/vim/boxdraw/boxdraw.txt deleted file mode 100644 index b821a43..0000000 --- a/Editor/vim/boxdraw/boxdraw.txt +++ /dev/null @@ -1,164 +0,0 @@ -Summary
--------
- * Draw diagrams and tables using "real box drawing characters" (AKA ANSI
-art).
- * Move rectangular/linear blocks of text around.
- * Trace box-drawing typeset diagrams -- follow the lines, etc.
-
-Detailed description
---------------------
-These scripts facilitate drawing simple 'ANSI' graphic containing box
-drawing characters (not just '+', '-' and '|', but REAL box drawing
-characters). It can be useful to draw diagrams and fancy tables (at
-least, I use it this way).
-
-Upon sourcing the script defines several macros:
-
-<shift+arrow> -- moves cursor in specified direction leaving trail of
-box drawing characters, making all joins and crossings.
-g+<arrow> -- follow line of boxdrawing characters until it reaches
-intersection or ends.
-<shift+arrow> in visual mode -- move selected rectangular block in
-specified direction.
-\e -- ends box drawing mode (unmap shift+arrows macros and restore
-virtualedit value)
-\b -- restarts box drawing (map shift+arrows macros and set virtual
- edit=all)
-\s -- selects 'single-line' boxdrawing characters
-\d -- selects 'double-line' boxdrawing characters
-\a -- convert all characters in selection into ascii '+', '-', '|' (utf8
- only, not implemented)
-("\" prefix may be changed by changing mapleader variable, see :h mapleader)
-
-When rectangular block is selected, it can be moved around using
-<shift-arrow> keys. Unfortunately, as of version 6.1 multibyte
-characters and rectangular blocks do not live together too good, so this
-feature is experimental.
-
-When line block is selected, <shift-up> and <shift-down> moves it up or down
-nondestructively, <shift-left> decreases indent and <shift-up> increases
-indent.
-
-Currently box drawing is supported for utf8 and cp437 (DOS) encodings.
-
-Script does not use any "weird" box drawing characters from unicode set
-that are not present in, say, cp437. So, it is safe to save utf-8 file
-in any single byte encoding that contains regular single box drawing
-characters.
-This script also contains mapping that converts all boxdrawing
-characters in current selection into ascii '+', '-', '|'.
-
-If vim encoding is single byte, this script assumes cp437 (DOS). Most
-encodings have boxdrawing characters at the same place, however, some
-(notably, koi8-r) have them in different code postions.
-If you want to use it with encoding that contains such
-characters in diferent place, please drop me a note -- I will be happy
-to add support for that codepage too.
-
-To help you determine which boxdrawing characters are suppored by your
-terminal I have included file sampler.txt. Just type it (or cat it) on
-the termianal and encoding that labels the block that looks "right" will
-be your supported encoding.
-
-Note for PuTTY users
---------------------
-
-It turns out that PuTTY does not translate Shift+Arrow combination into
-X key code (like xterm does), so mappings will not work for this
-terminal. I have modified initialization script to use <arrows> instead
-of <shift>+<arrows> in Unix environment.
-
-Perl scripts
-------------
-
-Some box-drawing related procedures are more naturally done with
-external scripts. These scripts take ascii standard input and produce
-utf8 encoded standard output.
-
-bdua2b.pl -- converts regular '+-|'-style drawing into single-line utf8
- boxdrawing. This script has does not just blindly replace characters,
- but instead looks to the neighbourhood and chooses boxdrawing
- character that fits best. Use this script as a filter to convert
- existing ascii drawings.
- Option -ss selects single border characters, -sd -- double border,
- -sh -- single vertical double horizontal, -sv single horizontal double
- vertical.
-
-outline.pl -- outlines groups of similar characters in the input with
- boxdrawing characters. Option -d makes output twice as wide, options
- -s* select boxdrawing flavor as in previous script.
- For example,
-
- aaaacc
- abbcc
- ccbbc
- cccb
-
-will be converted into
-
- ┌───┬─┐
- │┌─┬┘┌┘
- ├┴┐└┐│
- │ └┐├┘
- └──┴┘
-
-or
-
- ┌───────┬───┐
- │ ┌───┬─┘ ┌─┘
- ├─┴─┐ └─┐ │
- │ └─┐ ├─┘
- └─────┴─┘
-
-
-Both scripts were tested with ActivePerl 5.6.1.
-
-Plans:
-------
-* Support double boxes in a cleaner way.
-
-Installation
-------------
-Copy boxdraw.vim to the place where you normally keep vim scripts (e.g. ~/.vim
-or c:\vim\vimfiles) and source it every time you want to draw a diagram or nice
-table.
-
-You may wish also to add this to your menu by adding a line to your .gvimrc
-(_gvimrc) file (use actual path to boxdraw.vim):
-:menu Tools.Bo&x\ Draw :so ~/.vim/boxdraw.vim<CR>
-
-Environment
------------
-I run Windows and use boxdraw.vim in gvim (it supports utf-8 very
-nicely) and bd-single in vim (its support of utf-8 is kind of unclear
-for me). Both major Windows monospaced fonts (Courier New and Lucida
-Console) support wide range of Unicode characters, including box
-drawing.
-
-Why use box drawing characters?
--------------------------------
-These characters are in Unicode standard for compatibility with wide
-range of existing 8-bit encodings that have them. The wording of Unicode
-standard discourages usage of such characters, other than for the
-purpose of converting between encodigns and storage of legacy data.
-Having said all that I found that sometimes a picture, even crude and
-primitive, is worth pages of explanations. Just about the only way to
-include picture in source code is to use ascii or "ansi" art. Ascii is
-more compatible, but "ansi" looks way better. Since I have to use
-Unicode to include cyrillic characters in comments anyway, I decided to
-stop on "ansi" art as a format of choice for in-source drawings.
-
-Author
-------
-Andrew Nikitin <nsg21@hotmail.com>
-
-History
--------
-2002-01-09 -- v0.0 -- initial upload, single boxes in utf-8 encoding
-2002-01-10 -- v0.1 -- double boxes
-2002-01-30 -- v0.2 -- single-byte, box->ascii conversion
-2003-11-24 -- v0.3 -- perl scripts + some rectangular block movements
-2004-06-18 -- v0.4 -- following the lines, updated perl scripts
-2004-11-26 -- v1.0 -- combined single-byte and utf8 versions, included
-sampler.txt to help determine encoding
-2008-12-17 -- v1.1 -- special processing for line-block movements, changed cabbr for perl
diff --git a/Editor/vim/boxdraw/boxdraw.vim b/Editor/vim/boxdraw/boxdraw.vim deleted file mode 100644 index 284232f..0000000 --- a/Editor/vim/boxdraw/boxdraw.vim +++ /dev/null @@ -1,291 +0,0 @@ -" Box drawing module for Vim 6.0 -" (C) Andrew Nikitin, 2002 -" 2002-01-07 -- created by nsg -" 2002-01-08 -- first box drawing (single only) -" 2002-01-09 -- (00:42) fixed col(".") bug (note vim bug k"tylj does not retu) -" 2002-01-09 -- optimize -" 2002-01-10 -- double boxes -" 2002-01-16 -- use script-local var and access function instead of global -" 2002-01-30 -- ,a mapping (box->ascii conversion) -" 2003-11-10 -- implemented MB avoiding "number Ctl-V" -" 2004-06-18 -- fixed ToAscii so it replaces "─"; trace path (g+arrow) -" 2004-06-23 -- merged single-byte and utf-8 support in one file -" 2004-06-30 -- do not use shift+arrows unless in win32 -" 2008-12-17 -- special processing for line-block movements, changed cabbr for -" perl - - -let s:o_utf8='--0251--001459--50585a----------0202----0c1c----525e------------51--51--53--5f--54--60------------------------------------------00185c--003468------------------1024----2c3c--------------------56--62--65--6b--------------------------------------------------505b5d----------506769----------5561------------646a------------57--63----------66--6c------------------------------------------------------------------01' -let s:i_utf8='44cc11------------------14------50------05------41------15--------------51--------------54--------------45--------------55--------------------------------------88221824289060a009060a81428219262a9162a29864a889468a9966aa14504105------40010410' -let s:o_cp437='--b3ba--c4c0d3--cdd4c8----------b3b3----dac3----d5c6------------ba--ba--d6--c7--c9--cc------------------------------------------c4d9bd--c4c1d0------------------bfb4----c2c5--------------------b7--b6--d2--d7--------------------------------------------------cdbebc----------cdcfca----------b8b5------------d1d8------------bb--b9----------cb--ce' -let s:i_cp437='----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------115191626090a222a08242815005455415445519260a288aa82a88aa894698640609182466994114' - -let s:scriptfile=expand("<sfile>:h") - -" -" Activate mode. Assigned to ,b macro. -" -fu! <SID>S() - if has("gui_running") - " se enc=utf8 - en - let s:ve=&ve - setl ve=all - " Note that typical terminal emulator program (Putty, in particular) does - " not support Shift arrows too good. You will, probably, have to redefines - " those to, say, - " ,<Up> etc. - if has("win32") - " Under Windows Shift+Arrows works quite smooth, unlike most terminals - nm <S-Up> :call <SID>M(1,'k')<CR> - nm <S-Down> :call <SID>M(16,'j')<CR> - nm <S-Left> :call <SID>M(64,'h')<CR> - nm <S-Right> :call <SID>M(4,'l')<CR> - nm g<Up> :call <SID>G(0)<CR> - nm g<Right> :call <SID>G(1)<CR> - nm g<Down> :call <SID>G(2)<CR> - nm g<Left> :call <SID>G(3)<CR> - vm <S-Up> <esc>:call <SID>MB('k')<CR> - vm <S-Down> <esc>:call <SID>MB('j')<CR> - vm <S-Left> <esc>:call <SID>MB('h')<CR> - vm <S-Right> <esc>:call <SID>MB('l')<CR> - else - nm <Up> :call <SID>M(1,'k')<CR> - nm <Down> :call <SID>M(16,'j')<CR> - nm <Left> :call <SID>M(64,'h')<CR> - nm <Right> :call <SID>M(4,'l')<CR> - nm g<Up> :call <SID>G(0)<CR> - nm g<Right> :call <SID>G(1)<CR> - nm g<Down> :call <SID>G(2)<CR> - nm g<Left> :call <SID>G(3)<CR> - vm <Up> <esc>:call <SID>MB('k')<CR> - vm <Down> <esc>:call <SID>MB('j')<CR> - vm <Left> <esc>:call <SID>MB('h')<CR> - vm <Right> <esc>:call <SID>MB('l')<CR> - en - vmap <Leader>a :ToAscii<cr> - nm <Leader>e :call <SID>E()<CR> - nm <Leader>s :call <SID>SetLT(1)<CR> - nm <Leader>d :call <SID>SetLT(2)<CR> - exec "cabbr <"."buffer> perl perl ".s:scriptfile - - let s:bdlt=1 - nm <Leader>b x - nun <Leader>b -endf - -fu! s:SetLT(thickness) - let s:bdlt=a:thickness -endf - -" Deactivate mode. -" Unmap macros, restore &ve option -fu! <SID>E() - if has("win32") - " Under Windows Shift+Arrows works quite smooth, unlike most terminals - nun <S-Up> - nun <S-Down> - nun <S-Left> - nun <S-Right> - nun g<Up> - nun g<Right> - nun g<Down> - nun g<Left> - vu <S-Up> - vu <S-Down> - vu <S-Left> - vu <S-Right> - else - nun <Up> - nun <Down> - nun <Left> - nun <Right> - nun g<Up> - nun g<Right> - nun g<Down> - nun g<Left> - vu <Up> - vu <Down> - vu <Left> - vu <Right> - en - nun <Leader>e - nm <buffer> <Leader>b :call <SID>S()<CR> - cuna <buffer> perl - let &ve=s:ve - unlet s:ve - "echo "Finished Boxdrawing mode" -endf - -fu! s:GetBoxCode(char) - " check if symbol from unicode boxdrawing range - " E2=1110(0010) - " 25= 10(0101)xx - if 'utf-8'== &enc - if(0xE2==char2nr(a:char[0])&&0x25==char2nr(a:char[1])/4) - retu '0x'.strpart(s:i_utf8,2*(char2nr(a:char[1])%4*64+char2nr(a:char[2])%64),2) - en - else " Assume cp437 encoding - retu '0x'.strpart(s:i_cp437,2*char2nr(a:char),2) - en - retu 0 -endf - -" Try neihgbour in direction 'd' if c is true. Mask m for the direction -" should also be supplied. -" Function returns neighboring bit -" Unicode entries are encoded in utf8 as -" 7 bit : 0vvvvvvv -" 11 bit : 110vvvvv 10vvvvvv -" 16 bit : 1110vvvv 10vvvvvv 10vvvvvv -fu! s:T(c,d,m) - if(a:c) - exe 'norm mt'.a:d.'"tyl`t' - let c=s:GetBoxCode(@t) - retu c%a:m*4/a:m - en - retu 0 -endf - -" 3*4^x, where x=0,1,2,3 -" fu! s:Mask(x) -" retu ((6+a:x*(45+a:x*(-54+a:x*27)))/2) -" endf - -" Move cursor (follow) in specified direction -" Return new direction if new position is valid, -1 otherwise -" dir: 'kljh' -" ^>V< -" 0123 -" mask: 3 12 48 192 -" let @x=3|echo (6+@x*(45+@x*(-54+@x*27)))/2 -" -fu! <SID>F(d) - exe 'norm '.('kljh'[a:d]).'"tyl' - let c=s:GetBoxCode(@t) - let i=0 - let r=-1 - while i<4 - if 0!=c%4 && a:d!=(i+2)%4 - if r<0 - let r=i - else - retu -1 - endif - endif - let c=c/4 - let i=i+1 - endw - retu r -endf - -fu! <SID>G(d) - let y=line(".") - let x=virtcol(".") - let n=a:d - while n>=0 - let n=s:F(n) - if y==line(".") && x==virtcol(".") - echo "Returned to same spot" - break - endif - endw -endf - -" Move cursor in specified direction (d= h,j,k or l). Mask s for -" the direction should also be supplied -" -fu! <SID>M(s,d) - let t=@t - let x=s:T(1<col("."),'h',16)*64+s:T(line(".")<line("$"),'j',4)*16+s:T(1,'l',256)*4+s:T(1<line("."),'k',64) - let @t=t - let c=a:s*s:bdlt+x-x%(a:s*4)/a:s*a:s - "echo 'need c='.c.' x='.x - if 'utf-8'==&enc - let o=strpart(s:o_utf8,2*c,2) - if o!='--' && o!='' - exe "norm r\<C-V>u25".o.a:d - en - else - let o=strpart(s:o_cp437,2*c,2) - if o!='--' && o!='' - exe "norm r\<C-V>x".o.a:d - en - en -" "echo "Boxdrawing mode" -endf - -scriptencoding utf8 -command! -range ToAscii :silent <line1>,<line2>s/┌\|┬\|┐\|╓\|╥\|╖\|╒\|╤\|╕\|╔\|╦\|╗\|├\|┼\|┤\|╟\|╫\|╢\|╞\|╪\|╡\|╠\|╬\|╣\|└\|┴\|┘\|╙\|╨\|╜\|╘\|╧\|╛\|╚\|╩\|╝/+/ge|:silent <line1>,<line2>s/[│║]/\|/ge|:silent <line1>,<line2>s/[═─]/-/ge - -command! -range ToHorz :<line1>,<line2>s/─\|═/-/g -command! -range ToHorz2 :<line1>,<line2>s/─/-/g -" 0000000: 636f 6d6d 616e 6421 202d 7261 6e67 6520 command! -range -" 0000010: 546f 486f 727a 203a 3c6c 696e 6531 3e2c ToHorz :<line1>, -" 0000020: 3c6c 696e 6532 3e73 2fe2 9480 5c7c e295 <line2>s/...\|.. -" 0000030: 9029 2f6f 2f67 0d0a .)/o/g.. -command! -range ToVert :<line1>,<line2>s/│\|║/\|/g - -" Move block dispatch -fu! s:MB(d) - if visualmode()=='' || visualmode()=='v' - call s:MRB(a:d) - elseif visualmode()=='V' - call s:MLB(a:d) - en -endf - -" Move line block -fu! s:MLB(d) - if a:d=='j' || a:d=='k' - let l:cmd= "norm gv\"yd".a:d."\"yP1V" - exe l:cmd - elseif a:d=='h' - normal gv - :'<,'>s/^.// - normal gv - elseif a:d=='l' - normal gv - :'<,'>s/^/ / - normal gv - en -endf - -" Move Rectangular block -" sideeffect: stores contents of a block in "y -" 1<C-V> does not work good in 6.0 when multibyte characters are involved -" gvp does not work good ... -" gv also has some problems -" See http://vim.sourceforge.net/tips/tip.php?tip_id=808 for different way to -" paste -fu! s:MRB(d) - " It seems that rectangular boxes and multibyte do not live together too - " good asof version 6.3 - " Normally something like - " exe 'norm gv"yygvr '.a:d.'1<C-V>"ypgv' - " should have worked - let l:y1=line(".") - let l:x1=virtcol(".") - "echo l:x1."-".l:y1 - normal gv"yygvo - let l:y2=line(".") - let l:x2=virtcol(".") - if l:x1>l:x2 | let l:t=l:x1 | let l:x1=l:x2 | let l:x2=l:t | endif - if l:y1>l:y2 | let l:t=l:y1 | let l:y1=l:y2 | let l:y2=l:t | endif - let l:pos=l:y1."G0" - if 1<l:x1 | let l:pos=l:pos.(l:x1-1)."l" | endif - let l:size="" - if 0<l:y2-l:y1 | let l:size=l:size.(l:y2-l:y1)."j" | endif - if 0<l:x2-l:x1 | let l:size=l:size.(l:x2-l:x1)."l" | endif - exe "normal gvr ".l:pos.a:d."".l:size."d\"yPgvjk" -endf - - -:nmap <buffer> ,b :call <SID>S()<CR> -if has("win32") - " Under win32 activate boxdrwaing mode upon start. - " If undesirable, prepend with :nmap ,b - " - :normal ,b -else -en diff --git a/Editor/vim/boxdraw/outline.pl b/Editor/vim/boxdraw/outline.pl deleted file mode 100644 index f095e7f..0000000 --- a/Editor/vim/boxdraw/outline.pl +++ /dev/null @@ -1,74 +0,0 @@ -# outlines groups of similar characters
-# 2003-11-24 15:07:28 Created by nsg
-# 2004-06-18 14:29:45 changed hex boxset to x; added double, horz, vert boxsets
-use strict;
-use utf8;
-use Getopt::Std;
-
-our (
- $opt_s, # boxset (x=hex)
- $opt_d, # double each input character
- $opt_e, # output encoding
-);
-getopts("s:de:");
-$opt_s='s' if '' eq $opt_s;
-$opt_e='utf8' if '' eq $opt_e;
-
-binmode (STDIN, ":encoding($opt_e)");
-binmode (STDOUT, ":encoding($opt_e)");
-#binmode (STDOUT, ":encoding(utf8)");
-my $p='';
-
-my %boxset=(
-# 1|.,'}\u{25',"1 (_2 ]\ o_utf8) {~ 4#.2*#:i.16
- 's'=>" \x{2502}\x{2500}\x{2514}\x{2502}\x{2502}\x{250c}\x{251c}\x{2500}\x{2518}\x{2500}\x{2534}\x{2510}\x{2524}\x{252c}\x{253c}\n",
- 'd'=>" \x{2551}\x{2550}\x{255a}\x{2551}\x{2551}\x{2554}\x{2560}\x{2550}\x{255d}\x{2550}\x{2569}\x{2557}\x{2563}\x{2566}\x{256c}\n",
- 'h'=>" \x{2502}\x{2550}\x{2558}\x{2502}\x{2502}\x{2552}\x{255e}\x{2550}\x{255b}\x{2550}\x{2567}\x{2555}\x{2561}\x{2564}\x{256a}\n",
- 'v'=>" \x{2551}\x{2500}\x{2559}\x{2551}\x{2551}\x{2553}\x{255f}\x{2500}\x{255c}\x{2500}\x{2568}\x{2556}\x{2562}\x{2565}\x{256b}\n",
-);
-
-my $BOX=$boxset{$opt_s} || $boxset{'s'};
-
-# corners/splits:
-# ┌┬┐╓╥╖╒╤╕╔╦╗ 6ec
-# ├┼┤╟╫╢╞╪╡╠╬╣ 7fd
-# └┴┘╙╨╜╘╧╛╚╩╝ 3b9
-# round corners:
-# 256d 256e
-# 2570 256f
-# horizontal
-# ═ ─
-# vertical
-# │ ║
-
-while(<STDIN>){
- chomp;
- s/./$&$&/g if $opt_d;
- process_line();
- $p=$_;
-}
-$_='';
-process_line();
-
-sub process_line
-{
- my $out;
- my $l=length;
- $l=length($p) if length($p)>$l;
- for my$i(0..$l) {
- my $c=0;
- $c|=1 if sc($p,$i-1) ne sc($p,$i);
- $c|=2 if sc($p,$i) ne sc($_,$i);
- $c|=4 if sc($_,$i) ne sc($_,$i-1);
- $c|=8 if sc($_,$i-1) ne sc($p,$i-1);
- $out.=substr($BOX,$c,1) if 'x' ne $opt_s;
- $out.=sprintf"%1x",$c if 'x' eq $opt_s;
- }
- print "$out\n";
-}
-
-sub sc # (str, index)
-{
- return ' ' if 0>$_[1] || $_[1]>=length($_[0]);
- return substr($_[0],$_[1],1);
-}
diff --git a/Editor/vim/boxdraw/sampler.txt b/Editor/vim/boxdraw/sampler.txt deleted file mode 100644 index 1f6aad8..0000000 --- a/Editor/vim/boxdraw/sampler.txt +++ /dev/null @@ -1,13 +0,0 @@ -Box drawing characters sampler. (C) nsg, 2004
-╒╕╔╗╓╖┌╥─┐
-├┼╢║╟╜└╫┬┤ utf-8
-╞╪╣╠╩╤╦╬╡│
-╘╧╝╚═╛╙╨┴┘
-
- koi8-r, koi8-u*
-
-
-ոɻֿ·
-öŴٺ cp437 (A.K.A dos), cp737, cp86x, cp85x*, cp895, etc.
-ƾص˹
-ϼн
diff --git a/Editor/vim/bundle/Vundle.vim b/Editor/vim/bundle/Vundle.vim deleted file mode 160000 -Subproject 88688fe453038ac1ac26e31646cfbec50fca2fb diff --git a/Editor/vim/bundle/syntastic b/Editor/vim/bundle/syntastic deleted file mode 160000 -Subproject 8e672780e76c0a774b7fe834eed9652ccd684c2 diff --git a/Editor/vim/bundle/ultisnips b/Editor/vim/bundle/ultisnips deleted file mode 160000 -Subproject 71c39721de9cb2d67478e8b8c1a543e006fb67d diff --git a/Editor/vim/bundle/vim-snippets b/Editor/vim/bundle/vim-snippets deleted file mode 160000 -Subproject 89a4e548441debc2d54267ea6088b048a29273d diff --git a/Editor/vim/bundle/vim-surround b/Editor/vim/bundle/vim-surround deleted file mode 160000 -Subproject e49d6c2459e0f5569ff2d533b4df995dd7f9831 diff --git a/Editor/vim/doc/DrawIt.txt b/Editor/vim/doc/DrawIt.txt deleted file mode 100644 index 8e72f64..0000000 --- a/Editor/vim/doc/DrawIt.txt +++ /dev/null @@ -1,489 +0,0 @@ -DrawIt.txt* The DrawIt Tool Nov 25, 2013 - -Authors: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> - Sylvain Viart <molo@multimania.com> - (remove NOSPAM from Campbell's email first) -Copyright: Copyright (C) 2004-2013 Charles E. Campbell - Permission is hereby granted to use and distribute this code, - with or without modifications, provided that this copyright - notice is copied with it. Like anything else that's free, - DrawIt.vim and DrawItPlugin.vim are provided *as is*; it comes - with no warranty of any kind, either expressed or implied. By - using this plugin, you agree that in no event will the copyright - holder be liable for any damages resulting from the use of this - software. - - -============================================================================== -1. Contents *drawit-contents* {{{1 - - 1. Contents......................: |drawit-contents| - 2. DrawIt Manual.................: |drawit| - 3. DrawIt Usage..................: |drawit-usage| - Starting....................: |drawit-start| - Stopping....................: |drawit-stop| - User Map Protection.........: |drawit-protect| - Drawing.....................: |drawit-drawing| - Tip.........................: |drawit-tip| - Changing Drawing Characters.: |drawit-setdrawit| - Moving......................: |drawit-moving| - Erasing.....................: |drawit-erase| - Example.....................: |drawit-example| - Visual Block Mode...........: |drawit-visblock| - Brushes.....................: |drawit-brush| - DrawIt Modes................: |drawit-modes| - 4. DrawIt History................: |drawit-history| - - -============================================================================== -2. DrawIt Manual *drawit* {{{1 - *drawit-manual* - /===============+============================================================\ - || Starting & | || - || Stopping | Explanation || - ++--------------+-----------------------------------------------------------++ - || \di | start DrawIt |drawit-start| || - || \ds | stop DrawIt |drawit-stop| || - || :DIstart | start DrawIt |drawit-start| || - || :DIstart S | start DrawIt in single-bar mode |drawit-start| || - || :DIstart D | start DrawIt in double-bar mode |drawit-start| || - || :DIsngl | start DrawIt in single-bar mode |drawit-start| |drawit-sngl| || - || :DIdbl | start DrawIt in double-bar mode |drawit-start| |drawit-dbl| || - || :DIstop | stop DrawIt |drawit-stop| || - || :DrawIt[!] | start/stop DrawIt |drawit-start| |drawit-stop| || - || | || - ++==============+===========================================================++ - || Maps | Explanation || - ++--------------+-----------------------------------------------------------++ - || | The DrawIt routines use a replace, move, and || - || | replace/insert strategy. The package also lets one insert|| - || | spaces, draw arrows by using the following characters or || - || | keypad characters: || - || +-----------------------------------------------------------++ - || <left> | move and draw left |drawit-drawing| || - || <right> | move and draw right, inserting lines/space as needed || - || <up> | move and draw up, inserting lines/space as needed || - || <down> | move and draw down, inserting lines/space as needed || - || <s-left> | move cursor left |drawit-move| || - || <s-right> | move cursor right, inserting lines/space as needed || - || <s-up> | move cursor up, inserting lines/space as needed || - || <s-down> | move cursor down, inserting lines/space as needed || - || <space> | toggle into and out of erase mode || - || > | insert a > and move right (draw -> arrow) || - || < | insert a < and move left (draw <- arrow) || - || ^ | insert a ^ and move up (draw ^ arrow) || - || v | insert a v and move down (draw v arrow) || - || <pgdn> | replace with a \, move down and right, and insert a \ || - || <end> | replace with a /, move down and left, and insert a / || - || <pgup> | replace with a /, move up and right, and insert a / || - || <home> | replace with a \, move up and left, and insert a \ || - || \> | insert a fat > and move right (draw -> arrow) || - || \< | insert a fat < and move left (draw <- arrow) || - || \^ | insert a fat ^ and move up (draw ^ arrow) || - || \v | insert a fat v and move down (draw v arrow) || - ||<s-leftmouse> | drag and draw with current brush |drawit-brush| || - ||<c-leftmouse> | drag and move current brush |drawit-brush| || - || | || - ||==============+===========================================================++ - ||Visual Cmds | Explanation || - ||--------------+-----------------------------------------------------------++ - || | The drawing mode routines use visual-block mode to || - || | select endpoints for lines, arrows, and ellipses. Bresen- || - || | ham and Bresenham-like algorithms are used for this. || - || | || - || | These routines need a block of spaces, and so the canvas || - || | routine must first be used to create such a block. The || - || | canvas routine will query the user for the number of || - || | lines to hold |'textwidth'| spaces. || - || +-----------------------------------------------------------++ - || \a | draw arrow from corners of visual-block selected region || |drawit-a| - || \b | draw box on visual-block selected region || |drawit-b| - || \c | the canvas routine (will query user, see above) || |drawit-c| - || \e | draw an ellipse on visual-block selected region || |drawit-e| - || \f | flood figure with a character (you will be prompted) || |drawit-f| - || \l | draw line from corners of visual-block selected region || |drawit-l| - || \s | spacer: appends spaces up to the textwidth (default: 78) || |drawit-s| - || | || - ++==============+===========================================================++ - || Function and Explanation || - ++--------------+-----------------------------------------------------------++ - || :call SetDrawIt('vertical','horizontal','crossing','\','/','X','*') || - || set drawing characters for motions for moving || - || and for the ellipse drawing boundary |drawit-setdrawit| || - || default motion || - || | up/down, || - || - left/right, || - || + -| crossing, || - || \ downright, || - || / downleft, and || - || X \/ crossing || - ++=======================+==================================================++ - || Commands | Explanation || - ++-----------------------+--------------------------------------------------++ - || :SetBrush a-z | sets brush (register) to given register || - || :'<,'>SetBrush a-z | yanks visual block to brush |drawit-brush||| || - || :DInrml | switch to normal mode |drawit-nrml| || - || :DIsngl | switch to single-line mode |drawit-sngl| || - || :DIdbl | switch to double-line mode |drawit-dbl| || - \============================================================================/ - - -============================================================================== -3. DrawIt Usage *drawit-usage* {{{1 - -STARTING *drawit-start* {{{2 -\di (starts in normal drawing mode) *drawit-\di* -:DrawIt (starts in normal drawing mode) *drawit-DrawIt* -:DIstart (starts in normal drawing mode) *drawit-DIstart* -:DIstart S (starts in single-bar drawing mode) -:DIstart D (starts in double-bar drawing mode) -:DInrml (starts in normal drawing mode) *drawit-DInrml* -:DIsngl (starts in single-bar drawing mode) *drawit-DIsngl* -:DIdbl (starts in double-bar drawing mode) *drawit-DIdbl* - -Typically one puts <drawit.vim> into the .vim/plugin directory -(vimfiles\plugin for Windows) where it becomes always available. It uses a -minimal interface (\di: you can think of it as *D*raw*I*t or *D*rawIt -*I*nitialize) to start it and (\ds: *D*rawIt *S*top) to stop it. Instead of -using "\" you may specify your own preference for a map leader (see -|mapleader|). - -With a trailing 'S', :DIstart will begin in single-bar mode (see |drawit-sngl|). -With a trailing 'D', :DIstart will begin in double-bar mode (see |drawit-dbl|). -Similarly, :DIsngl and :DIdbl will start DrawIt as well as begin in -single-bar or double-bar mode, respectively. - -A message, "[DrawIt]", will appear on the message line. - - -STOPPING *drawit-stop* {{{2 -\ds -:DIstop -:DrawIt! - -When you are done with DrawIt, use \ds to stop DrawIt mode. Stopping DrawIt -will restore your usual options and remove the maps DrawIt set up. - -A message, "[DrawIt off]", will appear on the message line. - - *drawit-utf16* - *drawit-utf8* *drawit-unicode* -NORMAL, SINGLE BAR, AND DOUBLE BAR MODES *drawit-sngl* *drawit-dbl* -:DInrml :DIsngl :DIdbl - -One may use these commands to start up Drawit in normal, single-bar, or -double-bar modes, respectively. When your |'encoding'| is utf-8 or utf-16, -DrawIt supports drawing with special box characters (single-bar, double_bar). -These commands are also used to switch to normal, single-bar, or double-bar -modes. - - -USER MAP PROTECTION *drawit-protect* {{{2 - -Starting DrawIt causes it to set up a number of maps which facilitate drawing. -DrawIt accommodates users with conflicting maps by saving both maps and user -options and before setting them to what DrawIt needs. When you stop DrawIt -(|drawit-stop|), DrawIt will restore the user's maps and options as they were -before DrawIt was started. - - -OPTIONS *drawit-options* {{{2 - - *g:drawit_insertmode* -g:drawit_insertmode : if this variable exists and is 1 then maps are - made which make cursor-control drawing available - while in insert mode, too. Otherwise, DrawIt's - maps only affect normal mode. - -DRAWING *drawit-drawing* {{{2 - -After DrawIt is started, use the number pad or arrow keys to move the cursor -about. As the cursor moves, DrawIt will then leave appropriate "line" -characters behind as you move horizontally, vertically, or diagonally, and -will transparently enlarge your file to accommodate your drawing as needed. -The trail will consist of -, |, \, / characters (depending on which direction -and SetDrawIt() changes), and + and X characters where line crossings occur. -You may use h-j-k-l to move about your display and generally use editing -commands as you wish even while in DrawIt mode. - -Another tool that may be used to convert Ascii-art into nice pictures is -available at https://github.com/christiangoltz/shaape . - - -CHANGING DRAWING CHARACTERS *drawit-setdrawit* {{{2 - -The SetDrawIt() function is available for those who wish to change the -characters that DrawIt uses. > - - ex. :call SetDrawIt('*','*','*','*','*','*','*') - ex. :call SetDrawIt('-','|','-','\','/','/','*') -< -The first example shows how to change all the DrawIt drawing characters to -asterisks, and the second shows how to give crossing priority to - and /. -The default setting is equivalent to: > - - :call SetDrawIt('|','-','+','\','/','X','*') -< -where SetDrawit()'s arguments refer, in order, to the > - - vertical drawing character - horizontal drawing character - horizontal/vertical crossing drawing character - down right drawing character - down left drawing character - diagonal crossing drawing character - ellipse boundary drawing character -< - -TIP *drawit-tip* - -I have found that sometimes one or more of the <home>, <end>, <pageup>, -and <pagedown> keys give unique sequences but are not interpreted -properly by Vim. This problem impacts DrawIt as it uses those four -keys to signify diagonal moves/drawing. One solution I use is to -put into my <.vimrc> file mapings like: - - map ^V... <home> - -where the ellipsis (...) is the actual character sequence produced by -hitting the key. The way to generate such maps is to type "map ", -followed by three control-v presses, press the associated key, then -a space followed by the proper interpretation sequence (ie. <home>). - - -MOVING *drawit-move* *drawit-moving* {{{2 - -DrawIt supports shifting the arrow keys to cause motion of the cursor. The -motion of the cursor will not modify what's below the cursor. The cursor -will move and lines and/or spaces will be inserted to support the move as -required. Your terminal may not support shifted arrow keys, however, or Vim -may not catch them as such. For example, on the machine I use, shift-up -(<s-up>) produced <Esc>[161q, but vim didn't know that sequence was a <s-up>. -I merely made a nmap: - - nmap <Esc>[161q <s-up> - -and vim thereafter recognized the <s-up> command. - - -ERASING *drawit-erase* {{{2 -<space> - -The <space> key will toggle DrawIt's erase mode/DrawIt mode. When in [DrawIt -erase] mode, a message "[DrawIt erase]" will appear and the number pad will -now cause spaces to be drawn instead of the usual drawing characters. The -drawing behavior will be restored when the <space> key toggles DrawIt back -to regular DrawIt mode. - - -EXAMPLES *drawit-example* {{{2 - -Needless to say, the square spirals which follow were done with DrawIt and -a bit of block editing with Vim: > - - +------------ -----------+ +------------ -----------+ +------------ - |+----------+ +---------+| |+----------+ +---------+| |+----------+ - ||+--------+| |+-------+|| ||+--------+| |+-------+|| ||+--------+| - |||-------+|| ||+------||| |||-------+|| ||+------||| |||-------+|| - ||+-------+|| ||+------+|| ||+-------+|| ||+------+|| ||+-------+|| - |+---------+| |+--------+| |+---------+| |+--------+| |+---------+| - +-----------+ +----------+ +-----------+ +----------+ +-----------+ - -VISUAL BLOCK MODE FOR ARROWS LINES BOXES AND ELLIPSES *drawit-visblock* {{{2 - -\a : draw arrow from corners of visual-block selected region *drawit-a* -\b : draw box on visual-block selected region *drawit-b* -\c : the canvas routine (will query user, see above) *drawit-c* -\e : draw an ellipse on visual-block selected region *drawit-e* -\f : flood figure with a character (you will be prompted) *drawit-f* -\l : draw line from corners of visual-block selected region *drawit-l* -\s : spacer: appends spaces up to the textwidth (default: 78) *drawit-s* - -The DrawIt package has been merged with Sylvain Viart's drawing package (by -permission) which provides DrawIt with visual-block selection of -starting/ending point drawing of arrows (\a), lines (\l), and boxes (\b). -Additionally I wrote an ellipse drawing function using visual block -specification (|drawit-e|). - -One may create a block of spaces for these maps to operate in; the "canvas" -routine (\c) will help create such blocks. First, the s:Canvas() routine will -query the user for the number of lines s/he wishes to have, and will then fill -those lines with spaces out to the |'textwidth'| if user has specified it; -otherwise, the display width will be used. - -Although most of the maps use visual-block selection, that isn't true of the -\f map. Instead, it assume that you have already drawn some closed figure -and want to fill it with some character. - -The Sylvain Viart functions and the ellipse drawing function depend -upon using visual block mode. As a typical use: > - - Example: * \h - DrawIt asks: how many lines under the cursor? 10 - DrawIt then appends 10 lines filled with blanks - out to textwidth (if defined) or 78 columns. - * ctrl-v (move) \b - DrawIt then draws a box - * ctrl-v (move) \e - DrawIt then draws an ellipse -< -Select the first endpoint with ctrl-v and then move to the other endpoint. -One may then select \a for arrows, \b for boxes, \e for ellipses, or \l for -lines. The internal s:AutoCanvas() will convert tabs to spaces and will -extend with spaces as needed to support the visual block. Note that when -DrawIt is enabled, virtualedit is also enabled (to "all"). -> - Examples: - - __ _ *************** +-------+ - \_ _/ **** **** | | - \_ _/ ** ---------> ** | | - \_ _/ **** **** | | - \__/ <------- *************** +-------+ - - \l \a \e and \a \b -< - *drawit-setbrush* -BRUSHES *drawit-brush* {{{2 -> - :SetBrush [a-z] -< - Set the current brush to the selected brush register: -> - ex. :SetBrush b - - :'<,'>SetBrush [a-z] -< - Select text for the brush by using visual-block mode: ctrl-v, move . - Then set the current text into the brush register: (default brush: a) -> - <leftmouse> -< - Select a visual-block region. One may use "ay, for example, - to yank selected text to register a. -> - <shift-leftmouse> -< - One may drag and draw with the current brush (default brush: a) - by holding down the shift key and the leftmouse button and moving - the mouse. Blanks in the brush are considered to be transparent. -> - <ctrl-leftmouse> -< - One may drag and move a selection with <ctrl-leftmouse>. First, - select the region using the <leftmouse>. Release the mouse button, - then press ctrl and the <leftmouse> button; while continuing to press - the button, move the mouse. The selected block of text will then - move along with the cursor. -> - \ra ... \rz -< - Replace text with the given register's contents (ie. the brush). -> - \pa ... \pz -< - Like \ra ... \rz, except that blanks are considered to be transparent. - - Example: Draw the following > - \ \ - o o - * - --- -< Then use ctrl-v, move, "ay to grab a copy into register a. - By default, the current brush uses register a (change brush - with :SetBrush [reg]). Hold the <shift> and <leftbutton> - keys down and move the mouse; as you move, a copy of the - brush will be left behind. - - -DRAWIT MODES *drawit-modes* {{{2 - - -[DrawIt] regular DrawIt mode (|drawit-start|) - -[DrawIt off] DrawIt is off (|drawit-stop| ) - -[DrawIt erase] DrawIt will erase using the number pad (|drawit-erase|) - - g:DrChipTopLvlMenu: by default its "DrChip"; you may set this to whatever - you like in your <.vimrc>. This variable controls where - DrawIt's menu items are placed. - - -============================================================================== -4. History *drawit-history* {{{1 - - 13 Sep 05, 2013 * improved s:Strlen() -- now uses |strdisplaywidth()| - if available. - Sep 13, 2013 * (Paul Wagland) found a case where lines were - being drawn with the wrong character. This - affected the Bresenham-algorithm based - drawing facility (ie. lines and arrows - specified by visual blocks; - |drawit-a|, |drawit-l|). - 12 Nov 16, 2012 * (Alexandre Viau) arrows weren't being drawn. - Fixed. - Nov 29, 2012 * (Kim Jang-hwan) reported that with - g:Align_xstrlen set to 3 that the cursor was - moved (linewise) after invocation. This - problem also afflicted DrawIt. Fixed. - 11 Jan 21, 2010 * (Evan Stern) several places were using - hardcoded drawing characters instead of - b:di_... equivalents. - Feb 22, 2011 * for menus, &go =~# used to insure correct case - Sep 22, 2011 * ctrl-leftmouse (see |drawit-brush|) now moves the - selected text entirely, no longer leaving a copy - of the text where it was initially. - Nov 07, 2011 * included support for utf-8 box drawing characters - Nov 16, 2011 * included support for utf-8 single-double characters - Nov 16, 2011 * included support for cp437 box drawing characters - Dec 06, 2011 * included support for box and line drawing (\b, \l) - support for utf-8 / cp437 box drawing characters - Dec 06, 2011 * fat arrows now use utf-8 characters when available - Jan 30, 2012 * \f supported when using utf-8/cp437 box drawing - characters as boundary characters - 10 Jun 12, 2008 * Fixed a bug with ctrl-leftmouse (which was leaving - a space in the original selected text) - Mar 24, 2009 * :DrawIt starts, :DrawIt! stops DrawIt mode. - Mar 24, 2009 * I've included <script> modifiers to the maps to - cause rhs remapping only with mappings local to - the script (see |:map-script|) - 9 Sep 14, 2007 * Johann-Guenter Simon fixed a bug with s:DrawErase(); - it called SetDrawIt() and that call hadn't been - updated to account for the new b:di_ellipse - parameter. - 8 Feb 12, 2007 * fixed a bug which prevented multi-character user - maps from being restored properly - May 03, 2007 * Extended SetDrawIt() to handle b:di_ellipse, the - ellipse boundary drawing character - * Changed "Holer" to "Canvas", and wrote AutoCanvas(), - which allows one to use the visual-block drawing - maps without creating a canvas first. - * DrawIt implements using the ctrl-leftmouse to move - a visual-block selected region. - * Floods can now be done inside an ellipse - * DrawIt's maps are now all users of <buffer> - 7 Feb 16, 2005 * now checks that "m" is in &go before attempting to - use menus - Aug 17, 2005 * report option workaround - Nov 01, 2005 * converted DrawIt to use autoload feature of vim 7.0 - Dec 28, 2005 * now uses cecutil to save/restore user maps - Jan 18, 2006 * cecutil now updated to use keepjumps - Jan 23, 2006 * :DIstart and :DIstop commands provided; thus users - using "set noremap" can still use DrawIt. - Jan 26, 2006 * DrawIt menu entry now keeps its place - Apr 10, 2006 * Brushes were implemented - 6 Feb 24, 2003 * The latest DrawIt now provides a fill function. - \f will ask for a character to fill the figure - surrounding the current cursor location. Plus - I suggest reading :he drawit-tip for those whose - home/pageup/pagedown/end keys aren't all working - properly with DrawIt. - 08/18/03 * \p[a-z] and \r[a-z] implemented - 08/04/03 * b:..keep variables renamed to b:di_..keep variables - StopDrawIt() now insures that erase mode is off - 03/11/03 * included g:drawit_insertmode handling - 02/21/03 * included flood function - 12/11/02 * deletes trailing whitespace only if holer used - 8/27/02 * fat arrowheads included - * shift-arrow keys move but don't modify - - --------------------------------------------------------------------- -vim:tw=78:ts=8:ft=help:fdm=marker diff --git a/Editor/vim/doc/imaps.txt.gz b/Editor/vim/doc/imaps.txt.gz deleted file mode 120000 index cf5808b..0000000 --- a/Editor/vim/doc/imaps.txt.gz +++ /dev/null @@ -1 +0,0 @@ -/usr/share/vim/addons/doc/imaps.txt.gz
\ No newline at end of file diff --git a/Editor/vim/doc/latex-suite-quickstart.txt.gz b/Editor/vim/doc/latex-suite-quickstart.txt.gz deleted file mode 120000 index 5ef4db2..0000000 --- a/Editor/vim/doc/latex-suite-quickstart.txt.gz +++ /dev/null @@ -1 +0,0 @@ -/usr/share/vim/addons/doc/latex-suite-quickstart.txt.gz
\ No newline at end of file diff --git a/Editor/vim/doc/latex-suite.txt.gz b/Editor/vim/doc/latex-suite.txt.gz deleted file mode 120000 index 35c3d5a..0000000 --- a/Editor/vim/doc/latex-suite.txt.gz +++ /dev/null @@ -1 +0,0 @@ -/usr/share/vim/addons/doc/latex-suite.txt.gz
\ No newline at end of file diff --git a/Editor/vim/doc/latexhelp.txt.gz b/Editor/vim/doc/latexhelp.txt.gz deleted file mode 120000 index f8197a0..0000000 --- a/Editor/vim/doc/latexhelp.txt.gz +++ /dev/null @@ -1 +0,0 @@ -/usr/share/vim/addons/doc/latexhelp.txt.gz
\ No newline at end of file diff --git a/Editor/vim/doc/surround.txt b/Editor/vim/doc/surround.txt deleted file mode 100644 index 30a642a..0000000 --- a/Editor/vim/doc/surround.txt +++ /dev/null @@ -1,205 +0,0 @@ -*surround.txt* Plugin for deleting, changing, and adding "surroundings" - -Author: Tim Pope <http://tpo.pe/> -License: Same terms as Vim itself (see |license|) - -This plugin is only available if 'compatible' is not set. - -INTRODUCTION *surround* - -This plugin is a tool for dealing with pairs of "surroundings." Examples -of surroundings include parentheses, quotes, and HTML tags. They are -closely related to what Vim refers to as |text-objects|. Provided -are mappings to allow for removing, changing, and adding surroundings. - -Details follow on the exact semantics, but first, consider the following -examples. An asterisk (*) is used to denote the cursor position. - - Old text Command New text ~ - "Hello *world!" ds" Hello world! - [123+4*56]/2 cs]) (123+456)/2 - "Look ma, I'm *HTML!" cs"<q> <q>Look ma, I'm HTML!</q> - if *x>3 { ysW( if ( x>3 ) { - my $str = *whee!; vllllS' my $str = 'whee!'; - -While a few features of this plugin will work in older versions of Vim, -Vim 7 is recommended for full functionality. - -MAPPINGS *surround-mappings* - -Delete surroundings is *ds* . The next character given determines the target -to delete. The exact nature of the target is explained in |surround-targets| -but essentially it is the last character of a |text-object|. This mapping -deletes the difference between the "i"nner object and "a"n object. This is -easiest to understand with some examples: - - Old text Command New text ~ - "Hello *world!" ds" Hello world! - (123+4*56)/2 ds) 123+456/2 - <div>Yo!*</div> dst Yo! - -Change surroundings is *cs* . It takes two arguments, a target like with -|ds|, and a replacement. Details about the second argument can be found -below in |surround-replacements|. Once again, examples are in order. - - Old text Command New text ~ - "Hello *world!" cs"' 'Hello world!' - "Hello *world!" cs"<q> <q>Hello world!</q> - (123+4*56)/2 cs)] [123+456]/2 - (123+4*56)/2 cs)[ [ 123+456 ]/2 - <div>Yo!*</div> cst<p> <p>Yo!</p> - -*ys* takes a valid Vim motion or text object as the first object, and wraps -it using the second argument as with |cs|. (It's a stretch, but a good -mnemonic for "ys" is "you surround".) - - Old text Command New text ~ - Hello w*orld! ysiw) Hello (world)! - -As a special case, *yss* operates on the current line, ignoring leading -whitespace. - - Old text Command New text ~ - Hello w*orld! yssB {Hello world!} - -There is also *yS* and *ySS* which indent the surrounded text and place it -on a line of its own. - -In visual mode, a simple "S" with an argument wraps the selection. This is -referred to as the *vS* mapping, although ordinarily there will be -additional keystrokes between the v and S. In linewise visual mode, the -surroundings are placed on separate lines and indented. In blockwise visual -mode, each line is surrounded. - -A "gS" in visual mode, known as *vgS* , behaves similarly. In linewise visual -mode, the automatic indenting is suppressed. In blockwise visual mode, this -enables surrounding past the end of the line with 'virtualedit' set (there -seems to be no way in Vim Script to differentiate between a jagged end of line -selection and a virtual block selected past the end of the line, so two maps -were needed). - - *i_CTRL-G_s* *i_CTRL-G_S* -Finally, there is an experimental insert mode mapping on <C-G>s and <C-S>. -Beware that the latter won't work on terminals with flow control (if you -accidentally freeze your terminal, use <C-Q> to unfreeze it). The mapping -inserts the specified surroundings and puts the cursor between them. If, -immediately after the mapping and before the replacement, a second <C-S> or -carriage return is pressed, the prefix, cursor, and suffix will be placed on -three separate lines. <C-G>S (not <C-G>s) also exhibits this behavior. - -TARGETS *surround-targets* - -The |ds| and |cs| commands both take a target as their first argument. The -possible targets are based closely on the |text-objects| provided by Vim. -All targets are currently just one character. - -Eight punctuation marks, (, ), {, }, [, ], <, and >, represent themselves -and their counterparts. If the opening mark is used, contained whitespace is -also trimmed. The targets b, B, r, and a are aliases for ), }, ], and > -(the first two mirror Vim; the second two are completely arbitrary and -subject to change). - -Three quote marks, ', ", `, represent themselves, in pairs. They are only -searched for on the current line. - -A t is a pair of HTML or XML tags. See |tag-blocks| for details. Remember -that you can specify a numerical argument if you want to get to a tag other -than the innermost one. - -The letters w, W, and s correspond to a |word|, a |WORD|, and a |sentence|, -respectively. These are special in that they have nothing to delete, and -used with |ds| they are a no-op. With |cs|, one could consider them a -slight shortcut for ysi (cswb == ysiwb, more or less). - -A p represents a |paragraph|. This behaves similarly to w, W, and s above; -however, newlines are sometimes added and/or removed. - -REPLACEMENTS *surround-replacements* - -A replacement argument is a single character, and is required by |cs|, |ys|, -and |vS|. Undefined replacement characters (with the exception of alphabetic -characters) default to placing themselves at the beginning and end of the -destination, which can be useful for characters like / and |. - -If either ), }, ], or > is used, the text is wrapped in the appropriate pair -of characters. Similar behavior can be found with (, {, and [ (but not <), -which append an additional space to the inside. Like with the targets above, -b, B, r, and a are aliases for ), }, ], and >. To fulfill the common need for -code blocks in C-style languages, <C-}> (which is really <C-]>) adds braces on -lines separate from the content. - -If t or < is used, Vim prompts for an HTML/XML tag to insert. You may specify -attributes here and they will be stripped from the closing tag. End your -input by pressing <CR> or >. If <C-T> is used, the tags will appear on lines -by themselves. - -If s is used, a leading but not trailing space is added. This is useful for -removing parentheses from a function call with csbs. - -CUSTOMIZING *surround-customizing* - -The following adds a potential replacement on "-" (ASCII 45) in PHP files. -(To determine the ASCII code to use, :echo char2nr("-")). The carriage -return will be replaced by the original text. -> - autocmd FileType php let b:surround_45 = "<?php \r ?>" -< -This can be used in a PHP file as in the following example. - - Old text Command New text ~ - print "Hello *world!" yss- <?php print "Hello world!" ?> - -Additionally, one can use a global variable for globally available -replacements. -> - let g:surround_45 = "<% \r %>" - let g:surround_61 = "<%= \r %>" -< -Advanced, experimental, and subject to change: One can also prompt for -replacement text. The syntax for this is to surround the replacement in pairs -of low numbered control characters. If this sounds confusing, that's because -it is (but it makes the parsing easy). Consider the following example for a -LaTeX environment on the "l" replacement. -> - let g:surround_108 = "\\begin{\1environment: \1}\r\\end{\1\1}" -< -When this replacement is used, the user is prompted with an "environment: " -prompt for input. This input is inserted between each set of \1's. -Additional inputs up to \7 can be used. - -Furthermore, one can specify a regular expression substitution to apply. -> - let g:surround_108 = "\\begin{\1environment: \1}\r\\end{\1\r}.*\r\1}" -< -This will remove anything after the first } in the input when the text is -placed within the \end{} slot. The first \r marks where the pattern begins, -and the second where the replacement text begins. - -Here's a second example for creating an HTML <div>. The substitution cleverly -prompts for an id, but only adds id="" if it is non-blank. You may have to -read this one a few times slowly before you understand it. -> - let g:surround_{char2nr("d")} = "<div\1id: \r..*\r id=\"&\"\1>\r</div>" -< -Inputting text replacements is a proof of concept at this point. The ugly, -unintuitive interface and the brevity of the documentation reflect this. - -Finally, It is possible to always append a string to surroundings in insert -mode (and only insert mode). This is useful with certain plugins and mappings -that allow you to jump to such markings. -> - let g:surround_insert_tail = "<++>" -< -ISSUES *surround-issues* - -Vim could potentially get confused when deleting/changing occurs at the very -end of the line. Please report any repeatable instances of this. - -Do we need to use |inputsave()|/|inputrestore()| with the tag replacement? - -Indenting is handled haphazardly. Need to decide the most appropriate -behavior and implement it. Right now one can do :let b:surround_indent = 1 -(or the global equivalent) to enable automatic re-indenting by Vim via |=|; -should this be the default? - - vim:tw=78:ts=8:ft=help:norl: diff --git a/Editor/vim/doc/tags b/Editor/vim/doc/tags deleted file mode 100644 index 54ecdda..0000000 --- a/Editor/vim/doc/tags +++ /dev/null @@ -1,56 +0,0 @@ -cs surround.txt /*cs* -drawit DrawIt.txt /*drawit* -drawit-DIdbl DrawIt.txt /*drawit-DIdbl* -drawit-DInrml DrawIt.txt /*drawit-DInrml* -drawit-DIsngl DrawIt.txt /*drawit-DIsngl* -drawit-DIstart DrawIt.txt /*drawit-DIstart* -drawit-DrawIt DrawIt.txt /*drawit-DrawIt* -drawit-\di DrawIt.txt /*drawit-\\di* -drawit-a DrawIt.txt /*drawit-a* -drawit-b DrawIt.txt /*drawit-b* -drawit-brush DrawIt.txt /*drawit-brush* -drawit-c DrawIt.txt /*drawit-c* -drawit-contents DrawIt.txt /*drawit-contents* -drawit-dbl DrawIt.txt /*drawit-dbl* -drawit-drawing DrawIt.txt /*drawit-drawing* -drawit-e DrawIt.txt /*drawit-e* -drawit-erase DrawIt.txt /*drawit-erase* -drawit-example DrawIt.txt /*drawit-example* -drawit-f DrawIt.txt /*drawit-f* -drawit-history DrawIt.txt /*drawit-history* -drawit-l DrawIt.txt /*drawit-l* -drawit-manual DrawIt.txt /*drawit-manual* -drawit-modes DrawIt.txt /*drawit-modes* -drawit-move DrawIt.txt /*drawit-move* -drawit-moving DrawIt.txt /*drawit-moving* -drawit-options DrawIt.txt /*drawit-options* -drawit-protect DrawIt.txt /*drawit-protect* -drawit-s DrawIt.txt /*drawit-s* -drawit-setbrush DrawIt.txt /*drawit-setbrush* -drawit-setdrawit DrawIt.txt /*drawit-setdrawit* -drawit-sngl DrawIt.txt /*drawit-sngl* -drawit-start DrawIt.txt /*drawit-start* -drawit-stop DrawIt.txt /*drawit-stop* -drawit-tip DrawIt.txt /*drawit-tip* -drawit-unicode DrawIt.txt /*drawit-unicode* -drawit-usage DrawIt.txt /*drawit-usage* -drawit-utf16 DrawIt.txt /*drawit-utf16* -drawit-utf8 DrawIt.txt /*drawit-utf8* -drawit-visblock DrawIt.txt /*drawit-visblock* -ds surround.txt /*ds* -g:drawit_insertmode DrawIt.txt /*g:drawit_insertmode* -i_CTRL-G_S surround.txt /*i_CTRL-G_S* -i_CTRL-G_s surround.txt /*i_CTRL-G_s* -surround surround.txt /*surround* -surround-customizing surround.txt /*surround-customizing* -surround-issues surround.txt /*surround-issues* -surround-mappings surround.txt /*surround-mappings* -surround-replacements surround.txt /*surround-replacements* -surround-targets surround.txt /*surround-targets* -surround.txt surround.txt /*surround.txt* -vS surround.txt /*vS* -vgS surround.txt /*vgS* -yS surround.txt /*yS* -ySS surround.txt /*ySS* -ys surround.txt /*ys* -yss surround.txt /*yss* diff --git a/Editor/vim/filetype.vim b/Editor/vim/filetype.vim deleted file mode 100644 index 357aa24..0000000 --- a/Editor/vim/filetype.vim +++ /dev/null @@ -1,4 +0,0 @@ -augroup filetypedetect - " Mail - autocmd BufRead,BufNewFile *mutt-* setfiletype mail -augroup END diff --git a/Editor/vim/plugin/cecutil.vim b/Editor/vim/plugin/cecutil.vim deleted file mode 100644 index b720044..0000000 --- a/Editor/vim/plugin/cecutil.vim +++ /dev/null @@ -1,536 +0,0 @@ -" cecutil.vim : save/restore window position -" save/restore mark position -" save/restore selected user maps -" Author: Charles E. Campbell -" Version: 18i NOT RELEASED -" Date: Oct 21, 2013 -" -" Saving Restoring Destroying Marks: {{{1 -" call SaveMark(markname) let savemark= SaveMark(markname) -" call RestoreMark(markname) call RestoreMark(savemark) -" call DestroyMark(markname) -" commands: SM RM DM -" -" Saving Restoring Destroying Window Position: {{{1 -" call SaveWinPosn() let winposn= SaveWinPosn() -" call RestoreWinPosn() call RestoreWinPosn(winposn) -" \swp : save current window/buffer's position -" \rwp : restore current window/buffer's previous position -" commands: SWP RWP -" -" Saving And Restoring User Maps: {{{1 -" call SaveUserMaps(mapmode,maplead,mapchx,suffix) -" call RestoreUserMaps(suffix) -" -" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim -" -" You believe that God is one. You do well. The demons also {{{1 -" believe, and shudder. But do you want to know, vain man, that -" faith apart from works is dead? (James 2:19,20 WEB) -"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore() - -" --------------------------------------------------------------------- -" Load Once: {{{1 -if &cp || exists("g:loaded_cecutil") - finish -endif -let g:loaded_cecutil = "v18h" -let s:keepcpo = &cpo -set cpo&vim -"DechoRemOn - -" ======================= -" Public Interface: {{{1 -" ======================= - -" --------------------------------------------------------------------- -" Map Interface: {{{2 -if !hasmapto('<Plug>SaveWinPosn') - map <unique> <Leader>swp <Plug>SaveWinPosn -endif -if !hasmapto('<Plug>RestoreWinPosn') - map <unique> <Leader>rwp <Plug>RestoreWinPosn -endif -nmap <silent> <Plug>SaveWinPosn :call SaveWinPosn()<CR> -nmap <silent> <Plug>RestoreWinPosn :call RestoreWinPosn()<CR> - -" --------------------------------------------------------------------- -" Command Interface: {{{2 -com! -bar -nargs=0 SWP call SaveWinPosn() -com! -bar -nargs=? RWP call RestoreWinPosn(<args>) -com! -bar -nargs=1 SM call SaveMark(<q-args>) -com! -bar -nargs=1 RM call RestoreMark(<q-args>) -com! -bar -nargs=1 DM call DestroyMark(<q-args>) - -com! -bar -nargs=1 WLR call s:WinLineRestore(<q-args>) - -if v:version < 630 - let s:modifier= "sil! " -else - let s:modifier= "sil! keepj " -endif - -" =============== -" Functions: {{{1 -" =============== - -" --------------------------------------------------------------------- -" SaveWinPosn: {{{2 -" let winposn= SaveWinPosn() will save window position in winposn variable -" call SaveWinPosn() will save window position in b:cecutil_winposn{b:cecutil_iwinposn} -" let winposn= SaveWinPosn(0) will *only* save window position in winposn variable (no stacking done) -fun! SaveWinPosn(...) -" echomsg "Decho: SaveWinPosn() a:0=".a:0 - if line("$") == 1 && getline(1) == "" -" echomsg "Decho: SaveWinPosn : empty buffer" - return "" - endif - let so_keep = &l:so - let siso_keep = &siso - let ss_keep = &l:ss - setlocal so=0 siso=0 ss=0 - - let swline = line(".") " save-window line in file - let swcol = col(".") " save-window column in file - if swcol >= col("$") - let swcol= swcol + virtcol(".") - virtcol("$") " adjust for virtual edit (cursor past end-of-line) - endif - let swwline = winline() - 1 " save-window window line - let swwcol = virtcol(".") - wincol() " save-window window column - let savedposn = "" -" echomsg "Decho: sw[".swline.",".swcol."] sww[".swwline.",".swwcol."]" - let savedposn = "call GoWinbufnr(".winbufnr(0).")" - let savedposn = savedposn."|".s:modifier.swline - let savedposn = savedposn."|".s:modifier."norm! 0z\<cr>" - if swwline > 0 - let savedposn= savedposn.":".s:modifier."call s:WinLineRestore(".(swwline+1).")\<cr>" - endif - if swwcol > 0 - let savedposn= savedposn.":".s:modifier."norm! 0".swwcol."zl\<cr>" - endif - let savedposn = savedposn.":".s:modifier."call cursor(".swline.",".swcol.")\<cr>" - - " save window position in - " b:cecutil_winposn_{iwinposn} (stack) - " only when SaveWinPosn() is used - if a:0 == 0 - if !exists("b:cecutil_iwinposn") - let b:cecutil_iwinposn= 1 - else - let b:cecutil_iwinposn= b:cecutil_iwinposn + 1 - endif -" echomsg "Decho: saving posn to SWP stack" - let b:cecutil_winposn{b:cecutil_iwinposn}= savedposn - endif - - let &l:so = so_keep - let &siso = siso_keep - let &l:ss = ss_keep - -" if exists("b:cecutil_iwinposn") " Decho -" echomsg "Decho: b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]" -" else " Decho -" echomsg "Decho: b:cecutil_iwinposn doesn't exist" -" endif " Decho -" echomsg "Decho: SaveWinPosn [".savedposn."]" - return savedposn -endfun - -" --------------------------------------------------------------------- -" RestoreWinPosn: {{{2 -" call RestoreWinPosn() -" call RestoreWinPosn(winposn) -fun! RestoreWinPosn(...) -" echomsg "Decho: RestoreWinPosn() a:0=".a:0 -" echomsg "Decho: getline(1)<".getline(1).">" -" echomsg "Decho: line(.)=".line(".") - if line("$") == 1 && getline(1) == "" -" echomsg "Decho: RestoreWinPosn : empty buffer" - return "" - endif - let so_keep = &l:so - let siso_keep = &l:siso - let ss_keep = &l:ss - setlocal so=0 siso=0 ss=0 - - if a:0 == 0 || a:1 == "" - " use saved window position in b:cecutil_winposn{b:cecutil_iwinposn} if it exists - if exists("b:cecutil_iwinposn") && exists("b:cecutil_winposn{b:cecutil_iwinposn}") -" echomsg "Decho: using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">" - try - exe s:modifier.b:cecutil_winposn{b:cecutil_iwinposn} - catch /^Vim\%((\a\+)\)\=:E749/ - " ignore empty buffer error messages - endtry - " normally drop top-of-stack by one - " but while new top-of-stack doesn't exist - " drop top-of-stack index by one again - if b:cecutil_iwinposn >= 1 - unlet b:cecutil_winposn{b:cecutil_iwinposn} - let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 - while b:cecutil_iwinposn >= 1 && !exists("b:cecutil_winposn{b:cecutil_iwinposn}") - let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 - endwhile - if b:cecutil_iwinposn < 1 - unlet b:cecutil_iwinposn - endif - endif - else - echohl WarningMsg - echomsg "***warning*** need to SaveWinPosn first!" - echohl None - endif - - else " handle input argument -" echomsg "Decho: using input a:1<".a:1.">" - " use window position passed to this function - exe a:1 - " remove a:1 pattern from b:cecutil_winposn{b:cecutil_iwinposn} stack - if exists("b:cecutil_iwinposn") - let jwinposn= b:cecutil_iwinposn - while jwinposn >= 1 " search for a:1 in iwinposn..1 - if exists("b:cecutil_winposn{jwinposn}") " if it exists - if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches - unlet b:cecutil_winposn{jwinposn} " unlet it - if jwinposn == b:cecutil_iwinposn " if at top-of-stack - let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one - endif - endif - endif - let jwinposn= jwinposn - 1 - endwhile - endif - endif - - " Seems to be something odd: vertical motions after RWP - " cause jump to first column. The following fixes that. - " Note: was using wincol()>1, but with signs, a cursor - " at column 1 yields wincol()==3. Beeping ensued. - let vekeep= &ve - set ve=all - if virtcol('.') > 1 - exe s:modifier."norm! hl" - elseif virtcol(".") < virtcol("$") - exe s:modifier."norm! lh" - endif - let &ve= vekeep - - let &l:so = so_keep - let &l:siso = siso_keep - let &l:ss = ss_keep - -" echomsg "Decho: RestoreWinPosn" -endfun - -" --------------------------------------------------------------------- -" s:WinLineRestore: {{{2 -fun! s:WinLineRestore(swwline) -" echomsg "Decho: s:WinLineRestore(swwline=".a:swwline.")" - while winline() < a:swwline - let curwinline= winline() - exe s:modifier."norm! \<c-y>" - if curwinline == winline() - break - endif - endwhile -" echomsg "Decho: s:WinLineRestore" -endfun - -" --------------------------------------------------------------------- -" GoWinbufnr: go to window holding given buffer (by number) {{{2 -" Prefers current window; if its buffer number doesn't match, -" then will try from topleft to bottom right -fun! GoWinbufnr(bufnum) -" call Dfunc("GoWinbufnr(".a:bufnum.")") - if winbufnr(0) == a:bufnum -" call Dret("GoWinbufnr : winbufnr(0)==a:bufnum") - return - endif - winc t - let first=1 - while winbufnr(0) != a:bufnum && (first || winnr() != 1) - winc w - let first= 0 - endwhile -" call Dret("GoWinbufnr") -endfun - -" --------------------------------------------------------------------- -" SaveMark: sets up a string saving a mark position. {{{2 -" For example, SaveMark("a") -" Also sets up a global variable, g:savemark_{markname} -fun! SaveMark(markname) -" call Dfunc("SaveMark(markname<".a:markname.">)") - let markname= a:markname - if strpart(markname,0,1) !~ '\a' - let markname= strpart(markname,1,1) - endif -" call Decho("markname=".markname) - - let lzkeep = &lz - set lz - - if 1 <= line("'".markname) && line("'".markname) <= line("$") - let winposn = SaveWinPosn(0) - exe s:modifier."norm! `".markname - let savemark = SaveWinPosn(0) - let g:savemark_{markname} = savemark - let savemark = markname.savemark - call RestoreWinPosn(winposn) - else - let g:savemark_{markname} = "" - let savemark = "" - endif - - let &lz= lzkeep - -" call Dret("SaveMark : savemark<".savemark.">") - return savemark -endfun - -" --------------------------------------------------------------------- -" RestoreMark: {{{2 -" call RestoreMark("a") -or- call RestoreMark(savemark) -fun! RestoreMark(markname) -" call Dfunc("RestoreMark(markname<".a:markname.">)") - - if strlen(a:markname) <= 0 -" call Dret("RestoreMark : no such mark") - return - endif - let markname= strpart(a:markname,0,1) - if markname !~ '\a' - " handles 'a -> a styles - let markname= strpart(a:markname,1,1) - endif -" call Decho("markname=".markname." strlen(a:markname)=".strlen(a:markname)) - - let lzkeep = &lz - set lz - let winposn = SaveWinPosn(0) - - if strlen(a:markname) <= 2 - if exists("g:savemark_{markname}") && strlen(g:savemark_{markname}) != 0 - " use global variable g:savemark_{markname} -" call Decho("use savemark list") - call RestoreWinPosn(g:savemark_{markname}) - exe "norm! m".markname - endif - else - " markname is a savemark command (string) -" call Decho("use savemark command") - let markcmd= strpart(a:markname,1) - call RestoreWinPosn(markcmd) - exe "norm! m".markname - endif - - call RestoreWinPosn(winposn) - let &lz = lzkeep - -" call Dret("RestoreMark") -endfun - -" --------------------------------------------------------------------- -" DestroyMark: {{{2 -" call DestroyMark("a") -- destroys mark -fun! DestroyMark(markname) -" call Dfunc("DestroyMark(markname<".a:markname.">)") - - " save options and set to standard values - let reportkeep= &report - let lzkeep = &lz - set lz report=10000 - - let markname= strpart(a:markname,0,1) - if markname !~ '\a' - " handles 'a -> a styles - let markname= strpart(a:markname,1,1) - endif -" call Decho("markname=".markname) - - let curmod = &mod - let winposn = SaveWinPosn(0) - 1 - let lineone = getline(".") - exe "k".markname - d - put! =lineone - let &mod = curmod - call RestoreWinPosn(winposn) - - " restore options to user settings - let &report = reportkeep - let &lz = lzkeep - -" call Dret("DestroyMark") -endfun - -" --------------------------------------------------------------------- -" QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{2 -" However, <q-args> doesn't split at all, so this one returns a list -" with splits at all whitespace (only!), plus a leading length-of-list. -" The resulting list: qarglist[0] corresponds to a:0 -" qarglist[i] corresponds to a:{i} -fun! QArgSplitter(qarg) -" call Dfunc("QArgSplitter(qarg<".a:qarg.">)") - let qarglist = split(a:qarg) - let qarglistlen = len(qarglist) - let qarglist = insert(qarglist,qarglistlen) -" call Dret("QArgSplitter ".string(qarglist)) - return qarglist -endfun - -" --------------------------------------------------------------------- -" ListWinPosn: {{{2 -"fun! ListWinPosn() " Decho -" if !exists("b:cecutil_iwinposn") || b:cecutil_iwinposn == 0 " Decho -" call Decho("nothing on SWP stack") " Decho -" else " Decho -" let jwinposn= b:cecutil_iwinposn " Decho -" while jwinposn >= 1 " Decho -" if exists("b:cecutil_winposn{jwinposn}") " Decho -" call Decho("winposn{".jwinposn."}<".b:cecutil_winposn{jwinposn}.">") " Decho -" else " Decho -" call Decho("winposn{".jwinposn."} -- doesn't exist") " Decho -" endif " Decho -" let jwinposn= jwinposn - 1 " Decho -" endwhile " Decho -" endif " Decho -"endfun " Decho -"com! -nargs=0 LWP call ListWinPosn() " Decho - -" --------------------------------------------------------------------- -" SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{2 -" which can be used to restore user maps later with -" call RestoreUserMaps() -" -" mapmode - see :help maparg for details (n v o i c l "") -" ex. "n" = Normal -" The letters "b" and "u" are optional prefixes; -" The "u" means that the map will also be unmapped -" The "b" means that the map has a <buffer> qualifier -" ex. "un" = Normal + unmapping -" ex. "bn" = Normal + <buffer> -" ex. "bun" = Normal + <buffer> + unmapping -" ex. "ubn" = Normal + <buffer> + unmapping -" maplead - see mapchx -" mapchx - "<something>" handled as a single map item. -" ex. "<left>" -" - "string" a string of single letters which are actually -" multiple two-letter maps (using the maplead: -" maplead . each_character_in_string) -" ex. maplead="\" and mapchx="abc" saves user mappings for -" \a, \b, and \c -" Of course, if maplead is "", then for mapchx="abc", -" mappings for a, b, and c are saved. -" - :something handled as a single map item, w/o the ":" -" ex. mapchx= ":abc" will save a mapping for "abc" -" suffix - a string unique to your plugin -" ex. suffix= "DrawIt" -fun! SaveUserMaps(mapmode,maplead,mapchx,suffix) -" call Dfunc("SaveUserMaps(mapmode<".a:mapmode."> maplead<".a:maplead."> mapchx<".a:mapchx."> suffix<".a:suffix.">)") - - if !exists("s:restoremap_{a:suffix}") - " initialize restoremap_suffix to null string - let s:restoremap_{a:suffix}= "" - endif - - " set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u") - " if 0, save only - let mapmode = a:mapmode - let dounmap = 0 - let dobuffer = "" - while mapmode =~ '^[bu]' - if mapmode =~ '^u' - let dounmap = 1 - let mapmode = strpart(a:mapmode,1) - elseif mapmode =~ '^b' - let dobuffer = "<buffer> " - let mapmode = strpart(a:mapmode,1) - endif - endwhile -" call Decho("dounmap=".dounmap." dobuffer<".dobuffer.">") - - " save single map :...something... - if strpart(a:mapchx,0,1) == ':' -" call Decho("save single map :...something...") - let amap= strpart(a:mapchx,1) - if amap == "|" || amap == "\<c-v>" - let amap= "\<c-v>".amap - endif - let amap = a:maplead.amap - let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:sil! ".mapmode."unmap ".dobuffer.amap - if maparg(amap,mapmode) != "" - let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge') - let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".dobuffer.amap." ".maprhs - endif - if dounmap - exe "sil! ".mapmode."unmap ".dobuffer.amap - endif - - " save single map <something> - elseif strpart(a:mapchx,0,1) == '<' -" call Decho("save single map <something>") - let amap = a:mapchx - if amap == "|" || amap == "\<c-v>" - let amap= "\<c-v>".amap -" call Decho("amap[[".amap."]]") - endif - let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap - if maparg(a:mapchx,mapmode) != "" - let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge') - let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs - endif - if dounmap - exe "sil! ".mapmode."unmap ".dobuffer.amap - endif - - " save multiple maps - else -" call Decho("save multiple maps") - let i= 1 - while i <= strlen(a:mapchx) - let amap= a:maplead.strpart(a:mapchx,i-1,1) - if amap == "|" || amap == "\<c-v>" - let amap= "\<c-v>".amap - endif - let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap - if maparg(amap,mapmode) != "" - let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge') - let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs - endif - if dounmap - exe "sil! ".mapmode."unmap ".dobuffer.amap - endif - let i= i + 1 - endwhile - endif -" call Dret("SaveUserMaps : restoremap_".a:suffix.": ".s:restoremap_{a:suffix}) -endfun - -" --------------------------------------------------------------------- -" RestoreUserMaps: {{{2 -" Used to restore user maps saved by SaveUserMaps() -fun! RestoreUserMaps(suffix) -" call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)") - if exists("s:restoremap_{a:suffix}") - let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e') - if s:restoremap_{a:suffix} != "" -" call Decho("exe ".s:restoremap_{a:suffix}) - exe "sil! ".s:restoremap_{a:suffix} - endif - unlet s:restoremap_{a:suffix} - endif -" call Dret("RestoreUserMaps") -endfun - -" ============== -" Restore: {{{1 -" ============== -let &cpo= s:keepcpo -unlet s:keepcpo - -" ================ -" Modelines: {{{1 -" ================ -" vim: ts=4 fdm=marker diff --git a/Editor/vim/plugin/surround.vim b/Editor/vim/plugin/surround.vim deleted file mode 100644 index 05b1c5c..0000000 --- a/Editor/vim/plugin/surround.vim +++ /dev/null @@ -1,588 +0,0 @@ -" surround.vim - Surroundings -" Author: Tim Pope <http://tpo.pe/> -" Version: 2.0 -" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim - -if exists("g:loaded_surround") || &cp || v:version < 700 - finish -endif -let g:loaded_surround = 1 - -" Input functions {{{1 - -function! s:getchar() - let c = getchar() - if c =~ '^\d\+$' - let c = nr2char(c) - endif - return c -endfunction - -function! s:inputtarget() - let c = s:getchar() - while c =~ '^\d\+$' - let c .= s:getchar() - endwhile - if c == " " - let c .= s:getchar() - endif - if c =~ "\<Esc>\|\<C-C>\|\0" - return "" - else - return c - endif -endfunction - -function! s:inputreplacement() - let c = s:getchar() - if c == " " - let c .= s:getchar() - endif - if c =~ "\<Esc>" || c =~ "\<C-C>" - return "" - else - return c - endif -endfunction - -function! s:beep() - exe "norm! \<Esc>" - return "" -endfunction - -function! s:redraw() - redraw - return "" -endfunction - -" }}}1 - -" Wrapping functions {{{1 - -function! s:extractbefore(str) - if a:str =~ '\r' - return matchstr(a:str,'.*\ze\r') - else - return matchstr(a:str,'.*\ze\n') - endif -endfunction - -function! s:extractafter(str) - if a:str =~ '\r' - return matchstr(a:str,'\r\zs.*') - else - return matchstr(a:str,'\n\zs.*') - endif -endfunction - -function! s:fixindent(str,spc) - let str = substitute(a:str,'\t',repeat(' ',&sw),'g') - let spc = substitute(a:spc,'\t',repeat(' ',&sw),'g') - let str = substitute(str,'\(\n\|\%^\).\@=','\1'.spc,'g') - if ! &et - let str = substitute(str,'\s\{'.&ts.'\}',"\t",'g') - endif - return str -endfunction - -function! s:process(string) - let i = 0 - for i in range(7) - let repl_{i} = '' - let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i)) - if m != '' - let m = substitute(strpart(m,1),'\r.*','','') - let repl_{i} = input(substitute(m,':\s*$','','').': ') - endif - endfor - let s = "" - let i = 0 - while i < strlen(a:string) - let char = strpart(a:string,i,1) - if char2nr(char) < 8 - let next = stridx(a:string,char,i+1) - if next == -1 - let s .= char - else - let insertion = repl_{char2nr(char)} - let subs = strpart(a:string,i+1,next-i-1) - let subs = matchstr(subs,'\r.*') - while subs =~ '^\r.*\r' - let sub = matchstr(subs,"^\r\\zs[^\r]*\r[^\r]*") - let subs = strpart(subs,strlen(sub)+1) - let r = stridx(sub,"\r") - let insertion = substitute(insertion,strpart(sub,0,r),strpart(sub,r+1),'') - endwhile - let s .= insertion - let i = next - endif - else - let s .= char - endif - let i += 1 - endwhile - return s -endfunction - -function! s:wrap(string,char,type,...) - let keeper = a:string - let newchar = a:char - let s:tag = "" - let type = a:type - let linemode = type ==# 'V' ? 1 : 0 - let special = a:0 ? a:1 : 0 - let before = "" - let after = "" - if type ==# "V" - let initspaces = matchstr(keeper,'\%^\s*') - else - let initspaces = matchstr(getline('.'),'\%^\s*') - endif - let pairs = "b()B{}r[]a<>" - let extraspace = "" - if newchar =~ '^ ' - let newchar = strpart(newchar,1) - let extraspace = ' ' - endif - let idx = stridx(pairs,newchar) - if newchar == ' ' - let before = '' - let after = '' - elseif exists("b:surround_".char2nr(newchar)) - let all = s:process(b:surround_{char2nr(newchar)}) - let before = s:extractbefore(all) - let after = s:extractafter(all) - elseif exists("g:surround_".char2nr(newchar)) - let all = s:process(g:surround_{char2nr(newchar)}) - let before = s:extractbefore(all) - let after = s:extractafter(all) - elseif newchar ==# "p" - let before = "\n" - let after = "\n\n" - elseif newchar ==# 's' - let before = ' ' - let after = '' - elseif newchar ==# ':' - let before = ':' - let after = '' - elseif newchar =~# "[tT\<C-T><,]" - let dounmapp = 0 - let dounmapb = 0 - if !maparg(">","c") - let dounmapb = 1 - " Hide from AsNeeded - exe "cn"."oremap > <CR>" - endif - let default = "" - if newchar ==# "T" - if !exists("s:lastdel") - let s:lastdel = "" - endif - let default = matchstr(s:lastdel,'<\zs.\{-\}\ze>') - endif - let tag = input("<",default) - echo "<".substitute(tag,'>*$','>','') - if dounmapb - silent! cunmap > - endif - let s:tag = tag - if tag != "" - let tag = substitute(tag,'>*$','','') - let s:tag = tag . '>' - let before = '<'.tag.'>' - if tag =~ '/$' - let after = '' - else - let after = '</'.substitute(tag,' .*','','').'>' - endif - if newchar == "\<C-T>" || newchar == "," - if type ==# "v" || type ==# "V" - let before .= "\n\t" - endif - if type ==# "v" - let after = "\n". after - endif - endif - endif - elseif newchar ==# 'l' || newchar == '\' - " LaTeX - let env = input('\begin{') - let env = '{' . env - let env .= s:closematch(env) - echo '\begin'.env - if env != "" - let before = '\begin'.env - let after = '\end'.matchstr(env,'[^}]*').'}' - endif - elseif newchar ==# 'f' || newchar ==# 'F' - let fnc = input('function: ') - if fnc != "" - let before = substitute(fnc,'($','','').'(' - let after = ')' - if newchar ==# 'F' - let before .= ' ' - let after = ' ' . after - endif - endif - elseif newchar ==# "\<C-F>" - let fnc = input('function: ') - let before = '('.fnc.' ' - let after = ')' - elseif idx >= 0 - let spc = (idx % 3) == 1 ? " " : "" - let idx = idx / 3 * 3 - let before = strpart(pairs,idx+1,1) . spc - let after = spc . strpart(pairs,idx+2,1) - elseif newchar == "\<C-[>" || newchar == "\<C-]>" - let before = "{\n\t" - let after = "\n}" - elseif newchar !~ '\a' - let before = newchar - let after = newchar - else - let before = '' - let after = '' - endif - let after = substitute(after ,'\n','\n'.initspaces,'g') - if type ==# 'V' || (special && type ==# "v") - let before = substitute(before,' \+$','','') - let after = substitute(after ,'^ \+','','') - if after !~ '^\n' - let after = initspaces.after - endif - if keeper !~ '\n$' && after !~ '^\n' - let keeper .= "\n" - elseif keeper =~ '\n$' && after =~ '^\n' - let after = strpart(after,1) - endif - if before !~ '\n\s*$' - let before .= "\n" - if special - let before .= "\t" - endif - endif - endif - if type ==# 'V' - let before = initspaces.before - endif - if before =~ '\n\s*\%$' - if type ==# 'v' - let keeper = initspaces.keeper - endif - let padding = matchstr(before,'\n\zs\s\+\%$') - let before = substitute(before,'\n\s\+\%$','\n','') - let keeper = s:fixindent(keeper,padding) - endif - if type ==# 'V' - let keeper = before.keeper.after - elseif type =~ "^\<C-V>" - " Really we should be iterating over the buffer - let repl = substitute(before,'[\\~]','\\&','g').'\1'.substitute(after,'[\\~]','\\&','g') - let repl = substitute(repl,'\n',' ','g') - let keeper = substitute(keeper."\n",'\(.\{-\}\)\(\n\)',repl.'\n','g') - let keeper = substitute(keeper,'\n\%$','','') - else - let keeper = before.extraspace.keeper.extraspace.after - endif - return keeper -endfunction - -function! s:wrapreg(reg,char,...) - let orig = getreg(a:reg) - let type = substitute(getregtype(a:reg),'\d\+$','','') - let special = a:0 ? a:1 : 0 - let new = s:wrap(orig,a:char,type,special) - call setreg(a:reg,new,type) -endfunction -" }}}1 - -function! s:insert(...) " {{{1 - " Optional argument causes the result to appear on 3 lines, not 1 - let linemode = a:0 ? a:1 : 0 - let char = s:inputreplacement() - while char == "\<CR>" || char == "\<C-S>" - " TODO: use total count for additional blank lines - let linemode += 1 - let char = s:inputreplacement() - endwhile - if char == "" - return "" - endif - let cb_save = &clipboard - set clipboard-=unnamed clipboard-=unnamedplus - let reg_save = @@ - call setreg('"',"\r",'v') - call s:wrapreg('"',char,linemode) - " If line mode is used and the surrounding consists solely of a suffix, - " remove the initial newline. This fits a use case of mine but is a - " little inconsistent. Is there anyone that would prefer the simpler - " behavior of just inserting the newline? - if linemode && match(getreg('"'),'^\n\s*\zs.*') == 0 - call setreg('"',matchstr(getreg('"'),'^\n\s*\zs.*'),getregtype('"')) - endif - " This can be used to append a placeholder to the end - if exists("g:surround_insert_tail") - call setreg('"',g:surround_insert_tail,"a".getregtype('"')) - endif - if col('.') >= col('$') - norm! ""p - else - norm! ""P - endif - if linemode - call s:reindent() - endif - norm! `] - call search('\r','bW') - let @@ = reg_save - let &clipboard = cb_save - return "\<Del>" -endfunction " }}}1 - -function! s:reindent() " {{{1 - if exists("b:surround_indent") ? b:surround_indent : (!exists("g:surround_indent") || g:surround_indent) - silent norm! '[='] - endif -endfunction " }}}1 - -function! s:dosurround(...) " {{{1 - let scount = v:count1 - let char = (a:0 ? a:1 : s:inputtarget()) - let spc = "" - if char =~ '^\d\+' - let scount = scount * matchstr(char,'^\d\+') - let char = substitute(char,'^\d\+','','') - endif - if char =~ '^ ' - let char = strpart(char,1) - let spc = 1 - endif - if char == 'a' - let char = '>' - endif - if char == 'r' - let char = ']' - endif - let newchar = "" - if a:0 > 1 - let newchar = a:2 - if newchar == "\<Esc>" || newchar == "\<C-C>" || newchar == "" - return s:beep() - endif - endif - let cb_save = &clipboard - set clipboard-=unnamed clipboard-=unnamedplus - let append = "" - let original = getreg('"') - let otype = getregtype('"') - call setreg('"',"") - let strcount = (scount == 1 ? "" : scount) - if char == '/' - exe 'norm! '.strcount.'[/d'.strcount.']/' - elseif char =~# '[[:punct:]]' && char !~# '[][(){}<>"''`]' - exe 'norm! T'.char - if getline('.')[col('.')-1] == char - exe 'norm! l' - endif - exe 'norm! dt'.char - else - exe 'norm! d'.strcount.'i'.char - endif - let keeper = getreg('"') - let okeeper = keeper " for reindent below - if keeper == "" - call setreg('"',original,otype) - let &clipboard = cb_save - return "" - endif - let oldline = getline('.') - let oldlnum = line('.') - if char ==# "p" - call setreg('"','','V') - elseif char ==# "s" || char ==# "w" || char ==# "W" - " Do nothing - call setreg('"','') - elseif char =~ "[\"'`]" - exe "norm! i \<Esc>d2i".char - call setreg('"',substitute(getreg('"'),' ','','')) - elseif char == '/' - norm! "_x - call setreg('"','/**/',"c") - let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','') - elseif char =~# '[[:punct:]]' && char !~# '[][(){}<>]' - exe 'norm! F'.char - exe 'norm! df'.char - else - " One character backwards - call search('.','bW') - exe "norm! da".char - endif - let removed = getreg('"') - let rem2 = substitute(removed,'\n.*','','') - let oldhead = strpart(oldline,0,strlen(oldline)-strlen(rem2)) - let oldtail = strpart(oldline, strlen(oldline)-strlen(rem2)) - let regtype = getregtype('"') - if char =~# '[\[({<T]' || spc - let keeper = substitute(keeper,'^\s\+','','') - let keeper = substitute(keeper,'\s\+$','','') - endif - if col("']") == col("$") && col('.') + 1 == col('$') - if oldhead =~# '^\s*$' && a:0 < 2 - let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','') - endif - let pcmd = "p" - else - let pcmd = "P" - endif - if line('.') + 1 < oldlnum && regtype ==# "V" - let pcmd = "p" - endif - call setreg('"',keeper,regtype) - if newchar != "" - call s:wrapreg('"',newchar) - endif - silent exe 'norm! ""'.pcmd.'`[' - if removed =~ '\n' || okeeper =~ '\n' || getreg('"') =~ '\n' - call s:reindent() - endif - if getline('.') =~ '^\s\+$' && keeper =~ '^\s*\n' - silent norm! cc - endif - call setreg('"',original,otype) - let s:lastdel = removed - let &clipboard = cb_save - if newchar == "" - silent! call repeat#set("\<Plug>Dsurround".char,scount) - else - silent! call repeat#set("\<Plug>Csurround".char.newchar.s:tag,scount) - endif -endfunction " }}}1 - -function! s:changesurround() " {{{1 - let a = s:inputtarget() - if a == "" - return s:beep() - endif - let b = s:inputreplacement() - if b == "" - return s:beep() - endif - call s:dosurround(a,b) -endfunction " }}}1 - -function! s:opfunc(type,...) " {{{1 - let char = s:inputreplacement() - if char == "" - return s:beep() - endif - let reg = '"' - let sel_save = &selection - let &selection = "inclusive" - let cb_save = &clipboard - set clipboard-=unnamed clipboard-=unnamedplus - let reg_save = getreg(reg) - let reg_type = getregtype(reg) - let type = a:type - if a:type == "char" - silent exe 'norm! v`[o`]"'.reg.'y' - let type = 'v' - elseif a:type == "line" - silent exe 'norm! `[V`]"'.reg.'y' - let type = 'V' - elseif a:type ==# "v" || a:type ==# "V" || a:type ==# "\<C-V>" - let &selection = sel_save - let ve = &virtualedit - if !(a:0 && a:1) - set virtualedit= - endif - silent exe 'norm! gv"'.reg.'y' - let &virtualedit = ve - elseif a:type =~ '^\d\+$' - let type = 'v' - silent exe 'norm! ^v'.a:type.'$h"'.reg.'y' - if mode() ==# 'v' - norm! v - return s:beep() - endif - else - let &selection = sel_save - let &clipboard = cb_save - return s:beep() - endif - let keeper = getreg(reg) - if type ==# "v" && a:type !=# "v" - let append = matchstr(keeper,'\_s\@<!\s*$') - let keeper = substitute(keeper,'\_s\@<!\s*$','','') - endif - call setreg(reg,keeper,type) - call s:wrapreg(reg,char,a:0 && a:1) - if type ==# "v" && a:type !=# "v" && append != "" - call setreg(reg,append,"ac") - endif - silent exe 'norm! gv'.(reg == '"' ? '' : '"' . reg).'p`[' - if type ==# 'V' || (getreg(reg) =~ '\n' && type ==# 'v') - call s:reindent() - endif - call setreg(reg,reg_save,reg_type) - let &selection = sel_save - let &clipboard = cb_save - if a:type =~ '^\d\+$' - silent! call repeat#set("\<Plug>Y".(a:0 && a:1 ? "S" : "s")."surround".char.s:tag,a:type) - else - silent! call repeat#set("\<Plug>SurroundRepeat".char.s:tag) - endif -endfunction - -function! s:opfunc2(arg) - call s:opfunc(a:arg,1) -endfunction " }}}1 - -function! s:closematch(str) " {{{1 - " Close an open (, {, [, or < on the command line. - let tail = matchstr(a:str,'.[^\[\](){}<>]*$') - if tail =~ '^\[.\+' - return "]" - elseif tail =~ '^(.\+' - return ")" - elseif tail =~ '^{.\+' - return "}" - elseif tail =~ '^<.+' - return ">" - else - return "" - endif -endfunction " }}}1 - -nnoremap <silent> <Plug>SurroundRepeat . -nnoremap <silent> <Plug>Dsurround :<C-U>call <SID>dosurround(<SID>inputtarget())<CR> -nnoremap <silent> <Plug>Csurround :<C-U>call <SID>changesurround()<CR> -nnoremap <silent> <Plug>Yssurround :<C-U>call <SID>opfunc(v:count1)<CR> -nnoremap <silent> <Plug>YSsurround :<C-U>call <SID>opfunc2(v:count1)<CR> -" <C-U> discards the numerical argument but there's not much we can do with it -nnoremap <silent> <Plug>Ysurround :<C-U>set opfunc=<SID>opfunc<CR>g@ -nnoremap <silent> <Plug>YSurround :<C-U>set opfunc=<SID>opfunc2<CR>g@ -vnoremap <silent> <Plug>VSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR> -vnoremap <silent> <Plug>VgSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1)<CR> -inoremap <silent> <Plug>Isurround <C-R>=<SID>insert()<CR> -inoremap <silent> <Plug>ISurround <C-R>=<SID>insert(1)<CR> - -if !exists("g:surround_no_mappings") || ! g:surround_no_mappings - nmap ds <Plug>Dsurround - nmap cs <Plug>Csurround - nmap ys <Plug>Ysurround - nmap yS <Plug>YSurround - nmap yss <Plug>Yssurround - nmap ySs <Plug>YSsurround - nmap ySS <Plug>YSsurround - xmap S <Plug>VSurround - xmap gS <Plug>VgSurround - if !exists("g:surround_no_insert_mappings") || ! g:surround_no_insert_mappings - if !hasmapto("<Plug>Isurround","i") && "" == mapcheck("<C-S>","i") - imap <C-S> <Plug>Isurround - endif - imap <C-G>s <Plug>Isurround - imap <C-G>S <Plug>ISurround - endif -endif - -" vim:set ft=vim sw=2 sts=2 et: |