4 #include <readline/readline.h>
8 * Vim interface for the readline(3) function.
10 * Prints 'prompt' and reads a line from the input. If EOF is encountered,
11 * returns the string "E"; otherwise, returns the string "S<line>" where <line>
12 * is the line read from input.
14 * This function is not thread-safe.
16 char* vimreadline(char* prompt
) {
17 static char buf
[1024];
18 char* res
= readline(prompt
);
21 strncpy(buf
+ 1, res
, sizeof(buf
) - 1);
30 #define UNIXTIME_BASE 1451606400 /* = Unix time of 2016-01-01 */
33 * Returns the number of milliseconds since 2016-01-01 00:00:00 UTC.
35 * This date is chosen (instead of the standard 1970 epoch) so the number of
36 * milliseconds will not exceed a 32-bit integer, which is the limit for Vim
39 int vimtimems(int dummy
) {
41 (void) dummy
; /* unused */
42 gettimeofday(&tv
, NULL
);
43 return (tv
.tv_sec
- UNIXTIME_BASE
) * 1000 + (tv
.tv_usec
/ 1000);