mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2026-08-16 02:44:35 +00:00
added 'autosave_clean_command_line' autocmd
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -13,3 +13,14 @@ api.nvim_exec(
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
api.nvim_exec(
|
||||
[[
|
||||
function! g:AutoSaveClearCommandLine(timer)
|
||||
if mode() ==# 'n'
|
||||
echon ''
|
||||
endif
|
||||
endfunction
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user