-
Notifications
You must be signed in to change notification settings - Fork 257
Visual Customizations
smhc edited this page Mar 27, 2022
·
3 revisions
This page is for changes to the look and feel of the plugin. Things like colors, dynamic sizing or positioning, etc.
This is a nice look where the sidebar will float to the right, positioned like a right hand sidebar but floating. One side effect of this layout is that it will automatically close the tree after you open a file.
require("neo-tree").setup({
filesystem = {
window = {
popup = {
position = { col = "100%", row = "2" },
size = function(state)
local root_name = vim.fn.fnamemodify(state.path, ":~")
local root_len = string.len(root_name) + 4
return {
width = math.max(root_len, 50),
height = vim.o.lines - 6
}
end
},
}
}
})
The above configuration uses a function to return the size so the height can be adjusted. It will also dynamically change the width to show the entire root path if it is long.
If a colour scheme supports nvim-tree but not neo-tree (e.g gruvbox-material) some of the highlights can be linked with the following:
vim.cmd([[
highlight! link NeoTreeDirectoryIcon NvimTreeFolderIcon
highlight! link NeoTreeDirectoryName NvimTreeFolderName
highlight! link NeoTreeSymbolicLinkTarget NvimTreeSymlink
highlight! link NeoTreeRootName NvimTreeRootFolder
highlight! link NeoTreeDirectoryName NvimTreeOpenedFolderName
highlight! link NeoTreeFileNameOpened NvimTreeOpenedFile
]])