refactor: use neovim autocmd api

main
olimorris 2022-10-26 13:41:13 +01:00
parent 63a8031516
commit 26d82d6876
2 changed files with 7 additions and 11 deletions

View File

@ -125,15 +125,12 @@ end
---Start recording a session and write to disk on a specific autocommand
---@return nil
function M.start()
vim.cmd(string.format(
[[
augroup Persisted
autocmd!
autocmd %s * lua require("persisted").save()
augroup end
]],
config.options.command
))
vim.api.nvim_create_autocmd(config.options.command, {
group = vim.api.nvim_create_augroup("Persisted", { clear = true }),
callback = function()
require("persisted").save()
end,
})
vim.g.persisting = true
end
@ -213,7 +210,6 @@ function M.list()
:gsub("//", "")
:sub(1, -5)
local branch, dir_path
if string.find(session_name, branch_separator, 1, true) then

View File

@ -1,6 +1,6 @@
if !isdirectory('plenary.nvim')
!git clone https://github.com/nvim-lua/plenary.nvim.git plenary.nvim
!git -C plenary.nvim reset --hard 4b7e52044bbb84242158d977a50c4cbcd85070c7
" !git -C plenary.nvim reset --hard 4b7e52044bbb84242158d977a50c4cbcd85070c7
endif
set runtimepath+=plenary.nvim,.