diff options
142 files changed, 7121 insertions, 0 deletions
diff --git a/vim/autoload/DrawIt.vim b/vim/autoload/DrawIt.vim new file mode 100644 index 0000000..89f6ad5 --- /dev/null +++ b/vim/autoload/DrawIt.vim @@ -0,0 +1,2921 @@ +" DrawIt.vim: a simple way to draw things in Vim +" +" Maintainer: Charles E. Campbell +" Authors: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> - NOSPAM +" Sylvain Viart (molo@multimania.com) +" Version: 13 +" Date: Nov 25, 2013 +" +" Quick Setup: {{{1 +" tar -oxvf DrawIt.tar +" Should put DrawItPlugin.vim in your .vim/plugin directory, +" put DrawIt.vim in your .vim/autoload directory +" put DrawIt.txt in your .vim/doc directory. +" Then, use \di to start DrawIt, +" \ds to stop Drawit, and +" draw by simply moving about using the cursor keys. +" +" You may also use visual-block mode to select endpoints and +" draw lines, arrows, and ellipses. +" +" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 +" 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 is provided *as is* and 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. +" +" Required: THIS SCRIPT REQUIRES VIM 7.0 (or later) {{{1 +" GetLatestVimScripts: 40 1 :AutoInstall: DrawIt.vim +" GetLatestVimScripts: 1066 1 cecutil.vim +" +" Woe to her who is rebellious and polluted, the oppressing {{{1 +" city! She didn't obey the voice. She didn't receive correction. +" She didn't trust in Yahweh. She didn't draw near to her God. (Zeph 3:1,2 WEB) + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_DrawIt") + finish +endif +let g:loaded_DrawIt= "v13" +if v:version < 700 + echohl WarningMsg + echo "***warning*** this version of DrawIt needs vim 7.0" + echohl Normal + finish +endif +let s:keepcpo= &cpo +set cpo&vim +scriptencoding utf-8 + +" --------------------------------------------------------------------- +" Script Variables: {{{1 +if !exists("g:drawit_xstrlen") + if exists("g:Align_xstrlen") + let g:drawit_xstrlen= g:Align_xstrlen + elseif exists("g:netrw_xstrlen") + let g:drawit_xstrlen= g:netrw_xstrlen + elseif &enc == "latin1" || !has("multi_byte") + let g:drawit_xstrlen= 0 + else + let g:drawit_xstrlen= 1 + endif +endif +if !exists("g:drawit_mode") + let g:drawit_mode= 'N' " other options: =S (single-line utf-*,cp437) or =D (double-line utf-*,cp437) +endif +if !exists("s:saveposn_count") + let s:saveposn_count= 0 +endif +"DechoTabOn + +" ===================================================================== +" DrawIt Functions: (by Charles E. Campbell) {{{1 +" ===================================================================== + +" --------------------------------------------------------------------- +" DrawIt#DrawItStart: this function maps the cursor keys, sets up default {{{2 +" drawing characters, and makes some settings +fun! DrawIt#DrawItStart(...) +" call Dfunc("DrawItStart()") + + if a:0 > 0 + if exists("b:di_gfxchr") && b:di_gfxchr && (a:1 == 'S' || a:1 == 's') + DIsngl + elseif exists("b:di_gfxchr") && b:di_gfxchr && (a:1 == 'D' || a:1 == 'd') + DIdbl + elseif !exists("g:drawit_mode") + let g:drawit_mode= 'N' + endif + endif + + " DrawItStart: report on [DrawIt] mode {{{3 + if exists("b:dodrawit") && b:dodrawit == 1 + " already in DrawIt mode + echo "[DrawIt] (already on, use ".((exists("mapleader") && mapleader != "")? mapleader : '\')."ds to stop)" +" call Dret("DrawItStart") + return + endif + let b:dodrawit= 1 + + " indicate in DrawIt mode + echo "[DrawIt]" + + " DrawItStart: turn on mouse {{{3 + if !exists("b:drawit_keep_mouse") + let b:drawit_keep_mouse= &mouse + endif + setl mouse=a + + " DrawItStart: set up DrawIt commands {{{3 + com! -nargs=1 -range SetBrush <line1>,<line2>call DrawIt#SetBrush(<q-args>) + com! -count Canvas call s:Spacer(line("."),line(".") + <count> - 1,0) + + " DrawItStart: set up default drawing characters {{{3 + if !exists("b:di_vert") |let b:di_vert = "|" |endif + if !exists("b:di_horiz") |let b:di_horiz = "-" |endif + if !exists("b:di_plus") |let b:di_plus = "+" |endif + if !exists("b:di_upright")|let b:di_upright = "/" |endif " same as downleft + if !exists("b:di_upleft") |let b:di_upleft = "\\"|endif " same as downright + if !exists("b:di_cross") |let b:di_cross = "X" |endif + if !exists("b:di_ellipse")|let b:di_ellipse = '*' |endif + + let b:di_gfxchr= 1 + if &enc == 'utf-8' || &enc == 'utf-16' || &enc == "ucs-4" + " Box drawing characters using unicode + " │ ─ ┌ â” â”” ┘ ┬ â”´ ├ ┤ ┼ ╱ ╲ ╳ + " â•‘ â• â•” â•— â•š ╠╦ â•© â• â•£ ╬ +" call Decho("box drawing characters using unicode") + if !exists("b:di_Svert") |let b:di_Svert = '│' |endif + if !exists("b:di_Dvert") |let b:di_Dvert = 'â•‘' |endif + if !exists("b:di_Shoriz") |let b:di_Shoriz = '─' |endif + if !exists("b:di_Dhoriz") |let b:di_Dhoriz = 'â•' |endif + if !exists("b:di_Sulcorn") |let b:di_Sulcorn = '┌' |endif + if !exists("b:di_Dulcorn") |let b:di_Dulcorn = 'â•”' |endif + if !exists("b:di_Surcorn") |let b:di_Surcorn = 'â”' |endif + if !exists("b:di_Durcorn") |let b:di_Durcorn = 'â•—' |endif + if !exists("b:di_Sllcorn") |let b:di_Sllcorn = 'â””' |endif + if !exists("b:di_Dllcorn") |let b:di_Dllcorn = 'â•š' |endif + if !exists("b:di_Slrcorn") |let b:di_Slrcorn = '┘' |endif + if !exists("b:di_Dlrcorn") |let b:di_Dlrcorn = 'â•' |endif + if !exists("b:di_Splus") |let b:di_Splus = '┼' |endif + if !exists("b:di_Dplus") |let b:di_Dplus = '╬' |endif + if !exists("b:di_Sdnplus") |let b:di_Sdnplus = '┬' |endif + if !exists("b:di_Ddnplus") |let b:di_Ddnplus = '╦' |endif + if !exists("b:di_Supplus") |let b:di_Supplus = 'â”´' |endif + if !exists("b:di_Dupplus") |let b:di_Dupplus = 'â•©' |endif + if !exists("b:di_Slplus") |let b:di_Slplus = '┤' |endif + if !exists("b:di_Dlplus") |let b:di_Dlplus = 'â•£' |endif + if !exists("b:di_Srplus") |let b:di_Srplus = '├' |endif + if !exists("b:di_Drplus") |let b:di_Drplus = 'â• ' |endif + if !exists("b:di_Supright")|let b:di_Supright= "╱" |endif " same as Sdownleft + if !exists("b:di_Supleft") |let b:di_Supleft = "╲" |endif " same as Sdownright + if !exists("b:di_Scross") |let b:di_Scross = "╳" |endif + + " Mixed Single-Double unicode box drawing characters + " â•ž â•Ÿ â•¡ â•¢ ╤ â•¥ ╧ ╪ â•« + if !exists("b:di_DhSd") |let b:di_DhSd = '╤' |endif + if !exists("b:di_DhSu") |let b:di_DhSu = '╧' |endif + if !exists("b:di_DuSl") |let b:di_DuSl = 'â•¢' |endif + if !exists("b:di_DuSlr") |let b:di_DuSlr= 'â•«' |endif + if !exists("b:di_DuSr") |let b:di_DuSr = 'â•Ÿ' |endif + if !exists("b:di_ShDd") |let b:di_ShDd = 'â•¥' |endif + if !exists("b:di_ShDu") |let b:di_ShDu = '╨' |endif + if !exists("b:di_SuDl") |let b:di_SuDl = 'â•¡' |endif + if !exists("b:di_SuDlr") |let b:di_SuDlr= '╪' |endif + if !exists("b:di_SdDh") |let b:di_SdDh = '╤' |endif + if !exists("b:di_SuDh") |let b:di_SuDh = '╧' |endif + if !exists("b:di_SuDr") |let b:di_SuDr = 'â•ž' |endif + + " Mixed Single-Double unicode box drawing corner characters + " â•’ â•“ â•• â•– ╘ â•™ â•› â•œ + if !exists("b:di_cSdDr")| let b:di_cSdDr= 'â•’'| endif + if !exists("b:di_cDdSr")| let b:di_cDdSr= 'â•“'| endif + if !exists("b:di_cDlSd")| let b:di_cDlSd= 'â••'| endif + if !exists("b:di_cSlDd")| let b:di_cSlDd= 'â•–'| endif + if !exists("b:di_cDrSu")| let b:di_cDrSu= '╘'| endif + if !exists("b:di_cSrDu")| let b:di_cSrDu= 'â•™'| endif + if !exists("b:di_cDlSu")| let b:di_cDlSu= 'â•›'| endif + if !exists("b:di_cSlDu")| let b:di_cSlDu= 'â•œ'| endif + + elseif &enc == 'cp437' + " Box drawing characters using cp437 (dos) +" call Decho("box drawing characters using cp437") + if !exists("b:di_Svert") |let b:di_Svert = nr2char(179) |endif " │ + if !exists("b:di_Dvert") |let b:di_Dvert = nr2char(186) |endif " â•‘ + if !exists("b:di_Shoriz") |let b:di_Shoriz = nr2char(196) |endif " ─ + if !exists("b:di_Dhoriz") |let b:di_Dhoriz = nr2char(205) |endif " â• + if !exists("b:di_Sulcorn") |let b:di_Sulcorn = nr2char(218) |endif " ┌ + if !exists("b:di_Dulcorn") |let b:di_Dulcorn = nr2char(201) |endif " â•” + if !exists("b:di_Surcorn") |let b:di_Surcorn = nr2char(191) |endif " â” + if !exists("b:di_Durcorn") |let b:di_Durcorn = nr2char(187) |endif " â•— + if !exists("b:di_Sllcorn") |let b:di_Sllcorn = nr2char(192) |endif " â”” + if !exists("b:di_Dllcorn") |let b:di_Dllcorn = nr2char(200) |endif " â•š + if !exists("b:di_Slrcorn") |let b:di_Slrcorn = nr2char(217) |endif " ┘ + if !exists("b:di_Dlrcorn") |let b:di_Dlrcorn = nr2char(188) |endif " â• + if !exists("b:di_Splus") |let b:di_Splus = nr2char(197) |endif " ┼ + if !exists("b:di_Dplus") |let b:di_Dplus = nr2char(206) |endif " ╬ + if !exists("b:di_Sdnplus") |let b:di_Sdnplus = nr2char(194) |endif " ┬ + if !exists("b:di_Ddnplus") |let b:di_Ddnplus = nr2char(203) |endif " ╦ + if !exists("b:di_Supplus") |let b:di_Supplus = nr2char(193) |endif " â”´ + if !exists("b:di_Dupplus") |let b:di_Dupplus = nr2char(202) |endif " â•© + if !exists("b:di_Slplus") |let b:di_Slplus = nr2char(180) |endif " ┤ + if !exists("b:di_Dlplus") |let b:di_Dlplus = nr2char(185) |endif " â•£ + if !exists("b:di_Srplus") |let b:di_Srplus = nr2char(195) |endif " ├ + if !exists("b:di_Drplus") |let b:di_Drplus = nr2char(204) |endif " â• + if !exists("b:di_Supright")|let b:di_Supright= '/' |endif " ╱ + if !exists("b:di_Supleft") |let b:di_Supleft = '\' |endif " ╲ + if !exists("b:di_Scross") |let b:di_Scross = 'X' |endif " ╳ + + " Mixed Single-Double cp437 box drawing characters + if !exists("b:di_DhSd") |let b:di_DhSd = nr2char(209)|endif " ╤ + if !exists("b:di_DhSu") |let b:di_DhSu = nr2char(207)|endif " ╧ + if !exists("b:di_DuSl") |let b:di_DuSl = nr2char(182)|endif " â•¢ + if !exists("b:di_DuSlr") |let b:di_DuSlr= nr2char(215)|endif " â•« + if !exists("b:di_DuSr") |let b:di_DuSr = nr2char(199)|endif " â•Ÿ + if !exists("b:di_ShDd") |let b:di_ShDd = nr2char(210)|endif " â•¥ + if !exists("b:di_ShDu") |let b:di_ShDu = nr2char(208)|endif " ╨ + if !exists("b:di_SuDl") |let b:di_SuDl = nr2char(181)|endif " â•¡ + if !exists("b:di_SuDlr") |let b:di_SuDlr= nr2char(216)|endif " ╪ + if !exists("b:di_SdDh") |let b:di_SdDh = nr2char(209)|endif " ╤ + if !exists("b:di_SuDh") |let b:di_SuDh = nr2char(207)|endif " ╧ + if !exists("b:di_SuDr") |let b:di_SuDr = nr2char(198)|endif " â•ž + + " Mixed Single-Double cp437 box drawing corner characters + if !exists("b:di_cSdDr")| let b:di_cSdDr= nr2char(213)| endif " â•’ + if !exists("b:di_cDdSr")| let b:di_cDdSr= nr2char(214)| endif " â•“ + if !exists("b:di_cDlSd")| let b:di_cDlSd= nr2char(184)| endif " â•• + if !exists("b:di_cSlDd")| let b:di_cSlDd= nr2char(183)| endif " â•– + if !exists("b:di_cDrSu")| let b:di_cDrSu= nr2char(212)| endif " ╘ + if !exists("b:di_cSrDu")| let b:di_cSrDu= nr2char(211)| endif " â•™ + if !exists("b:di_cDlSu")| let b:di_cDlSu= nr2char(190)| endif " â•› + if !exists("b:di_cSlDu")| let b:di_cSlDu= nr2char(189)| endif " â•œ + + else +" call Decho("regular box drawing characters only") + let b:di_gfxchr = 0 + endif + + " set up initial DrawIt behavior (as opposed to erase behavior) + let b:di_erase = 0 + + call s:DrawItSaveUserSettings() + + " DrawItStart: save and unmap user maps {{{3 + let b:lastdir = 1 + if exists("mapleader") + let usermaplead = mapleader + else + let usermaplead = "\\" + endif + call SaveUserMaps("bn","","><^v","DrawIt") + call SaveUserMaps("bv",usermaplead,"abceflsy","DrawIt") + call SaveUserMaps("bn","","<c-v>","DrawIt") + call SaveUserMaps("bn",usermaplead,"h><v^","DrawIt") + call SaveUserMaps("bn","","<left>","DrawIt") + call SaveUserMaps("bn","","<right>","DrawIt") + call SaveUserMaps("bn","","<up>","DrawIt") + call SaveUserMaps("bn","","<down>","DrawIt") + call SaveUserMaps("bn","","<left>","DrawIt") + call SaveUserMaps("bn","","<s-right>","DrawIt") + call SaveUserMaps("bn","","<s-up>","DrawIt") + call SaveUserMaps("bn","","<s-down>","DrawIt") + call SaveUserMaps("bn","","<space>","DrawIt") + call SaveUserMaps("bn","","<home>","DrawIt") + call SaveUserMaps("bn","","<end>","DrawIt") + call SaveUserMaps("bn","","<pageup>","DrawIt") + call SaveUserMaps("bn","","<pagedown>","DrawIt") + call SaveUserMaps("bn","","<c-leftdrag>","DrawIt") + call SaveUserMaps("bn","","<c-leftmouse>","DrawIt") + call SaveUserMaps("bn","","<c-leftrelease>","DrawIt") + call SaveUserMaps("bn","","<leftdrag>","DrawIt") + call SaveUserMaps("bn","","<leftmouse>","DrawIt") + call SaveUserMaps("bn","","<middlemouse>","DrawIt") + call SaveUserMaps("bn","","<rightmouse>","DrawIt") + call SaveUserMaps("bn","","<s-leftdrag>","DrawIt") + call SaveUserMaps("bn","","<s-leftmouse>","DrawIt") + call SaveUserMaps("bn","","<s-leftrelease>","DrawIt") + call SaveUserMaps("bv","","<c-leftmouse>","DrawIt") + call SaveUserMaps("bv","","<leftmouse>","DrawIt") + call SaveUserMaps("bv","","<middlemouse>","DrawIt") + call SaveUserMaps("bv","","<rightmouse>","DrawIt") + call SaveUserMaps("bv","","<s-leftmouse>","DrawIt") + call SaveUserMaps("bn",usermaplead,":pa","DrawIt") + call SaveUserMaps("bn",usermaplead,":pb","DrawIt") + call SaveUserMaps("bn",usermaplead,":pc","DrawIt") + call SaveUserMaps("bn",usermaplead,":pd","DrawIt") + call SaveUserMaps("bn",usermaplead,":pe","DrawIt") + call SaveUserMaps("bn",usermaplead,":pf","DrawIt") + call SaveUserMaps("bn",usermaplead,":pg","DrawIt") + call SaveUserMaps("bn",usermaplead,":ph","DrawIt") + call SaveUserMaps("bn",usermaplead,":pi","DrawIt") + call SaveUserMaps("bn",usermaplead,":pj","DrawIt") + call SaveUserMaps("bn",usermaplead,":pk","DrawIt") + call SaveUserMaps("bn",usermaplead,":pl","DrawIt") + call SaveUserMaps("bn",usermaplead,":pm","DrawIt") + call SaveUserMaps("bn",usermaplead,":pn","DrawIt") + call SaveUserMaps("bn",usermaplead,":po","DrawIt") + call SaveUserMaps("bn",usermaplead,":pp","DrawIt") + call SaveUserMaps("bn",usermaplead,":pq","DrawIt") + call SaveUserMaps("bn",usermaplead,":pr","DrawIt") + call SaveUserMaps("bn",usermaplead,":ps","DrawIt") + call SaveUserMaps("bn",usermaplead,":pt","DrawIt") + call SaveUserMaps("bn",usermaplead,":pu","DrawIt") + call SaveUserMaps("bn",usermaplead,":pv","DrawIt") + call SaveUserMaps("bn",usermaplead,":pw","DrawIt") + call SaveUserMaps("bn",usermaplead,":px","DrawIt") + call SaveUserMaps("bn",usermaplead,":py","DrawIt") + call SaveUserMaps("bn",usermaplead,":pz","DrawIt") + call SaveUserMaps("bn",usermaplead,":ra","DrawIt") + call SaveUserMaps("bn",usermaplead,":rb","DrawIt") + call SaveUserMaps("bn",usermaplead,":rc","DrawIt") + call SaveUserMaps("bn",usermaplead,":rd","DrawIt") + call SaveUserMaps("bn",usermaplead,":re","DrawIt") + call SaveUserMaps("bn",usermaplead,":rf","DrawIt") + call SaveUserMaps("bn",usermaplead,":rg","DrawIt") + call SaveUserMaps("bn",usermaplead,":rh","DrawIt") + call SaveUserMaps("bn",usermaplead,":ri","DrawIt") + call SaveUserMaps("bn",usermaplead,":rj","DrawIt") + call SaveUserMaps("bn",usermaplead,":rk","DrawIt") + call SaveUserMaps("bn",usermaplead,":rl","DrawIt") + call SaveUserMaps("bn",usermaplead,":rm","DrawIt") + call SaveUserMaps("bn",usermaplead,":rn","DrawIt") + call SaveUserMaps("bn",usermaplead,":ro","DrawIt") + call SaveUserMaps("bn",usermaplead,":rp","DrawIt") + call SaveUserMaps("bn",usermaplead,":rq","DrawIt") + call SaveUserMaps("bn",usermaplead,":rr","DrawIt") + call SaveUserMaps("bn",usermaplead,":rs","DrawIt") + call SaveUserMaps("bn",usermaplead,":rt","DrawIt") + call SaveUserMaps("bn",usermaplead,":ru","DrawIt") + call SaveUserMaps("bn",usermaplead,":rv","DrawIt") + call SaveUserMaps("bn",usermaplead,":rw","DrawIt") + call SaveUserMaps("bn",usermaplead,":rx","DrawIt") + call SaveUserMaps("bn",usermaplead,":ry","DrawIt") + call SaveUserMaps("bn",usermaplead,":rz","DrawIt") + if exists("g:drawit_insertmode") && g:drawit_insertmode + call SaveUserMaps("bi","","<left>","DrawIt") + call SaveUserMaps("bi","","<right>","DrawIt") + call SaveUserMaps("bi","","<up>","DrawIt") + call SaveUserMaps("bi","","<down>","DrawIt") + call SaveUserMaps("bi","","<left>","DrawIt") + call SaveUserMaps("bi","","<s-right>","DrawIt") + call SaveUserMaps("bi","","<s-up>","DrawIt") + call SaveUserMaps("bi","","<s-down>","DrawIt") + call SaveUserMaps("bi","","<home>","DrawIt") + call SaveUserMaps("bi","","<end>","DrawIt") + call SaveUserMaps("bi","","<pageup>","DrawIt") + call SaveUserMaps("bi","","<pagedown>","DrawIt") + call SaveUserMaps("bi","","<leftmouse>","DrawIt") + endif + call SaveUserMaps("bn","",":\<c-v>","DrawIt") + + " DrawItStart: DrawIt maps (Charles Campbell) {{{3 + nmap <silent> <buffer> <script> <left> :set lz<CR>:silent! call <SID>DrawLeft()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <right> :set lz<CR>:silent! call <SID>DrawRight()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <up> :set lz<CR>:silent! call <SID>DrawUp()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <down> :set lz<CR>:silent! call <SID>DrawDown()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <s-left> :set lz<CR>:silent! call <SID>MoveLeft()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <s-right> :set lz<CR>:silent! call <SID>MoveRight()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <s-up> :set lz<CR>:silent! call <SID>MoveUp()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <s-down> :set lz<CR>:silent! call <SID>MoveDown()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <space> :set lz<CR>:silent! call <SID>DrawErase()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> > :set lz<CR>:silent! call <SID>DrawSpace('>',1)<CR>:set nolz<CR> + nmap <silent> <buffer> <script> < :set lz<CR>:silent! call <SID>DrawSpace('<',2)<CR>:set nolz<CR> + nmap <silent> <buffer> <script> ^ :set lz<CR>:silent! call <SID>DrawSpace('^',3)<CR>:set nolz<CR> + nmap <silent> <buffer> <script> v :set lz<CR>:silent! call <SID>DrawSpace('v',4)<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <home> :set lz<CR>:silent! call <SID>DrawSlantUpLeft()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <end> :set lz<CR>:silent! call <SID>DrawSlantDownLeft()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <pageup> :set lz<CR>:silent! call <SID>DrawSlantUpRight()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <pagedown> :set lz<CR>:silent! call <SID>DrawSlantDownRight()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <Leader>> :set lz<CR>:silent! call <SID>DrawFatRArrow()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <Leader>< :set lz<CR>:silent! call <SID>DrawFatLArrow()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <Leader>^ :set lz<CR>:silent! call <SID>DrawFatUArrow()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <Leader>v :set lz<CR>:silent! call <SID>DrawFatDArrow()<CR>:set nolz<CR> + nmap <silent> <buffer> <script> <Leader>f :call <SID>Flood()<cr> + + " DrawItStart: Set up insertmode maps {{{3 + if exists("g:drawit_insertmode") && g:drawit_insertmode + imap <silent> <buffer> <script> <left> <Esc><left>a + imap <silent> <buffer> <script> <right> <Esc><right>a + imap <silent> <buffer> <script> <up> <Esc><up>a + imap <silent> <buffer> <script> <down> <Esc><down>a + imap <silent> <buffer> <script> <left> <Esc><left>a + imap <silent> <buffer> <script> <s-right> <Esc><s-right>a + imap <silent> <buffer> <script> <s-up> <Esc><s-up>a + imap <silent> <buffer> <script> <s-down> <Esc><s-down>a + imap <silent> <buffer> <script> <home> <Esc><home>a + imap <silent> <buffer> <script> <end> <Esc><end>a + imap <silent> <buffer> <script> <pageup> <Esc><pageup>a + imap <silent> <buffer> <script> <pagedown> <Esc><pagedown>a + endif + + " DrawItStart: set up drawing mode mappings (Sylvain Viart) {{{3 + nnoremap <silent> <buffer> <script> <c-v> :call <SID>LeftStart()<CR><c-v> + vmap <silent> <buffer> <script> <Leader>a :<c-u>call <SID>CallBox('Arrow')<CR> + vmap <silent> <buffer> <script> <Leader>b :<c-u>call <SID>CallBox('DrawBox')<cr> + nmap <buffer> <script> <Leader>c :call <SID>Canvas()<cr> + vmap <silent> <buffer> <script> <Leader>l :<c-u>call <SID>CallBox('DrawPlainLine')<CR> + vmap <silent> <buffer> <script> <Leader>s :<c-u>call <SID>Spacer(line("'<"), line("'>"),0)<cr> + + " DrawItStart: set up drawing mode mappings (Charles Campbell) {{{3 + " \pa ... \pz : blanks are transparent + " \ra ... \rz : blanks copy over + vmap <buffer> <silent> <Leader>e :<c-u>call <SID>CallBox('DrawEllipse')<CR> + + let allreg= "abcdefghijklmnopqrstuvwxyz" + while strlen(allreg) > 0 + let ireg= strpart(allreg,0,1) + exe "nmap <silent> <buffer> <Leader>p".ireg.' :<c-u>set lz<cr>:silent! call <SID>PutBlock("'.ireg.'",0)<cr>:set nolz<cr>' + exe "nmap <silent> <buffer> <Leader>r".ireg.' :<c-u>set lz<cr>:silent! call <SID>PutBlock("'.ireg.'",1)<cr>:set nolz<cr>' + let allreg= strpart(allreg,1) + endwhile + + " DrawItStart: mouse maps (Sylvain Viart) {{{3 + " start visual-block with leftmouse + nnoremap <silent> <buffer> <script> <leftmouse> <leftmouse>:call <SID>LeftStart()<CR><c-v> + vnoremap <silent> <buffer> <script> <rightmouse> <leftmouse>:<c-u>call <SID>RightStart(1)<cr> + vnoremap <silent> <buffer> <script> <middlemouse> <leftmouse>:<c-u>call <SID>RightStart(0)<cr> + vnoremap <silent> <buffer> <script> <c-leftmouse> <leftmouse>:<c-u>call <SID>CLeftStart()<cr> + + " DrawItStart: mouse maps (Charles Campbell) {{{3 + " Draw with current brush + nnoremap <silent> <buffer> <script> <s-leftmouse> <leftmouse>:call <SID>SLeftStart()<CR><c-v> + nnoremap <silent> <buffer> <script> <c-leftmouse> <leftmouse>:call <SID>CLeftStart()<CR><c-v> + + " DrawItStart: Menu support {{{3 + if has("gui_running") && has("menu") && &go =~# 'm' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Stop\ \ DrawIt<tab>\\ds <Leader>ds' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Toggle\ Erase\ Mode<tab><space> <space>' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Arrow<tab>\\a <Leader>a' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Box<tab>\\b <Leader>b' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Make\ Blank\ Zone<tab>\\c <Leader>c' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Ellipse<tab>\\e <Leader>e' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Flood<tab>\\e <Leader>f' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Line<tab>\\l <Leader>l' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Append\ Blanks<tab>\\s <Leader>s' + exe 'silent! unmenu '.g:DrChipTopLvlMenu.'DrawIt.Start\ DrawIt' + endif +" call Dret("DrawItStart") +endfun + +" --------------------------------------------------------------------- +" DrawIt#DrawItStop: this function unmaps the cursor keys and restores settings {{{2 +fun! DrawIt#DrawItStop() +" call Dfunc("DrawItStop()") + + " DrawItStop: report on [DrawIt off] mode {{{3 + if !exists("b:dodrawit") + echo "[DrawIt off]" +" call Dret("DrawItStop") + return + endif + + " DrawItStop: restore mouse {{{3 + if exists("b:drawit_keep_mouse") + let &mouse= b:drawit_keep_mouse + unlet b:drawit_keep_mouse + endif + unlet b:dodrawit + echo "[DrawIt off]" + + if exists("b:drawit_canvas_used") + " DrawItStop: clean up trailing white space {{{3 + call s:SavePosn() + silent! %s/\s\+$//e + unlet b:drawit_canvas_used + call s:RestorePosn() + endif + + " DrawItStop: remove drawit commands {{{3 + delc SetBrush + + " DrawItStop: insure that erase mode is off {{{3 + " (thanks go to Gary Johnson for this) + if b:di_erase == 1 + call s:DrawErase() + endif + + " DrawItStop: restore user map(s), if any {{{3 + call RestoreUserMaps("DrawIt") + + call s:DrawItRestoreUserSettings() + + " DrawItStop: DrChip menu support: {{{3 + if has("gui_running") && has("menu") && &go =~# 'm' + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Start\ DrawIt<tab>\\di <Leader>di' + exe 'unmenu '.g:DrChipTopLvlMenu.'DrawIt.Stop\ \ DrawIt' + exe 'unmenu '.g:DrChipTopLvlMenu.'DrawIt.Toggle\ Erase\ Mode' + exe 'unmenu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Arrow' + exe 'unmenu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Box' + exe 'unmenu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Ellipse' + exe 'unmenu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Flood' + exe 'unmenu '.g:DrChipTopLvlMenu.'DrawIt.Draw\ Line' + exe 'unmenu '.g:DrChipTopLvlMenu.'DrawIt.Make\ Blank\ Zone' + exe 'unmenu '.g:DrChipTopLvlMenu.'DrawIt.Append\ Blanks' + endif +" call Dret("DrawItStop") +endfun + +" --------------------------------------------------------------------- +" s:DrawItSaveUserSettings: saves user settings, changes them to be safe for DrawIt {{{2 +" Use s:DrawItRestoreUserSettings() to restore. +fun! s:DrawItSaveUserSettings() +" call Dfunc("s:DrawItSaveUserSettings()") + " save user settings + let b:di_aikeep = &l:ai + let b:di_cedit = &cedit + let b:di_cinkeep = &l:cin + let b:di_cpokeep = &l:cpo + let b:di_etkeep = &l:et + let b:di_fokeep = &l:fo + let b:di_gdkeep = &l:gd + let b:di_gokeep = &l:go + let b:di_magickeep = &l:magic + let b:di_remapkeep = &l:remap + let b:di_repkeep = &l:report + let b:di_sikeep = &l:si + let b:di_stakeep = &l:sta + let b:di_vekeep = &l:ve + + " change user settings to something safe for DrawIt + setl cpo&vim + setl nocin noai nosi nogd sta et ve=all report=10000 + setl go-=aA + setl fo-=a + setl remap magic + set cedit& +" call Dret("s:DrawItSaveUserSettings") +endfun + +" --------------------------------------------------------------------- +" s:DrawItRestoreUserSettings: restore user settings {{{2 +fun! s:DrawItRestoreUserSettings() +" call Dfunc("s:DrawItRestoreUserSettings()") + + " restore user's settings + let &l:ai = b:di_aikeep + let &l:cin = b:di_cinkeep + let &l:cpo = b:di_cpokeep + let &l:et = b:di_etkeep + let &l:fo = b:di_fokeep + let &l:gd = b:di_gdkeep + let &l:go = b:di_gokeep + let &l:magic = b:di_magickeep + let &l:remap = b:di_remapkeep + let &l:report = b:di_repkeep + let &l:si = b:di_sikeep + let &l:sta = b:di_stakeep + let &l:ve = b:di_vekeep + unlet b:di_aikeep + unlet b:di_cinkeep + unlet b:di_cpokeep + unlet b:di_etkeep + unlet b:di_fokeep + unlet b:di_gdkeep + unlet b:di_gokeep + unlet b:di_magickeep + unlet b:di_remapkeep + unlet b:di_repkeep + unlet b:di_sikeep + unlet b:di_stakeep + unlet b:di_vekeep +" call Dret("s:DrawItRestoreUserSettings") +endfun + +" --------------------------------------------------------------------- +" DrawIt#SetMode: sets normal, single, double drawing mode, and ensures that DrawIt mode is on {{{2 +fun! DrawIt#SetMode(mode) +" call Dfunc("DrawIt#SetMode(mode=".a:mode.")") + if &enc == 'utf-8' || &enc == 'cp437' || &enc == 'utf-16' || &enc == 'ucs-4' + let b:di_gfxchr= 1 + else + let b:di_gfxchr= 0 + endif + if b:di_gfxchr == 0 + let g:drawit_mode= 'N' + elseif &enc != 'utf-8' && &enc != 'cp437' && &enc != 'utf-16' && &enc != 'ucs-4' + let g:drawit_mode = 'N' + let b:di_gfxchr = 0 + elseif a:mode =~ '^[sS]$' + let g:drawit_mode= 'S' + elseif a:mode =~ '^[dD]$' + let g:drawit_mode= 'D' + else + let g:drawit_mode = 'N' + let b:di_gfxchr = 0 + endif + if !exists("b:dodrawit") || b:dodrawit == 0 + call DrawIt#DrawItStart() + endif +" call Dret("DrawIt#SetMode") +endfun + +" --------------------------------------------------------------------- +" SetDrawIt: this function allows one to change the drawing characters {{{2 +fun! SetDrawIt(di_vert,di_horiz,di_plus,di_upleft,di_upright,di_cross,di_ellipse) +" call Dfunc("SetDrawIt(vert<".a:di_vert."> horiz<".a:di_horiz."> plus<".a:di_plus."> upleft<".a:di_upleft."> upright<".a:di_upright."> cross<".a:di_cross."> ellipse<".a:di_ellipse.">)") + let b:di_vert = a:di_vert + let b:di_horiz = a:di_horiz + let b:di_plus = a:di_plus + let b:di_upleft = a:di_upleft + let b:di_upright = a:di_upright + let b:di_cross = a:di_cross + let b:di_ellipse = a:di_ellipse +" call Dret("SetDrawIt") +endfun + +" ===================================================================== +" s:DrawLeft: {{{2 +fun! s:DrawLeft() +" call Dfunc("s:DrawLeft()") + let curline = getline(".") + let curcol = virtcol(".") + let b:lastdir = 2 + let keepatat = @@ +" call Decho("curcol#".curcol." curline<".curline.">") + + if curcol > 0 + norm! vy + let curchar= @@ +" call Decho("curchar<".curchar.">") +" let curchar = strpart(curline,curcol-1,1) + + " step1: Replace + " step2: Move and Replace + let step= 1 + while step <= 2 +" call Decho("step#".step) + + if step == 2 + if curcol < 2 + break + endif +" call Decho("move and replace: curchar<".curchar."> mode<".g:drawit_mode.">") + call s:MoveLeft() + norm! vy + let curchar= @@ +" call Decho("curchar<".curchar.">") + else +" call Decho("replace: curchar<".curchar."> mode<".g:drawit_mode.">") + endif + + if s:IsDrawItH(curchar) + if g:drawit_mode == 'S' + exe "norm! r".b:di_Splus + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dplus + else + exe "norm! r".b:di_plus + endif + + else + + if g:drawit_mode == 'S' + exe "norm! r".b:di_Shoriz + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dhoriz + else + exe "norm! r".b:di_horiz + endif + + endif + let step= step + 1 + endwhile + + norm! l + call s:DrawCorner() + norm! h + call s:DrawCorner() + endif + let @@= keepatat +" call Dret("s:DrawLeft") +endfun + +" --------------------------------------------------------------------- +" s:DrawRight: {{{2 +fun! s:DrawRight() +" call Dfunc("s:DrawRight()") + let curline = getline(".") + let curcol = virtcol(".") + let b:lastdir = 1 + let keepatat = @@ + norm! vy + let curchar= @@ +" call Decho("curchar<".curchar.">") + + " replace + if curcol == virtcol("$") + if g:drawit_mode == 'S' + exe "norm! a".b:di_Shoriz."\<Esc>" + elseif g:drawit_mode == 'D' + exe "norm! a".b:di_Dhoriz."\<Esc>" + else + exe "norm! a".b:di_horiz."\<Esc>" + endif + else + if s:IsDrawItH(curchar) + if g:drawit_mode == 'S' + exe "norm! r".b:di_Splus + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dplus + else + exe "norm! r".b:di_plus + endif + else + if g:drawit_mode == 'S' + exe "norm! r".b:di_Shoriz + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dhoriz + else + exe "norm! r".b:di_horiz + endif + endif + endif + + " move and replace + call s:MoveRight() + if curcol == virtcol("$") + if g:drawit_mode == 'S' + exe "norm! i".b:di_Shoriz."\<Esc>" + elseif g:drawit_mode == 'D' + exe "norm! i".b:di_Dhoriz."\<Esc>" + else + exe "norm! i".b:di_horiz."\<Esc>" + endif + else + norm! vy + let curchar= @@ +" call Decho("curchar<".curchar.">") + if s:IsDrawItH(curchar) + if g:drawit_mode == 'S' + exe "norm! r".b:di_Splus + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dplus + else + exe "norm! r".b:di_plus + endif + else + if g:drawit_mode == 'S' + exe "norm! r".b:di_Shoriz + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dhoriz + else + exe "norm! r".b:di_horiz + endif + endif + endif + + norm! h + call s:DrawCorner() + norm! l + call s:DrawCorner() + + let @@= keepatat +" call Dret("s:DrawRight") +endfun + +" --------------------------------------------------------------------- +" s:DrawUp: {{{2 +fun! s:DrawUp() +" call Dfunc("s:DrawUp()") + let curline = getline(".") + let curcol = virtcol(".") + let b:lastdir = 3 + let keepatat = @@ + norm! vy + let curchar = @@ +" call Decho("curchar<".curchar.">") + + " replace + if curcol == 1 && virtcol("$") == 1 +" call Decho("case curcol#".curcol."==virtcol($): insert") + if g:drawit_mode == 'S' + exe "norm! i".b:di_Svert."\<Esc>" + elseif g:drawit_mode == 'D' + exe "norm! i".b:di_Dvert."\<Esc>" + else + exe "norm! i".b:di_vert."\<Esc>" + endif + else +" call Decho("case curcol#".curcol."!=virtcol($) curchar<".curchar.">: replace") + if s:IsDrawItV(curchar) + if g:drawit_mode == 'S' + exe "norm! r".b:di_Splus + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dplus + else + exe "norm! r".b:di_plus + endif + else + if g:drawit_mode == 'S' + exe "norm! r".b:di_Svert + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dvert + else + exe "norm! r".b:di_vert + endif + endif + endif + + " move and replace/insert + call s:MoveUp() + let curline= getline(".") +" let curchar= strpart(curline,curcol-1,1) + norm! vy + let curchar= @@ + + if curcol == 1 && virtcol("$") == 1 + if g:drawit_mode == 'S' + exe "norm! i".b:di_Svert."\<Esc>" + elseif g:drawit_mode == 'D' + exe "norm! i".b:di_Dvert."\<Esc>" + else + exe "norm! i".b:di_vert."\<Esc>" + endif + elseif s:IsDrawItV(curchar) + if g:drawit_mode == 'S' + exe "norm! r".b:di_Splus + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dplus + else + exe "norm! r".b:di_plus + endif + else + if g:drawit_mode == 'S' + exe "norm! r".b:di_Svert + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dvert + else + exe "norm! r".b:di_vert + endif + + endif + + norm! j + call s:DrawCorner() + norm! k + call s:DrawCorner() + + let @@= keepatat +" call Dret("s:DrawUp") +endfun + +" --------------------------------------------------------------------- +" s:DrawDown: {{{2 +fun! s:DrawDown() +" call Dfunc("s:DrawDown()") + let curline = getline(".") + let curcol = virtcol(".") + let keepatat = @@ + norm! vy + let curchar = @@ +" call Decho("curchar<".curchar.">") + let b:lastdir = 4 + + " replace + if curcol == 1 && virtcol("$") == 1 +" call Decho("curcol=".curcol." $=1" + if g:drawit_mode == 'S' + exe "norm! i".b:di_Svert."\<Esc>" + elseif g:drawit_mode == 'D' + exe "norm! i".b:di_Dvert."\<Esc>" + else + exe "norm! i".b:di_vert."\<Esc>" + endif + else + norm! vy + let curchar= @@ +" call Decho("curchar<".curchar.">") + if s:IsDrawItV(curchar) + if g:drawit_mode == 'S' + exe "norm! r".b:di_Splus + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dplus + else + exe "norm! r".b:di_plus + endif + else + if g:drawit_mode == 'S' + exe "norm! r".b:di_Svert + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dvert + else + exe "norm! r".b:di_vert + endif + endif + endif + + " move and replace/insert + call s:MoveDown() + let curline= getline(".") + norm! vy + let curchar= @@ +" call Decho("curchar<".curchar.">") + if curcol == 1 && virtcol("$") == 1 + if g:drawit_mode == 'S' + exe "norm! i".b:di_Svert."\<Esc>" + elseif g:drawit_mode == 'D' + exe "norm! i".b:di_Dvert."\<Esc>" + else + exe "norm! i".b:di_vert."\<Esc>" + endif + elseif s:IsDrawItV(curchar) + if g:drawit_mode == 'S' + exe "norm! r".b:di_Splus + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dplus + else + exe "norm! r".b:di_plus + endif + else + if g:drawit_mode == 'S' + exe "norm! r".b:di_Svert + elseif g:drawit_mode == 'D' + exe "norm! r".b:di_Dvert + else + exe "norm! r".b:di_vert + endif + + endif + + norm! k + call s:DrawCorner() + norm! j + call s:DrawCorner() + + let @@= keepatat +" call Dret("s:DrawDown") +endfun + +" --------------------------------------------------------------------- +" s:DrawCorner: change a ┼ or a ╬ into an appropriate corner {{{2 +fun! s:DrawCorner() +" call Dfunc("s:DrawCorner()") + let keepatat= @@ + norm! vy + let ctr= @@ + if ctr != b:di_Splus && ctr != b:di_Dplus + let @@= keepatat +" call Dret("s:DrawCorner : ctr<".ctr."> (quick return)") + return + endif + + " cleft: Grab a copy of the character to the left of the cursor + if virtcol(".") > 1 + norm! hvyl + let cleft= @@ + else + let cleft= " " + endif + + " cright: Grab a copy of the character to the right of the cursor + if virtcol(".") < virtcol("$") + norm! lvyh + let cright= @@ + else + let cright= " " + endif + + " cup: Grab a copy of the character above the cursor + if line(".") > 1 + norm! kvyj + let cup= @@ + else + let cup= " " + endif + + " cdown: Grab a copy of the character below the cursor + if line(".") < line("$") + norm! jvyk + let cdown= @@ + else + let cdown= " " + endif +" call Decho("ctr<".ctr."> cup<".cup."> cright<".cright."> cdown<".cdown."> cleft<".cleft.">") + " - MIXED SINGLE-DOUBLE CORNERS ---------------------------------------- + " ┼╠╬╠╒╠+ " │ │ │ + if !s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && !s:IsRightD(cleft) + exe "norm! r".b:di_cSdDr + + " ┼─ ╬─ ╓─ + " â•‘ â•‘ â•‘ + elseif !s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpD(cdown) + \ && !s:IsRightS(cleft) + exe "norm! r".b:di_cDdSr + + " â•â”¼ â•â•¬ â•â•• + " │ │ │ + elseif !s:IsDnS(cup) + \ && !s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_cDlSd + + " ─┼ ─╬ ─╖ + " â•‘ â•‘ â•‘ + elseif !s:IsDnD(cup) + \ && !s:IsLeftS(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_cSlDd + + " │ │ │ + " ┼╠╬╠╘╠+ elseif s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && !s:IsUpS(cdown) + \ && !s:IsRightD(cleft) + exe "norm! r".b:di_cDrSu + + " â•‘ â•‘ â•‘ + " ┼─ ╬─ ╙─ + elseif s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && !s:IsUpD(cdown) + \ && !s:IsRightS(cleft) + exe "norm! r".b:di_cSrDu + + " │ │ │ + " â•â”¼ â•â•¬ â•â•› + elseif s:IsDnS(cup) + \ && !s:IsLeftD(cright) + \ && !s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_cDlSu + + " â•‘ â•‘ â•‘ + " ─┼ ─╬ ─╜ + elseif s:IsDnD(cup) + \ && !s:IsLeftS(cright) + \ && !s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_cSlDu + + " - SINGLE LINE -------------------------------------------------------- + elseif ctr == b:di_Splus + " ─┼ ─┠+ " │ │ + if !s:IsDnS(cup) + \ && !s:IsLeftS(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_Surcorn + + " ┼─ ┌─ + " │ │ + elseif !s:IsDnS(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpS(cdown) + \ && !s:IsRightS(cleft) + exe "norm! r".b:di_Sulcorn + + " │ │ + " ─┼ ─┘ + elseif s:IsDnS(cup) + \ && !s:IsLeftS(cright) + \ && !s:IsUpS(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_Slrcorn + + " │ │ + " ┼─ └─ + elseif s:IsDnS(cup) + \ && s:IsLeftS(cright) + \ && !s:IsUpS(cdown) + \ && !s:IsRightS(cleft) + exe "norm! r".b:di_Sllcorn + + " │ │ + " ┼─ ├─ + " │ │ + elseif s:IsDnS(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpS(cdown) + \ && !s:IsRightS(cleft) + exe "norm! r".b:di_Srplus + + " │ │ + " ─┼ ─┤ + " │ │ + elseif s:IsDnS(cup) + \ && !s:IsLeftS(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_Slplus + + " ─┼─ ─┬─ + " │ │ + elseif !s:IsDnS(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_Sdnplus + + " ─┼─ ─╥─ + " â•‘ â•‘ + elseif !s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_ShDd + + " â•‘ â•‘ + " ─┼─ ─╨─ + elseif s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && !s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_ShDu + + " │ │ + " ─┼─ ─┴─ + elseif s:IsDnS(cup) + \ && s:IsLeftS(cright) + \ && !s:IsUpS(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_Supplus + + " â•‘ â•‘ + " ┼─ ╟─ + " â•‘ â•‘ + elseif s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpD(cdown) + \ && !s:IsRightS(cleft) + exe "norm! r".b:di_DuSr + + " â•‘ â•‘ + " ─┼ ─╢ + " â•‘ â•‘ + elseif s:IsDnD(cup) + \ && !s:IsLeftS(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_DuSl + + " │ │ + " ┼╠╞╠+ " │ │ + elseif s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && !s:IsRightD(cleft) + exe "norm! r".b:di_SuDr + + " │ │ + " â•â”¼ â•â•¡ + " │ │ + elseif s:IsDnS(cup) + \ && !s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_SuDl + + " â•â”¼â• â•â•¤â• + " │ │ + elseif !s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_DhSd + + " │ │ + " â•â”¼â• â•â•§â• + elseif s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && !s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_DhSu + + " â•‘ â•‘ + " ─┼─ ─╫─ + " â•‘ â•‘ + elseif s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_DuSlr + + " │ │ + " â•â”¼â• â•â•ªâ• + " │ │ + elseif s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_SuDlr + endif + + " - DOUBLE LINE -------------------------------------------------------- + elseif ctr == b:di_Dplus + " â•â•¬ â•â•— + " â•‘ â•‘ + if !s:IsDnD(cup) + \ && !s:IsLeftD(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_Durcorn + + " ╬╠╔╠+ " â•‘ â•‘ + elseif !s:IsDnD(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpD(cdown) + \ && !s:IsRightD(cleft) + exe "norm! r".b:di_Dulcorn + + " â•‘ â•‘ + " â•â•¬ â•â• + elseif s:IsDnD(cup) + \ && !s:IsLeftD(cright) + \ && !s:IsUpD(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_Dlrcorn + + " â•‘ â•‘ + " ╬╠╚╠+ elseif s:IsDnD(cup) + \ && s:IsLeftD(cright) + \ && !s:IsUpD(cdown) + \ && !s:IsRightD(cleft) + exe "norm! r".b:di_Dllcorn + + " â•‘ â•‘ + " ╬╠╠╠+ " â•‘ â•‘ + elseif s:IsDnD(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpD(cdown) + \ && !s:IsRightD(cleft) + exe "norm! r".b:di_Drplus + + " â•‘ â•‘ + " â•â•¬ â•â•£ + " â•‘ â•‘ + elseif s:IsDnD(cup) + \ && !s:IsLeftD(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_Dlplus + + " â•‘ â•‘ + " ─╬ ─╢ + " â•‘ â•‘ + elseif s:IsDnD(cup) + \ && !s:IsLeftD(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_DuSl + + " â•‘ â•‘ + " ╬─ ╟─ + " â•‘ â•‘ + elseif s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpD(cdown) + \ && !s:IsRightD(cleft) + exe "norm! r".b:di_DuSr + + " â•â•¬â• â•â•¦â• + " â•‘ â•‘ + elseif !s:IsDnD(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_Ddnplus + + " â•‘ â•‘ + " â•â•¬â• â•â•©â• + elseif s:IsDnD(cup) + \ && s:IsLeftD(cright) + \ && !s:IsUpD(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_Dupplus + + " │ │ + " ╬╠╞╠+ " │ │ + elseif s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && !s:IsRightD(cleft) + exe "norm! r".b:di_SuDr + + " │ │ + " â•â•¬ â•â•¡ + " │ │ + elseif s:IsDnS(cup) + \ && !s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_SuDl + + " ─╬─ ─╥─ + " â•‘ â•‘ + elseif !s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_ShDd + + " â•‘ â•‘ + " ─╬─ ─╨─ + elseif s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && !s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_ShDu + + " │ │ + " â•â•¬â• â•â•ªâ• + " │ │ + elseif s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_SuDlr + + " │ │ + " â•â•¬â• â•â•¨â• + elseif s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && !s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_SuDh + + " â•â•¬â• â•â•¤â• + " │ │ + elseif !s:IsDnS(cup) + \ && s:IsLeftD(cright) + \ && s:IsUpS(cdown) + \ && s:IsRightD(cleft) + exe "norm! r".b:di_SdDh + + " â•‘ â•‘ + " ─╬─ ─╫─ + " â•‘ â•‘ + elseif s:IsDnD(cup) + \ && s:IsLeftS(cright) + \ && s:IsUpD(cdown) + \ && s:IsRightS(cleft) + exe "norm! r".b:di_DuSlr + endif + + endif + + norm! vy + let newctr= @@ + let @@= keepatat +" call Dret("s:DrawCorner : ".((newctr != ctr)? "newctr<".newctr.">" : "unchanged")) +endfun + +" --------------------------------------------------------------------- +" s:IsDrawItH: moving horizontally {{{2 +fun! s:IsDrawItH(chr) +" call Dfunc("s:IsDrawItH(chr<".a:chr.">)") + if a:chr == b:di_vert || a:chr == b:di_plus +" call Dret("s:IsDrawItH 1") + return 1 + endif + if b:di_gfxchr == 0 +" call Dret("s:IsDrawItH 0") + return 0 + endif + if a:chr == b:di_Svert || a:chr == b:di_Dvert + \ || a:chr == b:di_Splus || a:chr == b:di_Dplus + \ || a:chr == b:di_Surcorn || a:chr == b:di_Durcorn + \ || a:chr == b:di_Slrcorn || a:chr == b:di_Dlrcorn + \ || a:chr == b:di_Sllcorn || a:chr == b:di_Dllcorn + \ || a:chr == b:di_Sulcorn || a:chr == b:di_Dulcorn + \ || a:chr == b:di_Sdnplus || a:chr == b:di_Ddnplus + \ || a:chr == b:di_Supplus || a:chr == b:di_Dupplus + \ || a:chr == b:di_Srplus || a:chr == b:di_Drplus + \ || a:chr == b:di_Slplus || a:chr == b:di_Dlplus + \ || a:chr == b:di_DhSd || a:chr == b:di_DhSu + \ || a:chr == b:di_DuSl || a:chr == b:di_DuSr + \ || a:chr == b:di_ShDd || a:chr == b:di_ShDu + \ || a:chr == b:di_SuDl || a:chr == b:di_SuDr + \ || a:chr == b:di_DuSlr || a:chr == b:di_SuDlr + \ || a:chr == b:di_cSdDr || a:chr == b:di_cSdDr + \ || a:chr == b:di_cDdSr || a:chr == b:di_cDdSr + \ || a:chr == b:di_cDlSd || a:chr == b:di_cDlSd + \ || a:chr == b:di_cSlDd || a:chr == b:di_cSlDd + \ || a:chr == b:di_cDrSu || a:chr == b:di_cDrSu + \ || a:chr == b:di_cSrDu || a:chr == b:di_cSrDu + \ || a:chr == b:di_cDlSu || a:chr == b:di_cDlSu + \ || a:chr == b:di_cSlDu || a:chr == b:di_cSlDu +" call Dret("s:IsDrawItH 1") + return 1 + endif +" call Dret("s:IsDrawItH 0") + return 0 +endfun + +" --------------------------------------------------------------------- +" s:IsDrawItV: moving vertically {{{2 +fun! s:IsDrawItV(chr) +" call Dfunc("s:IsDrawItV(chr<".a:chr.">)") + if a:chr == b:di_horiz || a:chr == b:di_plus +" call Dret("s:IsDrawItH 1") + return 1 + endif + if b:di_gfxchr == 0 +" call Dret("s:IsDrawItH 0") + return 0 + endif + if a:chr == b:di_Shoriz || a:chr == b:di_Dhoriz + \ || a:chr == b:di_Splus || a:chr == b:di_Dplus + \ || a:chr == b:di_Surcorn || a:chr == b:di_Durcorn + \ || a:chr == b:di_Slrcorn || a:chr == b:di_Dlrcorn + \ || a:chr == b:di_Sllcorn || a:chr == b:di_Dllcorn + \ || a:chr == b:di_Sulcorn || a:chr == b:di_Dulcorn + \ || a:chr == b:di_Sdnplus || a:chr == b:di_Ddnplus + \ || a:chr == b:di_Supplus || a:chr == b:di_Dupplus + \ || a:chr == b:di_Srplus || a:chr == b:di_Drplus + \ || a:chr == b:di_Slplus || a:chr == b:di_Dlplus + \ || a:chr == b:di_DhSd || a:chr == b:di_DhSu + \ || a:chr == b:di_DuSl || a:chr == b:di_DuSr + \ || a:chr == b:di_ShDd || a:chr == b:di_ShDu + \ || a:chr == b:di_SuDl || a:chr == b:di_SuDr + \ || a:chr == b:di_DuSlr || a:chr == b:di_SuDlr + \ || a:chr == b:di_cSdDr || a:chr == b:di_cSdDr + \ || a:chr == b:di_cDdSr || a:chr == b:di_cDdSr + \ || a:chr == b:di_cDlSd || a:chr == b:di_cDlSd + \ || a:chr == b:di_cSlDd || a:chr == b:di_cSlDd + \ || a:chr == b:di_cDrSu || a:chr == b:di_cDrSu + \ || a:chr == b:di_cSrDu || a:chr == b:di_cSrDu + \ || a:chr == b:di_cDlSu || a:chr == b:di_cDlSu + \ || a:chr == b:di_cSlDu || a:chr == b:di_cSlDu +" call Dret("s:IsDrawItV 1") + return 1 + endif +" call Dret("s:IsDrawItV 0") + return 0 +endfun + +" --------------------------------------------------------------------- +" s:IsDnS: does the character "chr" have a single-line vertical-down? {{{2 +fun! s:IsDnS(chr) +" call Dfunc("s:IsDnS(chr<".a:chr.">)") + let ret= 0 + if b:di_gfxchr + if a:chr == b:di_Svert |let ret= 1 + elseif a:chr == b:di_Sulcorn|let ret= 1 + elseif a:chr == b:di_Surcorn|let ret= 1 + elseif a:chr == b:di_Splus |let ret= 1 + elseif a:chr == b:di_Sdnplus|let ret= 1 + elseif a:chr == b:di_Slplus |let ret= 1 + elseif a:chr == b:di_Srplus |let ret= 1 + elseif a:chr == b:di_SdDh |let ret= 1 + elseif a:chr == b:di_cDlSd |let ret= 1 + elseif a:chr == b:di_cSdDr |let ret= 1 + endif + endif +" call Dret("s:IsDnS ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" s:IsDnD: does the character "chr" have a double-line vertical-down? {{{2 +fun! s:IsDnD(chr) +" call Dfunc("s:IsDnD(chr<".a:chr.">)") + let ret= 0 + if b:di_gfxchr + if a:chr == b:di_Dvert |let ret= 1 + elseif a:chr == b:di_Dulcorn|let ret= 1 + elseif a:chr == b:di_Durcorn|let ret= 1 + elseif a:chr == b:di_Dplus |let ret= 1 + elseif a:chr == b:di_Ddnplus|let ret= 1 + elseif a:chr == b:di_Dlplus |let ret= 1 + elseif a:chr == b:di_Drplus |let ret= 1 + elseif a:chr == b:di_cDdSr |let ret= 1 + elseif a:chr == b:di_cSlDd |let ret= 1 + endif + endif +" call Dret("s:IsDnD ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" s:IsUpS: does the character "chr" have a single-line vertical-up? {{{2 +fun! s:IsUpS(chr) +" call Dfunc("s:IsUpS(chr<".a:chr.">)") + let ret= 0 + if b:di_gfxchr + if a:chr == b:di_Svert |let ret= 1 + elseif a:chr == b:di_Sllcorn|let ret= 1 + elseif a:chr == b:di_Slrcorn|let ret= 1 + elseif a:chr == b:di_Splus |let ret= 1 + elseif a:chr == b:di_Supplus|let ret= 1 + elseif a:chr == b:di_Slplus |let ret= 1 + elseif a:chr == b:di_Srplus |let ret= 1 + elseif a:chr == b:di_SuDh |let ret= 1 + elseif a:chr == b:di_cDrSu |let ret= 1 + elseif a:chr == b:di_cDlSu |let ret= 1 + endif + endif +" call Dret("s:IsUpS ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" s:IsUpD: does the character "chr" have a double-line vertical-up? {{{2 +fun! s:IsUpD(chr) +" call Dfunc("s:IsUpD(chr<".a:chr.">)") + let ret= 0 + if b:di_gfxchr + if a:chr == b:di_Dvert |let ret= 1 + elseif a:chr == b:di_Dllcorn|let ret= 1 + elseif a:chr == b:di_Dlrcorn|let ret= 1 + elseif a:chr == b:di_Dplus |let ret= 1 + elseif a:chr == b:di_Dupplus|let ret= 1 + elseif a:chr == b:di_Dlplus |let ret= 1 + elseif a:chr == b:di_Drplus |let ret= 1 + elseif a:chr == b:di_cSrDu |let ret= 1 + elseif a:chr == b:di_cSlDu |let ret= 1 + endif + endif +" call Dret("s:IsUpD ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" s:IsLeftS: does the character "chr" have a single-line horizontal-left? {{{2 +fun! s:IsLeftS(chr) +" call Dfunc("s:IsLeftS(chr<".a:chr.">)") + let ret= 0 + if b:di_gfxchr + if a:chr == b:di_Shoriz |let ret= 1 + elseif a:chr == b:di_Surcorn |let ret= 1 + elseif a:chr == b:di_Slrcorn |let ret= 1 + elseif a:chr == b:di_Splus |let ret= 1 + elseif a:chr == b:di_Sdnplus |let ret= 1 + elseif a:chr == b:di_Supplus |let ret= 1 + elseif a:chr == b:di_Slplus |let ret= 1 + elseif a:chr == b:di_cSlDd |let ret= 1 + elseif a:chr == b:di_cSlDu |let ret= 1 + endif + endif +" call Dret("s:IsLeftS ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" s:IsLeftD: does the character "chr" have a double-line horizontal-left? {{{2 +fun! s:IsLeftD(chr) +" call Dfunc("s:IsLeftD(chr<".a:chr.">)") + let ret= 0 + if b:di_gfxchr + if a:chr == b:di_Dhoriz |let ret= 1 + elseif a:chr == b:di_Durcorn |let ret= 1 + elseif a:chr == b:di_Dlrcorn |let ret= 1 + elseif a:chr == b:di_Dplus |let ret= 1 + elseif a:chr == b:di_Ddnplus |let ret= 1 + elseif a:chr == b:di_Dupplus |let ret= 1 + elseif a:chr == b:di_Dlplus |let ret= 1 + elseif a:chr == b:di_cDlSd |let ret= 1 + elseif a:chr == b:di_cDlSu |let ret= 1 + endif + endif +" call Dret("s:IsLeftD ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" s:IsRightS: does the character "chr" have a single-line horizontal-right? {{{2 +fun! s:IsRightS(chr) +" call Dfunc("s:IsRightS(chr<".a:chr.">)") + let ret= 0 + if b:di_gfxchr + if a:chr == b:di_Shoriz |let ret= 1 + elseif a:chr == b:di_Sulcorn |let ret= 1 + elseif a:chr == b:di_Sllcorn |let ret= 1 + elseif a:chr == b:di_Splus |let ret= 1 + elseif a:chr == b:di_Sdnplus |let ret= 1 + elseif a:chr == b:di_Supplus |let ret= 1 + elseif a:chr == b:di_Srplus |let ret= 1 + elseif a:chr == b:di_cDdSr |let ret= 1 + elseif a:chr == b:di_cSrDu |let ret= 1 + endif + endif +" call Dret("s:IsRightS ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" s:IsRightD: does the character "chr" have a double-line horizontal-right? {{{2 +fun! s:IsRightD(chr) +" call Dfunc("s:IsRightD(chr<".a:chr.">)") + let ret= 0 + if b:di_gfxchr + if a:chr == b:di_Dhoriz |let ret= 1 + elseif a:chr == b:di_Dulcorn |let ret= 1 + elseif a:chr == b:di_Dllcorn |let ret= 1 + elseif a:chr == b:di_Dplus |let ret= 1 + elseif a:chr == b:di_Ddnplus |let ret= 1 + elseif a:chr == b:di_Dupplus |let ret= 1 + elseif a:chr == b:di_Drplus |let ret= 1 + elseif a:chr == b:di_cSdDr |let ret= 1 + elseif a:chr == b:di_cDrSu |let ret= 1 + endif + endif +" call Dret("s:IsRightD ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" s:DrawErase: toggle [DrawIt on] and [DrawIt erase] modes {{{2 +fun! s:DrawErase() +" call Dfunc("s:DrawErase() b:di_erase=".b:di_erase) + if b:di_erase == 0 + let b:di_erase= 1 + echo "[DrawIt erase]" + let b:di_vert_save = b:di_vert + let b:di_horiz_save = b:di_horiz + let b:di_plus_save = b:di_plus + let b:di_upright_save = b:di_upright + let b:di_upleft_save = b:di_upleft + let b:di_cross_save = b:di_cross + let b:di_ellipse_save = b:di_ellipse + call SetDrawIt(' ',' ',' ',' ',' ',' ',' ') + else + let b:di_erase= 0 + echo "[DrawIt]" + call SetDrawIt(b:di_vert_save,b:di_horiz_save,b:di_plus_save,b:di_upleft_save,b:di_upright_save,b:di_cross_save,b:di_ellipse_save) + endif +" call Dret("s:DrawErase") +endfun + +" --------------------------------------------------------------------- +" s:DrawSpace: clear character and move right {{{2 +fun! s:DrawSpace(chr,dir) +" call Dfunc("s:DrawSpace(chr<".a:chr."> dir<".a:dir.">)") + let curcol= virtcol(".") + + " replace current location with arrowhead/space + if curcol == virtcol("$")-1 + exe "norm! r".a:chr + else + exe "norm! r".a:chr + endif + + if a:dir == 0 + let dir= b:lastdir + else + let dir= a:dir + endif + + " perform specified move + if dir == 1 + call s:MoveRight() + elseif dir == 2 + call s:MoveLeft() + elseif dir == 3 + call s:MoveUp() + else + call s:MoveDown() + endif +" call Dret("s:DrawSpace") +endfun + +" --------------------------------------------------------------------- +" s:DrawSlantDownLeft: / {{{2 +fun! s:DrawSlantDownLeft() +" call Dfunc("s:DrawSlantDownLeft()") + call s:ReplaceDownLeft() " replace + call s:MoveDown() " move + call s:MoveLeft() " move + call s:ReplaceDownLeft() " replace +" call Dret("s:DrawSlantDownLeft") +endfun + +" --------------------------------------------------------------------- +" s:DrawSlantDownRight: \ {{{2 +fun! s:DrawSlantDownRight() +" call Dfunc("s:DrawSlantDownRight()") + call s:ReplaceDownRight() " replace + call s:MoveDown() " move + call s:MoveRight() " move + call s:ReplaceDownRight() " replace +" call Dret("s:DrawSlantDownRight") +endfun + +" --------------------------------------------------------------------- +" s:DrawSlantUpLeft: \ {{{2 +fun! s:DrawSlantUpLeft() +" call Dfunc("s:DrawSlantUpLeft()") + call s:ReplaceDownRight() " replace + call s:MoveUp() " move + call s:MoveLeft() " move + call s:ReplaceDownRight() " replace +" call Dret("s:DrawSlantUpLeft") +endfun + +" --------------------------------------------------------------------- +" s:DrawSlantUpRight: / {{{2 +fun! s:DrawSlantUpRight() +" call Dfunc("s:DrawSlantUpRight()") + call s:ReplaceDownLeft() " replace + call s:MoveUp() " move + call s:MoveRight() " replace + call s:ReplaceDownLeft() " replace +" call Dret("s:DrawSlantUpRight") +endfun + +" --------------------------------------------------------------------- +" s:MoveLeft: {{{2 +fun! s:MoveLeft() +" call Dfunc("s:MoveLeft()") + norm! h + let b:lastdir= 2 +" call Dret("s:MoveLeft : b:lastdir=".b:lastdir) +endfun + +" --------------------------------------------------------------------- +" s:MoveRight: {{{2 +fun! s:MoveRight() +" call Dfunc("s:MoveRight()") + if virtcol(".") >= virtcol("$") - 1 + exe "norm! A \<Esc>" + else + norm! l + endif + let b:lastdir= 1 +" call Dret("s:MoveRight : b:lastdir=".b:lastdir) +endfun + +" --------------------------------------------------------------------- +" s:MoveUp: {{{2 +fun! s:MoveUp() +" call Dfunc("s:MoveUp()") + if line(".") == 1 + let curcol= virtcol(".") - 1 + if curcol == 0 && virtcol("$") == 1 + exe "norm! i \<Esc>" + elseif curcol == 0 + exe "norm! YP:s/./ /ge\<CR>0r " + else + exe "norm! YP:s/./ /ge\<CR>0".curcol."lr " + endif + else + let curcol= virtcol(".") + norm! k + while virtcol("$") <= curcol + exe "norm! A \<Esc>" + endwhile + endif + let b:lastdir= 3 +" call Dret("s:MoveUp : b:lastdir=".b:lastdir) +endfun + +" --------------------------------------------------------------------- +" s:MoveDown: {{{2 +fun! s:MoveDown() +" call Dfunc("s:MoveDown()") + if line(".") == line("$") + let curcol= virtcol(".") - 1 + if curcol == 0 && virtcol("$") == 1 + exe "norm! i \<Esc>" + elseif curcol == 0 + exe "norm! Yp:s/./ /ge\<CR>0r " + else + exe "norm! Yp:s/./ /ge\<CR>0".curcol."lr " + endif + else + let curcol= virtcol(".") + norm! j + while virtcol("$") <= curcol + exe "norm! A \<Esc>" + endwhile + endif + let b:lastdir= 4 +" call Dret("s:MoveDown : b:lastdir=".b:lastdir) +endfun + +" --------------------------------------------------------------------- +" s:ReplaceDownLeft: / X (upright) {{{2 +fun! s:ReplaceDownLeft() +" call Dfunc("s:ReplaceDownLeft()") + let curcol = virtcol(".") + let keepatat = @@ + if curcol != virtcol("$") + norm! vy + let curchar= @@ + + " determine if curchr needs to be changed to an "X" + let chg2cross = 0 + if curchar == b:di_upleft || curchar == b:di_cross + let chg2cross = 1 + elseif b:di_gfxchr + " performing following test only if gfx drawing characters exist + if curchar == b:di_Supleft || curchar == b:di_Scross + let chg2cross = 1 + endif + endif + + if chg2cross + if g:drawit_mode == 'S' + exe "norm! r".b:di_Scross + else + exe "norm! r".b:di_cross + endif + else + if g:drawit_mode == 'S' + exe "norm! r".b:di_Supright + else + exe "norm! r".b:di_upright + endif + endif + else + if g:drawit_mode == 'S' + exe "norm! i".b:di_Supright."\<Esc>" + else + exe "norm! i".b:di_upright."\<Esc>" + endif + endif + let @@= keepatat +" call Dret("s:ReplaceDownLeft") +endfun + +" --------------------------------------------------------------------- +" s:ReplaceDownRight: \ X (upleft) {{{2 +fun! s:ReplaceDownRight() +" call Dfunc("s:ReplaceDownRight()") + let curcol = virtcol(".") + let keepatat = @@ + if curcol != virtcol("$") + norm! vy + let curchar= @@ +" call Decho("case curcol#".curcol." == virtcol($) drawit_mode<".g:drawit_mode."> curchar<".curchar.">") + + " determine if curchr needs to be changed to an "X" + let chg2cross = 0 + if curchar == b:di_upright || curchar == b:di_cross + let chg2cross = 1 + elseif b:di_gfxchr + " performing following test only if gfx drawing characters exist + if curchar == b:di_Supright || curchar == b:di_Scross + let chg2cross = 1 + endif + endif + + if chg2cross + if g:drawit_mode == 'S' + exe "norm! r".b:di_Scross + else + exe "norm! r".b:di_cross + endif + else + if g:drawit_mode == 'S' + exe "norm! r".b:di_Supleft + else + exe "norm! r".b:di_upleft + endif + endif + else +" call Decho("case curcol#".curcol." != virtcol($) drawit_mode<".g:drawit_mode.">") + if g:drawit_mode == 'S' + exe "norm! i".b:di_Supleft."\<Esc>" + else + exe "norm! i".b:di_upleft."\<Esc>" + endif + endif + let @@= keepatat +" call Dret("s:ReplaceDownRight") +endfun + +" --------------------------------------------------------------------- +" s:DrawFatRArrow: ----|> {{{2 +fun! s:DrawFatRArrow() +" call Dfunc("s:DrawFatRArrow()") + if g:drawit_mode == 'N' || !b:di_gfxchr + call s:MoveRight() + norm! r| + call s:MoveRight() + norm! r> + else + call s:MoveRight() + norm! râ–¶ + endif +" call Dret("s:DrawFatRArrow") +endfun + +" --------------------------------------------------------------------- +" s:DrawFatLArrow: <|---- {{{2 +fun! s:DrawFatLArrow() +" call Dfunc("s:DrawFatLArrow()") + if g:drawit_mode == 'N' || !b:di_gfxchr + call s:MoveLeft() + norm! r| + call s:MoveLeft() + norm! r< + else + call s:MoveLeft() + norm! râ—€ + endif +" call Dret("s:DrawFatLArrow") +endfun + +" --------------------------------------------------------------------- +" . +" s:DrawFatUArrow: /_\ {{{2 +" | +fun! s:DrawFatUArrow() +" call Dfunc("s:DrawFatUArrow()") + if g:drawit_mode == 'N' || !b:di_bfxchr + call s:MoveUp() + norm! r_ + call s:MoveRight() + norm! r\ + call s:MoveLeft() + call s:MoveLeft() + norm! r/ + call s:MoveRight() + call s:MoveUp() + norm! r. + else + call s:MoveUp() + norm! râ–² + endif +" call Dret("s:DrawFatUArrow") +endfun + +" --------------------------------------------------------------------- +" s:DrawFatDArrow: _|_ {{{2 +" \ / +" ' +fun! s:DrawFatDArrow() +" call Dfunc("s:DrawFatDArrow()") + if g:drawit_mode == 'N' || !b:di_gfxchr + call s:MoveRight() + norm! r_ + call s:MoveLeft() + call s:MoveLeft() + norm! r_ + call s:MoveDown() + norm! r\ + call s:MoveRight() + call s:MoveRight() + norm! r/ + call s:MoveDown() + call s:MoveLeft() + norm! r' + else + call s:MoveDown() + norm! râ–¼ + endif +" call Dret("s:DrawFatDArrow") +endfun + +" --------------------------------------------------------------------- +" s:DrawEllipse: Bresenham-like ellipse drawing algorithm {{{2 +" 2 2 can +" x y be 2 2 2 2 2 2 +" - + - = 1 rewritten b x + a y = a b +" a b as +" +" Take step which has minimum error +" (x,y-1) (x+1,y) (x+1,y-1) +" +" 2 2 2 2 2 2 +" Ei = | b x + a y - a b | +" +" Algorithm only draws arc from (0,b) to (a,0) and uses +" DrawFour() to reflect points to other three quadrants +fun! s:DrawEllipse(x0,y0,x1,y1) +" call Dfunc("s:DrawEllipse(x0=".a:x0." y0=".a:y0." x1=".a:x1." y1=".a:y1.")") + let x0 = a:x0 + let y0 = a:y0 + let x1 = a:x1 + let y1 = a:y1 + let xoff = (x0+x1)/2 + let yoff = (y0+y1)/2 + let a = s:Abs(x1-x0)/2 + let b = s:Abs(y1-y0)/2 + let a2 = a*a + let b2 = b*b + let twoa2= a2 + a2 + let twob2= b2 + b2 + + let xi= 0 + let yi= b + let ei= 0 + call s:DrawFour(xi,yi,xoff,yoff,a,b) + while xi <= a && yi >= 0 + + let dy= a2 - twoa2*yi + let ca= ei + twob2*xi + b2 + let cb= ca + dy + let cc= ei + dy + + let aca= s:Abs(ca) + let acb= s:Abs(cb) + let acc= s:Abs(cc) + + " pick case: (xi+1,yi) (xi,yi-1) (xi+1,yi-1) + if aca <= acb && aca <= acc + let xi= xi + 1 + let ei= ca + elseif acb <= aca && acb <= acc + let ei= cb + let xi= xi + 1 + let yi= yi - 1 + else + let ei= cc + let yi= yi - 1 + endif + if xi > a:x1 + break + endif + call s:DrawFour(xi,yi,xoff,yoff,a,b) + endw +" call Dret("s:DrawEllipse") +endf + +" --------------------------------------------------------------------- +" s:DrawFour: reflect a point to four quadrants {{{2 +fun! s:DrawFour(x,y,xoff,yoff,a,b) +" call Dfunc("s:DrawFour(xy[".a:x.",".a:y."] off[".a:xoff.",".a:yoff."] a=".a:a." b=".a:b.")") + let x = a:xoff + a:x + let y = a:yoff + a:y + let lx = a:xoff - a:x + let by = a:yoff - a:y + call s:SetCharAt(b:di_ellipse, x, y) + call s:SetCharAt(b:di_ellipse, lx, y) + call s:SetCharAt(b:di_ellipse, lx,by) + call s:SetCharAt(b:di_ellipse, x,by) +" call Dret("s:DrawFour") +endf + +" --------------------------------------------------------------------- +" s:SavePosn: saves position of cursor on screen so NetWrite can restore it {{{2 +fun! s:SavePosn() +" call Dfunc("s:SavePosn() saveposn_count=".s:saveposn_count.' ['.line('.').','.virtcol('.').']') + let s:saveposn_count= s:saveposn_count + 1 + + " Save current line and column + let b:drawit_line_{s:saveposn_count} = line(".") + let b:drawit_col_{s:saveposn_count} = virtcol(".") - 1 + + " Save top-of-screen line + norm! H + let b:drawit_hline_{s:saveposn_count}= line(".") + + " restore position + exe "norm! ".b:drawit_hline_{s:saveposn_count}."G0z\<CR>" + if b:drawit_col_{s:saveposn_count} == 0 + exe "norm! ".b:drawit_line_{s:saveposn_count}."G0" + else + exe "norm! ".b:drawit_line_{s:saveposn_count}."G0".b:drawit_col_{s:saveposn_count}."l" + endif +" call Dret("s:SavePosn : saveposn_count=".s:saveposn_count) +endfun + +" ------------------------------------------------------------------------ +" s:RestorePosn: {{{2 +fun! s:RestorePosn() +" call Dfunc("s:RestorePosn() saveposn_count=".s:saveposn_count) + if s:saveposn_count <= 0 +" call Dret("s:RestorePosn : s:saveposn_count<=0") + return + endif + " restore top-of-screen line + exe "norm! ".b:drawit_hline_{s:saveposn_count}."G0z\<CR>" + + " restore position + if b:drawit_col_{s:saveposn_count} == 0 + exe "norm! ".b:drawit_line_{s:saveposn_count}."G0" + else + exe "norm! ".b:drawit_line_{s:saveposn_count}."G0".b:drawit_col_{s:saveposn_count}."l" + endif + if s:saveposn_count > 0 + unlet b:drawit_hline_{s:saveposn_count} + unlet b:drawit_line_{s:saveposn_count} + unlet b:drawit_col_{s:saveposn_count} + let s:saveposn_count= s:saveposn_count - 1 + endif +" call Dret("s:RestorePosn : saveposn_count=".s:saveposn_count) +endfun + +" ------------------------------------------------------------------------ +" s:Flood: this function begins a flood of a region {{{2 +" based on b:di... characters as boundaries +" and starting at the current cursor location. +fun! s:Flood() +" call Dfunc("s:Flood()") + + let s:bndry = b:di_vert.b:di_horiz.b:di_plus.b:di_upright.b:di_upleft.b:di_cross.b:di_ellipse + if b:di_gfxchr + let s:bndry= s:bndry.b:di_Svert.b:di_Dvert.b:di_Shoriz.b:di_Dhoriz.b:di_Sulcorn.b:di_Dulcorn.b:di_Surcorn.b:di_Durcorn.b:di_Sllcorn.b:di_Dllcorn.b:di_Slrcorn.b:di_Dlrcorn.b:di_Splus.b:di_Dplus.b:di_Sdnplus.b:di_Ddnplus.b:di_Supplus.b:di_Dupplus.b:di_Slplus.b:di_Dlplus.b:di_Srplus.b:di_Drplus.b:di_Supright.b:di_Supleft.b:di_Scross + let s:bndry= s:bndry.b:di_DhSd.b:di_DhSu.b:di_DuSl.b:di_DuSlr.b:di_DuSr.b:di_ShDd.b:di_ShDu.b:di_SuDl.b:di_SuDlr.b:di_SdDh.b:di_SuDh.b:di_SuDr.b:di_cSdDr.b:di_cDdSr.b:di_cDlSd.b:di_cSlDd.b:di_cDrSu.b:di_cSrDu.b:di_cDlSu.b:di_cSlDu + endif + let row = line(".") + let col = virtcol(".") + let athold = @0 + let s:DIrows = line("$") + call s:SavePosn() + + " get fill character from user + " Put entire fillchar string into the s:bndry (boundary characters), + " although only use the first such character for filling + call inputsave() + let s:fillchar= input("Enter fill character: ") + call inputrestore() + let s:bndry= "[".escape(s:bndry.s:fillchar,'\-]^')."]" +" call Decho("s:bndry<".s:bndry.">") + if s:Strlen(s:fillchar) > 1 + let s:fillchar= strpart(s:fillchar,0,1) + endif + + " flood the region + call s:DI_Flood(row,col) + + " restore + call s:RestorePosn() + let @0= athold + unlet s:DIrows s:bndry s:fillchar + +" call Dret("s:Flood") +endfun + +" ------------------------------------------------------------------------ +" s:DI_Flood: fill up to the boundaries all characters to the left and right. {{{2 +" Then, based on the left/right column extents reached, check +" adjacent rows to see if any characters there need filling. +fun! s:DI_Flood(frow,fcol) +" call Dfunc("s:DI_Flood(frow=".a:frow." fcol=".a:fcol.")") + if a:frow <= 0 || a:fcol <= 0 || s:SetPosn(a:frow,a:fcol) || s:IsBoundary(a:frow,a:fcol) +" call Dret("s:DI_Flood") + return + endif + + " fill current line + let colL= s:DI_FillLeft(a:frow,a:fcol) + let colR= s:DI_FillRight(a:frow,a:fcol+1) + + " do a filladjacent on the next line up + if a:frow > 1 + call s:DI_FillAdjacent(a:frow-1,colL,colR) + endif + + " do a filladjacent on the next line down + if a:frow < s:DIrows + call s:DI_FillAdjacent(a:frow+1,colL,colR) + endif + +" call Dret("s:DI_Flood") +endfun + +" ------------------------------------------------------------------------ +" s:DI_FillLeft: Starting at (frow,fcol), non-boundary locations are {{{2 +" filled with the fillchar. The leftmost extent reached +" is returned. +fun! s:DI_FillLeft(frow,fcol) +" call Dfunc("s:DI_FillLeft(frow=".a:frow." fcol=".a:fcol.")") + if s:SetPosn(a:frow,a:fcol) +" call Dret("s:DI_FillLeft ".a:fcol) + return a:fcol + endif + + let Lcol= a:fcol + while Lcol >= 1 + if !s:IsBoundary(a:frow,Lcol) + exe "silent! norm! r".s:fillchar."h" + else + break + endif + let Lcol= Lcol - 1 + endwhile + + let Lcol= (Lcol < 1)? 1 : Lcol + 1 + +" call Dret("s:DI_FillLeft ".Lcol) + return Lcol +endfun + +" --------------------------------------------------------------------- +" s:DI_FillRight: Starting at (frow,fcol), non-boundary locations are {{{2 +" filled with the fillchar. The rightmost extent reached +" is returned. +fun! s:DI_FillRight(frow,fcol) +" call Dfunc("s:DI_FillRight(frow=".a:frow." fcol=".a:fcol.")") + if s:SetPosn(a:frow,a:fcol) +" call Dret("s:DI_FillRight ".a:fcol) + return a:fcol + endif + + let Rcol = a:fcol + while Rcol <= virtcol("$") + if !s:IsBoundary(a:frow,Rcol) + exe "silent! norm! r".s:fillchar."l" + else + break + endif + let Rcol= Rcol + 1 + endwhile + + let DIcols = virtcol("$") + let Rcol = (Rcol > DIcols)? DIcols : Rcol - 1 + +" call Dret("s:DI_FillRight ".Rcol) + return Rcol +endfun + +" --------------------------------------------------------------------- +" s:DI_FillAdjacent: {{{2 +" DI_Flood does FillLeft and FillRight, so the run from left to right +" (fcolL to fcolR) is known to have been filled. FillAdjacent is called +" from (fcolL to fcolR) on the lines one row up and down; if any character +" on the run is not a boundary character, then a flood is needed on that +" location. +fun! s:DI_FillAdjacent(frow,fcolL,fcolR) +" call Dfunc("s:DI_FillAdjacent(frow=".a:frow." fcolL=".a:fcolL." fcolR=".a:fcolR.")") + + let icol = a:fcolL + while icol <= a:fcolR + if !s:IsBoundary(a:frow,icol) + call s:DI_Flood(a:frow,icol) + endif + let icol= icol + 1 + endwhile + +" call Dret("s:DI_FillAdjacent") +endfun + +" --------------------------------------------------------------------- +" s:SetPosn: set cursor to given position on screen {{{2 +" srow,scol: -s-creen row and column +" Returns 1 : failed sanity check +" 0 : otherwise +fun! s:SetPosn(row,col) +" call Dfunc("s:SetPosn(row=".a:row." col=".a:col.")") + " sanity checks + if a:row < 1 +" call Dret("s:SetPosn 1") + return 1 + endif + if a:col < 1 +" call Dret("s:SetPosn 1") + return 1 + endif + + exe "norm! ".a:row."G".a:col."\<Bar>" + +" call Dret("s:SetPosn 0") + return 0 +endfun + +" --------------------------------------------------------------------- +" s:IsBoundary: returns 0 if not on boundary, 1 if on boundary {{{2 +" The "boundary" also includes the fill character. +fun! s:IsBoundary(row,col) +" call Dfunc("s:IsBoundary(row=".a:row." col=".a:col.")") + + let orow= line(".") + let ocol= virtcol(".") + exe "norm! ".a:row."G".a:col."\<Bar>" + norm! vy + let ret= @0 =~ s:bndry + if a:row != orow || a:col != ocol + exe "norm! ".orow."G".ocol."\<Bar>" + endif + +" call Dret("s:IsBoundary ".ret." : @0<".@0.">") + return ret +endfun + +" --------------------------------------------------------------------- +" s:PutBlock: puts a register's contents into the text at the current {{{2 +" cursor location +" replace= 0: Blanks are transparent +" = 1: Blanks copy over +" = 2: Erase all drawing characters +" +fun! s:PutBlock(block,replace) +" call Dfunc("s:PutBlock(block<".a:block."> replace=".a:replace.") g:drawit_xstrlen=".g:drawit_xstrlen) + call s:SavePosn() + exe "let block = @".a:block + let blocklen = strlen(block) + let drawit_line = line('.') + let drawchars = '['.escape(b:di_vert.b:di_horiz.b:di_plus.b:di_upright.b:di_upleft.b:di_cross,'\-').']' +" call Decho("blocklen=".blocklen." block<".string(block).">") + + " insure that putting a block will do so in a region containing spaces out to textwidth + exe "let blockrows= s:Strlen(substitute(@".a:block.",'[^[:cntrl:]]','','g'))" + exe 'let blockcols= s:Strlen(substitute(@'.a:block.",'^\\(.\\{-}\\)\\n\\_.*$','\\1',''))" + let curline= line('.') + let curcol = virtcol('.') +" call Decho("blockrows=".blockrows." blockcols=".blockcols." curline=".curline." curcol=".curcol) + call s:AutoCanvas(curline-1,curline + blockrows+1,curcol + blockcols) + + let iblock= 0 + while iblock < blocklen + " the following logic should permit 1, 2, or 4 byte glyphs (I've only tested it with 1 and 2) + let chr= strpart(block,iblock,4) + if char2nr(chr) <= 255 + let chr= strpart(block,iblock,1) + elseif char2nr(chr) <= 65536 + let chr= strpart(block,iblock,2) + let iblock= iblock + 1 + else + let iblock= iblock + 3 + endif +" call Decho("iblock=".iblock." chr#".char2nr(chr)."<".string(chr).">") + + if char2nr(chr) == 10 + " handle newline + let drawit_line= drawit_line + 1 + if b:drawit_col_{s:saveposn_count} == 0 + exe "norm! ".drawit_line."G0" + else + exe "norm! ".drawit_line."G0".b:drawit_col_{s:saveposn_count}."l" + endif + + elseif a:replace == 2 + " replace all drawing characters with blanks + if match(chr,drawchars) != -1 + norm! r l + else + norm! l + endif + + elseif chr == ' ' && a:replace == 0 + " allow blanks to be transparent + norm! l + + else + " usual replace character + exe "norm! r".chr."l" + endif + let iblock = iblock + 1 + endwhile + call s:RestorePosn() + +" call Dret("s:PutBlock") +endfun + +" --------------------------------------------------------------------- +" s:AutoCanvas: automatic "Canvas" routine {{{2 +fun! s:AutoCanvas(linestart,linestop,cols) +" call Dfunc("s:AutoCanvas(linestart=".a:linestart." linestop=".a:linestop." cols=".a:cols.") line($)=".line("$")) + + " insure there's enough blank lines at end-of-file + if line("$") < a:linestop +" call Decho("append ".(a:linestop - line("$"))." empty lines") + call s:SavePosn() + exe "norm! G".(a:linestop - line("$"))."o\<esc>" + call s:RestorePosn() + endif + + " insure that any tabs contained within the selected region are converted to blanks + let etkeep= &l:et + set et +" call Decho("exe ".a:linestart.",".a:linestop."retab") + exe a:linestart.",".a:linestop."retab" + let &l:et= etkeep + + " insure that there's whitespace to textwidth/screenwidth/a:cols + if a:cols <= 0 + let tw= &tw + if tw <= 0 + let tw= &columns + endif + else + let tw= a:cols + endif +" Decho("tw=".tw) + if search('^$\|.\%<'.(tw+1).'v$',"cn",(a:linestop+1)) > 0 +" call Decho("append trailing whitespace") + call s:Spacer(a:linestart,a:linestop,tw) + endif + +" call Dret("s:AutoCanvas : tw=".tw) +endfun + +" --------------------------------------------------------------------- +" s:Strlen: this function returns the length of a string, even if its {{{2 +" using two-byte etc characters. +" Currently, its only used if g:Align_xstrlen is set to a +" nonzero value. Solution from Nicolai Weibull, vim docs +" (:help strlen()), Tony Mechelynck, and my own invention. +fun! s:Strlen(x) +" call Dfunc("s:Strlen(x<".a:x.">") + + if v:version >= 703 && exists("*strdisplaywidth") + let ret= strdisplaywidth(a:x) + + elseif g:drawit_xstrlen == 1 + " number of codepoints (Latin a + combining circumflex is two codepoints) + " (comment from TM, solution from NW) + let ret= strlen(substitute(a:x,'.','c','g')) + + elseif g:drawit_xstrlen == 2 + " number of spacing codepoints (Latin a + combining circumflex is one spacing + " codepoint; a hard tab is one; wide and narrow CJK are one each; etc.) + " (comment from TM, solution from TM) + let ret= strlen(substitute(a:x, '.\Z', 'x', 'g')) + + elseif g:drawit_xstrlen == 3 + " virtual length (counting, for instance, tabs as anything between 1 and + " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately + " preceded by lam, one otherwise, etc.) + " (comment from TM, solution from me) + let modkeep= &l:mod + exe "norm! o\<esc>" + call setline(line("."),a:x) + let ret= virtcol("$") - 1 + d + keepj norm! k + let &l:mod= modkeep + + else + " at least give a decent default + let ret= strlen(a:x) + endif + +" call Dret("s:Strlen ".ret) + return ret +endfun + +" ===================================================================== +" DrawIt Functions: (by Sylvain Viart) {{{1 +" ===================================================================== + +" --------------------------------------------------------------------- +" s:Canvas: {{{2 +fun! s:Canvas() +" call Dfunc("s:Canvas()") + + let lines = input("how many lines under the cursor? ") + let curline= line('.') + if curline < line('$') + exe "norm! ".lines."o\<esc>" + endif + call s:Spacer(curline+1,curline+lines,0) + let b:drawit_canvas_used= 1 + +" call Dret("s:Canvas") +endf + +" --------------------------------------------------------------------- +" s:Spacer: fill end of line with space {{{2 +" if a:cols >0: to the virtual column specified by a:cols +" <=0: to textwidth (if nonzero), otherwise +" to display width (&columns) +fun! s:Spacer(debut, fin, cols) range +" call Dfunc("s:Spacer(debut=".a:debut." fin=".a:fin." cols=".a:cols.") textwidth=".&textwidth) + call s:SavePosn() + + if a:cols <= 0 + let width = &textwidth + if width <= 0 + let width= &columns + endif + else + let width= a:cols + endif + + let l= a:debut + while l <= a:fin + call setline(l,printf('%-'.width.'s',getline(l))) + let l = l + 1 + endwhile + + call s:RestorePosn() + +" call Dret("s:Spacer") +endf + +" --------------------------------------------------------------------- +" s:CallBox: call the specified function using the current visual selection box {{{2 +fun! s:CallBox(func_name) +" call Dfunc("s:CallBox(func_name<".a:func_name.">)") + + if exists("b:xmouse_start") + let xdep = b:xmouse_start + else + let xdep= 0 + endif + if exists("b:ymouse_start") + let ydep = b:ymouse_start + else + let ydep= 0 + endif + let col0 = virtcol("'<") + let row0 = line("'<") + let col1 = virtcol("'>") + let row1 = line("'>") +" call Decho("TL corner[".row0.",".col0."] original") +" call Decho("BR corner[".row1.",".col1."] original") +" call Decho("xydep [".ydep.",".xdep."]") + + if col1 == xdep && row1 == ydep + let col1 = col0 + let row1 = row0 + let col0 = xdep + let row0 = ydep + endif +" call Decho("TL corner[".row0.",".col0."]") +" call Decho("BR corner[".row1.",".col1."]") + + " insure that the selected region has blanks to that specified by col1 + call s:AutoCanvas((row0 < row1)? row0 : row1,(row1 > row0)? row1 : row0,(col1 > col0)? col1 : col0) + +" call Decho("exe call s:".a:func_name."(".col0.','.row0.','.col1.','.row1.")") + exe "call s:".a:func_name."(".col0.','.row0.','.col1.','.row1.")" + let b:xmouse_start= 0 + let b:ymouse_start= 0 + +" call Dret("s:CallBox") +endf + +" --------------------------------------------------------------------- +" s:DrawBox: {{{2 +fun! s:DrawBox(x0, y0, x1, y1) +" call Dfunc("s:DrawBox(xy0[".a:x0.",".a:y0." xy1[".a:x1.",".a:y1."]) g:drawit_mode=".g:drawit_mode) + " loop each line + let x0= (a:x1 > a:x0)? a:x0 : a:x1 + let x1= (a:x1 > a:x0)? a:x1 : a:x0 + let y0= (a:y1 > a:y0)? a:y0 : a:y1 + let y1= (a:y1 > a:y0)? a:y1 : a:y0 +" call Decho('x0='.x0.' y0='.y0) +" call Decho('x1='.x1.' y1='.y1) + let l = y0 + while l <= y1 + let c = x0 + while c <= x1 + let remp= '.' + if l == y0 || l == y1 + if g:drawit_mode == 's' || g:drawit_mode == 'S' + let remp = b:di_Shoriz + elseif g:drawit_mode == 'd' || g:drawit_mode == 'D' + let remp = b:di_Dhoriz + else + let remp = b:di_horiz + endif + if g:drawit_mode =~ '[sSdD]' + if c == x0 && l == y0 + let remp= (g:drawit_mode == 's' || g:drawit_mode == 'S')? b:di_Sulcorn : b:di_Dulcorn +" call Decho('x0,y0: ulcorn<'.remp.'>') + elseif c == x1 && l == y0 + let remp= (g:drawit_mode == 's' || g:drawit_mode == 'S')? b:di_Surcorn : b:di_Durcorn +" call Decho('x0,y1: ulcorn<'.remp.'>') + elseif c == x0 && l == y1 + let remp= (g:drawit_mode == 's' || g:drawit_mode == 'S')? b:di_Sllcorn : b:di_Dllcorn +" call Decho('x1,y0: ulcorn<'.remp.'>') + elseif c == x1 && l == y1 + let remp= (g:drawit_mode == 's' || g:drawit_mode == 'S')? b:di_Slrcorn : b:di_Dlrcorn +" call Decho('x1,y1: ulcorn<'.remp.'>') + endif + else + if c == x0 || c == x1 + let remp = b:di_plus + endif + endif + else + if g:drawit_mode == 's' || g:drawit_mode == 'S' + let remp = b:di_Svert + elseif g:drawit_mode == 'd' || g:drawit_mode == 'D' + let remp = b:di_Dvert + else + let remp = b:di_vert + endif + if c != x0 && c != x1 + let remp = '.' + endif + endif + + if remp != '.' + call s:SetCharAt(remp, c, l) + endif + let c = c + 1 + endw + let l = l + 1 + endw + +" call Dret("s:DrawBox") +endf + +" --------------------------------------------------------------------- +" s:SetCharAt: set the character at the specified position (something must pre-exist at the pos'n) {{{2 +fun! s:SetCharAt(chr, x, y) +" call Dfunc("s:SetCharAt(chr<".a:chr."> xy[".a:x.",".a:y."])") + + exe a:y + if a:x <= 1 + exe "norm! 0r".a:chr + else + exe "norm! 0".(a:x-1)."lr".a:chr + endif + +" call Dret("s:SetCharAt") +endf + +" --------------------------------------------------------------------- +" s:DrawLine: Bresenham line-drawing algorithm {{{2 +" taken from : +" http://www.graphics.lcs.mit.edu/~mcmillan/comp136/Lecture6/Lines.html +fun! s:DrawLine(x0, y0, x1, y1, horiz) +" call Dfunc("s:DrawLine(xy0[".a:x0.",".a:y0."] xy1[".a:x1.",".a:y1."] horiz=".a:horiz.")") + + if ( a:x0 < a:x1 && a:y0 > a:y1 ) || ( a:x0 > a:x1 && a:y0 > a:y1 ) + " swap direction + let x0 = a:x1 + let y0 = a:y1 + let x1 = a:x0 + let y1 = a:y0 +" call Decho("swap points: p0(".x0.",".y0.") p1(".x1.",".y1.")") + else + let x0 = a:x0 + let y0 = a:y0 + let x1 = a:x1 + let y1 = a:y1 +" call Decho("points: p0(".x0.",".y0.") p1(".x1.",".y1.")") + endif + let dy = y1 - y0 + let dx = x1 - x0 +" call Decho("[dx=x1-x0]=".dx." [dy=y1-y0]=".dy) + + if dy < 0 + let dy = -dy + let stepy = -1 + else + let stepy = 1 + endif + + if dx < 0 + let dx = -dx + let stepx = -1 + else + let stepx = 1 + endif + + let dy = 2*dy + let dx = 2*dx + if a:horiz == '_' + let horiz= a:horiz + else + let horiz = (g:drawit_mode == 'N')? b:di_horiz : ((g:drawit_mode == 'S')? b:di_Shoriz : b:di_Dhoriz) + endif + if a:horiz == '|' + let vertline= a:vert + else + let vertline = (g:drawit_mode == 'N')? b:di_vert : ((g:drawit_mode == 'S')? b:di_Svert : b:di_Dvert) + endif + + if dx > dy +" call Decho("case dx>dy : Δ=".dx.",".dy." step=".stepx.",".stepy) + let char = horiz + call s:SetCharAt(char, x0, y0) + let fraction = dy - (dx / 2) " same as 2*Δy - Δx + while x0 != x1 + let char = horiz + if fraction >= 0 + if stepx > 0 +" call Decho("..case [fraction=".fraction."]≥0 and [stepx=".stepx."]>0: go upleft") + let char = (g:drawit_mode == 'N')? b:di_upleft : b:di_Supleft + else +" call Decho("..case [fraction=".fraction."]≥0 and [stepx=".stepx."]≤0: go upright") + let char = (g:drawit_mode == 'N')? b:di_upright : b:di_Supright + endif + let y0 = y0 + stepy + let fraction = fraction - dx " same as fraction -= 2*Δx +" call Decho("....[y0+=stepy]=".y0." [fraction-=dx]=".fraction) + endif + let x0 = x0 + stepx + let fraction = fraction + dy " same as fraction = fraction - 2*Δy +" call Decho("..[x0+=stepx]=".x0." [fraction-=dy]=".fraction) + call s:SetCharAt(char, x0, y0) + endw + else +" call Decho("case dx≤dy : Δ=".dx.",".dy." step=".stepx.",".stepy) + let char = vertline + call s:SetCharAt(char, x0, y0) + let fraction = dx - (dy / 2) + while y0 != y1 + let char = (g:drawit_mode == 'N')? b:di_vert : ((g:drawit_mode == 'S')? b:di_Svert : b:di_Dvert) + if fraction >= 0 + if stepx > 0 +" call Decho("..case [fraction=".fraction."]≥0 and [stepx=".stepx."]>0: go upleft") + let char = (g:drawit_mode == 'N')? b:di_upleft : b:di_Supleft + else +" call Decho("..case [fraction=".fraction."]≥0 and [stepx=".stepy."]≤0: go upright") + let char = (g:drawit_mode == 'N')? b:di_upright : b:di_Supright + endif + let x0 = x0 + stepx + let fraction = fraction - dy +" call Decho("....[x0+=stepx]=".x0." [fraction-=dy]=".fraction) + endif + let y0 = y0 + stepy + let fraction = fraction + dx +" call Decho("..[y0+=stepy]=".y0." [fraction-=dy]=".fraction) + call s:SetCharAt(char, x0, y0) + endw + endif + +" call Dret("s:DrawLine") +endf + +" --------------------------------------------------------------------- +" s:Arrow: {{{2 +fun! s:Arrow(x0, y0, x1, y1) +" call Dfunc("s:Arrow(xy0[".a:x0.",".a:y0."] xy1[".a:x1.",".a:y1."])") + + let horiz = (g:drawit_mode == 'N')? b:di_horiz : ((g:drawit_mode == 'S')? b:di_Shoriz : b:di_Dhoriz) + call s:DrawLine(a:x0, a:y0, a:x1, a:y1,horiz) + let dy = a:y1 - a:y0 + let dx = a:x1 - a:x0 + if s:Abs(dx) > <SID>Abs(dy) + " move x + if dx > 0 + call s:SetCharAt('>', a:x1, a:y1) + else + call s:SetCharAt('<', a:x1, a:y1) + endif + else + " move y + if dy > 0 + call s:SetCharAt('v', a:x1, a:y1) + else + call s:SetCharAt('^', a:x1, a:y1) + endif + endif + +" call Dret("s:Arrow") +endf + +" --------------------------------------------------------------------- +" s:Abs: return absolute value {{{2 +fun! s:Abs(val) + if a:val < 0 + return - a:val + else + return a:val + endif +endf + +" --------------------------------------------------------------------- +" s:DrawPlainLine: {{{2 +fun! s:DrawPlainLine(x0,y0,x1,y1) +" call Dfunc("s:DrawPlainLine(xy0[".a:x0.",".a:y0."] xy1[".a:x1.",".a:y1."])") + +" call Decho("exe call s:DrawLine(".a:x0.','.a:y0.','.a:x1.','.a:y1.',"_")') + exe "call s:DrawLine(".a:x0.','.a:y0.','.a:x1.','.a:y1.',"_")' + +" call Dret("s:DrawPlainLine") +endf + +" ===================================================================== +" Mouse Functions: {{{1 +" ===================================================================== + +" --------------------------------------------------------------------- +" s:LeftStart: Read visual drag mapping {{{2 +" The visual start point is saved in b:xmouse_start and b:ymouse_start +fun! s:LeftStart() +" call Dfunc("s:LeftStart()") + let b:xmouse_start = virtcol('.') + let b:ymouse_start = line('.') + vnoremap <silent> <buffer> <script> <leftrelease> <leftrelease>:<c-u>call <SID>LeftRelease()<cr>gv +" call Dret("s:LeftStart : [".b:ymouse_start.",".b:xmouse_start."]") +endf! + +" --------------------------------------------------------------------- +" s:LeftRelease: {{{2 +fun! s:LeftRelease() +" call Dfunc("s:LeftRelease()") + vunmap <buffer> <leftrelease> +" call Dret("s:LeftRelease : [".line('.').','.virtcol('.').']') +endf + +" --------------------------------------------------------------------- +" s:SLeftStart: begin drawing with a brush {{{2 +fun! s:SLeftStart() + if !exists("b:drawit_brush") + let b:drawit_brush= "a" + endif +" call Dfunc("s:SLeftStart() brush=".b:drawit_brush.' ['.line('.').','.virtcol('.').']') + noremap <silent> <buffer> <script> <s-leftdrag> <leftmouse>:<c-u>call <SID>SLeftDrag()<cr> + noremap <silent> <buffer> <script> <s-leftrelease> <leftmouse>:<c-u>call <SID>SLeftRelease()<cr> +" call Dret("s:SLeftStart") +endfun + +" --------------------------------------------------------------------- +" s:SLeftDrag: {{{2 +fun! s:SLeftDrag() +" call Dfunc("s:SLeftDrag() brush=".b:drawit_brush.' ['.line('.').','.virtcol('.').']') + call s:SavePosn() + call s:PutBlock(b:drawit_brush,0) + call s:RestorePosn() +" call Dret("s:SLeftDrag") +endfun + +" --------------------------------------------------------------------- +" s:SLeftRelease: {{{2 +fun! s:SLeftRelease() +" call Dfunc("s:SLeftRelease() brush=".b:drawit_brush.' ['.line('.').','.virtcol('.').']') + call s:SLeftDrag() + nunmap <buffer> <s-leftdrag> + nunmap <buffer> <s-leftrelease> +" call Dret("s:SLeftRelease") +endfun + +" --------------------------------------------------------------------- +" s:CLeftStart: begin moving a block of text {{{2 +fun! s:CLeftStart() + if !exists("b:drawit_brush") + let b:drawit_brush= "a" + endif +" call Dfunc("s:CLeftStart() brush=".b:drawit_brush) + if !line("'<") || !line("'>") + redraw! + echohl Error + echo "must visual-block select a region first" +" call Dret("s:CLeftStart : must visual-block select a region first") + return + endif + '<,'>call DrawIt#SetBrush(b:drawit_brush) + norm! gvr + let s:cleft_width= virtcol("'>") - virtcol("'<") + if s:cleft_width < 0 + let s:cleft_width= -s:cleft_width + endif + let s:cleft_height= line("'>") - line("'<") + if s:cleft_height < 0 + let s:cleft_height= -s:cleft_height + endif + if exists("s:cleft_oldblock") + unlet s:cleft_oldblock + endif +" call Decho("blocksize: ".s:cleft_height."x".s:cleft_width) + noremap <silent> <buffer> <script> <c-leftdrag> :<c-u>call <SID>CLeftDrag()<cr> + noremap <silent> <buffer> <script> <c-leftrelease> <leftmouse>:<c-u>call <SID>CLeftRelease()<cr> +" call Dret("s:CLeftStart") +endfun + +" --------------------------------------------------------------------- +" s:CLeftDrag: {{{2 +fun! s:CLeftDrag() +" call Dfunc("s:CLeftDrag() cleft_width=".s:cleft_width." cleft_height=".s:cleft_height) + exe 'let keepbrush= @'.b:drawit_brush +" call Decho("keepbrush<".keepbrush.">") + + " restore prior contents of block zone + if exists("s:cleft_oldblock") +" call Decho("draw prior contents: [".line(".").",".virtcol(".")."] line($)=".line("$")) +" call Decho("draw prior contents<".s:cleft_oldblock.">") + exe 'let @'.b:drawit_brush.'=s:cleft_oldblock' + call s:PutBlock(b:drawit_brush,1) + endif + + " move cursor to <leftmouse> position + exe "norm! \<leftmouse>" + + " save new block zone contents +" call Decho("save contents: [".line(".").",".virtcol(".")."] - [".(line(".")+s:cleft_height).",".(virtcol(".")+s:cleft_width)."]") + let curline= line(".") + call s:AutoCanvas(curline,curline + s:cleft_height,virtcol(".")+s:cleft_width) + if s:cleft_width > 0 && s:cleft_height > 0 + exe "silent! norm! \<c-v>".s:cleft_width."l".s:cleft_height.'j"'.b:drawit_brush.'y' + elseif s:cleft_width > 0 + exe "silent! norm! \<c-v>".s:cleft_width.'l"'.b:drawit_brush.'y' + else + exe "silent! norm! \<c-v>".s:cleft_height.'j"'.b:drawit_brush.'y' + endif + exe "let s:cleft_oldblock= @".b:drawit_brush +" call Decho("s:cleft_oldblock=@".b:drawit_brush) +" call Decho("cleft_height=".s:cleft_height." cleft_width=".s:cleft_width) +" call Decho("save contents<".s:cleft_oldblock.">") + + " draw the brush +" call Decho("draw brush") +" call Decho("draw brush ".b:drawit_brush.": [".line(".").",".virtcol(".")."] line($)=".line("$")) + exe 'let @'.b:drawit_brush.'=keepbrush' + call s:PutBlock(b:drawit_brush,1) + +" call Dret("s:CLeftDrag") +endfun + +" --------------------------------------------------------------------- +" s:CLeftRelease: {{{2 +fun! s:CLeftRelease() +" call Dfunc("s:CLeftRelease()") + call s:CLeftDrag() + nunmap <buffer> <c-leftdrag> + nunmap <buffer> <c-leftrelease> + unlet s:cleft_oldblock s:cleft_height s:cleft_width +" call Dret("s:CLeftRelease") +endfun + +" --------------------------------------------------------------------- +" DrawIt#SetBrush: {{{2 +fun! DrawIt#SetBrush(brush) range +" call Dfunc("DrawIt#SetBrush(brush<".a:brush.">)") + let b:drawit_brush= a:brush +" call Decho("visualmode<".visualmode()."> range[".a:firstline.",".a:lastline."] visrange[".line("'<").",".line("'>")."]") + if visualmode() == "\<c-v>" && ((a:firstline == line("'>") && a:lastline == line("'<")) || (a:firstline == line("'<") && a:lastline == line("'>"))) + " last visual mode was visual block mode, and + " either [firstline,lastline] == ['<,'>] or ['>,'<] + " Assuming that SetBrush called from a visual-block selection! + " Yank visual block into selected register (brush) +" call Decho("yanking visual block into register ".b:drawit_brush) + exe 'norm! gv"'.b:drawit_brush.'y' + endif +" call Dret("DrawIt#SetBrush : b:drawit_brush=".b:drawit_brush) +endfun + +" ------------------------------------------------------------------------ +" Modelines: {{{1 +" vim: fdm=marker +let &cpo= s:keepcpo +unlet s:keepcpo diff --git a/vim/autoload/pathogen.vim b/vim/autoload/pathogen.vim new file mode 100644 index 0000000..c6d54a1 --- /dev/null +++ b/vim/autoload/pathogen.vim @@ -0,0 +1,344 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope <http://tpo.pe/> +" Version: 2.3 + +" Install in ~/.vim/autoload (or ~\vimfiles\autoload). +" +" For management of individually installed plugins in ~/.vim/bundle (or +" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your +" .vimrc is the only other setup necessary. +" +" The API is documented inline below. + +if exists("g:loaded_pathogen") || &cp + finish +endif +let g:loaded_pathogen = 1 + +" Point of entry for basic default usage. Give a relative path to invoke +" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke +" pathogen#surround(). Curly braces are expanded with pathogen#expand(): +" "bundle/{}" finds all subdirectories inside "bundle" inside all directories +" in the runtime path. +function! pathogen#infect(...) abort + for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] + if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' + call pathogen#surround(path) + elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#surround(path . '/{}') + elseif path =~# '[{}*]' + call pathogen#interpose(path) + else + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#interpose(path . '/{}') + endif + endfor + call pathogen#cycle_filetype() + if pathogen#is_disabled($MYVIMRC) + return 'finish' + endif + return '' +endfunction + +" Split a path into a list. +function! pathogen#split(path) abort + if type(a:path) == type([]) | return a:path | endif + if empty(a:path) | return [] | endif + let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,') + return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")') +endfunction + +" Convert a list to a path. +function! pathogen#join(...) abort + if type(a:1) == type(1) && a:1 + let i = 1 + let space = ' ' + else + let i = 0 + let space = '' + endif + let path = "" + while i < a:0 + if type(a:000[i]) == type([]) + let list = a:000[i] + let j = 0 + while j < len(list) + let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g') + let path .= ',' . escaped + let j += 1 + endwhile + else + let path .= "," . a:000[i] + endif + let i += 1 + endwhile + return substitute(path,'^,','','') +endfunction + +" Convert a list to a path with escaped spaces for 'path', 'tag', etc. +function! pathogen#legacyjoin(...) abort + return call('pathogen#join',[1] + a:000) +endfunction + +" Turn filetype detection off and back on again if it was already enabled. +function! pathogen#cycle_filetype() abort + if exists('g:did_load_filetypes') + filetype off + filetype on + endif +endfunction + +" Check if a bundle is disabled. A bundle is considered disabled if its +" basename or full name is included in the list g:pathogen_disabled. +function! pathogen#is_disabled(path) abort + if a:path =~# '\~$' + return 1 + endif + let sep = pathogen#slash() + let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST) + return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1 +endfunction "}}}1 + +" Prepend the given directory to the runtime path and append its corresponding +" after directory. Curly braces are expanded with pathogen#expand(). +function! pathogen#surround(path) abort + let sep = pathogen#slash() + let rtp = pathogen#split(&rtp) + let path = fnamemodify(a:path, ':p:?[\\/]\=$??') + let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)') + let after = filter(reverse(pathogen#expand(path.sep.'after')), '!pathogen#is_disabled(v:val[0:-7])') + call filter(rtp, 'index(before + after, v:val) == -1') + let &rtp = pathogen#join(before, rtp, after) + return &rtp +endfunction + +" For each directory in the runtime path, add a second entry with the given +" argument appended. Curly braces are expanded with pathogen#expand(). +function! pathogen#interpose(name) abort + let sep = pathogen#slash() + let name = a:name + if has_key(s:done_bundles, name) + return "" + endif + let s:done_bundles[name] = 1 + let list = [] + for dir in pathogen#split(&rtp) + if dir =~# '\<after$' + let list += reverse(filter(pathogen#expand(dir[0:-6].name.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir] + else + let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)') + endif + endfor + let &rtp = pathogen#join(pathogen#uniq(list)) + return 1 +endfunction + +let s:done_bundles = {} + +" Invoke :helptags on all non-$VIM doc directories in runtimepath. +function! pathogen#helptags() abort + let sep = pathogen#slash() + for glob in pathogen#split(&rtp) + for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep') + if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags')) + silent! execute 'helptags' pathogen#fnameescape(dir) + endif + endfor + endfor +endfunction + +command! -bar Helptags :call pathogen#helptags() + +" Execute the given command. This is basically a backdoor for --remote-expr. +function! pathogen#execute(...) abort + for command in a:000 + execute command + endfor + return '' +endfunction + +" Section: Unofficial + +function! pathogen#is_absolute(path) abort + return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]') +endfunction + +" Given a string, returns all possible permutations of comma delimited braced +" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields +" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard +" and globbed. Actual globs are preserved. +function! pathogen#expand(pattern) abort + if a:pattern =~# '{[^{}]\+}' + let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1) + let found = map(split(pat, ',', 1), 'pre.v:val.post') + let results = [] + for pattern in found + call extend(results, pathogen#expand(pattern)) + endfor + return results + elseif a:pattern =~# '{}' + let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)') + let post = a:pattern[strlen(pat) : -1] + return map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post') + else + return [a:pattern] + endif +endfunction + +" \ on Windows unless shellslash is set, / everywhere else. +function! pathogen#slash() abort + return !exists("+shellslash") || &shellslash ? '/' : '\' +endfunction + +function! pathogen#separator() abort + return pathogen#slash() +endfunction + +" Convenience wrapper around glob() which returns a list. +function! pathogen#glob(pattern) abort + let files = split(glob(a:pattern),"\n") + return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")') +endfunction "}}}1 + +" Like pathogen#glob(), only limit the results to directories. +function! pathogen#glob_directories(pattern) abort + return filter(pathogen#glob(a:pattern),'isdirectory(v:val)') +endfunction "}}}1 + +" Remove duplicates from a list. +function! pathogen#uniq(list) abort + let i = 0 + let seen = {} + while i < len(a:list) + if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i]) + call remove(a:list,i) + elseif a:list[i] ==# '' + let i += 1 + let empty = 1 + else + let seen[a:list[i]] = 1 + let i += 1 + endif + endwhile + return a:list +endfunction + +" Backport of fnameescape(). +function! pathogen#fnameescape(string) abort + if exists('*fnameescape') + return fnameescape(a:string) + elseif a:string ==# '-' + return '\-' + else + return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','') + endif +endfunction + +" Like findfile(), but hardcoded to use the runtimepath. +function! pathogen#runtime_findfile(file,count) abort "{{{1 + let rtp = pathogen#join(1,pathogen#split(&rtp)) + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif +endfunction + +" Section: Deprecated + +function! s:warn(msg) abort + echohl WarningMsg + echomsg a:msg + echohl NONE +endfunction + +" Prepend all subdirectories of path to the rtp, and append all 'after' +" directories in those subdirectories. Deprecated. +function! pathogen#runtime_prepend_subdirectories(path) abort + call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')') + return pathogen#surround(a:path . pathogen#slash() . '{}') +endfunction + +function! pathogen#incubate(...) abort + let name = a:0 ? a:1 : 'bundle/{}' + call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')') + return pathogen#interpose(name) +endfunction + +" Deprecated alias for pathogen#interpose(). +function! pathogen#runtime_append_all_bundles(...) abort + if a:0 + call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')') + else + call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()') + endif + return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}') +endfunction + +if exists(':Vedit') + finish +endif + +let s:vopen_warning = 0 + +function! s:find(count,cmd,file,lcd) + let rtp = pathogen#join(1,pathogen#split(&runtimepath)) + let file = pathogen#runtime_findfile(a:file,a:count) + if file ==# '' + return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" + endif + if !s:vopen_warning + let s:vopen_warning = 1 + let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE' + else + let warning = '' + endif + if a:lcd + let path = file[0:-strlen(a:file)-2] + execute 'lcd `=path`' + return a:cmd.' '.pathogen#fnameescape(a:file) . warning + else + return a:cmd.' '.pathogen#fnameescape(file) . warning + endif +endfunction + +function! s:Findcomplete(A,L,P) + let sep = pathogen#slash() + let cheats = { + \'a': 'autoload', + \'d': 'doc', + \'f': 'ftplugin', + \'i': 'indent', + \'p': 'plugin', + \'s': 'syntax'} + if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) + let request = cheats[a:A[0]].a:A[1:-1] + else + let request = a:A + endif + let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' + let found = {} + for path in pathogen#split(&runtimepath) + let path = expand(path, ':p') + let matches = split(glob(path.sep.pattern),"\n") + call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') + call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]') + for match in matches + let found[match] = 1 + endfor + endfor + return sort(keys(found)) +endfunction + +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1) + +" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/vim/boxdraw/bdua2b.pl b/vim/boxdraw/bdua2b.pl new file mode 100644 index 0000000..2e94b9a --- /dev/null +++ b/vim/boxdraw/bdua2b.pl @@ -0,0 +1,91 @@ +# 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/vim/boxdraw/bdub2a.pl b/vim/boxdraw/bdub2a.pl new file mode 100644 index 0000000..4482923 --- /dev/null +++ b/vim/boxdraw/bdub2a.pl @@ -0,0 +1,30 @@ +# 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/vim/boxdraw/boxdraw.txt b/vim/boxdraw/boxdraw.txt new file mode 100644 index 0000000..b821a43 --- /dev/null +++ b/vim/boxdraw/boxdraw.txt @@ -0,0 +1,164 @@ +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/vim/boxdraw/boxdraw.vim b/vim/boxdraw/boxdraw.vim new file mode 100644 index 0000000..284232f --- /dev/null +++ b/vim/boxdraw/boxdraw.vim @@ -0,0 +1,291 @@ +" 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/vim/boxdraw/outline.pl b/vim/boxdraw/outline.pl new file mode 100644 index 0000000..f095e7f --- /dev/null +++ b/vim/boxdraw/outline.pl @@ -0,0 +1,74 @@ +# 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/vim/boxdraw/sampler.txt b/vim/boxdraw/sampler.txt new file mode 100644 index 0000000..1f6aad8 --- /dev/null +++ b/vim/boxdraw/sampler.txt @@ -0,0 +1,13 @@ +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/vim/bundle/vim-easymotion b/vim/bundle/vim-easymotion new file mode 160000 +Subproject c87f91d712d77ba883e0d8f8ff6effdee0c1ddf diff --git a/vim/bundle/vim-repeat b/vim/bundle/vim-repeat new file mode 160000 +Subproject 2a3c5f8e3c26a57b8eb4cfc4be79615a1c508ef diff --git a/vim/colors/solarized.vim b/vim/colors/solarized.vim new file mode 100644 index 0000000..175a0b5 --- /dev/null +++ b/vim/colors/solarized.vim @@ -0,0 +1,1117 @@ +" Name: Solarized vim colorscheme +" Author: Ethan Schoonover <es@ethanschoonover.com> +" URL: http://ethanschoonover.com/solarized +" (see this url for latest release & screenshots) +" License: OSI approved MIT license (see end of this file) +" Created: In the middle of the night +" Modified: 2011 May 05 +" +" Usage "{{{ +" +" --------------------------------------------------------------------- +" ABOUT: +" --------------------------------------------------------------------- +" Solarized is a carefully designed selective contrast colorscheme with dual +" light and dark modes that runs in both GUI, 256 and 16 color modes. +" +" See the homepage above for screenshots and details. +" +" --------------------------------------------------------------------- +" OPTIONS: +" --------------------------------------------------------------------- +" See the "solarized.txt" help file included with this colorscheme (in the +" "doc" subdirectory) for information on options, usage, the Toggle Background +" function and more. If you have already installed Solarized, this is available +" from the Solarized menu and command line as ":help solarized" +" +" --------------------------------------------------------------------- +" INSTALLATION: +" --------------------------------------------------------------------- +" Two options for installation: manual or pathogen +" +" MANUAL INSTALLATION OPTION: +" --------------------------------------------------------------------- +" +" 1. Download the solarized distribution (available on the homepage above) +" and unarchive the file. +" 2. Move `solarized.vim` to your `.vim/colors` directory. +" 3. Move each of the files in each subdirectories to the corresponding .vim +" subdirectory (e.g. autoload/togglebg.vim goes into your .vim/autoload +" directory as .vim/autoload/togglebg.vim). +" +" RECOMMENDED PATHOGEN INSTALLATION OPTION: +" --------------------------------------------------------------------- +" +" 1. Download and install Tim Pope's Pathogen from: +" https://github.com/tpope/vim-pathogen +" +" 2. Next, move or clone the `vim-colors-solarized` directory so that it is +" a subdirectory of the `.vim/bundle` directory. +" +" a. **clone with git:** +" +" $ cd ~/.vim/bundle +" $ git clone git://github.com/altercation/vim-colors-solarized.git +" +" b. **or move manually into the pathogen bundle directory:** +" In the parent directory of vim-colors-solarized: +" +" $ mv vim-colors-solarized ~/.vim/bundle/ +" +" MODIFY VIMRC: +" +" After either Option 1 or Option 2 above, put the following two lines in your +" .vimrc: +" +" syntax enable +" set background=dark +" colorscheme solarized +" +" or, for the light background mode of Solarized: +" +" syntax enable +" set background=light +" colorscheme solarized +" +" I like to have a different background in GUI and terminal modes, so I can use +" the following if-then. However, I find vim's background autodetection to be +" pretty good and, at least with MacVim, I can leave this background value +" assignment out entirely and get the same results. +" +" if has('gui_running') +" set background=light +" else +" set background=dark +" endif +" +" See the Solarized homepage at http://ethanschoonover.com/solarized for +" screenshots which will help you select either the light or dark background. +" +" --------------------------------------------------------------------- +" COLOR VALUES +" --------------------------------------------------------------------- +" Download palettes and files from: http://ethanschoonover.com/solarized +" +" L\*a\*b values are canonical (White D65, Reference D50), other values are +" matched in sRGB space. +" +" SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB +" --------- ------- ---- ------- ----------- ---------- ----------- ----------- +" base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21 +" base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26 +" base01 #586e75 10/7 brgreen 240 #4e4e4e 45 -07 -07 88 110 117 194 25 46 +" base00 #657b83 11/7 bryellow 241 #585858 50 -07 -07 101 123 131 195 23 51 +" base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59 +" base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63 +" base2 #eee8d5 7/7 white 254 #d7d7af 92 -00 10 238 232 213 44 11 93 +" base3 #fdf6e3 15/7 brwhite 230 #ffffd7 97 00 10 253 246 227 44 10 99 +" yellow #b58900 3/3 yellow 136 #af8700 60 10 65 181 137 0 45 100 71 +" orange #cb4b16 9/3 brred 166 #d75f00 50 50 55 203 75 22 18 89 80 +" red #dc322f 1/1 red 160 #d70000 50 65 45 220 50 47 1 79 86 +" magenta #d33682 5/5 magenta 125 #af005f 50 65 -05 211 54 130 331 74 83 +" violet #6c71c4 13/5 brmagenta 61 #5f5faf 50 15 -45 108 113 196 237 45 77 +" blue #268bd2 4/4 blue 33 #0087ff 55 -10 -45 38 139 210 205 82 82 +" cyan #2aa198 6/6 cyan 37 #00afaf 60 -35 -05 42 161 152 175 74 63 +" green #859900 2/2 green 64 #5f8700 60 -20 65 133 153 0 68 100 60 +" +" --------------------------------------------------------------------- +" COLORSCHEME HACKING +" --------------------------------------------------------------------- +" +" Useful commands for testing colorschemes: +" :source $VIMRUNTIME/syntax/hitest.vim +" :help highlight-groups +" :help cterm-colors +" :help group-name +" +" Useful links for developing colorschemes: +" http://www.vim.org/scripts/script.php?script_id=2937 +" http://vimcasts.org/episodes/creating-colorschemes-for-vim/ +" http://www.frexx.de/xterm-256-notes/" +" +" }}} +" Environment Specific Overrides "{{{ +" Allow or disallow certain features based on current terminal emulator or +" environment. + +" Terminals that support italics +let s:terms_italic=[ + \"rxvt", + \"gnome-terminal" + \] +" For reference only, terminals are known to be incomptible. +" Terminals that are in neither list need to be tested. +let s:terms_noitalic=[ + \"iTerm.app", + \"Apple_Terminal" + \] +if has("gui_running") + let s:terminal_italic=1 " TODO: could refactor to not require this at all +else + let s:terminal_italic=0 " terminals will be guilty until proven compatible + for term in s:terms_italic + if $TERM_PROGRAM =~ term + let s:terminal_italic=1 + endif + endfor +endif + +" }}} +" Default option values"{{{ +" --------------------------------------------------------------------- +" s:options_list is used to autogenerate a list of all non-default options +" using "call SolarizedOptions()" or with the "Generate .vimrc commands" +" Solarized menu option. See the "Menus" section below for the function itself. +let s:options_list=[ + \'" this block of commands has been autogenerated by solarized.vim and', + \'" includes the current, non-default Solarized option values.', + \'" To use, place these commands in your .vimrc file (replacing any', + \'" existing colorscheme commands). See also ":help solarized"', + \'', + \'" ------------------------------------------------------------------', + \'" Solarized Colorscheme Config', + \'" ------------------------------------------------------------------', + \] +let s:colorscheme_list=[ + \'syntax enable', + \'set background='.&background, + \'colorscheme solarized', + \] +let s:defaults_list=[ + \'" ------------------------------------------------------------------', + \'', + \'" The following items are available options, but do not need to be', + \'" included in your .vimrc as they are currently set to their defaults.', + \'' + \] +let s:lazycat_list=[ + \'" lazy method of appending this onto your .vimrc ":w! >> ~/.vimrc"', + \'" ------------------------------------------------------------------', + \] + +function! s:SetOption(name,default) + if type(a:default) == type(0) + let l:wrap='' + let l:ewrap='' + else + let l:wrap='"' + let l:ewrap='\"' + endif + if !exists("g:solarized_".a:name) || g:solarized_{a:name}==a:default + exe 'let g:solarized_'.a:name.'='.l:wrap.a:default.l:wrap.'"' + exe 'call add(s:defaults_list, "\" let g:solarized_'.a:name.'='.l:ewrap.g:solarized_{a:name}.l:ewrap.'")' + else + exe 'call add(s:options_list, "let g:solarized_'.a:name.'='.l:ewrap.g:solarized_{a:name}.l:ewrap.' \"default value is '.a:default.'")' + endif +endfunction + +if ($TERM_PROGRAM ==? "apple_terminal" && &t_Co < 256) + let s:solarized_termtrans_default = 1 +else + let s:solarized_termtrans_default = 0 +endif +call s:SetOption("termtrans",s:solarized_termtrans_default) +call s:SetOption("degrade",0) +call s:SetOption("bold",1) +call s:SetOption("underline",1) +call s:SetOption("italic",1) " note that we need to override this later if the terminal doesn't support +call s:SetOption("termcolors",16) +call s:SetOption("contrast","normal") +call s:SetOption("visibility","normal") +call s:SetOption("diffmode","normal") +call s:SetOption("hitrail",0) +call s:SetOption("menu",1) + +"}}} +" Colorscheme initialization "{{{ +" --------------------------------------------------------------------- +hi clear +if exists("syntax_on") + syntax reset +endif +let colors_name = "solarized" + +"}}} +" GUI & CSApprox hexadecimal palettes"{{{ +" --------------------------------------------------------------------- +" +" Set both gui and terminal color values in separate conditional statements +" Due to possibility that CSApprox is running (though I suppose we could just +" leave the hex values out entirely in that case and include only cterm colors) +" We also check to see if user has set solarized (force use of the +" neutral gray monotone palette component) +if (has("gui_running") && g:solarized_degrade == 0) + let s:vmode = "gui" + let s:base03 = "#002b36" + let s:base02 = "#073642" + let s:base01 = "#586e75" + let s:base00 = "#657b83" + let s:base0 = "#839496" + let s:base1 = "#93a1a1" + let s:base2 = "#eee8d5" + let s:base3 = "#fdf6e3" + let s:yellow = "#b58900" + let s:orange = "#cb4b16" + let s:red = "#dc322f" + let s:magenta = "#d33682" + let s:violet = "#6c71c4" + let s:blue = "#268bd2" + let s:cyan = "#2aa198" + "let s:green = "#859900" "original + let s:green = "#719e07" "experimental +elseif (has("gui_running") && g:solarized_degrade == 1) + " These colors are identical to the 256 color mode. They may be viewed + " while in gui mode via "let g:solarized_degrade=1", though this is not + " recommened and is for testing only. + let s:vmode = "gui" + let s:base03 = "#1c1c1c" + let s:base02 = "#262626" + let s:base01 = "#4e4e4e" + let s:base00 = "#585858" + let s:base0 = "#808080" + let s:base1 = "#8a8a8a" + let s:base2 = "#d7d7af" + let s:base3 = "#ffffd7" + let s:yellow = "#af8700" + let s:orange = "#d75f00" + let s:red = "#af0000" + let s:magenta = "#af005f" + let s:violet = "#5f5faf" + let s:blue = "#0087ff" + let s:cyan = "#00afaf" + let s:green = "#5f8700" +elseif g:solarized_termcolors != 256 && &t_Co >= 16 + let s:vmode = "cterm" + let s:base03 = "8" + let s:base02 = "0" + let s:base01 = "10" + let s:base00 = "11" + let s:base0 = "12" + let s:base1 = "14" + let s:base2 = "7" + let s:base3 = "15" + let s:yellow = "3" + let s:orange = "9" + let s:red = "1" + let s:magenta = "5" + let s:violet = "13" + let s:blue = "4" + let s:cyan = "6" + let s:green = "2" +elseif g:solarized_termcolors == 256 + let s:vmode = "cterm" + let s:base03 = "234" + let s:base02 = "235" + let s:base01 = "239" + let s:base00 = "240" + let s:base0 = "244" + let s:base1 = "245" + let s:base2 = "187" + let s:base3 = "230" + let s:yellow = "136" + let s:orange = "166" + let s:red = "124" + let s:magenta = "125" + let s:violet = "61" + let s:blue = "33" + let s:cyan = "37" + let s:green = "64" +else + let s:vmode = "cterm" + let s:bright = "* term=bold cterm=bold" +" let s:base03 = "0".s:bright +" let s:base02 = "0" +" let s:base01 = "2".s:bright +" let s:base00 = "3".s:bright +" let s:base0 = "4".s:bright +" let s:base1 = "6".s:bright +" let s:base2 = "7" +" let s:base3 = "7".s:bright +" let s:yellow = "3" +" let s:orange = "1".s:bright +" let s:red = "1" +" let s:magenta = "5" +" let s:violet = "5".s:bright +" let s:blue = "4" +" let s:cyan = "6" +" let s:green = "2" + let s:base03 = "DarkGray" " 0* + let s:base02 = "Black" " 0 + let s:base01 = "LightGreen" " 2* + let s:base00 = "LightYellow" " 3* + let s:base0 = "LightBlue" " 4* + let s:base1 = "LightCyan" " 6* + let s:base2 = "LightGray" " 7 + let s:base3 = "White" " 7* + let s:yellow = "DarkYellow" " 3 + let s:orange = "LightRed" " 1* + let s:red = "DarkRed" " 1 + let s:magenta = "DarkMagenta" " 5 + let s:violet = "LightMagenta" " 5* + let s:blue = "DarkBlue" " 4 + let s:cyan = "DarkCyan" " 6 + let s:green = "DarkGreen" " 2 + +endif +"}}} +" Formatting options and null values for passthrough effect "{{{ +" --------------------------------------------------------------------- + let s:none = "NONE" + let s:none = "NONE" + let s:t_none = "NONE" + let s:n = "NONE" + let s:c = ",undercurl" + let s:r = ",reverse" + let s:s = ",standout" + let s:ou = "" + let s:ob = "" +"}}} +" Background value based on termtrans setting "{{{ +" --------------------------------------------------------------------- +if (has("gui_running") || g:solarized_termtrans == 0) + let s:back = "NONE" +else + let s:back = "NONE" +endif +"}}} +" Alternate light scheme "{{{ +" --------------------------------------------------------------------- +if &background == "light" + let s:temp03 = s:base03 + let s:temp02 = s:base02 + let s:temp01 = s:base01 + let s:temp00 = s:base00 + let s:base03 = s:base3 + let s:base02 = s:base2 + let s:base01 = s:base1 + let s:base00 = s:base0 + let s:base0 = s:temp00 + let s:base1 = s:temp01 + let s:base2 = s:temp02 + let s:base3 = s:temp03 + if (s:back != "NONE") + let s:back = s:base03 + endif +endif +"}}} +" Optional contrast schemes "{{{ +" --------------------------------------------------------------------- +if g:solarized_contrast == "high" + let s:base01 = s:base00 + let s:base00 = s:base0 + let s:base0 = s:base1 + let s:base1 = s:base2 + let s:base2 = s:base3 + let s:back = s:back +endif +if g:solarized_contrast == "low" + let s:back = s:base02 + let s:ou = ",underline" +endif +"}}} +" Overrides dependent on user specified values and environment "{{{ +" --------------------------------------------------------------------- +if (g:solarized_bold == 0 || &t_Co == 8 ) + let s:b = "" + let s:bb = ",bold" +else + let s:b = ",bold" + let s:bb = "" +endif + +if g:solarized_underline == 0 + let s:u = "" +else + let s:u = ",underline" +endif + +if g:solarized_italic == 0 || s:terminal_italic == 0 + let s:i = "" +else + let s:i = ",italic" +endif +"}}} +" Highlighting primitives"{{{ +" --------------------------------------------------------------------- + +exe "let s:bg_none = ' ".s:vmode."bg=".s:none ."'" +exe "let s:bg_back = ' ".s:vmode."bg=".s:back ."'" +exe "let s:bg_base03 = ' ".s:vmode."bg=".s:base03 ."'" +exe "let s:bg_base02 = ' ".s:vmode."bg=".s:base02 ."'" +exe "let s:bg_base01 = ' ".s:vmode."bg=".s:base01 ."'" +exe "let s:bg_base00 = ' ".s:vmode."bg=".s:base00 ."'" +exe "let s:bg_base0 = ' ".s:vmode."bg=".s:base0 ."'" +exe "let s:bg_base1 = ' ".s:vmode."bg=".s:base1 ."'" +exe "let s:bg_base2 = ' ".s:vmode."bg=".s:base2 ."'" +exe "let s:bg_base3 = ' ".s:vmode."bg=".s:base3 ."'" +exe "let s:bg_green = ' ".s:vmode."bg=".s:green ."'" +exe "let s:bg_yellow = ' ".s:vmode."bg=".s:yellow ."'" +exe "let s:bg_orange = ' ".s:vmode."bg=".s:orange ."'" +exe "let s:bg_red = ' ".s:vmode."bg=".s:red ."'" +exe "let s:bg_magenta = ' ".s:vmode."bg=".s:magenta."'" +exe "let s:bg_violet = ' ".s:vmode."bg=".s:violet ."'" +exe "let s:bg_blue = ' ".s:vmode."bg=".s:blue ."'" +exe "let s:bg_cyan = ' ".s:vmode."bg=".s:cyan ."'" + +exe "let s:fg_none = ' ".s:vmode."fg=".s:none ."'" +exe "let s:fg_back = ' ".s:vmode."fg=".s:back ."'" +exe "let s:fg_base03 = ' ".s:vmode."fg=".s:base03 ."'" +exe "let s:fg_base02 = ' ".s:vmode."fg=".s:base02 ."'" +exe "let s:fg_base01 = ' ".s:vmode."fg=".s:base01 ."'" +exe "let s:fg_base00 = ' ".s:vmode."fg=".s:base00 ."'" +exe "let s:fg_base0 = ' ".s:vmode."fg=".s:base0 ."'" +exe "let s:fg_base1 = ' ".s:vmode."fg=".s:base1 ."'" +exe "let s:fg_base2 = ' ".s:vmode."fg=".s:base2 ."'" +exe "let s:fg_base3 = ' ".s:vmode."fg=".s:base3 ."'" +exe "let s:fg_green = ' ".s:vmode."fg=".s:green ."'" +exe "let s:fg_yellow = ' ".s:vmode."fg=".s:yellow ."'" +exe "let s:fg_orange = ' ".s:vmode."fg=".s:orange ."'" +exe "let s:fg_red = ' ".s:vmode."fg=".s:red ."'" +exe "let s:fg_magenta = ' ".s:vmode."fg=".s:magenta."'" +exe "let s:fg_violet = ' ".s:vmode."fg=".s:violet ."'" +exe "let s:fg_blue = ' ".s:vmode."fg=".s:blue ."'" +exe "let s:fg_cyan = ' ".s:vmode."fg=".s:cyan ."'" + +exe "let s:fmt_none = ' ".s:vmode."=NONE". " term=NONE". "'" +exe "let s:fmt_bold = ' ".s:vmode."=NONE".s:b. " term=NONE".s:b."'" +exe "let s:fmt_bldi = ' ".s:vmode."=NONE".s:b. " term=NONE".s:b."'" +exe "let s:fmt_undr = ' ".s:vmode."=NONE".s:u. " term=NONE".s:u."'" +exe "let s:fmt_undb = ' ".s:vmode."=NONE".s:u.s:b. " term=NONE".s:u.s:b."'" +exe "let s:fmt_undi = ' ".s:vmode."=NONE".s:u. " term=NONE".s:u."'" +exe "let s:fmt_uopt = ' ".s:vmode."=NONE".s:ou. " term=NONE".s:ou."'" +exe "let s:fmt_curl = ' ".s:vmode."=NONE".s:c. " term=NONE".s:c."'" +exe "let s:fmt_ital = ' ".s:vmode."=NONE".s:i. " term=NONE".s:i."'" +exe "let s:fmt_stnd = ' ".s:vmode."=NONE".s:s. " term=NONE".s:s."'" +exe "let s:fmt_revr = ' ".s:vmode."=NONE".s:r. " term=NONE".s:r."'" +exe "let s:fmt_revb = ' ".s:vmode."=NONE".s:r.s:b. " term=NONE".s:r.s:b."'" +" revbb (reverse bold for bright colors) is only set to actual bold in low +" color terminals (t_co=8, such as OS X Terminal.app) and should only be used +" with colors 8-15. +exe "let s:fmt_revbb = ' ".s:vmode."=NONE".s:r.s:bb. " term=NONE".s:r.s:bb."'" +exe "let s:fmt_revbbu = ' ".s:vmode."=NONE".s:r.s:bb.s:u." term=NONE".s:r.s:bb.s:u."'" + +if has("gui_running") + exe "let s:sp_none = ' guisp=".s:none ."'" + exe "let s:sp_back = ' guisp=".s:back ."'" + exe "let s:sp_base03 = ' guisp=".s:base03 ."'" + exe "let s:sp_base02 = ' guisp=".s:base02 ."'" + exe "let s:sp_base01 = ' guisp=".s:base01 ."'" + exe "let s:sp_base00 = ' guisp=".s:base00 ."'" + exe "let s:sp_base0 = ' guisp=".s:base0 ."'" + exe "let s:sp_base1 = ' guisp=".s:base1 ."'" + exe "let s:sp_base2 = ' guisp=".s:base2 ."'" + exe "let s:sp_base3 = ' guisp=".s:base3 ."'" + exe "let s:sp_green = ' guisp=".s:green ."'" + exe "let s:sp_yellow = ' guisp=".s:yellow ."'" + exe "let s:sp_orange = ' guisp=".s:orange ."'" + exe "let s:sp_red = ' guisp=".s:red ."'" + exe "let s:sp_magenta = ' guisp=".s:magenta."'" + exe "let s:sp_violet = ' guisp=".s:violet ."'" + exe "let s:sp_blue = ' guisp=".s:blue ."'" + exe "let s:sp_cyan = ' guisp=".s:cyan ."'" +else + let s:sp_none = "" + let s:sp_back = "" + let s:sp_base03 = "" + let s:sp_base02 = "" + let s:sp_base01 = "" + let s:sp_base00 = "" + let s:sp_base0 = "" + let s:sp_base1 = "" + let s:sp_base2 = "" + let s:sp_base3 = "" + let s:sp_green = "" + let s:sp_yellow = "" + let s:sp_orange = "" + let s:sp_red = "" + let s:sp_magenta = "" + let s:sp_violet = "" + let s:sp_blue = "" + let s:sp_cyan = "" +endif + +"}}} +" Basic highlighting"{{{ +" --------------------------------------------------------------------- +" note that link syntax to avoid duplicate configuration doesn't work with the +" exe compiled formats + +exe "hi! Normal" .s:fmt_none .s:fg_base0 .s:bg_back + +exe "hi! Comment" .s:fmt_ital .s:fg_base01 .s:bg_none +" *Comment any comment + +exe "hi! Constant" .s:fmt_none .s:fg_cyan .s:bg_none +" *Constant any constant +" String a string constant: "this is a string" +" Character a character constant: 'c', '\n' +" Number a number constant: 234, 0xff +" Boolean a boolean constant: TRUE, false +" Float a floating point constant: 2.3e10 + +exe "hi! Identifier" .s:fmt_none .s:fg_blue .s:bg_none +" *Identifier any variable name +" Function function name (also: methods for classes) +" +exe "hi! Statement" .s:fmt_none .s:fg_green .s:bg_none +" *Statement any statement +" Conditional if, then, else, endif, switch, etc. +" Repeat for, do, while, etc. +" Label case, default, etc. +" Operator "sizeof", "+", "*", etc. +" Keyword any other keyword +" Exception try, catch, throw + +exe "hi! PreProc" .s:fmt_none .s:fg_orange .s:bg_none +" *PreProc generic Preprocessor +" Include preprocessor #include +" Define preprocessor #define +" Macro same as Define +" PreCondit preprocessor #if, #else, #endif, etc. + +exe "hi! Type" .s:fmt_none .s:fg_yellow .s:bg_none +" *Type int, long, char, etc. +" StorageClass static, register, volatile, etc. +" Structure struct, union, enum, etc. +" Typedef A typedef + +exe "hi! Special" .s:fmt_none .s:fg_red .s:bg_none +" *Special any special symbol +" SpecialChar special character in a constant +" Tag you can use CTRL-] on this +" Delimiter character that needs attention +" SpecialComment special things inside a comment +" Debug debugging statements + +exe "hi! Underlined" .s:fmt_none .s:fg_violet .s:bg_none +" *Underlined text that stands out, HTML links + +exe "hi! Ignore" .s:fmt_none .s:fg_none .s:bg_none +" *Ignore left blank, hidden |hl-Ignore| + +exe "hi! Error" .s:fmt_bold .s:fg_red .s:bg_none +" *Error any erroneous construct + +exe "hi! Todo" .s:fmt_bold .s:fg_magenta.s:bg_none +" *Todo anything that needs extra attention; mostly the +" keywords TODO FIXME and XXX +" +"}}} +" Extended highlighting "{{{ +" --------------------------------------------------------------------- +if (g:solarized_visibility=="high") + exe "hi! SpecialKey" .s:fmt_revr .s:fg_red .s:bg_none + exe "hi! NonText" .s:fmt_bold .s:fg_red .s:bg_none +elseif (g:solarized_visibility=="low") + exe "hi! SpecialKey" .s:fmt_bold .s:fg_base02 .s:bg_none + exe "hi! NonText" .s:fmt_bold .s:fg_base02 .s:bg_none +else + exe "hi! SpecialKey" .s:fmt_bold .s:fg_base00 .s:bg_base02 + exe "hi! NonText" .s:fmt_bold .s:fg_base00 .s:bg_none +endif +exe "hi! StatusLine" .s:fmt_none .s:fg_base1 .s:bg_base02 .s:fmt_revbb +exe "hi! StatusLineNC" .s:fmt_none .s:fg_base00 .s:bg_base02 .s:fmt_revbb +exe "hi! Visual" .s:fmt_none .s:fg_base01 .s:bg_base03 .s:fmt_revbb +exe "hi! Directory" .s:fmt_none .s:fg_blue .s:bg_none +exe "hi! ErrorMsg" .s:fmt_revr .s:fg_red .s:bg_none +exe "hi! IncSearch" .s:fmt_stnd .s:fg_orange .s:bg_none +exe "hi! Search" .s:fmt_revr .s:fg_yellow .s:bg_none +exe "hi! MoreMsg" .s:fmt_none .s:fg_blue .s:bg_none +exe "hi! ModeMsg" .s:fmt_none .s:fg_blue .s:bg_none +exe "hi! LineNr" .s:fmt_none .s:fg_base01 .s:bg_none +exe "hi! Question" .s:fmt_bold .s:fg_cyan .s:bg_none +if ( has("gui_running") || &t_Co > 8 ) + exe "hi! VertSplit" .s:fmt_none .s:fg_base00 .s:bg_base00 +else + exe "hi! VertSplit" .s:fmt_revbb .s:fg_base00 .s:bg_base02 +endif +exe "hi! Title" .s:fmt_bold .s:fg_orange .s:bg_none +exe "hi! VisualNOS" .s:fmt_stnd .s:fg_none .s:bg_base02 .s:fmt_revbb +exe "hi! WarningMsg" .s:fmt_bold .s:fg_red .s:bg_none +exe "hi! WildMenu" .s:fmt_none .s:fg_base2 .s:bg_base02 .s:fmt_revbb +exe "hi! Folded" .s:fmt_undb .s:fg_base0 .s:bg_base02 .s:sp_base03 +exe "hi! FoldColumn" .s:fmt_none .s:fg_base0 .s:bg_base02 +if (g:solarized_diffmode=="high") +exe "hi! DiffAdd" .s:fmt_revr .s:fg_green .s:bg_none +exe "hi! DiffChange" .s:fmt_revr .s:fg_yellow .s:bg_none +exe "hi! DiffDelete" .s:fmt_revr .s:fg_red .s:bg_none +exe "hi! DiffText" .s:fmt_revr .s:fg_blue .s:bg_none +elseif (g:solarized_diffmode=="low") +exe "hi! DiffAdd" .s:fmt_undr .s:fg_green .s:bg_none .s:sp_green +exe "hi! DiffChange" .s:fmt_undr .s:fg_yellow .s:bg_none .s:sp_yellow +exe "hi! DiffDelete" .s:fmt_bold .s:fg_red .s:bg_none +exe "hi! DiffText" .s:fmt_undr .s:fg_blue .s:bg_none .s:sp_blue +else " normal + if has("gui_running") +exe "hi! DiffAdd" .s:fmt_bold .s:fg_green .s:bg_base02 .s:sp_green +exe "hi! DiffChange" .s:fmt_bold .s:fg_yellow .s:bg_base02 .s:sp_yellow +exe "hi! DiffDelete" .s:fmt_bold .s:fg_red .s:bg_base02 +exe "hi! DiffText" .s:fmt_bold .s:fg_blue .s:bg_base02 .s:sp_blue + else +exe "hi! DiffAdd" .s:fmt_none .s:fg_green .s:bg_base02 .s:sp_green +exe "hi! DiffChange" .s:fmt_none .s:fg_yellow .s:bg_base02 .s:sp_yellow +exe "hi! DiffDelete" .s:fmt_none .s:fg_red .s:bg_base02 +exe "hi! DiffText" .s:fmt_none .s:fg_blue .s:bg_base02 .s:sp_blue + endif +endif +exe "hi! SignColumn" .s:fmt_none .s:fg_base0 +exe "hi! Conceal" .s:fmt_none .s:fg_blue .s:bg_none +exe "hi! SpellBad" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_red +exe "hi! SpellCap" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_violet +exe "hi! SpellRare" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_cyan +exe "hi! SpellLocal" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_yellow +exe "hi! Pmenu" .s:fmt_none .s:fg_base0 .s:bg_base02 .s:fmt_revbb +exe "hi! PmenuSel" .s:fmt_none .s:fg_base01 .s:bg_base2 .s:fmt_revbb +exe "hi! PmenuSbar" .s:fmt_none .s:fg_base2 .s:bg_base0 .s:fmt_revbb +exe "hi! PmenuThumb" .s:fmt_none .s:fg_base0 .s:bg_base03 .s:fmt_revbb +exe "hi! TabLine" .s:fmt_undr .s:fg_base0 .s:bg_base02 .s:sp_base0 +exe "hi! TabLineFill" .s:fmt_undr .s:fg_base0 .s:bg_base02 .s:sp_base0 +exe "hi! TabLineSel" .s:fmt_undr .s:fg_base01 .s:bg_base2 .s:sp_base0 .s:fmt_revbbu +exe "hi! CursorColumn" .s:fmt_none .s:fg_none .s:bg_base02 +exe "hi! CursorLine" .s:fmt_uopt .s:fg_none .s:bg_base02 .s:sp_base1 +exe "hi! ColorColumn" .s:fmt_none .s:fg_none .s:bg_base02 +exe "hi! Cursor" .s:fmt_none .s:fg_base03 .s:bg_base0 +hi! link lCursor Cursor +exe "hi! MatchParen" .s:fmt_bold .s:fg_red .s:bg_base01 + +"}}} +" vim syntax highlighting "{{{ +" --------------------------------------------------------------------- +"exe "hi! vimLineComment" . s:fg_base01 .s:bg_none .s:fmt_ital +"hi! link vimComment Comment +"hi! link vimLineComment Comment +hi! link vimVar Identifier +hi! link vimFunc Function +hi! link vimUserFunc Function +hi! link helpSpecial Special +hi! link vimSet Normal +hi! link vimSetEqual Normal +exe "hi! vimCommentString" .s:fmt_none .s:fg_violet .s:bg_none +exe "hi! vimCommand" .s:fmt_none .s:fg_yellow .s:bg_none +exe "hi! vimCmdSep" .s:fmt_bold .s:fg_blue .s:bg_none +exe "hi! helpExample" .s:fmt_none .s:fg_base1 .s:bg_none +exe "hi! helpOption" .s:fmt_none .s:fg_cyan .s:bg_none +exe "hi! helpNote" .s:fmt_none .s:fg_magenta.s:bg_none +exe "hi! helpVim" .s:fmt_none .s:fg_magenta.s:bg_none +exe "hi! helpHyperTextJump" .s:fmt_undr .s:fg_blue .s:bg_none +exe "hi! helpHyperTextEntry".s:fmt_none .s:fg_green .s:bg_none +exe "hi! vimIsCommand" .s:fmt_none .s:fg_base00 .s:bg_none +exe "hi! vimSynMtchOpt" .s:fmt_none .s:fg_yellow .s:bg_none +exe "hi! vimSynType" .s:fmt_none .s:fg_cyan .s:bg_none +exe "hi! vimHiLink" .s:fmt_none .s:fg_blue .s:bg_none +exe "hi! vimHiGroup" .s:fmt_none .s:fg_blue .s:bg_none +exe "hi! vimGroup" .s:fmt_undb .s:fg_blue .s:bg_none +"}}} +" diff highlighting "{{{ +" --------------------------------------------------------------------- +hi! link diffAdded Statement +hi! link diffLine Identifier +"}}} +" git & gitcommit highlighting "{{{ +"git +"exe "hi! gitDateHeader" +"exe "hi! gitIdentityHeader" +"exe "hi! gitIdentityKeyword" +"exe "hi! gitNotesHeader" +"exe "hi! gitReflogHeader" +"exe "hi! gitKeyword" +"exe "hi! gitIdentity" +"exe "hi! gitEmailDelimiter" +"exe "hi! gitEmail" +"exe "hi! gitDate" +"exe "hi! gitMode" +"exe "hi! gitHashAbbrev" +"exe "hi! gitHash" +"exe "hi! gitReflogMiddle" +"exe "hi! gitReference" +"exe "hi! gitStage" +"exe "hi! gitType" +"exe "hi! gitDiffAdded" +"exe "hi! gitDiffRemoved" +"gitcommit +"exe "hi! gitcommitSummary" +exe "hi! gitcommitComment" .s:fmt_ital .s:fg_base01 .s:bg_none +hi! link gitcommitUntracked gitcommitComment +hi! link gitcommitDiscarded gitcommitComment +hi! link gitcommitSelected gitcommitComment +exe "hi! gitcommitUnmerged" .s:fmt_bold .s:fg_green .s:bg_none +exe "hi! gitcommitOnBranch" .s:fmt_bold .s:fg_base01 .s:bg_none +exe "hi! gitcommitBranch" .s:fmt_bold .s:fg_magenta .s:bg_none +hi! link gitcommitNoBranch gitcommitBranch +exe "hi! gitcommitDiscardedType".s:fmt_none .s:fg_red .s:bg_none +exe "hi! gitcommitSelectedType" .s:fmt_none .s:fg_green .s:bg_none +"exe "hi! gitcommitUnmergedType" +"exe "hi! gitcommitType" +"exe "hi! gitcommitNoChanges" +"exe "hi! gitcommitHeader" +exe "hi! gitcommitHeader" .s:fmt_none .s:fg_base01 .s:bg_none +exe "hi! gitcommitUntrackedFile".s:fmt_bold .s:fg_cyan .s:bg_none +exe "hi! gitcommitDiscardedFile".s:fmt_bold .s:fg_red .s:bg_none +exe "hi! gitcommitSelectedFile" .s:fmt_bold .s:fg_green .s:bg_none +exe "hi! gitcommitUnmergedFile" .s:fmt_bold .s:fg_yellow .s:bg_none +exe "hi! gitcommitFile" .s:fmt_bold .s:fg_base0 .s:bg_none +hi! link gitcommitDiscardedArrow gitcommitDiscardedFile +hi! link gitcommitSelectedArrow gitcommitSelectedFile +hi! link gitcommitUnmergedArrow gitcommitUnmergedFile +"exe "hi! gitcommitArrow" +"exe "hi! gitcommitOverflow" +"exe "hi! gitcommitBlank" +" }}} +" html highlighting "{{{ +" --------------------------------------------------------------------- +exe "hi! htmlTag" .s:fmt_none .s:fg_base01 .s:bg_none +exe "hi! htmlEndTag" .s:fmt_none .s:fg_base01 .s:bg_none +exe "hi! htmlTagN" .s:fmt_bold .s:fg_base1 .s:bg_none +exe "hi! htmlTagName" .s:fmt_bold .s:fg_blue .s:bg_none +exe "hi! htmlSpecialTagName".s:fmt_ital .s:fg_blue .s:bg_none +exe "hi! htmlArg" .s:fmt_none .s:fg_base00 .s:bg_none +exe "hi! javaScript" .s:fmt_none .s:fg_yellow .s:bg_none +"}}} +" perl highlighting "{{{ +" --------------------------------------------------------------------- +exe "hi! perlHereDoc" . s:fg_base1 .s:bg_back .s:fmt_none +exe "hi! perlVarPlain" . s:fg_yellow .s:bg_back .s:fmt_none +exe "hi! perlStatementFileDesc". s:fg_cyan.s:bg_back.s:fmt_none + +"}}} +" tex highlighting "{{{ +" --------------------------------------------------------------------- +exe "hi! texStatement" . s:fg_cyan .s:bg_back .s:fmt_none +exe "hi! texMathZoneX" . s:fg_yellow .s:bg_back .s:fmt_none +exe "hi! texMathMatcher" . s:fg_yellow .s:bg_back .s:fmt_none +exe "hi! texMathMatcher" . s:fg_yellow .s:bg_back .s:fmt_none +exe "hi! texRefLabel" . s:fg_yellow .s:bg_back .s:fmt_none +"}}} +" ruby highlighting "{{{ +" --------------------------------------------------------------------- +exe "hi! rubyDefine" . s:fg_base1 .s:bg_back .s:fmt_bold +"rubyInclude +"rubySharpBang +"rubyAccess +"rubyPredefinedVariable +"rubyBoolean +"rubyClassVariable +"rubyBeginEnd +"rubyRepeatModifier +"hi! link rubyArrayDelimiter Special " [ , , ] +"rubyCurlyBlock { , , } + +"hi! link rubyClass Keyword +"hi! link rubyModule Keyword +"hi! link rubyKeyword Keyword +"hi! link rubyOperator Operator +"hi! link rubyIdentifier Identifier +"hi! link rubyInstanceVariable Identifier +"hi! link rubyGlobalVariable Identifier +"hi! link rubyClassVariable Identifier +"hi! link rubyConstant Type +"}}} +" haskell syntax highlighting"{{{ +" --------------------------------------------------------------------- +" For use with syntax/haskell.vim : Haskell Syntax File +" http://www.vim.org/scripts/script.php?script_id=3034 +" See also Steffen Siering's github repository: +" http://github.com/urso/dotrc/blob/master/vim/syntax/haskell.vim +" --------------------------------------------------------------------- +" +" Treat True and False specially, see the plugin referenced above +let hs_highlight_boolean=1 +" highlight delims, see the plugin referenced above +let hs_highlight_delimiters=1 + +exe "hi! cPreCondit". s:fg_orange.s:bg_none .s:fmt_none + +exe "hi! VarId" . s:fg_blue .s:bg_none .s:fmt_none +exe "hi! ConId" . s:fg_yellow .s:bg_none .s:fmt_none +exe "hi! hsImport" . s:fg_magenta.s:bg_none .s:fmt_none +exe "hi! hsString" . s:fg_base00 .s:bg_none .s:fmt_none + +exe "hi! hsStructure" . s:fg_cyan .s:bg_none .s:fmt_none +exe "hi! hs_hlFunctionName" . s:fg_blue .s:bg_none +exe "hi! hsStatement" . s:fg_cyan .s:bg_none .s:fmt_none +exe "hi! hsImportLabel" . s:fg_cyan .s:bg_none .s:fmt_none +exe "hi! hs_OpFunctionName" . s:fg_yellow .s:bg_none .s:fmt_none +exe "hi! hs_DeclareFunction" . s:fg_orange .s:bg_none .s:fmt_none +exe "hi! hsVarSym" . s:fg_cyan .s:bg_none .s:fmt_none +exe "hi! hsType" . s:fg_yellow .s:bg_none .s:fmt_none +exe "hi! hsTypedef" . s:fg_cyan .s:bg_none .s:fmt_none +exe "hi! hsModuleName" . s:fg_green .s:bg_none .s:fmt_undr +exe "hi! hsModuleStartLabel" . s:fg_magenta.s:bg_none .s:fmt_none +hi! link hsImportParams Delimiter +hi! link hsDelimTypeExport Delimiter +hi! link hsModuleStartLabel hsStructure +hi! link hsModuleWhereLabel hsModuleStartLabel + +" following is for the haskell-conceal plugin +" the first two items don't have an impact, but better safe +exe "hi! hsNiceOperator" . s:fg_cyan .s:bg_none .s:fmt_none +exe "hi! hsniceoperator" . s:fg_cyan .s:bg_none .s:fmt_none + +"}}} +" pandoc markdown syntax highlighting "{{{ +" --------------------------------------------------------------------- + +"PandocHiLink pandocNormalBlock +exe "hi! pandocTitleBlock" .s:fg_blue .s:bg_none .s:fmt_none +exe "hi! pandocTitleBlockTitle" .s:fg_blue .s:bg_none .s:fmt_bold +exe "hi! pandocTitleComment" .s:fg_blue .s:bg_none .s:fmt_bold +exe "hi! pandocComment" .s:fg_base01 .s:bg_none .s:fmt_ital +exe "hi! pandocVerbatimBlock" .s:fg_yellow .s:bg_none .s:fmt_none +hi! link pandocVerbatimBlockDeep pandocVerbatimBlock +hi! link pandocCodeBlock pandocVerbatimBlock +hi! link pandocCodeBlockDelim pandocVerbatimBlock +exe "hi! pandocBlockQuote" .s:fg_blue .s:bg_none .s:fmt_none +exe "hi! pandocBlockQuoteLeader1" .s:fg_blue .s:bg_none .s:fmt_none +exe "hi! pandocBlockQuoteLeader2" .s:fg_cyan .s:bg_none .s:fmt_none +exe "hi! pandocBlockQuoteLeader3" .s:fg_yellow .s:bg_none .s:fmt_none +exe "hi! pandocBlockQuoteLeader4" .s:fg_red .s:bg_none .s:fmt_none +exe "hi! pandocBlockQuoteLeader5" .s:fg_base0 .s:bg_none .s:fmt_none +exe "hi! pandocBlockQuoteLeader6" .s:fg_base01 .s:bg_none .s:fmt_none +exe "hi! pandocListMarker" .s:fg_magenta.s:bg_none .s:fmt_none +exe "hi! pandocListReference" .s:fg_magenta.s:bg_none .s:fmt_undr + +" Definitions +" --------------------------------------------------------------------- +let s:fg_pdef = s:fg_violet +exe "hi! pandocDefinitionBlock" .s:fg_pdef .s:bg_none .s:fmt_none +exe "hi! pandocDefinitionTerm" .s:fg_pdef .s:bg_none .s:fmt_stnd +exe "hi! pandocDefinitionIndctr" .s:fg_pdef .s:bg_none .s:fmt_bold +exe "hi! pandocEmphasisDefinition" .s:fg_pdef .s:bg_none .s:fmt_ital +exe "hi! pandocEmphasisNestedDefinition" .s:fg_pdef .s:bg_none .s:fmt_bldi +exe "hi! pandocStrongEmphasisDefinition" .s:fg_pdef .s:bg_none .s:fmt_bold +exe "hi! pandocStrongEmphasisNestedDefinition" .s:fg_pdef.s:bg_none.s:fmt_bldi +exe "hi! pandocStrongEmphasisEmphasisDefinition" .s:fg_pdef.s:bg_none.s:fmt_bldi +exe "hi! pandocStrikeoutDefinition" .s:fg_pdef .s:bg_none .s:fmt_revr +exe "hi! pandocVerbatimInlineDefinition" .s:fg_pdef .s:bg_none .s:fmt_none +exe "hi! pandocSuperscriptDefinition" .s:fg_pdef .s:bg_none .s:fmt_none +exe "hi! pandocSubscriptDefinition" .s:fg_pdef .s:bg_none .s:fmt_none + +" Tables +" --------------------------------------------------------------------- +let s:fg_ptable = s:fg_blue +exe "hi! pandocTable" .s:fg_ptable.s:bg_none .s:fmt_none +exe "hi! pandocTableStructure" .s:fg_ptable.s:bg_none .s:fmt_none +hi! link pandocTableStructureTop pandocTableStructre +hi! link pandocTableStructureEnd pandocTableStructre +exe "hi! pandocTableZebraLight" .s:fg_ptable.s:bg_base03.s:fmt_none +exe "hi! pandocTableZebraDark" .s:fg_ptable.s:bg_base02.s:fmt_none +exe "hi! pandocEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_ital +exe "hi! pandocEmphasisNestedTable" .s:fg_ptable.s:bg_none .s:fmt_bldi +exe "hi! pandocStrongEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_bold +exe "hi! pandocStrongEmphasisNestedTable" .s:fg_ptable.s:bg_none .s:fmt_bldi +exe "hi! pandocStrongEmphasisEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_bldi +exe "hi! pandocStrikeoutTable" .s:fg_ptable.s:bg_none .s:fmt_revr +exe "hi! pandocVerbatimInlineTable" .s:fg_ptable.s:bg_none .s:fmt_none +exe "hi! pandocSuperscriptTable" .s:fg_ptable.s:bg_none .s:fmt_none +exe "hi! pandocSubscriptTable" .s:fg_ptable.s:bg_none .s:fmt_none + +" Headings +" --------------------------------------------------------------------- +let s:fg_phead = s:fg_orange +exe "hi! pandocHeading" .s:fg_phead .s:bg_none.s:fmt_bold +exe "hi! pandocHeadingMarker" .s:fg_yellow.s:bg_none.s:fmt_bold +exe "hi! pandocEmphasisHeading" .s:fg_phead .s:bg_none.s:fmt_bldi +exe "hi! pandocEmphasisNestedHeading" .s:fg_phead .s:bg_none.s:fmt_bldi +exe "hi! pandocStrongEmphasisHeading" .s:fg_phead .s:bg_none.s:fmt_bold +exe "hi! pandocStrongEmphasisNestedHeading" .s:fg_phead .s:bg_none.s:fmt_bldi +exe "hi! pandocStrongEmphasisEmphasisHeading".s:fg_phead .s:bg_none.s:fmt_bldi +exe "hi! pandocStrikeoutHeading" .s:fg_phead .s:bg_none.s:fmt_revr +exe "hi! pandocVerbatimInlineHeading" .s:fg_phead .s:bg_none.s:fmt_bold +exe "hi! pandocSuperscriptHeading" .s:fg_phead .s:bg_none.s:fmt_bold +exe "hi! pandocSubscriptHeading" .s:fg_phead .s:bg_none.s:fmt_bold + +" Links +" --------------------------------------------------------------------- +exe "hi! pandocLinkDelim" .s:fg_base01 .s:bg_none .s:fmt_none +exe "hi! pandocLinkLabel" .s:fg_blue .s:bg_none .s:fmt_undr +exe "hi! pandocLinkText" .s:fg_blue .s:bg_none .s:fmt_undb +exe "hi! pandocLinkURL" .s:fg_base00 .s:bg_none .s:fmt_undr +exe "hi! pandocLinkTitle" .s:fg_base00 .s:bg_none .s:fmt_undi +exe "hi! pandocLinkTitleDelim" .s:fg_base01 .s:bg_none .s:fmt_undi .s:sp_base00 +exe "hi! pandocLinkDefinition" .s:fg_cyan .s:bg_none .s:fmt_undr .s:sp_base00 +exe "hi! pandocLinkDefinitionID" .s:fg_blue .s:bg_none .s:fmt_bold +exe "hi! pandocImageCaption" .s:fg_violet .s:bg_none .s:fmt_undb +exe "hi! pandocFootnoteLink" .s:fg_green .s:bg_none .s:fmt_undr +exe "hi! pandocFootnoteDefLink" .s:fg_green .s:bg_none .s:fmt_bold +exe "hi! pandocFootnoteInline" .s:fg_green .s:bg_none .s:fmt_undb +exe "hi! pandocFootnote" .s:fg_green .s:bg_none .s:fmt_none +exe "hi! pandocCitationDelim" .s:fg_magenta.s:bg_none .s:fmt_none +exe "hi! pandocCitation" .s:fg_magenta.s:bg_none .s:fmt_none +exe "hi! pandocCitationID" .s:fg_magenta.s:bg_none .s:fmt_undr +exe "hi! pandocCitationRef" .s:fg_magenta.s:bg_none .s:fmt_none + +" Main Styles +" --------------------------------------------------------------------- +exe "hi! pandocStyleDelim" .s:fg_base01 .s:bg_none .s:fmt_none +exe "hi! pandocEmphasis" .s:fg_base0 .s:bg_none .s:fmt_ital +exe "hi! pandocEmphasisNested" .s:fg_base0 .s:bg_none .s:fmt_bldi +exe "hi! pandocStrongEmphasis" .s:fg_base0 .s:bg_none .s:fmt_bold +exe "hi! pandocStrongEmphasisNested" .s:fg_base0 .s:bg_none .s:fmt_bldi +exe "hi! pandocStrongEmphasisEmphasis" .s:fg_base0 .s:bg_none .s:fmt_bldi +exe "hi! pandocStrikeout" .s:fg_base01 .s:bg_none .s:fmt_revr +exe "hi! pandocVerbatimInline" .s:fg_yellow .s:bg_none .s:fmt_none +exe "hi! pandocSuperscript" .s:fg_violet .s:bg_none .s:fmt_none +exe "hi! pandocSubscript" .s:fg_violet .s:bg_none .s:fmt_none + +exe "hi! pandocRule" .s:fg_blue .s:bg_none .s:fmt_bold +exe "hi! pandocRuleLine" .s:fg_blue .s:bg_none .s:fmt_bold +exe "hi! pandocEscapePair" .s:fg_red .s:bg_none .s:fmt_bold +exe "hi! pandocCitationRef" .s:fg_magenta.s:bg_none .s:fmt_none +exe "hi! pandocNonBreakingSpace" . s:fg_red .s:bg_none .s:fmt_revr +hi! link pandocEscapedCharacter pandocEscapePair +hi! link pandocLineBreak pandocEscapePair + +" Embedded Code +" --------------------------------------------------------------------- +exe "hi! pandocMetadataDelim" .s:fg_base01 .s:bg_none .s:fmt_none +exe "hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt_none +exe "hi! pandocMetadataKey" .s:fg_blue .s:bg_none .s:fmt_none +exe "hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt_bold +hi! link pandocMetadataTitle pandocMetadata + +"}}} +" Utility autocommand "{{{ +" --------------------------------------------------------------------- +" In cases where Solarized is initialized inside a terminal vim session and +" then transferred to a gui session via the command `:gui`, the gui vim process +" does not re-read the colorscheme (or .vimrc for that matter) so any `has_gui` +" related code that sets gui specific values isn't executed. +" +" Currently, Solarized sets only the cterm or gui values for the colorscheme +" depending on gui or terminal mode. It's possible that, if the following +" autocommand method is deemed excessively poor form, that approach will be +" used again and the autocommand below will be dropped. +" +" However it seems relatively benign in this case to include the autocommand +" here. It fires only in cases where vim is transferring from terminal to gui +" mode (detected with the script scope s:vmode variable). It also allows for +" other potential terminal customizations that might make gui mode suboptimal. +" +autocmd GUIEnter * if (s:vmode != "gui") | exe "colorscheme " . g:colors_name | endif +"}}} +" Highlight Trailing Space {{{ +" Experimental: Different highlight when on cursorline +function! s:SolarizedHiTrail() + if g:solarized_hitrail==0 + hi! clear solarizedTrailingSpace + else + syn match solarizedTrailingSpace "\s*$" + exe "hi! solarizedTrailingSpace " .s:fmt_undr .s:fg_red .s:bg_none .s:sp_red + endif +endfunction +augroup SolarizedHiTrail + autocmd! + if g:solarized_hitrail==1 + autocmd! Syntax * call s:SolarizedHiTrail() + autocmd! ColorScheme * if g:colors_name == "solarized" | call s:SolarizedHiTrail() | else | augroup! s:SolarizedHiTrail | endif + endif +augroup END +" }}} +" Menus "{{{ +" --------------------------------------------------------------------- +" Turn off Solarized menu by including the following assignment in your .vimrc: +" +" let g:solarized_menu=0 + +function! s:SolarizedOptions() + new "new buffer + setf vim "vim filetype + let failed = append(0, s:defaults_list) + let failed = append(0, s:colorscheme_list) + let failed = append(0, s:options_list) + let failed = append(0, s:lazycat_list) + 0 "jump back to the top +endfunction +if !exists(":SolarizedOptions") + command SolarizedOptions :call s:SolarizedOptions() +endif + +function! SolarizedMenu() + if exists("g:loaded_solarized_menu") + try + silent! aunmenu Solarized + endtry + endif + let g:loaded_solarized_menu = 1 + + if g:colors_name == "solarized" && g:solarized_menu != 0 + + amenu &Solarized.&Contrast.&Low\ Contrast :let g:solarized_contrast="low" \| colorscheme solarized<CR> + amenu &Solarized.&Contrast.&Normal\ Contrast :let g:solarized_contrast="normal" \| colorscheme solarized<CR> + amenu &Solarized.&Contrast.&High\ Contrast :let g:solarized_contrast="high" \| colorscheme solarized<CR> + an &Solarized.&Contrast.-sep- <Nop> + amenu &Solarized.&Contrast.&Help:\ Contrast :help 'solarized_contrast'<CR> + + amenu &Solarized.&Visibility.&Low\ Visibility :let g:solarized_visibility="low" \| colorscheme solarized<CR> + amenu &Solarized.&Visibility.&Normal\ Visibility :let g:solarized_visibility="normal" \| colorscheme solarized<CR> + amenu &Solarized.&Visibility.&High\ Visibility :let g:solarized_visibility="high" \| colorscheme solarized<CR> + an &Solarized.&Visibility.-sep- <Nop> + amenu &Solarized.&Visibility.&Help:\ Visibility :help 'solarized_visibility'<CR> + + amenu &Solarized.&Background.&Toggle\ Background :ToggleBG<CR> + amenu &Solarized.&Background.&Dark\ Background :set background=dark \| colorscheme solarized<CR> + amenu &Solarized.&Background.&Light\ Background :set background=light \| colorscheme solarized<CR> + an &Solarized.&Background.-sep- <Nop> + amenu &Solarized.&Background.&Help:\ ToggleBG :help togglebg<CR> + + if g:solarized_bold==0 | let l:boldswitch="On" | else | let l:boldswitch="Off" | endif + exe "amenu &Solarized.&Styling.&Turn\\ Bold\\ ".l:boldswitch." :let g:solarized_bold=(abs(g:solarized_bold-1)) \\| colorscheme solarized<CR>" + if g:solarized_italic==0 | let l:italicswitch="On" | else | let l:italicswitch="Off" | endif + exe "amenu &Solarized.&Styling.&Turn\\ Italic\\ ".l:italicswitch." :let g:solarized_italic=(abs(g:solarized_italic-1)) \\| colorscheme solarized<CR>" + if g:solarized_underline==0 | let l:underlineswitch="On" | else | let l:underlineswitch="Off" | endif + exe "amenu &Solarized.&Styling.&Turn\\ Underline\\ ".l:underlineswitch." :let g:solarized_underline=(abs(g:solarized_underline-1)) \\| colorscheme solarized<CR>" + + amenu &Solarized.&Diff\ Mode.&Low\ Diff\ Mode :let g:solarized_diffmode="low" \| colorscheme solarized<CR> + amenu &Solarized.&Diff\ Mode.&Normal\ Diff\ Mode :let g:solarized_diffmode="normal" \| colorscheme solarized<CR> + amenu &Solarized.&Diff\ Mode.&High\ Diff\ Mode :let g:solarized_diffmode="high" \| colorscheme solarized<CR> + + if g:solarized_hitrail==0 | let l:hitrailswitch="On" | else | let l:hitrailswitch="Off" | endif + exe "amenu &Solarized.&Experimental.&Turn\\ Highlight\\ Trailing\\ Spaces\\ ".l:hitrailswitch." :let g:solarized_hitrail=(abs(g:solarized_hitrail-1)) \\| colorscheme solarized<CR>" + an &Solarized.&Experimental.-sep- <Nop> + amenu &Solarized.&Experimental.&Help:\ HiTrail :help 'solarized_hitrail'<CR> + + an &Solarized.-sep1- <Nop> + + amenu &Solarized.&Autogenerate\ options :SolarizedOptions<CR> + + an &Solarized.-sep2- <Nop> + + amenu &Solarized.&Help.&Solarized\ Help :help solarized<CR> + amenu &Solarized.&Help.&Toggle\ Background\ Help :help togglebg<CR> + amenu &Solarized.&Help.&Removing\ This\ Menu :help solarized-menu<CR> + + an 9999.77 &Help.&Solarized\ Colorscheme :help solarized<CR> + an 9999.78 &Help.&Toggle\ Background :help togglebg<CR> + an 9999.79 &Help.-sep3- <Nop> + + endif +endfunction + +autocmd ColorScheme * if g:colors_name != "solarized" | silent! aunmenu Solarized | else | call SolarizedMenu() | endif + +"}}} +" License "{{{ +" --------------------------------------------------------------------- +" +" Copyright (c) 2011 Ethan Schoonover +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to deal +" in the Software without restriction, including without limitation the rights +" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +" copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +" THE SOFTWARE. +" +" vim:foldmethod=marker:foldlevel=0 +"}}} diff --git a/vim/compiler/tex.vim b/vim/compiler/tex.vim new file mode 120000 index 0000000..96de836 --- /dev/null +++ b/vim/compiler/tex.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/compiler/tex.vim
\ No newline at end of file diff --git a/vim/doc/DrawIt.txt b/vim/doc/DrawIt.txt new file mode 100644 index 0000000..8e72f64 --- /dev/null +++ b/vim/doc/DrawIt.txt @@ -0,0 +1,489 @@ +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/vim/doc/imaps.txt.gz b/vim/doc/imaps.txt.gz new file mode 120000 index 0000000..cf5808b --- /dev/null +++ b/vim/doc/imaps.txt.gz @@ -0,0 +1 @@ +/usr/share/vim/addons/doc/imaps.txt.gz
\ No newline at end of file diff --git a/vim/doc/latex-suite-quickstart.txt.gz b/vim/doc/latex-suite-quickstart.txt.gz new file mode 120000 index 0000000..5ef4db2 --- /dev/null +++ b/vim/doc/latex-suite-quickstart.txt.gz @@ -0,0 +1 @@ +/usr/share/vim/addons/doc/latex-suite-quickstart.txt.gz
\ No newline at end of file diff --git a/vim/doc/latex-suite.txt.gz b/vim/doc/latex-suite.txt.gz new file mode 120000 index 0000000..35c3d5a --- /dev/null +++ b/vim/doc/latex-suite.txt.gz @@ -0,0 +1 @@ +/usr/share/vim/addons/doc/latex-suite.txt.gz
\ No newline at end of file diff --git a/vim/doc/latexhelp.txt.gz b/vim/doc/latexhelp.txt.gz new file mode 120000 index 0000000..f8197a0 --- /dev/null +++ b/vim/doc/latexhelp.txt.gz @@ -0,0 +1 @@ +/usr/share/vim/addons/doc/latexhelp.txt.gz
\ No newline at end of file diff --git a/vim/doc/surround.txt b/vim/doc/surround.txt new file mode 100644 index 0000000..30a642a --- /dev/null +++ b/vim/doc/surround.txt @@ -0,0 +1,205 @@ +*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/vim/doc/tags b/vim/doc/tags new file mode 100644 index 0000000..54ecdda --- /dev/null +++ b/vim/doc/tags @@ -0,0 +1,56 @@ +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/vim/filetype.vim b/vim/filetype.vim new file mode 100644 index 0000000..357aa24 --- /dev/null +++ b/vim/filetype.vim @@ -0,0 +1,4 @@ +augroup filetypedetect + " Mail + autocmd BufRead,BufNewFile *mutt-* setfiletype mail +augroup END diff --git a/vim/ftplugin/bib_latexSuite.vim b/vim/ftplugin/bib_latexSuite.vim new file mode 120000 index 0000000..8a4a21a --- /dev/null +++ b/vim/ftplugin/bib_latexSuite.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/bib_latexSuite.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/bibtex.vim b/vim/ftplugin/latex-suite/bibtex.vim new file mode 120000 index 0000000..b2187fc --- /dev/null +++ b/vim/ftplugin/latex-suite/bibtex.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/bibtex.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/bibtools.py b/vim/ftplugin/latex-suite/bibtools.py new file mode 120000 index 0000000..5246fec --- /dev/null +++ b/vim/ftplugin/latex-suite/bibtools.py @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/bibtools.py
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/bibtools.pyc b/vim/ftplugin/latex-suite/bibtools.pyc Binary files differnew file mode 100644 index 0000000..a60798f --- /dev/null +++ b/vim/ftplugin/latex-suite/bibtools.pyc diff --git a/vim/ftplugin/latex-suite/brackets.vim b/vim/ftplugin/latex-suite/brackets.vim new file mode 120000 index 0000000..db9c202 --- /dev/null +++ b/vim/ftplugin/latex-suite/brackets.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/brackets.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/compiler.vim b/vim/ftplugin/latex-suite/compiler.vim new file mode 120000 index 0000000..47f717b --- /dev/null +++ b/vim/ftplugin/latex-suite/compiler.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/compiler.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/custommacros.vim b/vim/ftplugin/latex-suite/custommacros.vim new file mode 120000 index 0000000..a92ac9a --- /dev/null +++ b/vim/ftplugin/latex-suite/custommacros.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/custommacros.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/diacritics.vim b/vim/ftplugin/latex-suite/diacritics.vim new file mode 120000 index 0000000..a9ebe2a --- /dev/null +++ b/vim/ftplugin/latex-suite/diacritics.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/diacritics.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/dictionaries/SIunits b/vim/ftplugin/latex-suite/dictionaries/SIunits new file mode 120000 index 0000000..8bd69c4 --- /dev/null +++ b/vim/ftplugin/latex-suite/dictionaries/SIunits @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/dictionaries/SIunits
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/dictionaries/dictionary b/vim/ftplugin/latex-suite/dictionaries/dictionary new file mode 120000 index 0000000..7e157e2 --- /dev/null +++ b/vim/ftplugin/latex-suite/dictionaries/dictionary @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/dictionaries/dictionary
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/elementmacros.vim b/vim/ftplugin/latex-suite/elementmacros.vim new file mode 120000 index 0000000..d803bec --- /dev/null +++ b/vim/ftplugin/latex-suite/elementmacros.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/elementmacros.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/envmacros.vim b/vim/ftplugin/latex-suite/envmacros.vim new file mode 120000 index 0000000..f3de31c --- /dev/null +++ b/vim/ftplugin/latex-suite/envmacros.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/envmacros.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/folding.vim b/vim/ftplugin/latex-suite/folding.vim new file mode 120000 index 0000000..6ea91bf --- /dev/null +++ b/vim/ftplugin/latex-suite/folding.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/folding.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/macros/example b/vim/ftplugin/latex-suite/macros/example new file mode 120000 index 0000000..182184b --- /dev/null +++ b/vim/ftplugin/latex-suite/macros/example @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/macros/example
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/main.vim b/vim/ftplugin/latex-suite/main.vim new file mode 120000 index 0000000..7756d01 --- /dev/null +++ b/vim/ftplugin/latex-suite/main.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/main.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/mathmacros-utf.vim b/vim/ftplugin/latex-suite/mathmacros-utf.vim new file mode 120000 index 0000000..eb27622 --- /dev/null +++ b/vim/ftplugin/latex-suite/mathmacros-utf.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/mathmacros-utf.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/mathmacros.vim b/vim/ftplugin/latex-suite/mathmacros.vim new file mode 120000 index 0000000..69ed4ec --- /dev/null +++ b/vim/ftplugin/latex-suite/mathmacros.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/mathmacros.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/multicompile.vim b/vim/ftplugin/latex-suite/multicompile.vim new file mode 120000 index 0000000..9c862b9 --- /dev/null +++ b/vim/ftplugin/latex-suite/multicompile.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/multicompile.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/outline.py b/vim/ftplugin/latex-suite/outline.py new file mode 120000 index 0000000..20f9372 --- /dev/null +++ b/vim/ftplugin/latex-suite/outline.py @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/outline.py
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/outline.pyc b/vim/ftplugin/latex-suite/outline.pyc Binary files differnew file mode 100644 index 0000000..9963739 --- /dev/null +++ b/vim/ftplugin/latex-suite/outline.pyc diff --git a/vim/ftplugin/latex-suite/packages.vim b/vim/ftplugin/latex-suite/packages.vim new file mode 120000 index 0000000..7692662 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/SIunits b/vim/ftplugin/latex-suite/packages/SIunits new file mode 120000 index 0000000..e91d5cd --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/SIunits @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/SIunits
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/accents b/vim/ftplugin/latex-suite/packages/accents new file mode 120000 index 0000000..95d9216 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/accents @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/accents
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/acromake b/vim/ftplugin/latex-suite/packages/acromake new file mode 120000 index 0000000..03af1df --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/acromake @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/acromake
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/afterpage b/vim/ftplugin/latex-suite/packages/afterpage new file mode 120000 index 0000000..2d5bd1d --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/afterpage @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/afterpage
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/alltt b/vim/ftplugin/latex-suite/packages/alltt new file mode 120000 index 0000000..4c99323 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/alltt @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/alltt
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/amsmath b/vim/ftplugin/latex-suite/packages/amsmath new file mode 120000 index 0000000..4e80d7f --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/amsmath @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/amsmath
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/amsthm b/vim/ftplugin/latex-suite/packages/amsthm new file mode 120000 index 0000000..6a50fa1 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/amsthm @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/amsthm
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/amsxtra b/vim/ftplugin/latex-suite/packages/amsxtra new file mode 120000 index 0000000..c659cb4 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/amsxtra @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/amsxtra
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/arabic b/vim/ftplugin/latex-suite/packages/arabic new file mode 120000 index 0000000..82e41b5 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/arabic @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/arabic
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/array b/vim/ftplugin/latex-suite/packages/array new file mode 120000 index 0000000..88cdc82 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/array @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/array
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/babel b/vim/ftplugin/latex-suite/packages/babel new file mode 120000 index 0000000..6c48b5d --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/babel @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/babel
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/bar b/vim/ftplugin/latex-suite/packages/bar new file mode 120000 index 0000000..3e7bc71 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/bar @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/bar
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/biblatex b/vim/ftplugin/latex-suite/packages/biblatex new file mode 120000 index 0000000..9033a18 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/biblatex @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/biblatex
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/bm b/vim/ftplugin/latex-suite/packages/bm new file mode 120000 index 0000000..8c59b19 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/bm @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/bm
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/bophook b/vim/ftplugin/latex-suite/packages/bophook new file mode 120000 index 0000000..232241d --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/bophook @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/bophook
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/boxedminipage b/vim/ftplugin/latex-suite/packages/boxedminipage new file mode 120000 index 0000000..3b3ec81 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/boxedminipage @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/boxedminipage
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/caption2 b/vim/ftplugin/latex-suite/packages/caption2 new file mode 120000 index 0000000..21652a1 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/caption2 @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/caption2
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/cases b/vim/ftplugin/latex-suite/packages/cases new file mode 120000 index 0000000..1128f0d --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/cases @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/cases
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/ccaption b/vim/ftplugin/latex-suite/packages/ccaption new file mode 120000 index 0000000..2f67d5b --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/ccaption @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/ccaption
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/changebar b/vim/ftplugin/latex-suite/packages/changebar new file mode 120000 index 0000000..435e625 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/changebar @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/changebar
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/chapterbib b/vim/ftplugin/latex-suite/packages/chapterbib new file mode 120000 index 0000000..b224006 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/chapterbib @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/chapterbib
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/cite b/vim/ftplugin/latex-suite/packages/cite new file mode 120000 index 0000000..0d1eee7 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/cite @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/cite
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/color b/vim/ftplugin/latex-suite/packages/color new file mode 120000 index 0000000..1babf39 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/color @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/color
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/comma b/vim/ftplugin/latex-suite/packages/comma new file mode 120000 index 0000000..ee9cc83 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/comma @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/comma
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/csquotes b/vim/ftplugin/latex-suite/packages/csquotes new file mode 120000 index 0000000..1eea388 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/csquotes @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/csquotes
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/deleq b/vim/ftplugin/latex-suite/packages/deleq new file mode 120000 index 0000000..0cb7f16 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/deleq @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/deleq
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/drftcite b/vim/ftplugin/latex-suite/packages/drftcite new file mode 120000 index 0000000..7bcd15e --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/drftcite @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/drftcite
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/dropping b/vim/ftplugin/latex-suite/packages/dropping new file mode 120000 index 0000000..001c600 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/dropping @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/dropping
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/enumerate b/vim/ftplugin/latex-suite/packages/enumerate new file mode 120000 index 0000000..59c1cbe --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/enumerate @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/enumerate
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/eqlist b/vim/ftplugin/latex-suite/packages/eqlist new file mode 120000 index 0000000..b2b3c7d --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/eqlist @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/eqlist
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/eqparbox b/vim/ftplugin/latex-suite/packages/eqparbox new file mode 120000 index 0000000..9de66ef --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/eqparbox @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/eqparbox
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/everyshi b/vim/ftplugin/latex-suite/packages/everyshi new file mode 120000 index 0000000..6c746a3 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/everyshi @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/everyshi
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/exmpl b/vim/ftplugin/latex-suite/packages/exmpl new file mode 120000 index 0000000..6d62c72 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/exmpl @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/exmpl
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/fixme b/vim/ftplugin/latex-suite/packages/fixme new file mode 120000 index 0000000..9b7fc0b --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/fixme @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/fixme
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/flafter b/vim/ftplugin/latex-suite/packages/flafter new file mode 120000 index 0000000..f0ca5d3 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/flafter @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/flafter
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/float b/vim/ftplugin/latex-suite/packages/float new file mode 120000 index 0000000..88947fc --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/float @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/float
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/floatflt b/vim/ftplugin/latex-suite/packages/floatflt new file mode 120000 index 0000000..54c8545 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/floatflt @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/floatflt
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/fn2end b/vim/ftplugin/latex-suite/packages/fn2end new file mode 120000 index 0000000..0409cf5 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/fn2end @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/fn2end
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/footmisc b/vim/ftplugin/latex-suite/packages/footmisc new file mode 120000 index 0000000..e0f7040 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/footmisc @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/footmisc
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/geometry b/vim/ftplugin/latex-suite/packages/geometry new file mode 120000 index 0000000..9eae177 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/geometry @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/geometry
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/german b/vim/ftplugin/latex-suite/packages/german new file mode 120000 index 0000000..7255a9d --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/german @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/german
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/graphicx b/vim/ftplugin/latex-suite/packages/graphicx new file mode 120000 index 0000000..1a9509e --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/graphicx @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/graphicx
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/graphpap b/vim/ftplugin/latex-suite/packages/graphpap new file mode 120000 index 0000000..d2ea7da --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/graphpap @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/graphpap
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/harpoon b/vim/ftplugin/latex-suite/packages/harpoon new file mode 120000 index 0000000..b2de7e5 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/harpoon @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/harpoon
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/hhline b/vim/ftplugin/latex-suite/packages/hhline new file mode 120000 index 0000000..e184977 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/hhline @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/hhline
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/histogram b/vim/ftplugin/latex-suite/packages/histogram new file mode 120000 index 0000000..5075eef --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/histogram @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/histogram
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/hyperref b/vim/ftplugin/latex-suite/packages/hyperref new file mode 120000 index 0000000..4f15513 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/hyperref @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/hyperref
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/ifthen b/vim/ftplugin/latex-suite/packages/ifthen new file mode 120000 index 0000000..78ab498 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/ifthen @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/ifthen
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/inputenc b/vim/ftplugin/latex-suite/packages/inputenc new file mode 120000 index 0000000..06df3af --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/inputenc @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/inputenc
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/letterspace b/vim/ftplugin/latex-suite/packages/letterspace new file mode 120000 index 0000000..9b1a052 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/letterspace @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/letterspace
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/lineno b/vim/ftplugin/latex-suite/packages/lineno new file mode 120000 index 0000000..8ff57e8 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/lineno @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/lineno
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/longtable b/vim/ftplugin/latex-suite/packages/longtable new file mode 120000 index 0000000..449046c --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/longtable @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/longtable
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/lscape b/vim/ftplugin/latex-suite/packages/lscape new file mode 120000 index 0000000..338090c --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/lscape @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/lscape
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/manyfoot b/vim/ftplugin/latex-suite/packages/manyfoot new file mode 120000 index 0000000..447a81d --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/manyfoot @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/manyfoot
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/moreverb b/vim/ftplugin/latex-suite/packages/moreverb new file mode 120000 index 0000000..f53e42a --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/moreverb @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/moreverb
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/multibox b/vim/ftplugin/latex-suite/packages/multibox new file mode 120000 index 0000000..13eab07 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/multibox @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/multibox
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/multicol b/vim/ftplugin/latex-suite/packages/multicol new file mode 120000 index 0000000..dffcd66 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/multicol @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/multicol
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/newalg b/vim/ftplugin/latex-suite/packages/newalg new file mode 120000 index 0000000..eff77ed --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/newalg @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/newalg
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/ngerman b/vim/ftplugin/latex-suite/packages/ngerman new file mode 120000 index 0000000..45ee1ed --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/ngerman @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/ngerman
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/numprint b/vim/ftplugin/latex-suite/packages/numprint new file mode 120000 index 0000000..39b222f --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/numprint @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/numprint
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/oldstyle b/vim/ftplugin/latex-suite/packages/oldstyle new file mode 120000 index 0000000..adee066 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/oldstyle @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/oldstyle
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/outliner b/vim/ftplugin/latex-suite/packages/outliner new file mode 120000 index 0000000..6091b28 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/outliner @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/outliner
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/overcite b/vim/ftplugin/latex-suite/packages/overcite new file mode 120000 index 0000000..6598d04 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/overcite @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/overcite
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/pagenote b/vim/ftplugin/latex-suite/packages/pagenote new file mode 120000 index 0000000..e1650d3 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/pagenote @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/pagenote
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/parallel b/vim/ftplugin/latex-suite/packages/parallel new file mode 120000 index 0000000..311e7cd --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/parallel @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/parallel
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/plain b/vim/ftplugin/latex-suite/packages/plain new file mode 120000 index 0000000..4184d23 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/plain @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/plain
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/plates b/vim/ftplugin/latex-suite/packages/plates new file mode 120000 index 0000000..e8fd326 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/plates @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/plates
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/polski b/vim/ftplugin/latex-suite/packages/polski new file mode 120000 index 0000000..448a8f1 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/polski @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/polski
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/psgo b/vim/ftplugin/latex-suite/packages/psgo new file mode 120000 index 0000000..2cede17 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/psgo @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/psgo
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/schedule b/vim/ftplugin/latex-suite/packages/schedule new file mode 120000 index 0000000..61c1db1 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/schedule @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/schedule
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/textfit b/vim/ftplugin/latex-suite/packages/textfit new file mode 120000 index 0000000..1d12972 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/textfit @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/textfit
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/times b/vim/ftplugin/latex-suite/packages/times new file mode 120000 index 0000000..4cbed6c --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/times @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/times
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/tipa b/vim/ftplugin/latex-suite/packages/tipa new file mode 120000 index 0000000..8bf48c9 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/tipa @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/tipa
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/ulem b/vim/ftplugin/latex-suite/packages/ulem new file mode 120000 index 0000000..4c343de --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/ulem @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/ulem
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/url b/vim/ftplugin/latex-suite/packages/url new file mode 120000 index 0000000..f4b73c1 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/url @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/url
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/verbatim b/vim/ftplugin/latex-suite/packages/verbatim new file mode 120000 index 0000000..a1abb9e --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/verbatim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/verbatim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/packages/version b/vim/ftplugin/latex-suite/packages/version new file mode 120000 index 0000000..8c53044 --- /dev/null +++ b/vim/ftplugin/latex-suite/packages/version @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/packages/version
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/projecttemplate.vim b/vim/ftplugin/latex-suite/projecttemplate.vim new file mode 120000 index 0000000..fdb6b82 --- /dev/null +++ b/vim/ftplugin/latex-suite/projecttemplate.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/projecttemplate.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/pytools.py b/vim/ftplugin/latex-suite/pytools.py new file mode 120000 index 0000000..5c3d8d8 --- /dev/null +++ b/vim/ftplugin/latex-suite/pytools.py @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/pytools.py
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/smartspace.vim b/vim/ftplugin/latex-suite/smartspace.vim new file mode 120000 index 0000000..a772f3e --- /dev/null +++ b/vim/ftplugin/latex-suite/smartspace.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/smartspace.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/templates.vim b/vim/ftplugin/latex-suite/templates.vim new file mode 120000 index 0000000..8dcadde --- /dev/null +++ b/vim/ftplugin/latex-suite/templates.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/templates.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/templates/IEEEtran.tex b/vim/ftplugin/latex-suite/templates/IEEEtran.tex new file mode 120000 index 0000000..459ad65 --- /dev/null +++ b/vim/ftplugin/latex-suite/templates/IEEEtran.tex @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/templates/IEEEtran.tex
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/templates/article.tex b/vim/ftplugin/latex-suite/templates/article.tex new file mode 120000 index 0000000..adc3398 --- /dev/null +++ b/vim/ftplugin/latex-suite/templates/article.tex @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/templates/article.tex
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/templates/report.tex b/vim/ftplugin/latex-suite/templates/report.tex new file mode 120000 index 0000000..980639e --- /dev/null +++ b/vim/ftplugin/latex-suite/templates/report.tex @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/templates/report.tex
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/templates/report_two_column.tex b/vim/ftplugin/latex-suite/templates/report_two_column.tex new file mode 120000 index 0000000..e95ddfb --- /dev/null +++ b/vim/ftplugin/latex-suite/templates/report_two_column.tex @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/templates/report_two_column.tex
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/texmenuconf.vim b/vim/ftplugin/latex-suite/texmenuconf.vim new file mode 120000 index 0000000..337c158 --- /dev/null +++ b/vim/ftplugin/latex-suite/texmenuconf.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/texmenuconf.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/texproject.vim b/vim/ftplugin/latex-suite/texproject.vim new file mode 120000 index 0000000..9254715 --- /dev/null +++ b/vim/ftplugin/latex-suite/texproject.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/texproject.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/texrc b/vim/ftplugin/latex-suite/texrc new file mode 120000 index 0000000..ebf927b --- /dev/null +++ b/vim/ftplugin/latex-suite/texrc @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/texrc
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/texviewer.vim b/vim/ftplugin/latex-suite/texviewer.vim new file mode 120000 index 0000000..e7c2963 --- /dev/null +++ b/vim/ftplugin/latex-suite/texviewer.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/texviewer.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/version.vim b/vim/ftplugin/latex-suite/version.vim new file mode 120000 index 0000000..53adfe7 --- /dev/null +++ b/vim/ftplugin/latex-suite/version.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/version.vim
\ No newline at end of file diff --git a/vim/ftplugin/latex-suite/wizardfuncs.vim b/vim/ftplugin/latex-suite/wizardfuncs.vim new file mode 120000 index 0000000..f32b74a --- /dev/null +++ b/vim/ftplugin/latex-suite/wizardfuncs.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/latex-suite/wizardfuncs.vim
\ No newline at end of file diff --git a/vim/ftplugin/tex_latexSuite.vim b/vim/ftplugin/tex_latexSuite.vim new file mode 120000 index 0000000..e0a3109 --- /dev/null +++ b/vim/ftplugin/tex_latexSuite.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/ftplugin/tex_latexSuite.vim
\ No newline at end of file diff --git a/vim/indent/tex.vim b/vim/indent/tex.vim new file mode 120000 index 0000000..551e3a9 --- /dev/null +++ b/vim/indent/tex.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/indent/tex.vim
\ No newline at end of file diff --git a/vim/plugin/DrawItPlugin.vim b/vim/plugin/DrawItPlugin.vim new file mode 100644 index 0000000..84333ce --- /dev/null +++ b/vim/plugin/DrawItPlugin.vim @@ -0,0 +1,76 @@ +" DrawItPlugin.vim: a simple way to draw things in Vim -- just put this file in +" your plugin directory, use \di to start (\ds to stop), and +" just move about using the cursor keys. +" +" You may also use visual-block mode to select endpoints and +" draw lines, arrows, and ellipses. +" +" Date: Nov 28, 2012 +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 +" 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 is provided *as is* and 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. +" +" Required: this script requires Vim 7.0 (or later) {{{1 +" To Enable: simply put this plugin into your ~/.vim/plugin directory {{{2 +" +" GetLatestVimScripts: 40 1 :AutoInstall: DrawIt.vim +" +" (Zeph 3:1,2 WEB) Woe to her who is rebellious and polluted, the {{{1 +" oppressing city! She didn't obey the voice. She didn't receive +" correction. She didn't trust in Yahweh. She didn't draw near to her God. + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_DrawItPlugin") + finish +endif +let g:loaded_DrawItPlugin = "v13" +let s:keepcpo = &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +" commands: +com! -nargs=0 -bang DrawIt set lz|if <bang>0|call DrawIt#DrawItStop()|else|call DrawIt#DrawItStart()|endif|set nolz +com! -nargs=? DIstart set lz|call DrawIt#DrawItStart(<q-args>)|set nolz +com! -nargs=0 DIstop set lz|call DrawIt#DrawItStop()|set nolz + +" commands: available only when not pre-defined +sil! com -nargs=0 DInrml call DrawIt#SetMode('N') +sil! com -nargs=0 DIsngl call DrawIt#SetMode('S') +sil! com -nargs=0 DIdbl call DrawIt#SetMode('D') + +" maps: users may override these maps by defining their own mappings in their .vimrc +" to <Plug>DrawItStart and/or <Plug>DrawItStop. By default: +" \di : start DrawIt +" \ds : stop DrawIt +if !hasmapto('<Plug>DrawItStart') + map <unique> <Leader>di <Plug>DrawItStart +endif +noremap <silent> <Plug>DrawItStart :set lz<cr>:call DrawIt#DrawItStart()<cr>:set nolz<cr> +if !hasmapto('<Plug>DrawItStop') + map <unique> <Leader>ds <Plug>DrawItStop +endif +noremap <silent> <Plug>DrawItStop :set lz<cr>:call DrawIt#DrawItStop()<cr>:set nolz<cr> + +" --------------------------------------------------------------------- +" DrChip Menu Support: {{{1 +if has("gui_running") && has("menu") && &go =~# 'm' + if !exists("g:DrChipTopLvlMenu") + let g:DrChipTopLvlMenu= "DrChip." + endif + exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Start\ DrawIt<tab>\\di <Leader>di' +endif + +" --------------------------------------------------------------------- +" Cleanup And Modelines: +" vim: fdm=marker +let &cpo= s:keepcpo +unlet s:keepcpo diff --git a/vim/plugin/SyntaxFolds.vim b/vim/plugin/SyntaxFolds.vim new file mode 120000 index 0000000..6368bba --- /dev/null +++ b/vim/plugin/SyntaxFolds.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/plugin/SyntaxFolds.vim
\ No newline at end of file diff --git a/vim/plugin/cecutil.vim b/vim/plugin/cecutil.vim new file mode 100644 index 0000000..b720044 --- /dev/null +++ b/vim/plugin/cecutil.vim @@ -0,0 +1,536 @@ +" 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/vim/plugin/filebrowser.vim b/vim/plugin/filebrowser.vim new file mode 120000 index 0000000..de8cea6 --- /dev/null +++ b/vim/plugin/filebrowser.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/plugin/filebrowser.vim
\ No newline at end of file diff --git a/vim/plugin/imaps.vim b/vim/plugin/imaps.vim new file mode 120000 index 0000000..078bfb9 --- /dev/null +++ b/vim/plugin/imaps.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/plugin/imaps.vim
\ No newline at end of file diff --git a/vim/plugin/libList.vim b/vim/plugin/libList.vim new file mode 120000 index 0000000..b9192da --- /dev/null +++ b/vim/plugin/libList.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/plugin/libList.vim
\ No newline at end of file diff --git a/vim/plugin/remoteOpen.vim b/vim/plugin/remoteOpen.vim new file mode 120000 index 0000000..3a06168 --- /dev/null +++ b/vim/plugin/remoteOpen.vim @@ -0,0 +1 @@ +/usr/share/vim/addons/plugin/remoteOpen.vim
\ No newline at end of file diff --git a/vim/plugin/surround.vim b/vim/plugin/surround.vim new file mode 100644 index 0000000..05b1c5c --- /dev/null +++ b/vim/plugin/surround.vim @@ -0,0 +1,588 @@ +" 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: |