Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
ad538bfd53 | |||
01d7fa95fe | |||
0361df7775 |
11
CHANGELOG.md
11
CHANGELOG.md
@ -1,5 +1,16 @@
|
||||
# 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,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*
|
||||
|
@ -1,6 +1,8 @@
|
||||
local Config = require("persistence.config")
|
||||
|
||||
local M = {}
|
||||
---@type string?
|
||||
M.current = nil
|
||||
|
||||
local e = vim.fn.fnameescape
|
||||
|
||||
@ -27,6 +29,7 @@ function M.setup(opts)
|
||||
end
|
||||
|
||||
function M.start()
|
||||
M.current = M.get_current()
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
group = vim.api.nvim_create_augroup("persistence", { clear = true }),
|
||||
callback = function()
|
||||
@ -55,13 +58,14 @@ function M.start()
|
||||
end
|
||||
|
||||
function M.stop()
|
||||
M.current = nil
|
||||
pcall(vim.api.nvim_del_augroup_by_name, "persistence")
|
||||
end
|
||||
|
||||
function M.save()
|
||||
local tmp = vim.o.sessionoptions
|
||||
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
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user