nvim-tree variable width

In order for nvim-tree to adapt its width to its content, create a file named ~/.config/nvim/lua/plugins/nvim-tree.lua. Put the following content into it.
return {
"nvim-tree/nvim-tree.lua",
opts = {
view = { adaptive_size = true }
}
}