1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-10 12:47:45 +03:00
mal/vimscript/readline.vim
2016-10-25 22:32:16 +00:00

24 lines
585 B
VimL

function PrintLn(str)
let lines = split(a:str, "\n", 1)
call writefile(lines, "/dev/stdout", "a")
endfunction
function s:buildlibvimreadline()
if !filereadable("libvimextras.so")
call system("make libvimextras.so")
endif
endfunction
" Returns [is_eof, line_string]
function Readline(prompt)
" Use the vimreadline() function defined in vimextras.c and compiled
" into libvimextras.so
call s:buildlibvimreadline()
let res = libcall("libvimextras.so", "vimreadline", a:prompt)
if res[0] == "E"
return [1, ""]
else
return [0, res[1:]]
endif
endfunction