From dc622188a3559597ea62588ca789d4fdd9775c16 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 13 Nov 2023 10:28:55 +0100 Subject: nvim: Finally make auto-reverts actually work --- .config/nvim/lua/mango/set.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to '.config/nvim/lua/mango') diff --git a/.config/nvim/lua/mango/set.lua b/.config/nvim/lua/mango/set.lua index e7a7d21..906dc26 100644 --- a/.config/nvim/lua/mango/set.lua +++ b/.config/nvim/lua/mango/set.lua @@ -51,11 +51,16 @@ api.nvim_create_autocmd('BufEnter', { }) -- Make buffer auto-reverting work… somehow -g.autoread = true -api.nvim_create_autocmd('CursorHold', { - command = 'checktime | call feedkeys("lh")', - group = augroup, -}) +vim.cmd([[ + if !exists('g:CheckUpdateStarted') + let g:CheckUpdateStarted = 1 + call timer_start(1000, 'CheckUpdate', {'repeat': -1}) + endif + + function! CheckUpdate(_) + silent! checktime + endfunction +]]) -- This has to be done to enable linenumbers in netrw g.netrw_bufsettings = 'noma nomod nu nobl nowrap ro' -- cgit v1.2.3