Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
ad538bfd53 | |||
01d7fa95fe | |||
0361df7775 | |||
9730a073fd | |||
8f7cbccfb5 |
18
CHANGELOG.md
18
CHANGELOG.md
@ -1,5 +1,23 @@
|
|||||||
# 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)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* dont save the session when only `gitcommit` buffers are present. Fixes [#14](https://github.com/folke/persistence.nvim/issues/14) ([8f7cbcc](https://github.com/folke/persistence.nvim/commit/8f7cbccfb506fe6cb35db9ad966137c363b049c5))
|
||||||
|
|
||||||
## [1.2.0](https://github.com/folke/persistence.nvim/compare/v1.1.0...v1.2.0) (2023-10-13)
|
## [1.2.0](https://github.com/folke/persistence.nvim/compare/v1.1.0...v1.2.0) (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*
|
Table of Contents *persistence.nvim-table-of-contents*
|
||||||
|
@ -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()
|
||||||
@ -39,6 +42,9 @@ function M.start()
|
|||||||
if vim.bo[b].buftype ~= "" then
|
if vim.bo[b].buftype ~= "" then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
if vim.bo[b].filetype == "gitcommit" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
return vim.api.nvim_buf_get_name(b) ~= ""
|
return vim.api.nvim_buf_get_name(b) ~= ""
|
||||||
end, vim.api.nvim_list_bufs())
|
end, vim.api.nvim_list_bufs())
|
||||||
if #bufs == 0 then
|
if #bufs == 0 then
|
||||||
@ -52,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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user