Vim Tips Wiki


Revision as of 09:28, September 12, 2013 by (Talk)

1,616pages on
this wiki

Use this page to discuss script 40 DrawIt: Ascii drawing plugin: lines, ellipses, arrows, fills, and more

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.

Shift + arrow key support in Mac OS X's Terminal

To have the shift + arrow key input (to move the cursor without drawing lines) work correctly in in OS X, it's necessary to add the following to Terminal's Preferences -> Settings -> Keyboard section:

shift cursor up:     \033[1;2A

shift cursor down:   \033[1;2B

shift cursor left:   \033[1;2D

shift cursor right:  \033[1;2C

Note that \033 is generated by typing Esc

Toolbar buttons

I've just been playing around with ToolBar button(s) and custom right mouse click menus for DrawIt. Maybe of interest to someone else:

amenu ]VlsDrawIt.Toggle\ Erase\ Mode<tab><space>   <space>
amenu ]VlsDrawIt.Make\ Blank\ Zone<tab>\\c         <Leader>c
amenu ]VlsDrawIt.Draw\ Flood<tab>\\e               <Leader>f

amenu ]VlsDrawItV.Draw\ Arrow<tab>\\a              gv<Leader>a
amenu ]VlsDrawItV.Draw\ Box<tab>\\b                gv<Leader>b
amenu ]VlsDrawItV.Draw\ Ellipse<tab>\\e            gv<Leader>e
amenu ]VlsDrawItV.Draw\ Line<tab>\\l               gv<Leader>l
amenu ]VlsDrawItV.Append\ Blanks<tab>\\s           gv<Leader>s

fun! s:StartDrawIt()
  aun ToolBar.DrawIt
  an <silent>icon=DrawItOff 1.16 ToolBar.DrawIt :call <SID>StopDrawIt()<CR>
  tm ToolBar.DrawIt               Stop drawing with DrawIt	\ds
  set lz
  call DrawIt#StartDrawIt()
  set nolz
  vunmap <buffer> <rightmouse>
  vnoremap <silent><buffer> <rightmouse> :<C-U>popup! ]VlsDrawItV<cr>gv
  nnoremap <silent><buffer> <rightmouse> :<C-U>popup! ]VlsDrawIt<cr>

fun! s:StopDrawIt()
  aun ToolBar.DrawIt
  an <silent> 1.16 ToolBar.DrawIt :call <SID>StartDrawIt()<CR>
  tm ToolBar.DrawIt               Start drawing with DrawIt	\di
  set lz
  call DrawIt#StopDrawIt()
  set nolz
  vunmap <buffer> <rightmouse>
  nunmap <buffer> <rightmouse>
an 1.16 ToolBar.DrawIt :call <SID>StartDrawIt()<CR>
tm ToolBar.DrawIt      Start drawing with DrawIt	\di



This is the only forum I've found for Bug reports, so:

I experienced an arrow drawing bug during which arrows with a dx < dy and drawn in the lower left to upper right manner (or vice-versa) would display '\'s instead of '/'s. Eg:

 B                     |                   |
/   A drawn to B ==>  \   Instead of ==>  /
A                     |                   |

[SOLUTION] In DrawIt.vim (line ~2591), s:DrawLine, under the 'else' statement of 'if dx > dy', the statement 'if stepy > 0 || stepx < 0' should be changed to 'if stepx > 0'.

[EDIT] Confirmed the fix. To be clear, the following diff is needed:

--- DrawIt.vim	2013-09-12 11:27:37.000000000 +0200
+++ DrawIt.vim.n	2013-09-12 11:27:33.000000000 +0200
@@ -2673,7 +2673,7 @@
      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 stepy > 0 || stepx < 0
+           if stepy > 0 || stepx > 0
 			let char = (g:drawit_mode == 'N')? b:di_upleft : b:di_Supleft
 			let char = (g:drawit_mode == 'N')? b:di_upright : b:di_Supright

Around Wikia's network

Random Wiki