Skip to content

Instantly share code, notes, and snippets.

@RRethy
Created January 3, 2019 23:56
Show Gist options
  • Save RRethy/f60af4b48d37d0b991868ab4843a69fe to your computer and use it in GitHub Desktop.
Save RRethy/f60af4b48d37d0b991868ab4843a69fe to your computer and use it in GitHub Desktop.
React to user input as it is typed - Old Method
fun! QueryInput() abort
let c = ''
" Builds a basic prompt
echohl Keyword | echon 'Input: ' | echohl None
while 1
let nbr = getchar()
" Check if no character button was clicked
if nbr < 0x20
return
else
let c .= nr2char(nbr)
redraw
" Print the prompt and what has been typed
echohl Keyword | echon 'Input: ' | echohl None | echon c
endif
endwhile
endf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment