-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on session restore when first buffer is terminal #454
Comments
Can I get your nvim-tree config? |
local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then
return
end
local opts = { noremap = true, silent = true }
nvim_tree.setup()
local function open_nvim_tree(data)
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
local directory = vim.fn.isdirectory(data.file) == 1
if not no_name and not directory then
return
end
if directory then
vim.cmd.cd(data.file)
end
require("nvim-tree.api").tree.open()
end
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = open_nvim_tree,
})
vim.keymap.set("n", "<C-f>", ":NvimTreeFindFileToggle<CR>", opts)
vim.keymap.set(
"n",
"<C-t>",
":lua require('nvim-tree.api').tree.toggle(false, true)<cr>",
opts
) |
I created a minimal lua file (I added our session integration feature to your config): require'barbar'.setup {sidebar_filetypes = {NvimTree = true}}
require'nvim-tree'.setup {}
vim.api.nvim_create_autocmd({'VimEnter'}, {callback = function(event)
local no_name = event.file == "" and vim.bo[event.buf].buftype == ""
local directory = vim.fn.isdirectory(event.file) == 1
if not no_name and not directory then
return
end
if directory then
vim.cmd.cd(event.file)
end
require("nvim-tree.api").tree.open()
end})
vim.opt.sessionoptions:append 'globals'
vim.api.nvim_create_user_command(
'Mksession',
function(attr)
vim.api.nvim_exec_autocmds('User', {pattern = 'SessionSavePre'})
vim.cmd.mksession {bang = attr.bang, args = attr.fargs}
end,
{bang = true, complete = 'file', desc = 'Save barbar with :mksession', nargs = '?'}
) Then ran: nvim --clean \
--cmd 'set rtp+=~/.local/share/nvim/lazy/barbar.nvim' \
--cmd 'set rtp+=~/.local/share/nvim/lazy/nvim-tree.lua' \
--cmd 'set rtp+=~/.local/share/nvim/lazy/nvim-web-devicons' \
-u minimal.lua Then did your steps from above (i.e. What session manager plugin are you using? Can you share your config for that? |
nvim-session-manager |
Do you use any particular config options for nvim-session-manager? |
local Path = require("plenary.path")
local status_ok, session_manager = pcall(require, "session_manager")
if not status_ok then
return
end
session_manager.setup({
sessions_dir = Path:new(vim.fn.stdpath("data"), "sessions"), -- The directory where the session files will be saved.
path_replacer = "__", -- The character to which the path separator will be replaced for session files.
colon_replacer = "++", -- The character to which the colon symbol will be replaced for session files.
autoload_mode = require("session_manager.config").AutoloadMode.LastSession, -- Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession
autosave_last_session = true, -- Automatically save last session on exit and on session switch.
autosave_ignore_not_normal = true, -- Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed.
autosave_ignore_dirs = {}, -- A list of directories where the session will not be autosaved.
autosave_ignore_filetypes = { -- All buffers of these file types will be closed before the session is saved.
"gitcommit",
},
autosave_ignore_buftypes = {}, -- All buffers of these bufer types will be closed before the session is saved.
autosave_only_in_session = false, -- Always autosaves session. If true, only autosaves after a session is active.
max_path_length = 80, -- Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all.
}) |
Does the latest commit fix the issue? I was never able to reproduce, but I just fixed something similar. If not, I have a few ideas. |
yes |
Thank you for confirming! |
Description
I get error on session restore when first buffer is terminal
To Reproduce
Steps to reproduce the behavior:
Screenshots
![NFS0cwG](https://user-images.githubusercontent.com/21293376/230887793-4864bfa8-e432-4e51-b95b-68fe966ac1e1.png)
![sHmGUyR](https://user-images.githubusercontent.com/21293376/230887808-5529adbd-f194-4975-a3bf-d7f59485dbc3.png)
Informations
Neovim version: 0.9
The text was updated successfully, but these errors were encountered: