Created
August 20, 2015 12:50
-
-
Save U-MA/66cc50b1cc3151d109ff to your computer and use it in GitHub Desktop.
This file contains 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
function! s:foo(second) abort | |
let l:start = reltime() | |
while str2float(reltimestr(reltime(l:start))) < float(a:second) | |
execute 'normal! r ' | |
endwhile | |
endfunction | |
tabnew Sample | |
call setline(1, 'Please any keys for 2 seconds.') | |
redraw | |
call s:foo(2) | |
call setline(2, 'Return') | |
let s:key = getchar(0) | |
while s:key | |
call setline(line('$')+1, s:key) | |
let s:key = getchar(0) | |
endwhile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment