From 4604a1f920a9ce7be0fb7b21004c17ef66e17025 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Thu, 20 Nov 2014 21:19:11 +0100 Subject: add vim folder --- vim/autoload/DrawIt.vim | 2921 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2921 insertions(+) create mode 100644 vim/autoload/DrawIt.vim (limited to 'vim/autoload/DrawIt.vim') 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 - 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 ,call DrawIt#SetBrush() + com! -count Canvas call s:Spacer(line("."),line(".") + - 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","","","DrawIt") + call SaveUserMaps("bn",usermaplead,"h>","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bn","","","DrawIt") + call SaveUserMaps("bv","","","DrawIt") + call SaveUserMaps("bv","","","DrawIt") + call SaveUserMaps("bv","","","DrawIt") + call SaveUserMaps("bv","","","DrawIt") + call SaveUserMaps("bv","","","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","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + call SaveUserMaps("bi","","","DrawIt") + endif + call SaveUserMaps("bn","",":\","DrawIt") + + " DrawItStart: DrawIt maps (Charles Campbell) {{{3 + nmap