vim script "input()" function that doesn't require user to hit enter -


i have user call function , have function request user input not want user have type 'enter' after typing letter required "input()" function. instance, user should able type single letter commands 'h','j','k','l' , each letter typed loop around function until user typed 'x' exit. if use "input()" user have type 'h<enter>','j<enter>'...

any suggestions on how might able this?

if more clarification needed please let me know.

update

got working:

function! s:getchar()   let c = getchar()   if c =~ '^\d\+$'     let c = nr2char(c)   endif   return c endfunction  " interactively change window size function! interactivewindow()   let char = "s"   while char =~ '^\w$'     echo "(interactivewindow) type: h,j,k,l resize or auto resize"     let char = s:getchar()     if char == "h" | call setwindowsize( "incr" ,-5 ,0 ) | endif     if char == "j" | call setwindowsize( "incr"  ,0 ,5 ) | endif     if char == "k" | call setwindowsize( "incr"  ,0 ,-5) | endif     if char == "l" | call setwindowsize( "incr"  ,5 ,0 ) | endif     if char == "a" | call setwindowsize( "abs"  ,0  ,0 ) | endif     redraw   endwhile endfunction 

getchar()

http://vimdoc.sourceforge.net/htmldoc/eval.html#getchar()


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -