Skip to content

Commit

Permalink
nvim(plugin/persistence): add support for tmux-resurrect
Browse files Browse the repository at this point in the history
gelocraft committed Jan 30, 2025
1 parent ccc8053 commit 3e3d5ba
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion nvim/lua/plugins/persistence.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
return {
'folke/persistence.nvim',
opts = {},
init = function()
local nvim_sessions = vim.fn.stdpath 'state' .. '/sessions/'
local tmux_sessions = vim.fn.expand '~/.local/share/tmux/resurrect/'

local tmux_sessions_exists = vim.fn.empty(
vim.fn.globpath(tmux_sessions, '*')
) == 0

local nvim_sessions_exists = vim.fn.empty(
vim.fn.globpath(nvim_sessions, '*')
) == 0

local is_inside_tmux = vim.env.TMUX ~= nil

if nvim_sessions_exists and tmux_sessions_exists and is_inside_tmux then
-- Restore neovim sessions
vim.schedule(function() require('persistence').load() end)
end
end,
config = true,
keys = {
{
'<leader>Rs',

0 comments on commit 3e3d5ba

Please sign in to comment.