neo-tree.nvim
neo-tree.nvim copied to clipboard
window scrolls when navigating from document_symbols
Did you check docs and existing issues?
- [X] I have read all the docs.
- [X] I have searched the existing issues.
- [X] I have searched the existing discussions.
Neovim Version (nvim -v)
0.9.1
Operating System / Version
MacOS 14.0
Describe the Bug
Switching windows from the document_symbols view causes jumps in the source file.
Screenshots, Traceback
https://github.com/nvim-neo-tree/neo-tree.nvim/assets/1538657/c5be4972-9dee-4763-bf12-57611434402b
Steps to Reproduce
nvim -u repro.lua styles.css- wait for cssls to install
:Neotree source=document_symbols reveal=true position=right toggle=true- move into various CSS boxes, and switch between the neo-tree window and the CSS window with
<C-W>{L,H}
Expected Behavior
The source file shouldn't jump around.
Your Configuration
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.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", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
'neovim/nvim-lspconfig',
dependencies = {
{ 'williamboman/mason.nvim', config = true },
{ 'williamboman/mason-lspconfig.nvim' },
},
config = function()
local servers = {
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
cssls = {},
}
local capabilities = vim.lsp.protocol.make_client_capabilities()
-- Ensure the servers above are installed
local mason_lspconfig = require('mason-lspconfig')
mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers),
})
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
}
end
}
end,
},
}
local neotree_config = {
"nvim-neo-tree/neo-tree.nvim",
dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
cmd = { "Neotree" },
opts = {
sources = { "filesystem", "document_symbols" },
},
}
table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- vim: ts=2 sts=2 sw=2 et
Similar error occurs when I moving cursor from document_symbols to golang file. My neotree config:
require("neo-tree").setup({
sources = {
'filesystem',
'document_symbols',
},
source_selector = {
winbar = true,
sources = {
{ source = "filesystem" },
{ source = "document_symbols" },
},
},
auto_clean_after_session_restore = true,
close_if_last_window = true,
default_component_configs = {
indent = {
padding = 0,
},
file_size = {
enabled = false,
},
type = {
enabled = false,
},
last_modified = {
enabled = false,
},
},
window = {
width = 25,
auto_expand_width = false,
mappings = {
["<bs>"] = "next_source",
["<esc>"] = "cancel",
["r"] = "rename",
["q"] = "close_window",
}
},
filesystem = {
follow_current_file = {
enabled = true,
leave_dirs_open = false,
},
hijack_netrw_behavior = "open_default",
window = {
mappings = {
["<2-LeftMouse>"] = "open_with_window_picker",
["<cr>"] = "open_with_window_picker",
["a"] = "add",
["y"] = "copy_to_clipboard",
["s"] = "split_with_window_picker",
["v"] = "vsplit_with_window_picker",
["."] = "set_root",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
["d"] = "delete",
},
},
},
document_symbols = {
follow_cursor = true,
renderers = {
root = {
{ "icon", default = "C" },
{ "name", zindex = 10 },
},
symbol = {
{ "indent", with_expanders = true },
{ "kind_icon", default = "?" },
{
"container",
content = {
{ "name", zindex = 10 },
}
}
},
},
window = {
mappings = {
["<cr>"] = "jump_to_symbol",
["<2-LeftMouse>"] = "jump_to_symbol",
}
}
}
})
Neovim version: v0.9.4 Build type: Release Neotree commit: 0b9a83e