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

View File

@ -1,6 +1,6 @@
if !isdirectory('plenary.nvim') if !isdirectory('plenary.nvim')
!git clone https://github.com/nvim-lua/plenary.nvim.git 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 endif
set runtimepath+=plenary.nvim,. set runtimepath+=plenary.nvim,.