You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Technically this is not a bug. However it's an annoyance. I'm not sure how to fix this either. Wondering if anyone one else out there knows a better way to do this.
Below snippet provided as solution to auto restore session when no files are passed.
Unfortunately, this overrides any commands provided when vi is invoked with options such as -t (tag search) or -c (commands).
The reason seems to be vim.fn.argc(-1) return 0 for these commands.
vim.api.nvim_create_autocmd("VimEnter", {
callback=function()
-- Only load the session if nvim was started with no argsifvim.fn.argc(-1) ==0then-- Save these to a different directory, so our manual sessions don't get pollutedresession.load(vim.fn.getcwd(), { dir="dirsession", silence_errors=true })
endend,
nested=true,
})
vim.api.nvim_create_autocmd("VimLeavePre", {
callback=function()
resession.save(vim.fn.getcwd(), { dir="dirsession", notify=false })
end,
})
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
Try running search for all files with stevearc and open in vim. vim -c "silent grep -- stevearc" -c "copen"
if you have tags, vi -t <tag>
Expected Behavior
The files picked by grep or tag must be opened.
Directory structure
No response
Repro
-- save as repro.lua-- run with nvim -u repro.lua-- DO NOT change the pathslocalroot=vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .reprofor_, nameinipairs({ "config", "data", "state", "runtime", "cache" }) dovim.env[("XDG_%s_HOME"):format(name:upper())] =root.."/" ..nameend-- bootstrap lazylocallazypath=root.."/plugins/lazy.nvim"ifnotvim.loop.fs_stat(lazypath) thenvim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
endvim.opt.runtimepath:prepend(lazypath)
-- install pluginslocalplugins= {
"folke/tokyonight.nvim",
{
"stevearc/resession.nvim",
config=function()
require("resession").setup({
-- add any needed settings here
})
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root=root.."/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else herevim.api.nvim_create_autocmd("VimEnter", {
callback=function()
-- Only load the session if nvim was started with no argsifvim.fn.argc(-1) ==0then-- Save these to a different directory, so our manual sessions don't get pollutedresession.load(vim.fn.getcwd(), { dir="dirsession", silence_errors=true })
endend,
nested=true,
})
vim.api.nvim_create_autocmd("VimLeavePre", {
callback=function()
resession.save(vim.fn.getcwd(), { dir="dirsession", notify=false })
end,
})
Did you check the bug with a clean config?
I have confirmed that the bug reproduces with nvim -u repro.lua using the repro.lua file above.
The text was updated successfully, but these errors were encountered:
Did you check the docs and existing issues?
Neovim version (nvim -v)
0.9.6
Operating system/version
Redhat 8
Describe the bug
Technically this is not a bug. However it's an annoyance. I'm not sure how to fix this either. Wondering if anyone one else out there knows a better way to do this.
Below snippet provided as solution to auto restore session when no files are passed.
Unfortunately, this overrides any commands provided when vi is invoked with options such as -t (tag search) or -c (commands).
The reason seems to be vim.fn.argc(-1) return 0 for these commands.
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
Try running search for all files with stevearc and open in vim.
vim -c "silent grep -- stevearc" -c "copen"
if you have tags,
vi -t <tag>
Expected Behavior
The files picked by grep or tag must be opened.
Directory structure
No response
Repro
Did you check the bug with a clean config?
nvim -u repro.lua
using the repro.lua file above.The text was updated successfully, but these errors were encountered: