home ~ socials ~ other projects

Use a Keymapping to Toggle nvim-tree's File Explorer Open and Closed

I have this in my Neovim config setup:

vim.keymap.set('n', '<leader>t', ":NvimTreeToggle<cr>", { desc = 'Toggle nvim-tree file explorer open and closed' })

It lets me hit the "leader" key followed by "t" to toggle the file editor open and closed.

Super handy.

Notes

  • You can put the line anywhere in the config strcuture that it works. In my case, it's in the file:

    ~/.config/nvim/after/plugin/nvim-tree-config.lua
-- end of line --

References

The file explorer I use for Neovim.

Something to look at for more ideas of stuff to tweak.