Wikia

Vim Tips Wiki

Changes: Script:40

Edit

Back to page

(Shift + arrow key support in Mac OS X's Terminal)
(Bug fix)
Line 57: Line 57:
   
 
==Comments==
 
==Comments==
  +
  +
== Bugs ==
  +
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:
  +
<pre>
  +
B | |
  +
/ A drawn to B ==> \ Instead of ==> /
  +
A | |
  +
</pre>
  +
[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'.

Revision as of 21:22, September 14, 2012

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 vim.org).
  • This page may be out of date: check the script's vim.org 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 Terminal.app 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>
endfun

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>
endfun
an 1.16 ToolBar.DrawIt :call <SID>StartDrawIt()<CR>
tm ToolBar.DrawIt      Start drawing with DrawIt	\di

Comments

Bugs

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'.

Around Wikia's network

Random Wiki