|
| 1 | +*drawit.txt* The DrawIt Tool November 29, 2001 |
| 2 | + |
| 3 | +Authors: Charles E. Campbell, Jr. < [email protected]> |
| 4 | + |
| 5 | + |
| 6 | + (remove NOSPAM from Campbell's email first) |
| 7 | + |
| 8 | +============================================================================== |
| 9 | +1. Contents *drawit-contents* |
| 10 | + |
| 11 | + 1. Contents......................: |drawit-contents| |
| 12 | + 2. DrawIt Manual.................: |drawit| |
| 13 | + 3. DrawIt Usage..................: |drawit-usage| |
| 14 | + Starting....................: |drawit-start| |
| 15 | + Stopping....................: |drawit-stopping| |
| 16 | + User Map Protection.........: |drawit-protect| |
| 17 | + Drawing.....................: |drawit-drawing| |
| 18 | + Changing Drawing Characters.: |drawit-setdrawit| |
| 19 | + Moving......................: |drawit-moving| |
| 20 | + Erasing.....................: |drawit-erase| |
| 21 | + Filling.....................: |drawit-fill| |
| 22 | + Tip.........................: |drawit-tip| |
| 23 | + Example.....................: |drawit-example| |
| 24 | + Visual Block Mode...........: |drawit-visblock| |
| 25 | + DrawIt Modes................: |drawit-modes| |
| 26 | + |
| 27 | +============================================================================== |
| 28 | + |
| 29 | +2. DrawIt Manual *drawit* |
| 30 | + *drawit-manual* |
| 31 | + To Enable: |
| 32 | + |
| 33 | + /=============+============================================================\ |
| 34 | + || Starting & | || |
| 35 | + || Stopping | Explanation || |
| 36 | + ++------------+-----------------------------------------------------------++ |
| 37 | + || \di | start DrawIt || |
| 38 | + || \ds | stop DrawIt || |
| 39 | + || | || |
| 40 | + ++============+===========================================================++ |
| 41 | + || Commands | Explanation || |
| 42 | + ++------------+-----------------------------------------------------------++ |
| 43 | + || | The DrawIt routines use a replace, move, and || |
| 44 | + || | replace/insert strategy. The package also lets one insert|| |
| 45 | + || | spaces, draw arrows by using the following characters or || |
| 46 | + || | keypad characters: || |
| 47 | + || +-----------------------------------------------------------++ |
| 48 | + || <left> | move and draw left || |
| 49 | + || <right> | move and draw right, inserting lines/space as needed || |
| 50 | + || <up> | move and draw up, inserting lines/space as needed || |
| 51 | + || <down> | move and draw down, inserting lines/space as needed || |
| 52 | + || <s-left> | move left || |
| 53 | + || <s-right> | move right, inserting lines/space as needed || |
| 54 | + || <s-up> | move up, inserting lines/space as needed || |
| 55 | + || <s-down> | move down, inserting lines/space as needed || |
| 56 | + || <space> | toggle into and out of erase mode || |
| 57 | + || > | insert a > and move right (draw -> arrow) || |
| 58 | + || < | insert a < and move left (draw <- arrow) || |
| 59 | + || ^ | insert a ^ and move up (draw ^ arrow) || |
| 60 | + || v | insert a v and move down (draw v arrow) || |
| 61 | + || <pgdn> | replace with a \, move down and right, and insert a \ || |
| 62 | + || <end> | replace with a /, move down and left, and insert a / || |
| 63 | + || <pgup> | replace with a /, move up and right, and insert a / || |
| 64 | + || <home> | replace with a \, move up and left, and insert a \ || |
| 65 | + || \> | insert a fat > and move right (draw -> arrow) || |
| 66 | + || \< | insert a fat < and move left (draw <- arrow) || |
| 67 | + || \^ | insert a fat ^ and move up (draw ^ arrow) || |
| 68 | + || \v | insert a fat v and move down (draw v arrow) || |
| 69 | + || | || |
| 70 | + || +-----------------------------------------------------------++ |
| 71 | + || | The drawing mode routines use visual-block mode to || |
| 72 | + || | select endpoints for lines, arrows, and ellipses. Bresen- || |
| 73 | + || | ham and Bresenham-like algorithms are used for this. || |
| 74 | + || | || |
| 75 | + || | These routines need a block of spaces, and so the "holer" || |
| 76 | + || | routine must first be used to create such a block. The || |
| 77 | + || | holer routine will query the user for the number of lines || |
| 78 | + || | to hold |'textwidth'| spaces. || |
| 79 | + || +-----------------------------------------------------------++ |
| 80 | + || \a | draw arrow from corners of visual-block selected region || |
| 81 | + || \b | draw box on visual-block selected region || |
| 82 | + || \e | draw an ellipse on visual-block selected region || |
| 83 | + || \f | fill a figure with some character || |
| 84 | + || \h | the holer routine (will query user, see above) || |
| 85 | + || \l | draw line from corners of visual-block selected region || |
| 86 | + || \s | spacer: appends spaces up to the textwidth (default: 78) || |
| 87 | + || | || |
| 88 | + ++============+===========================================================++ |
| 89 | + || Function and Explanation || |
| 90 | + ++------------+-----------------------------------------------------------++ |
| 91 | + || :call SetDrawIt('vertical','horizontal','crossing','\','/','X') || |
| 92 | + || set drawing characters for motions for moving || |
| 93 | + || default motion || |
| 94 | + || | up/down, || |
| 95 | + || - left/right, || |
| 96 | + || + -| crossing, || |
| 97 | + || \ downright, || |
| 98 | + || / downleft, and || |
| 99 | + || X \/ crossing || |
| 100 | + || || |
| 101 | + \==========================================================================/ |
| 102 | + |
| 103 | +============================================================================== |
| 104 | + |
| 105 | +3. DrawIt Usage *drawit-usage* |
| 106 | + |
| 107 | + |
| 108 | +STARTING *drawit-start* |
| 109 | +\di |
| 110 | + |
| 111 | +Typically one puts <drawit.vim> into the .vim/plugin directory |
| 112 | +(vimfiles\plugin for MS) where it becomes always available. It uses a minimal |
| 113 | +interface (\di: you can think of it as *D*raw*I*t or *D*rawIt *I*nitialize) to |
| 114 | +start it and (\ds: *D*rawIt *S*top) to stop it. Instead of using "\" you may |
| 115 | +specify your own preference for a map leader (see |mapleader|). |
| 116 | + |
| 117 | +A message, "[DrawIt]", will appear on the message line. |
| 118 | + |
| 119 | + |
| 120 | +STOPPING *drawit-stopping* |
| 121 | +\ds |
| 122 | + |
| 123 | +When you are done with DrawIt, use \ds to stop DrawIt mode. Stopping DrawIt |
| 124 | +will restore your usual options and remove the maps DrawIt set up. |
| 125 | + |
| 126 | +A message, "[DrawIt off]", will appear on the message line. |
| 127 | + |
| 128 | + |
| 129 | +USER MAP PROTECTION *drawit-protect* |
| 130 | + |
| 131 | +Starting DrawIt causes it to set up a number of maps which facilitate |
| 132 | +drawing. Just use the arrow keys or the keypad to cruise around your display. |
| 133 | +DrawIt will then leave appropriate lines as you move horizontally, vertically, |
| 134 | +or diagonally, and will transparently enlarge your file to accommodate your |
| 135 | +drawing as needed. DrawIt saves both maps and user options and sets them to |
| 136 | +its own needs. You may use h-j-k-l to move about your display and generally |
| 137 | +use editing commands as you wish even while in DrawIt mode. |
| 138 | + |
| 139 | + |
| 140 | +DRAWING *drawit-drawing* |
| 141 | + |
| 142 | +After DrawIt is started, just use the number pad to move the cursor about. It |
| 143 | +will leave a trail of -s, |s, \s, /s (depending on which direction and |
| 144 | +SetDrawIt() changes), and +s and Xs where line crossing occurs. |
| 145 | + |
| 146 | + |
| 147 | +CHANGING DRAWING CHARACTERS *drawit-setdrawit* |
| 148 | + |
| 149 | +The SetDrawIt() function is available for those who wish to change the |
| 150 | +characters that DrawIt uses. > |
| 151 | +
|
| 152 | + ex. :call SetDrawIt('*','*','*','*','*','*') |
| 153 | + ex. :call SetDrawIt('-','|','-','\','/','/') |
| 154 | +< |
| 155 | +The first example shows how to change all the DrawIt drawing characters to |
| 156 | +asterisks, and the second shows how to give crossing priority to - and /. |
| 157 | + |
| 158 | + |
| 159 | +MOVING *drawit-move* *drawit-moving* |
| 160 | + |
| 161 | +DrawIt supports shifting the arrow keys to cause motion of the cursor. The |
| 162 | +motion of the cursor will not modify what's below the cursor. The cursor |
| 163 | +will move and lines and/or spaces will be inserted to support the move as |
| 164 | +required. Your terminal may not support shifted arrow keys, however, or Vim |
| 165 | +may not catch them as such. For example, on the machine I use, shift-up |
| 166 | +(<s-up>) produced <Esc>[161q, but vim didn't know that sequence was a <s-up>. |
| 167 | +I merely made a nmap: |
| 168 | + |
| 169 | + nmap <Esc>[161q <s-up> |
| 170 | + |
| 171 | +and vim thereafter recognized the <s-up> command. |
| 172 | + |
| 173 | + |
| 174 | +ERASING *drawit-erase* |
| 175 | +<space> |
| 176 | + |
| 177 | +The <space> key will toggle DrawIt's erase mode/DrawIt mode. When in |
| 178 | +[DrawIt erase] mode, a message "[DrawIt erase]" will appear and the |
| 179 | +number pad will now cause spaces to be drawn instead of the usual drawing |
| 180 | +characters. The drawing characters will be restored when the <space> |
| 181 | +key toggles DrawIt back to regular DrawIt mode. |
| 182 | + |
| 183 | +FILLING *drawit-fill* |
| 184 | + |
| 185 | +With the cursor inside some figure, a \f will invoke a fill operation. |
| 186 | +DrawIt will ask the user to supply a character which will then be |
| 187 | +used to fill the figure. The figure is assumed to be connected only |
| 188 | +horizontally and vertically. Supplying more than one character to |
| 189 | +the prompt will result in the extra characters being also considered |
| 190 | +as boundary characters (for example, using ".*" will fill the the |
| 191 | +dot, but both dots and asterisks will be assumed to comprise boundary |
| 192 | +characters along with the usual boundary characters. |
| 193 | + |
| 194 | +TIP *drawit-tip* |
| 195 | + |
| 196 | +I have found that sometimes one or more of the <home>, <end>, <pageup>, |
| 197 | +and <pagedown> keys give unique sequences but are not interpreted |
| 198 | +properly by Vim. This problem impacts DrawIt as it uses those four |
| 199 | +keys to signify diagonal moves/drawing. One solution I use is to |
| 200 | +put into my <.vimrc> file mapings like: |
| 201 | + |
| 202 | + map ^V... <home> |
| 203 | + |
| 204 | +where the ellipsis (...) is the actual character sequence produced by |
| 205 | +hitting the key. The way to generate such maps is to type "map ", |
| 206 | +followed by three control-v presses, press the associated key, then |
| 207 | +a space followed by the proper interpretation sequence (ie. <home>). |
| 208 | + |
| 209 | +EXAMPLES *drawit-example* |
| 210 | + |
| 211 | +Needless to say, the bottom spirals were done with DrawIt and some |
| 212 | +block editing with Vim: > |
| 213 | +
|
| 214 | + +------------ -----------+ +------------ -----------+ +------------ |
| 215 | + |+----------+ +---------+| |+----------+ +---------+| |+----------+ |
| 216 | + ||+--------+| |+-------+|| ||+--------+| |+-------+|| ||+--------+| |
| 217 | + |||-------+|| ||+------||| |||-------+|| ||+------||| |||-------+|| |
| 218 | + ||+-------+|| ||+------+|| ||+-------+|| ||+------+|| ||+-------+|| |
| 219 | + |+---------+| |+--------+| |+---------+| |+--------+| |+---------+| |
| 220 | + +-----------+ +----------+ +-----------+ +----------+ +-----------+ |
| 221 | +
|
| 222 | +VISUAL BLOCK MODE FOR ARROWS LINES BOXES AND ELLIPSES *drawit-visblock* |
| 223 | +\a \b \e \h \l \s |
| 224 | + |
| 225 | +The DrawIt package has been merged with Sylvain Viart's drawing package |
| 226 | +which provides DrawIt with visual-block selection of starting/ending |
| 227 | +point drawing of arrows (\a), lines (\l), and boxes (\b). Addtionally |
| 228 | +I wrote an ellipse drawing function using visual block specification (\e). |
| 229 | + |
| 230 | +One must have a block of spaces for these maps which the "holer" routine |
| 231 | +(\h) will help create. The holer routine will query the user for the number |
| 232 | +of lines s/he wishes to have, and will fill those lines with spaces out to the |
| 233 | +|'textwidth'| (or 78 spaces if that option hasn't been set). |
| 234 | + |
| 235 | +The Sylvain Viart functions and the ellipse drawing function depend |
| 236 | +upon using visual block mode. Typical use: > |
| 237 | +
|
| 238 | + Example: * \h |
| 239 | + DrawIt asks: how many lines under the cursor? 10 |
| 240 | + DrawIt then appends 10 lines filled with blanks |
| 241 | + out to textwidth (if defined) or 78 columns. |
| 242 | + * ctrl-v (move) \b |
| 243 | + DrawIt then draws a box |
| 244 | +< |
| 245 | +One first creates a number of blank-filled lines; the \h map (the "holer") is |
| 246 | +useful for this. Select the first endpoint with ctrl-v and then move to the |
| 247 | +other endpoint. One may then select \a for arrows, \b for boxes, \e for ellipses, |
| 248 | +or \l for lines. |
| 249 | +> |
| 250 | + Examples: |
| 251 | +
|
| 252 | + __ _ *************** +-------+ |
| 253 | + \_ _/ **** **** | | |
| 254 | + \_ _/ ** ---------> ** | | |
| 255 | + \_ _/ **** **** | | |
| 256 | + \__/ <------- *************** +-------+ |
| 257 | +
|
| 258 | + \l \a \e and \a \b |
| 259 | +< |
| 260 | +DRAWIT MODES *drawit-modes* |
| 261 | + |
| 262 | + -[DrawIt] regular DrawIt mode |
| 263 | + -[DrawIt off] DrawIt is off |
| 264 | + -[DrawIt erase] DrawIt will erase using the number pad |
| 265 | + |
| 266 | + g:DrChipTopLvlMenu: by default its "DrChip"; you may set this to whatever |
| 267 | + you like in your <.vimrc>. This variable controls where |
| 268 | + DrawIt's menu items are placed. |
| 269 | + |
| 270 | +vim:tw=78:ts=8:ft=help |
0 commit comments