diff --git a/autoload/DrawIt.vim b/autoload/DrawIt.vim index cc941f0..b36583f 100644 --- a/autoload/DrawIt.vim +++ b/autoload/DrawIt.vim @@ -3,8 +3,8 @@ " Maintainer: Charles E. Campbell, Jr. " Authors: Charles E. Campbell, Jr. - NOSPAM " Sylvain Viart (molo@multimania.com) -" Version: 10 -" Date: Jun 12, 2008 +" Version: 11k ASTRO-ONLY +" Date: Feb 22, 2011 " " Quick Setup: {{{1 " tar -oxvf DrawIt.tar @@ -18,7 +18,7 @@ " You may also use visual-block mode to select endpoints and " draw lines, arrows, and ellipses. " -" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 1999-2010 Charles E. Campbell, Jr. {{{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, @@ -41,15 +41,29 @@ if &cp || exists("g:loaded_DrawIt") finish endif +let g:loaded_DrawIt= "v11k" +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 +if !exists("g:drawit_xstrlen") + if &enc == "latin1" || $LANG == "en_US.UTF-8" || !has("multi_byte") + let g:drawit_xstrlen= 0 + else + let g:drawit_xstrlen= 1 + endif +endif + " --------------------------------------------------------------------- " Script Variables: {{{1 if !exists("s:saveposn_count") let s:saveposn_count= 0 endif -let g:loaded_DrawIt= "v10" "DechoTabOn " ===================================================================== @@ -80,6 +94,16 @@ fun! DrawIt#StartDrawIt() endif setlocal mouse=a + " StartDrawIt: set up type of strlen() calculation that's needed {{{3 + if !exists("g:drawit_xstrlen") + if exists("g:Align_xstrlen") + let g:drawit_xstrlen= g:Align_xstrlen + endif + if !exists("g:drawit_xstrlen") + let g:drawit_xstrlen= 1 + endif + endif + " StartDrawIt: set up DrawIt commands {{{3 com! -nargs=1 -range SetBrush ,call DrawIt#SetBrush() com! -count Canvas call s:Spacer(line("."),line(".") + - 1,0) @@ -111,24 +135,24 @@ fun! DrawIt#StartDrawIt() let b:di_erase = 0 " StartDrawIt: option recording {{{3 - let b:di_aikeep = &ai - let b:di_cinkeep = &cin - let b:di_cpokeep = &cpo - let b:di_etkeep = &et - let b:di_fokeep = &fo - let b:di_gdkeep = &gd - let b:di_gokeep = &go - let b:di_magickeep = &magic - let b:di_remapkeep = &remap - let b:di_repkeep = &report - let b:di_sikeep = &si - let b:di_stakeep = &sta - let b:di_vekeep = &ve - set cpo&vim - set nocin noai nosi nogd sta et ve=all report=10000 - set go-=aA - set fo-=a - set remap magic + let b:di_aikeep = &l:ai + 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 + setlocal cpo&vim + setlocal nocin noai nosi nogd sta et ve=all report=10000 + setlocal go-=aA + setlocal fo-=a + setlocal remap magic " StartDrawIt: save and unmap user maps {{{3 let b:lastdir = 1 @@ -137,148 +161,154 @@ fun! DrawIt#StartDrawIt() else let usermaplead = "\\" endif - call SaveUserMaps("n","","><^v","DrawIt") - call SaveUserMaps("v",usermaplead,"abeflsy","DrawIt") - call SaveUserMaps("n",usermaplead,"h>","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n","","","DrawIt") - call SaveUserMaps("n",usermaplead,":pa","DrawIt") - call SaveUserMaps("n",usermaplead,":pb","DrawIt") - call SaveUserMaps("n",usermaplead,":pc","DrawIt") - call SaveUserMaps("n",usermaplead,":pd","DrawIt") - call SaveUserMaps("n",usermaplead,":pe","DrawIt") - call SaveUserMaps("n",usermaplead,":pf","DrawIt") - call SaveUserMaps("n",usermaplead,":pg","DrawIt") - call SaveUserMaps("n",usermaplead,":ph","DrawIt") - call SaveUserMaps("n",usermaplead,":pi","DrawIt") - call SaveUserMaps("n",usermaplead,":pj","DrawIt") - call SaveUserMaps("n",usermaplead,":pk","DrawIt") - call SaveUserMaps("n",usermaplead,":pl","DrawIt") - call SaveUserMaps("n",usermaplead,":pm","DrawIt") - call SaveUserMaps("n",usermaplead,":pn","DrawIt") - call SaveUserMaps("n",usermaplead,":po","DrawIt") - call SaveUserMaps("n",usermaplead,":pp","DrawIt") - call SaveUserMaps("n",usermaplead,":pq","DrawIt") - call SaveUserMaps("n",usermaplead,":pr","DrawIt") - call SaveUserMaps("n",usermaplead,":ps","DrawIt") - call SaveUserMaps("n",usermaplead,":pt","DrawIt") - call SaveUserMaps("n",usermaplead,":pu","DrawIt") - call SaveUserMaps("n",usermaplead,":pv","DrawIt") - call SaveUserMaps("n",usermaplead,":pw","DrawIt") - call SaveUserMaps("n",usermaplead,":px","DrawIt") - call SaveUserMaps("n",usermaplead,":py","DrawIt") - call SaveUserMaps("n",usermaplead,":pz","DrawIt") - call SaveUserMaps("n",usermaplead,":ra","DrawIt") - call SaveUserMaps("n",usermaplead,":rb","DrawIt") - call SaveUserMaps("n",usermaplead,":rc","DrawIt") - call SaveUserMaps("n",usermaplead,":rd","DrawIt") - call SaveUserMaps("n",usermaplead,":re","DrawIt") - call SaveUserMaps("n",usermaplead,":rf","DrawIt") - call SaveUserMaps("n",usermaplead,":rg","DrawIt") - call SaveUserMaps("n",usermaplead,":rh","DrawIt") - call SaveUserMaps("n",usermaplead,":ri","DrawIt") - call SaveUserMaps("n",usermaplead,":rj","DrawIt") - call SaveUserMaps("n",usermaplead,":rk","DrawIt") - call SaveUserMaps("n",usermaplead,":rl","DrawIt") - call SaveUserMaps("n",usermaplead,":rm","DrawIt") - call SaveUserMaps("n",usermaplead,":rn","DrawIt") - call SaveUserMaps("n",usermaplead,":ro","DrawIt") - call SaveUserMaps("n",usermaplead,":rp","DrawIt") - call SaveUserMaps("n",usermaplead,":rq","DrawIt") - call SaveUserMaps("n",usermaplead,":rr","DrawIt") - call SaveUserMaps("n",usermaplead,":rs","DrawIt") - call SaveUserMaps("n",usermaplead,":rt","DrawIt") - call SaveUserMaps("n",usermaplead,":ru","DrawIt") - call SaveUserMaps("n",usermaplead,":rv","DrawIt") - call SaveUserMaps("n",usermaplead,":rw","DrawIt") - call SaveUserMaps("n",usermaplead,":rx","DrawIt") - call SaveUserMaps("n",usermaplead,":ry","DrawIt") - call SaveUserMaps("n",usermaplead,":rz","DrawIt") + 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("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - call SaveUserMaps("i","","","DrawIt") - endif - call SaveUserMaps("n","",":\","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") + call SaveUserMaps("bi","","","DrawIt") + endif + call SaveUserMaps("bn","",":\","DrawIt") " StartDrawIt: DrawIt maps (Charles Campbell) {{{3 - nmap :set lz:silent! call DrawLeft():set nolz - nmap :set lz:silent! call DrawRight():set nolz - nmap :set lz:silent! call DrawUp():set nolz - nmap :set lz:silent! call DrawDown():set nolz - nmap :set lz:silent! call MoveLeft():set nolz - nmap :set lz:silent! call MoveRight():set nolz - nmap :set lz:silent! call MoveUp():set nolz - nmap :set lz:silent! call MoveDown():set nolz - nmap :set lz:silent! call DrawErase():set nolz - nmap > :set lz:silent! call DrawSpace('>',1):set nolz - nmap < :set lz:silent! call DrawSpace('<',2):set nolz - nmap ^ :set lz:silent! call DrawSpace('^',3):set nolz - nmap v :set lz:silent! call DrawSpace('v',4):set nolz - nmap :set lz:silent! call DrawSlantUpLeft():set nolz - nmap :set lz:silent! call DrawSlantDownLeft():set nolz - nmap :set lz:silent! call DrawSlantUpRight():set nolz - nmap :set lz:silent! call DrawSlantDownRight():set nolz - nmap > :set lz:silent! call DrawFatRArrow():set nolz - nmap < :set lz:silent! call DrawFatLArrow():set nolz - nmap ^ :set lz:silent! call DrawFatUArrow():set nolz - nmap v :set lz:silent! call DrawFatDArrow():set nolz - nmap f :call Flood() + nmap