added 'autosave_clean_command_line' autocmd

This commit is contained in:
kdav5758
2021-07-01 18:05:26 -05:00
parent 58caad5b78
commit 568369bd22
2 changed files with 34 additions and 4 deletions
+23 -4
View File
@@ -66,10 +66,6 @@ function M.save()
print(opts["execution_message"])
set_modified(false)
end
if (opts["clean_command_line_interval"] > 0) then
cmd([[sleep ]] .. opts["clean_command_line_interval"] .. [[ | echon '']])
end
end
local function parse_events()
@@ -97,6 +93,18 @@ function M.load_autocommands()
]],
false
)
if (opts["clean_command_line_interval"] > 0) then
api.nvim_exec(
[[
augroup autosave_clean_command_line
autocmd!
autocmd CmdlineLeave * call timer_start(]].. opts["clean_command_line_interval"] ..[[, funcref('g:AutoSaveClearCommandLine'))
augroup END
]],
false
)
end
end
function M.unload_autocommands()
@@ -105,6 +113,17 @@ function M.unload_autocommands()
autocmd!
augroup END
]], false)
if (opts["clean_command_line_interval"] > 0) then
api.nvim_exec(
[[
augroup autosave_clean_command_line
autocmd!
augroup END
]],
false
)
end
end
return M
+11
View File
@@ -13,3 +13,14 @@ api.nvim_exec(
]],
false
)
api.nvim_exec(
[[
function! g:AutoSaveClearCommandLine(timer)
if mode() ==# 'n'
echon ''
endif
endfunction
]],
false
)