You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore: refacto setup part 1
refacto setup for code entrypoint
following options switched boolean values as options to the setup function:
- `nvim_tree_disable_netrw` -> `disable_netrw`
- `nvim_tree_hijack_netrw` -> `hijack_netrw`
- `nvim_tree_auto_open` -> `open_on_setup`
- `nvim_tree_auto_close` -> `auto_close`
- `nvim_tree_tab_open` -> `tab_open`
- `nvim-tree-update-cwd` -> `update_cwd`
- `nvim_tree_hijack_cursor` -> `hijack_cursor`
- `nvim_tree_system_open_command` -> `system_open.cmd`
- `nvim_tree_system_open_command_args` -> `system_open.args`
- `nvim_tree_follow` -> `update_focused_file.enable`
- `nvim_tree_follow_update_path` -> `update_focused_file.update_cwd`
Also added new option `update_focused_file.ignore_list` which will
ignore filepath or filetypes that matches one entry of the list when
updating the path if update_cwd is true.
* add deprecation warning
* update readme
* schedule on enter to avoid running before vim first buffer has loaded
* update docs
* correct typo
* rename tab open -> open on tab
Copy file name to clipboardExpand all lines: README.md
+47-12Lines changed: 47 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -21,40 +21,75 @@ Install with [packer](https://github.com/wbthomason/packer.nvim):
21
21
```lua
22
22
use {
23
23
'kyazdani42/nvim-tree.lua',
24
-
requires='kyazdani42/nvim-web-devicons'
24
+
requires='kyazdani42/nvim-web-devicons',
25
+
config=function() require'nvim-tree'.setup {} end
25
26
}
26
27
```
27
28
28
29
## Setup
29
30
31
+
Options are currently being migrated 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
+
open_on_tab=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
+
30
75
```vim
31
76
let g:nvim_tree_side = 'right' "left by default
32
77
let g:nvim_tree_width = 40 "30 by default, can be width_in_columns or 'width_in_percent%'
33
78
let g:nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default
34
79
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.
38
80
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
81
let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open
42
82
let g:nvim_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.`
43
83
let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons).
44
84
let g:nvim_tree_highlight_opened_files = 1 "0 by default, will enable folder and file icon highlight for opened files/directories.
45
85
let g:nvim_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options
46
-
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
47
86
let g:nvim_tree_auto_resize = 0 "1 by default, will resize the tree to its saved width when opening a file
48
-
let g:nvim_tree_disable_netrw = 0 "1 by default, disables netrw
49
-
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)
50
87
let g:nvim_tree_add_trailing = 1 "0 by default, append a trailing slash to folder names
51
88
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
52
89
let g:nvim_tree_lsp_diagnostics = 1 "0 by default, will show lsp diagnostics in the signcolumn. See :help nvim_tree_lsp_diagnostics
53
90
let g:nvim_tree_disable_window_picker = 1 "0 by default, will disable the window picker.
54
-
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
55
91
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.
56
92
let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target.
57
-
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.
58
93
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.
59
94
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.
- 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`)
186
+
- 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`)
152
187
- if the file is a directory, `<CR>` will open the directory otherwise it will open the file in the buffer near the tree
153
188
- if the file is a symlink, `<CR>` will follow the symlink (if the target is a file)
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.
@@ -338,12 +369,6 @@ One space by default, used for rendering the space between the icon and the file
338
369
339
370
Defaults to ' ➛ '. Used as a separator between symlinks' source and target.
340
371
341
-
|g:nvim_tree_update_cwd|
342
-
343
-
Can be 0 or 1. 0 by default.
344
-
Will update the tree cwd when changing nvim's directory (DirChanged event).
0 commit comments