Created
January 3, 2019 23:56
-
-
Save RRethy/f60af4b48d37d0b991868ab4843a69fe to your computer and use it in GitHub Desktop.
React to user input as it is typed - Old Method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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