Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
999 B

  1. return function()
  2. require'persisted'.setup {
  3. options = {'globals'},
  4. pre_save = function() vim.api.nvim_exec_autocmds('User', {pattern = 'SessionSavePre'}) end,
  5. should_autosave = function()
  6. -- do not autosave if the alpha dashboard is the current filetype
  7. if vim.bo.filetype == "alpha" then
  8. return false
  9. end
  10. return true
  11. end,
  12. on_autoload_no_session = function()
  13. vim.notify("No existing session to load.")
  14. end,
  15. ignored_dirs = {
  16. "~/.config",
  17. "~/.local/nvim"
  18. },
  19. }
  20. local group = vim.api.nvim_create_augroup("PersistedHooks", {})
  21. vim.api.nvim_create_autocmd({ "User" }, {
  22. pattern = "PersistedTelescopeLoadPre",
  23. group = group,
  24. callback = function(session)
  25. -- Save the currently loaded session using a global variable
  26. require("persisted").save({ session = vim.g.persisted_loaded_session })
  27. -- Delete all of the open buffers
  28. vim.api.nvim_input("<ESC>:%bd!<CR>")
  29. end,
  30. })
  31. end