neo-tree-preview filetype doesn't work #1676
Unanswered
KerryCerqueira
asked this question in
Q&A
Replies: 1 comment
-
When the preview buffer is created it isn't immediately displayed in the preview window, therefore setting a window local option via filetype will basically do a no-op. what you have to actually do is wait until the buffer gets displayed into a window before setting foldmethod: vim.api.nvim_create_autocmd('FileType', {
pattern = 'neo-tree-preview',
callback = function(args)
vim.api.nvim_create_autocmd('BufWinEnter', {
buffer = args.buf,
once = true,
callback = function() vim.wo[0].foldmethod = 'manual' end,
})
end,
}) I'll see if the documentation can be clearer about this. maybe we should just wait until the window opens to set the filetype but i think usually filetypes are set before being displayed in windows. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Somewhere in my config I set vim foldmethods to use treesitter expressions which causes buffers to open with folds closed. This makes neotree floating preview windows pretty useless, but according to the
:h neo-tree-preview-mode
However, this autocommand didn't have the intended effect.
In fact,
set filetype?
reports that the filetype of the preview window is not being set by neotree. So, I'm not sure how to solve my problem, or what the documentation means.Beta Was this translation helpful? Give feedback.
All reactions