3 Commits

Author SHA1 Message Date
ad538bfd53 chore(main): release 2.0.0 (#36)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-15 21:42:03 +02:00
01d7fa95fe chore(build): auto-generate vimdoc 2023-10-15 19:41:11 +00:00
0361df7775 fix(start)!: session name is now based on the cwd when the session starts and not when the session ends. Fixes #1688 2023-10-15 21:40:27 +02:00
3 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,16 @@
# Changelog # Changelog
## [2.0.0](https://github.com/folke/persistence.nvim/compare/v1.2.1...v2.0.0) (2023-10-15)
### ⚠ BREAKING CHANGES
* **start:** session name is now based on the cwd when the session starts and not when the session ends. Fixes #1688
### Bug Fixes
* **start:** session name is now based on the cwd when the session starts and not when the session ends. Fixes [#1688](https://github.com/folke/persistence.nvim/issues/1688) ([0361df7](https://github.com/folke/persistence.nvim/commit/0361df7775f5b4ed51a6d7fe159438573b7f07a6))
## [1.2.1](https://github.com/folke/persistence.nvim/compare/v1.2.0...v1.2.1) (2023-10-13) ## [1.2.1](https://github.com/folke/persistence.nvim/compare/v1.2.0...v1.2.1) (2023-10-13)

View File

@ -1,4 +1,4 @@
*persistence.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 October 13 *persistence.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 October 15
============================================================================== ==============================================================================
Table of Contents *persistence.nvim-table-of-contents* Table of Contents *persistence.nvim-table-of-contents*

View File

@ -1,6 +1,8 @@
local Config = require("persistence.config") local Config = require("persistence.config")
local M = {} local M = {}
---@type string?
M.current = nil
local e = vim.fn.fnameescape local e = vim.fn.fnameescape
@ -27,6 +29,7 @@ function M.setup(opts)
end end
function M.start() function M.start()
M.current = M.get_current()
vim.api.nvim_create_autocmd("VimLeavePre", { vim.api.nvim_create_autocmd("VimLeavePre", {
group = vim.api.nvim_create_augroup("persistence", { clear = true }), group = vim.api.nvim_create_augroup("persistence", { clear = true }),
callback = function() callback = function()
@ -55,13 +58,14 @@ function M.start()
end end
function M.stop() function M.stop()
M.current = nil
pcall(vim.api.nvim_del_augroup_by_name, "persistence") pcall(vim.api.nvim_del_augroup_by_name, "persistence")
end end
function M.save() function M.save()
local tmp = vim.o.sessionoptions local tmp = vim.o.sessionoptions
vim.o.sessionoptions = table.concat(Config.options.options, ",") vim.o.sessionoptions = table.concat(Config.options.options, ",")
vim.cmd("mks! " .. e(M.get_current())) vim.cmd("mks! " .. e(M.current or M.get_current()))
vim.o.sessionoptions = tmp vim.o.sessionoptions = tmp
end end