Comments (7)
I don't know why, but after some trial and error, I realized the problem only occurred when the rustaceanvim plugin (one of the plugins included in lazyvim.plugins.extras.lang.rust
) was being imported. I fixed the issue by making it a dependency of treesitter.
Thanks for the help!
from nvim-possession.
Good evening!
Could you specify what it means that autoload isn't working? The autoload function checks whether a session whose directory path corresponds to the cwd
exists in the vim session file: if so, it executes it.
Could you please verify:
- that such a session correctly exists in your session file
- that the condition matches the current working directory (however you have set it)
Under these conditions is the autoload mechanism still not working?
from nvim-possession.
I might not fully understand what you're asking for, but I'll try my best.
This is what I presume to be the session file:
~/.local/share/nvim/sessions/dotfiles
let SessionLoad = 1
let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
let v:this_session=expand("<sfile>:p")
silent only
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
let s:wipebuf = bufnr('%')
endif
let s:shortmess_save = &shortmess
if &shortmess =~ 'A'
set shortmess=aoOA
else
set shortmess=aoO
endif
badd +97 ~/dotfiles/setup.sh
argglobal
%argdel
edit ~/dotfiles/setup.sh
let s:save_splitbelow = &splitbelow
let s:save_splitright = &splitright
set splitbelow splitright
let &splitbelow = s:save_splitbelow
let &splitright = s:save_splitright
wincmd t
let s:save_winminheight = &winminheight
let s:save_winminwidth = &winminwidth
set winminheight=0
set winheight=1
set winminwidth=0
set winwidth=1
argglobal
balt ~/dotfiles/.config/nvim/lua/config/autocmds.lua
let s:l = 97 - ((27 * winheight(0) + 28) / 56)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 97
normal! 0
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
silent exe 'bwipe ' . s:wipebuf
endif
unlet! s:wipebuf
set winheight=1 winwidth=20
let &shortmess = s:shortmess_save
let &winminheight = s:save_winminheight
let &winminwidth = s:save_winminwidth
let s:sx = expand("<sfile>:p:r")."x.vim"
if filereadable(s:sx)
exe "source " . fnameescape(s:sx)
endif
let &g:so = s:so_save | let &g:siso = s:siso_save
set hlsearch
nohlsearch
doautoall SessionLoadPost
unlet SessionLoad
" vim: set ft=vim :
When I open the terminal in nvim and type pwd
, it does return the absolute path for ~/dotfiles
.
The cwd
in the sessions list seems to show where the session files are, I'm not sure if that's the issue or if it's intended?
from nvim-possession.
Whenever you save a session from a certain directory, the corresponding session file must present the entry
...
cd ~/<dir_name>
...
which seems to be absent in yours: please check if you have specific configurations for vim sessions (for instance, not to save session path when saving). See :h sessionoptions
, if I am not mistaken you have to set the value curdir
.
Once such entry is present in the session file, and once you open neovim from within that directory, the plugin will automatically load the session.
from nvim-possession.
I did see that in the README, but I wasn't sure how to do that with LazyVim. However, it seems to work with:
vim.cmd("set ssop+=curdir")
in options.lua
and setting lazy = false
for possession.
So, now the plugin seems to work, except I get a large error saying "failed to run config
for nvim-possession".
Error:
Failed to run `config` for nvim-possession
.../nvim/lazy/nvim-possession/lua/nvim-possession/utils.lua:62: /home/slekup/dotfiles/.config/nvim/init.lua../home/slekup/.local/share/nvim/sessions/blue[19]..BufReadPost Autocommands for "*": Vim(append):Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:24: Error executing lua: /usr/share/nvim/runtime/filetype.lua:25: /home/slekup/dotfiles/.config/nvim/init.lua../home/slekup/.local/share/nvim/sessions/blue[19]..BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:151: Invalid 'group': 'syntaxset'
stack traceback:
[C]: in function 'nvim_exec_autocmds'
/usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:151: in function 'destroy'
/usr/share/nvim/runtime/lua/vim/treesitter.lua:471: in function 'stop'
...m/lazy/nvim-treesitter/lua/nvim-treesitter/highlight.lua:28: in function 'detach'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:522: in function 'detach_module'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:531: in function 'reattach_module'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in function <...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:132>
[C]: in function 'nvim_cmd'
/usr/share/nvim/runtime/filetype.lua:25: in function </usr/share/nvim/runtime/filetype.lua:24>
[C]: in function 'nvim_buf_call'
/usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:10>
...
[C]: in function 'xpcall'
.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:381: in function 'config'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:348: in function '_load'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:123: in function 'startup'
...lekup/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:112: in function 'setup'
/home/slekup/.config/nvim/lua/config/lazy.lua:14: in main chunk
[C]: in function 'require'
/home/slekup/dotfiles/.config/nvim/init.lua:2: in main chunk
stack traceback:
[C]: in function 'nvim_cmd'
/usr/share/nvim/runtime/filetype.lua:25: in function </usr/share/nvim/runtime/filetype.lua:24>
[C]: in function 'nvim_buf_call'
/usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:10>
[C]: in function 'source'
.../nvim/lazy/nvim-possession/lua/nvim-possession/utils.lua:62: in function 'autoload'
...e/nvim/lazy/nvim-possession/lua/nvim-possession/init.lua:148: in function 'setup'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:373: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:371>
[C]: in function 'xpcall'
.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:381: in function 'config'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:348: in function '_load'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:123: in function 'startup'
...lekup/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:112: in function 'setup'
/home/slekup/.config/nvim/lua/config/lazy.lua:14: in main chunk
[C]: in function 'require'
/home/slekup/dotfiles/.config/nvim/init.lua:2: in main chunk
stack traceback:
[C]: in function 'nvim_buf_call'
/usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:10>
[C]: in function 'source'
.../nvim/lazy/nvim-possession/lua/nvim-possession/utils.lua:62: in function 'autoload'
...e/nvim/lazy/nvim-possession/lua/nvim-possession/init.lua:148: in function 'setup'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:373: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:371>
[C]: in function 'xpcall'
.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:381: in function 'config'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:348: in function '_load'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:123: in function 'startup'
...lekup/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:112: in function 'setup'
/home/slekup/.config/nvim/lua/config/lazy.lua:14: in main chunk
[C]: in function 'require'
/home/slekup/dotfiles/.config/nvim/init.lua:2: in main chunk
# stacktrace:
- ~/.config/nvim/lua/config/lazy.lua:14
- ~/dotfiles/.config/nvim/init.lua:2
Possession config:
{
"gennaro-tedesco/nvim-possession",
lazy = false,
dependencies = {
{ "ibhagwan/fzf-lua" },
},
config = true,
opts = {
autoload = true,
autoswitch = {
enable = true,
},
fzf_winopts = {
width = 0.75,
},
},
keys = function()
local possession = require("nvim-possession")
return {
{
"<leader>ql",
function()
possession.list()
end,
desc = "List Sessions",
mode = "n",
},
{
"<leader>qn",
function()
possession.new()
end,
desc = "New Session",
mode = "n",
},
{
"<leader>qu",
function()
possession.update()
end,
desc = "Update Session",
mode = "n",
},
{
"<leader>qd",
function()
possession.delete()
end,
desc = "Delete Session",
mode = "n",
},
}
end,
},
Treesitter config:
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufReadPost",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, {
-- Languages
"markdown",
"markdown_inline",
})
end
end,
config = require("nvim-treesitter.configs").setup({
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown" },
sync_install = false,
auto_install = true,
ignore_install = {},
highlight = {
enable = true,
use_languagetree = true,
},
modules = {},
}),
},
from nvim-possession.
The error seems to be unrelated to nvim-possession
: the line it is pointing to is essentially loading a vim session, when doing so some other (treesitter) errors occur.
- Have you updated Treesitter and all its parsers to the latest versions?
- Could you try with a minimally reproducible configuration? I do not know how
LazyVim
interfaces with treesitter, so there may be configurations in there that need to be updated/set properly.
Here on the wiki you can find a minimally reproducible mini.lua
to try and reproduce.
from nvim-possession.
It happens when I use the "extra" plugins that LazyVim provides that include the treesitter plugin, such as the rust one, but when adding treesitter manually, no error shows.
(I had to replace the relative path with an absolute path on the first line and remove the extra /
added for the three references to root
.)
Repro:
local root = vim.fn.fnamemodify("/home/slekup/.repro", ":p")
-- 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",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
vim.g.mapleader = " "
require("lazy").setup({
root = root .. "plugins",
spec = {
{ "lazyvim/lazyvim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.ui.alpha" },
{ import = "lazyvim.plugins.extras.lang.rust" },
{ import = "plugins" },
{
{ "craftzdog/solarized-osaka.nvim" },
-- {
-- "nvim-treesitter/nvim-treesitter",
-- opts = function(_, opts)
-- opts.ensure_installed = opts.ensure_installed or {}
-- vim.list_extend(opts.ensure_installed, { "ron", "rust", "toml" })
-- end,
-- },
{
"gennaro-tedesco/nvim-possession",
lazy = false,
dependencies = {
"ibhagwan/fzf-lua",
},
config = true,
opts = {
autoload = true,
},
init = function()
local possession = require("nvim-possession")
vim.keymap.set("n", "<leader>ml", function()
possession.list()
end)
vim.keymap.set("n", "<leader>mn", function()
possession.new()
end)
vim.keymap.set("n", "<leader>mu", function()
possession.update()
end)
vim.keymap.set("n", "<leader>md", function()
possession.delete()
end)
end,
},
},
},
defaults = {
lazy = false,
version = false,
},
checker = { enabled = true }, -- automatically check for plugin updates
performance = {
rtp = {
disabled_plugins = {
"gzip",
"tarplugin",
"tohtml",
"tutor",
"zipplugin",
},
},
},
})
vim.opt.termguicolors = true
vim.cmd([[colorscheme solarized-osaka]])
from nvim-possession.
Related Issues (20)
- nvim-tree not loading when restoring a session HOT 9
- Replace "new" and "update" with just "save", buggy when launched at start HOT 7
- About vimscript configuration issues HOT 11
- tag the rockspec with the "neovim" label. HOT 4
- Expose a delete() function HOT 6
- Bad filepath error (No such file or directory) HOT 24
- Files that are deleted still shows in session file. HOT 11
- The autoload setting makes the loaded buffer innactive HOT 1
- How to "close" session? HOT 9
- Breaks on terminal HOT 14
- Bug in README with lualine HOT 2
- Plugin doesn't work HOT 9
- autoload cause double lualine in lazyvim HOT 4
- Close session HOT 9
- Auto-create session path HOT 3
- I get an error when calling the setup function: Vim:E499: Empty file name for '%' or '#', only works with ":p:h" HOT 1
- I have a text on the top that I don't know how to turn off HOT 2
- Switch session will clean up buffers from current session? HOT 8
- Decouple fzf-lua to a plugin? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-possession.