Compare commits

..

No commits in common. "main" and "v3.0.1" have entirely different histories.
main ... v3.0.1

7 changed files with 34 additions and 48 deletions

View File

@ -1,7 +0,0 @@
root = true
[*]
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8

View File

@ -6,10 +6,7 @@ body:
- type: markdown
attributes:
value: |
**Before** reporting an issue, make sure to read the [documentation](https://github.com/folke/persistence.nvim)
and search [existing issues](https://github.com/folke/persistence.nvim/issues).
Usage questions such as ***"How do I...?"*** belong in [Discussions](https://github.com/folke/persistence.nvim/discussions) and will be closed.
**Before** reporting an issue, make sure to read the [documentation](https://github.com/folke/persistence.nvim) and search [existing issues](https://github.com/folke/persistence.nvim/issues). Usage questions such as ***"How do I...?"*** belong in [Discussions](https://github.com/folke/persistence.nvim/discussions) and will be closed.
- type: checkboxes
attributes:
label: Did you check docs and existing issues?
@ -17,8 +14,6 @@ body:
options:
- label: I have read all the persistence.nvim docs
required: true
- label: I have updated the plugin to the latest version before submitting this issue
required: true
- label: I have searched the existing issues of persistence.nvim
required: true
- label: I have searched the existing issues of plugins related to this issue
@ -62,15 +57,33 @@ body:
label: Repro
description: Minimal `init.lua` to reproduce this issue. Save as `repro.lua` and run with `nvim -u repro.lua`
value: |
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
require("lazy.minit").repro({
spec = {
{ "folke/persistence.nvim", opts = {} },
-- add any other plugins here
},
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{ "folke/persistence.nvim", opts = {} },
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
render: lua
vim.cmd.colorscheme("tokyonight")
-- add anything else here
render: Lua
validations:
required: false

View File

@ -5,7 +5,6 @@ on:
- cron: "30 1 * * *"
jobs:
stale:
if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner)
ci:
uses: folke/github/.github/workflows/stale.yml@main
secrets: inherit

View File

@ -7,7 +7,6 @@ on:
- cron: "0 * * * *"
jobs:
update:
if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner)
ci:
uses: folke/github/.github/workflows/update.yml@main
secrets: inherit

View File

@ -1,12 +1,5 @@
# Changelog
## [3.1.0](https://github.com/folke/persistence.nvim/compare/v3.0.1...v3.1.0) (2024-07-07)
### Features
* **load:** fallback to regular session when branch session does not exist (yet) ([a93748a](https://github.com/folke/persistence.nvim/commit/a93748acdb2e7bc4389b3738b4c787b764c3b2a6))
## [3.0.1](https://github.com/folke/persistence.nvim/compare/v3.0.0...v3.0.1) (2024-07-07)

View File

@ -1,4 +1,4 @@
*persistence.nvim.txt* For Neovim Last change: 2025 February 25
*persistence.nvim.txt* For Neovim Last change: 2024 July 07
==============================================================================
Table of Contents *persistence.nvim-table-of-contents*

View File

@ -7,11 +7,9 @@ M._active = false
local e = vim.fn.fnameescape
---@param opts? {branch?: boolean}
function M.current(opts)
opts = opts or {}
function M.current()
local name = vim.fn.getcwd():gsub("[\\/:]+", "%%")
if Config.options.branch and opts.branch ~= false then
if Config.options.branch then
local branch = M.branch()
if branch and branch ~= "main" and branch ~= "master" then
name = name .. "%%" .. branch:gsub("[\\/:]+", "%%")
@ -45,7 +43,7 @@ function M.start()
if Config.options.need > 0 then
local bufs = vim.tbl_filter(function(b)
if vim.bo[b].buftype ~= "" or vim.tbl_contains({ "gitcommit", "gitrebase", "jj" }, vim.bo[b].filetype) then
if vim.bo[b].buftype ~= "" or vim.bo[b].filetype == "gitcommit" or vim.bo[b].filetype == "gitrebase" then
return false
end
return vim.api.nvim_buf_get_name(b) ~= ""
@ -73,16 +71,7 @@ end
---@param opts? { last?: boolean }
function M.load(opts)
opts = opts or {}
---@type string
local file
if opts.last then
file = M.last()
else
file = M.current()
if vim.fn.filereadable(file) == 0 then
file = M.current({ branch = false })
end
end
local file = opts.last and M.last() or M.current()
if file and vim.fn.filereadable(file) ~= 0 then
M.fire("LoadPre")
vim.cmd("silent! source " .. e(file))