Skip to content

Commit 5f40ee6

Browse files
committed
update readme
1 parent 35ac05e commit 5f40ee6

File tree

1 file changed

+47
-13
lines changed

1 file changed

+47
-13
lines changed

README.md

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,75 @@ Install with [packer](https://github.com/wbthomason/packer.nvim):
2121
```lua
2222
use {
2323
'kyazdani42/nvim-tree.lua',
24-
requires = 'kyazdani42/nvim-web-devicons'
24+
requires = 'kyazdani42/nvim-web-devicons',
25+
config = function() require'nvim-tree'.setup {} end
2526
}
2627
```
2728

2829
## Setup
2930

31+
Options are currently being migrating into the setup function, you need to run `require'nvim-tree'.setup()` in your personal configurations.
32+
Setup should be run in a lua file or in a lua heredoc (`:help lua-heredoc`) if using in a vim file.
33+
Note that options under the `g:` command should be set **BEFORE** running the setup function.
34+
35+
```lua
36+
-- following options are the default
37+
require'nvim-tree'.setup {
38+
-- disables netrw completely
39+
disable_netrw = true,
40+
-- hijack netrw window on startup
41+
hijack_netrw = true,
42+
-- open the tree when running this setup function
43+
open_on_setup = false,
44+
-- will not open on setup if the filetype is in this list
45+
ignore_ft_on_setup = {},
46+
-- closes neovim automatically when the tree is the last **WINDOW** in the view
47+
auto_close = false,
48+
-- opens the tree when changing/opening a new tab if the tree wasn't previously opened
49+
tab_open = false,
50+
-- hijack the cursor in the tree to put it at the start of the filename
51+
hijack_cursor = false,
52+
-- updates the root directory of the tree on `DirChanged` (when your run `:cd` usually)
53+
update_cwd = false,
54+
-- update the focused file on `BufEnter`, un-collapses the folders recursively until it finds the file
55+
update_focused_file = {
56+
-- enables the feature
57+
enable = false,
58+
-- update the root directory of the tree to the one of the folder containing the file if the file is not under the current root directory
59+
-- only relevant when `update_focused_file.enable` is true
60+
update_cwd = false,
61+
-- list of buffer names / filetypes that will not update the cwd if the file isn't found under the current root directory
62+
-- only relevant when `update_focused_file.update_cwd` is true and `update_focused_file.enable` is true
63+
ignore_list = {}
64+
},
65+
-- configuration options for the system open command (`s` in the tree by default)
66+
system_open = {
67+
-- the command to run this, leaving nil should work in most cases
68+
cmd = nil,
69+
-- the command arguments as a list
70+
args = {}
71+
},
72+
}
73+
```
74+
3075
```vim
3176
let g:nvim_tree_side = 'right' "left by default
3277
let g:nvim_tree_width = 40 "30 by default, can be width_in_columns or 'width_in_percent%'
3378
let g:nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default
3479
let g:nvim_tree_gitignore = 1 "0 by default
35-
let g:nvim_tree_auto_open = 1 "0 by default, opens the tree when typing `vim $DIR` or `vim`
36-
let g:nvim_tree_auto_close = 1 "0 by default, closes the tree when it's the last window
37-
let g:nvim_tree_auto_ignore_ft = [ 'startify', 'dashboard' ] "empty by default, don't auto open tree on specific filetypes.
3880
let g:nvim_tree_quit_on_open = 1 "0 by default, closes the tree when you open a file
39-
let g:nvim_tree_follow = 1 "0 by default, this option allows the cursor to be updated when entering a buffer
40-
let g:nvim_tree_follow_update_path = 1 "0 by default, will update the path of the current dir if the file is not inside the tree.
41-
Default is 0
4281
let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open
4382
let g:nvim_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.`
4483
let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons).
4584
let g:nvim_tree_highlight_opened_files = 1 "0 by default, will enable folder and file icon highlight for opened files/directories.
4685
let g:nvim_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options
47-
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
4886
let g:nvim_tree_auto_resize = 0 "1 by default, will resize the tree to its saved width when opening a file
49-
let g:nvim_tree_disable_netrw = 0 "1 by default, disables netrw
50-
let g:nvim_tree_hijack_netrw = 0 "1 by default, prevents netrw from automatically opening when opening directories (but lets you keep its other utilities)
5187
let g:nvim_tree_add_trailing = 1 "0 by default, append a trailing slash to folder names
5288
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
5389
let g:nvim_tree_lsp_diagnostics = 1 "0 by default, will show lsp diagnostics in the signcolumn. See :help nvim_tree_lsp_diagnostics
5490
let g:nvim_tree_disable_window_picker = 1 "0 by default, will disable the window picker.
55-
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
5691
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.
5792
let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target.
58-
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.
5993
let g:nvim_tree_respect_buf_cwd = 1 "0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.
6094
let g:nvim_tree_refresh_wait = 500 "1000 by default, control how often the tree can be refreshed, 1000 means the tree can be refresh once per 1000ms.
6195
let g:nvim_tree_window_picker_exclude = {
@@ -148,7 +182,7 @@ highlight NvimTreeFolderIcon guibg=blue
148182
- type `]c` to go to next git item
149183
- type `[c` to go to prev git item
150184
- type `-` to navigate up to the parent directory of the current file/directory
151-
- type `s` to open a file with default system application or a folder with default file manager (if you want to change the command used to do it see `:h g:nvim_tree_system_open_command` and `:h g:nvim_tree_system_open_command_args`)
185+
- type `s` to open a file with default system application or a folder with default file manager (if you want to change the command used to do it see `:h nvim-tree.setup` under `system_open`)
152186
- if the file is a directory, `<CR>` will open the directory otherwise it will open the file in the buffer near the tree
153187
- if the file is a symlink, `<CR>` will follow the symlink (if the target is a file)
154188
- `<C-v>` will open the file in a vertical split

0 commit comments

Comments
 (0)