Skip to content

Commit

Permalink
feat: upgraded nvim tree
Browse files Browse the repository at this point in the history
They changed the interface to be more lua based.
nvim-tree/nvim-tree.lua#674
  • Loading branch information
kiran94 committed Oct 3, 2021
1 parent fa6913a commit 4d60786
Showing 1 changed file with 51 additions and 13 deletions.
64 changes: 51 additions & 13 deletions nvim/plugins/nvim-tree.vim
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
let g:nvim_tree_side = 'right' " left by default
let g:nvim_tree_width = 40 " 30 by default, can be width_in_columns or 'width_in_percent%'
let g:nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] " empty by default
let g:nvim_tree_gitignore = 1 " 0 by default
let g:nvim_tree_auto_open = 0 " 0 by default, opens the tree when typing `vim $DIR` or `vim`
let g:nvim_tree_auto_close = 1 " 0 by default, closes the tree when it's the last window
let g:nvim_tree_quit_on_open = 1 " 0 by default, closes the tree when you open a file
let g:nvim_tree_follow = 1 " 0 by default, this option allows the cursor to be updated when entering a buffer
let g:nvim_tree_indent_markers = 1 " 0 by default, this option shows indent markers when folders are open
let g:nvim_tree_hide_dotfiles = 0 " 0 by default, this option hides files and folders starting with a dot `.`
let g:nvim_tree_git_hl = 1 " 0 by default, will enable file highlight for git attributes (can be used without the icons).
let g:nvim_tree_highlight_opened_files = 1 " 0 by default, will enable folder and file icon highlight for opened files/directories.
let g:nvim_tree_root_folder_modifier = ':~' " This is the default. See :help filename-modifiers for more options
let g:nvim_tree_tab_open = 1 " 0 by default, will open the tree when entering a new tab and the tree was previously open
let g:nvim_tree_auto_resize = 0 " 1 by default, will resize the tree to its saved width when opening a file
let g:nvim_tree_disable_netrw = 1 " 1 by default, disables netrw
let g:nvim_tree_hijack_netrw = 1 " 1 by default, prevents netrw from automatically opening when opening directories (but lets you keep its other utilities)
let g:nvim_tree_add_trailing = 1 " 0 by default, append a trailing slash to folder names
let g:nvim_tree_group_empty = 1 " 0 by default, compact folders that only contain a single folder into one node in the file tree
let g:nvim_tree_lsp_diagnostics = 1 " 0 by default, will show lsp diagnostics in the signcolumn. See :help nvim_tree_lsp_diagnostics
let g:nvim_tree_disable_window_picker = 1 " 0 by default, will disable the window picker.
let g:nvim_tree_hijack_cursor = 0 " 1 by default, when moving cursor in the tree, will position the cursor at the start of the file on the current line
let g:nvim_tree_icon_padding = ' ' " one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font.
" let g:nvim_tree_update_cwd = 1 " 0 by default, will update the tree cwd when changing nvim's directory (DirChanged event). Behaves strangely with autochdir set.
let g:nvim_tree_show_icons = {
\ 'git': 1,
\ 'folders': 1,
\ 'files': 1,
\ 'folder_arrows': 1,
\ }

"If 0, do not show the icons for one of 'git' 'folder' and 'files'
"1 by default, notice that if 'files' is 1, it will only display
"if nvim-web-devicons is installed and on your runtimepath.
Expand Down Expand Up @@ -74,3 +62,53 @@ let g:nvim_tree_icons = {

" a list of groups can be found at `:help nvim_tree_highlight`
highlight NvimTreeFolderIcon guibg=blue


lua << EOF
require'nvim-tree'.setup {
disable_netrw = true, -- disables netrw completely
hijack_netrw = true, -- hijack netrw window on startup
open_on_setup = false, -- open the tree when running this setup function
ignore_ft_on_setup = {}, -- will not open on setup if the filetype is in this list
auto_close = true, -- closes neovim automatically when the tree is the last **WINDOW** in the view
open_on_tab = true, -- opens the tree when changing/opening a new tab if the tree wasn't previously opened

-- hijacks new directory buffers when they are opened.
update_to_buf_dir = {
enable = true, -- enable the feature
auto_open = false, -- allow to open the tree if it was previously closed
},

hijack_cursor = true, -- hijack the cursor in the tree to put it at the start of the filename
update_cwd = true, -- updates the root directory of the tree on `DirChanged` (when your run `:cd` usually)
lsp_diagnostics = true, -- show lsp diagnostics in the signcolumn

-- update the focused file on `BufEnter`, un-collapses the folders recursively until it finds the file
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = { '.git', 'node_modules', 'cache', '.mypy_cache' }
},

-- configuration options for the system open command (`s` in the tree by default)
system_open = {
cmd = nil, -- the command to run this, leaving nil should work in most cases
args = {} -- the command arguments as a list
},

view = {
width = 40, -- width of the window, can be either a number (columns) or a string in `%`, for left or right side placement
-- height = 30, -- height of the window, can be either a number (columns) or a string in `%`, for top or bottom side placement
side = 'right', -- side of the tree, can be one of 'left' | 'right' | 'top' | 'bottom'
auto_resize = false, -- if true the tree will resize itself after opening a file
mappings = {
-- custom only false will merge the list with the default mappings
-- if true, it will only use your list to set the mappings
custom_only = false,
-- list of mappings to set on the tree manually
list = {}
}
}
}
EOF

0 comments on commit 4d60786

Please sign in to comment.