I' m not sure if this is a issue or the behaviour of the file explorer is changed, but g:nvim_tree_bindings does not accept lists anymore.
I had a list in edit and close_node but now i complain about error in lib.lua (line 273).
Since i'm already writing, i would like to ask why the configuration is done with global vim variable and not in a lua fashion with something like setup()?
i changed the table order, you know need to define a binding to a function (that makes more sense).
The setup lua fashion is not done because when i started writing this plugin, there was not much lua plugins around and i was learning lua at the same time ^^
i will refactor the plugin initialization at some point :)
Thanks for the fast response and thanks for the plugin :+1:
I don' t agree with the practicality of the function bindings, since is very unlikely to have more than three mappings to an action, which will fit very easily into a list.
Anyway this is great and i keep using it.
the function bindings is still a list (:help nvim_tree_bindings), but the key mapping has been reversed to give the ability to map custom user functions easily without going through the au FileType NvimTree autocmd :)
@kyazdani42 is there a documentaion that list the default keymapping functions? As a user, I _just_ want to remap existing actions to different keys. I know more advanced users might leverage of the new approach and create new functions, but IMHO would be nice to have aliases for the default functions or the list of the default functions documented.
By aliases I mean:
vim.g.nvim_tree_bindings = {
["<CR>"] = "open_vertical_split",
["u"] = "open_current_window",
}
By documented default functions I mean:
The default actions are:
- `require('nvim_tree/actions').open()` to open in the current buffer
- `require('nvim_tree/actions').open('vertical')` to open in a vertical split
- `require('nvim_tree/actions').open('horizontal')` to open in a horizontal split
# ...
Maybe we already have that and I missing something. Sorry if that's the case.
yeah i was lazy so i just added a note to check the definition table in the help file (and readme). I might add complete documentation when i can.
I was mistaken, now i've understood.
But there is another "problem", when using dir_up NeoVim sometimes complains:
Error executing lua .../nvim-tree/lua/nvim-tree/lib.lua:158: attempt to index upvalue 'fname' (a nil value)
Anyway the action is performed correctly.
For @kassio, the bindings are not documented by their are very clearly organized in the source code.
closing this since it has been documented. @CantoroMC if you see the dir_up error coming up again, could you open another issue please ? thanks :)
Most helpful comment
I was mistaken, now i've understood.
But there is another "problem", when using dir_up NeoVim sometimes complains:
Error executing lua .../nvim-tree/lua/nvim-tree/lib.lua:158: attempt to index upvalue 'fname' (a nil value)
Anyway the action is performed correctly.
For @kassio, the bindings are not documented by their are very clearly organized in the source code.