Closed
Description
That is, I want to enable the preview mode by default. The following way caused an error saying that the buffer is not modifiable. But if I call vim.cmd('normal! P')
directly from command mode :lua ...
when my cursor is at neo-tree buffer, it does work. So I think either I should use the require('neo-tree.sources.common.preview')
way to call the preview()
(but this way the state
is missing) or the detection of event like "neo-tree buffer did get loaded" is needed?
And is it possible to return a string to my custom command defined under commands
, so I can just use handler = 'my_command'
?
event_handlers = {
{
event = 'neo_tree_buffer_enter',
handler = function ()
if not require('neo-tree.sources.common.preview').is_active() then
vim.cmd('normal! P')
end
end
},
},