我有一个可更新缓冲区的vimscript
function! NextTodos()
:let tempfile = "~/AppData/Local/Temp/Journal-VIC777C.tmp"
:exe 'e ' . tempfile
" delete all existing lines, see
" https://alvinalexander.com/linux-unix/vi-vim-delete-all-lines-how
:1,$d
:r ~\workspace\logs\Journal.log
:silent v/-next\|-wait\|-periodic/d
" reverse list, does not work correctly
:g/^/m0
:sort
:execute "normal gg"
" https://stackoverflow.com/a/21277670/1933185
:put =readfile(expand('~\workspace\logs\Journal.log'))[1:19]
" http://learnvimscriptthehardway.stevelosh.com/chapters/29.html
:execute "normal ggdd"
:w
:syn match String "-next"
:syn match Comment "-periodic"
:syn match Special "-wait"
endfunction
当我调用此脚本时,vim在命令行中显示一条信息消息。 (从德语翻译:按Enter键或输入命令)
首先,当我按下Enter键时,信息消息将消失,缓冲区将被更新。
如何使它工作,使缓冲区立即更新,而不必按Enter键?
关于 How do I disable the “Press ENTER or type command to continue” prompt in Vim?。 可接受的答案指出:添加另一个回车,这不能解决我的问题。我必须使用:silent。