我正在编辑HTML文件.我使用这个keymap启动firefox来预览页面:
map <F6> :update<CR>:silent !xdg-open %:p<CR>
Run Code Online (Sandbox Code Playgroud)
但是在这个命令之后,Vim窗口变成了全黑.我需要滚动每一行才能再次出现.
所以我想写一个函数来刷新缓冲区.这是我做的:
function! Refresh()
" code
set noconfirm
bufdo e!
set confirm
endfunction
nmap <F5> :call Refresh()<CR>
Run Code Online (Sandbox Code Playgroud)
我从这篇文章中得到了这个想法.但它不起作用.
如何添加"重绘"功能(与ctrl-L相同)
:redr[aw][!] Redraw the screen right now. When ! is included it is
cleared first.
Useful to update the screen halfway executing a script
or function. Also when halfway a mapping and
'lazyredraw' is set.
Run Code Online (Sandbox Code Playgroud)