Skip to content

Commit 8d50548

Browse files
committed
update docs
1 parent 55f6342 commit 8d50548

File tree

2 files changed

+102
-77
lines changed

2 files changed

+102
-77
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use {
2828

2929
## Setup
3030

31-
Options are currently being migrating into the setup function, you need to run `require'nvim-tree'.setup()` in your personal configurations.
31+
Options are currently being migrated into the setup function, you need to run `require'nvim-tree'.setup()` in your personal configurations.
3232
Setup should be run in a lua file or in a lua heredoc (`:help lua-heredoc`) if using in a vim file.
3333
Note that options under the `g:` command should be set **BEFORE** running the setup function.
3434

doc/nvim-tree-lua.txt

Lines changed: 101 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,107 @@ Print clipboard content for both cut and copy
5858
Resize the NvimTree window to the given size. Example: `:NvimTreeresize 50`
5959
resizes the window to the width of 50.
6060

61+
==============================================================================
62+
SETUP *nvim-tree-setup*
63+
64+
To configure the tree (and make it runnable), you should call the setup
65+
function.
66+
67+
>
68+
require'nvim-tree'.setup {
69+
disable_netrw = true,
70+
hijack_netrw = true,
71+
open_on_setup = false,
72+
ignore_ft_on_setup = {},
73+
auto_close = false,
74+
tab_open = false,
75+
hijack_cursor = false,
76+
update_cwd = false,
77+
update_focused_file = {
78+
enable = false,
79+
update_cwd = false,
80+
ignore_list = {}
81+
},
82+
system_open = {
83+
cmd = nil,
84+
args = {}
85+
},
86+
}
87+
<
88+
89+
As options are currently being migrated, configuration of global options in
90+
*nvim-tree-options* should be done BEFORE the setup call.
91+
92+
Here is a list of the options available in the setup call:
93+
- |disable_netrw|: completely disable netrw
94+
type: `boolean`
95+
default: `true`
96+
97+
- |hijack_netrw|: hijack netrw windows (overriden if |disable_netrw| is `true`)
98+
type: `boolean`
99+
default: `true`
100+
101+
- |open_on_setup|: will automatically the tree when running setup if current
102+
buffer is a directory, is empty or is unnamed.
103+
type: `boolean`
104+
default: `false`
105+
106+
- |ignore_ft_on_setup|: list of filetypes that will make |open_on_setup| not
107+
open. You can use this option if you don't want the tree to open in some
108+
scenarios (eg using vim startify).
109+
type: `{string}`
110+
default: `{}`
111+
112+
- |auto_close|: force closing neovim when the tree is the last window in the view.
113+
type: `boolean`
114+
default: `false`
115+
116+
- |tab_open|: opens the tree automatically when switching tabpage or opening a new
117+
tabpage if the tree was previously open.
118+
type: `boolean`
119+
default: `false`
120+
121+
- |hijack_cursor|: keeps the cursor on the first letter of the filename when
122+
moving in the tree.
123+
type: `boolean`
124+
default: `false`
125+
126+
- |update_cwd|: changes the tree root directory on `DirChanged` and refreshes
127+
the tree.
128+
type: `boolean`
129+
default: `false`
130+
131+
- |update_focused_file|: update the focused file on `BufEnter`, un-collapses
132+
the folders recursively until it finds the file
133+
134+
- |update_focused_file.enable|: enable this feature.
135+
type: `boolean`
136+
default: `false`
137+
138+
- |update_focused_file.update_cwd|: update the root directory of the tree to the one
139+
of the folder containing the file if the file is not under the current root
140+
directory. Only relevant when |update_focused_file.enable| is `true`
141+
type: `boolean`
142+
default: `false`
143+
144+
- |update_focused_file.ignore_list|: list of buffer names and filetypes that will not
145+
update the root dir of the tree if the file isn't found under the current root
146+
directory. Only relevant when |update_focused_file.update_cwd| is `true` and
147+
|update_focused_file.enable| is `true`.
148+
type: `{string}`
149+
default: `{}`
150+
151+
- |system_open|: configuration options for the system open command
152+
153+
- |system_open.cmd|: the command to run, leaving nil should work but
154+
useful if you want to override the default command with another one.
155+
type: `string`
156+
default: `nil`
157+
158+
- |system_open.args|: the command arguments as a list
159+
type: `{string}`
160+
default: `{}`
161+
61162
==============================================================================
62163
OPTIONS *nvim-tree-options*
63164

@@ -166,58 +267,12 @@ You can enable file highlight for git attributes by setting this property.
166267
This can be used with or without the icons.
167268

168269

169-
|g:nvim_tree_follow| *g:nvim_tree_follow*
170-
171-
Can be `0` or `1`. When `1`, will update the cursor to update to the correct
172-
location in the tree on |BufEnter|.
173-
Default is 0
174-
175-
|g:nvim_tree_follow_update_path| *g:nvim_tree_follow_update_path*
176-
177-
Can be `0` or `1`. When `1`, will update the path of the current dir if the
178-
file is not inside the tree. Works only with |g:nvim_tree_follow| = 1.
179-
Default is 0
180-
181-
|g:nvim_tree_auto_open| *g:nvim_tree_auto_open*
182-
183-
Can be `0` or `1`. When `1`, will open the tree when the package is loaded.
184-
It's not relying on VimEnter anymore.
185-
Default is 0
186-
187-
|g:nvim_tree_auto_close| *g:nvim_tree_auto_close*
188-
189-
Can be `0` or `1`. When `1`, will bind |BufEnter| to automatically
190-
close the tree if it's the last window.
191-
Default is 0
192-
193-
|g:nvim_tree_auto_ignore_ft| *g:nvim_tree_auto_ignore_ft*
194-
195-
Don't auto open the tree on specific filetypes.
196-
Useful when you don't want to open tree on plugins like 'Startify'
197-
Default is {}
198-
>
199-
example: let g.nvim_tree_auto_ignore_ft = {'startify', 'dashboard'}
200-
201270
|g:nvim_tree_quit_on_open| *g:nvim_tree_quit_on_open*
202271

203272
Can be `0` or `1`. When `1`, will close the tree when a file is opened.
204273
Applies to: `edit`, `vsplit`, `split`, `tabnew`.
205274
Default is 0
206275

207-
|g:nvim_tree_system_open_command| *g:nvim_tree_system_open_command*
208-
209-
A string containing the command used to open a file/folder with default system
210-
application. If left unset it will be automatically filled with the right
211-
command, depending on the operating system. If your operating system isn't
212-
recognized or if you want to use another command you can edit it.
213-
Default: depends on the operating system
214-
215-
|g:nvim_tree_system_open_command_args| *g:nvim_tree_system_open_command_args*
216-
217-
An array of strings containing the arguments to be passed to the command
218-
specified in |g:nvim_tree_system_open_command|.
219-
Default: unset if not using Windows
220-
221276
|g:nvim_tree_disable_keybindings| *g:nvim_tree_disable_keybindings*
222277

223278
Can be `0` or `1`. When `1`, will disable all keybindings by the plugin.
@@ -246,30 +301,12 @@ In what format to show root folder. See `:help filename-modifiers` for
246301
available options.
247302
Default is `:~`
248303

249-
|g:nvim_tree_tab_open| *g:nvim_tree_tab_open*
250-
251-
Can be 0 or 1. When 1, will open the tree when entering a new tab if the
252-
tree was previously open.
253-
Default is 0
254-
255304
|g:nvim_tree_auto_resize| *g:nvim_tree_auto_resize*
256305

257306
Can be 0 or 1. When 1, it will resize the tree to it's saved width
258307
when opening a new file.
259308
Default is 1
260309

261-
|g:nvim_tree_hijack_netrw| *g:nvim_tree_hijack_netrw*
262-
263-
Can be 0 or 1. When 1, disable netrw buffers when nvim-tree start but keeps
264-
existing netrw functionnalities accross buffers (like `gx`).
265-
1 by default.
266-
267-
|g:nvim_tree_disable_netrw| *g:nvim_tree_disable_netrw*
268-
269-
Can be 0 or 1. When 1, completely disable netrw and all related
270-
functionnalities.
271-
1 by default.
272-
273310
|g:nvim_tree_add_trailing| *g:nvim_tree_add_trailing*
274311

275312
Can be 0 or 1. When 1, appends a trailing slash to folder names.
@@ -324,12 +361,6 @@ selectable. The default table is
324361
}
325362
<
326363

327-
|g:nvim_tree_hijack_cursor| *g:nvim_tree_hijack_cursor*
328-
329-
Can be 0 or 1. 1 by default.
330-
When 1, moving cursor in the tree will position the cursor at the start
331-
of the file on the current line.
332-
333364
|g:nvim_tree_icon_padding| *g:nvim_tree_icon_padding*
334365

335366
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
338369

339370
Defaults to ' ➛ '. Used as a separator between symlinks' source and target.
340371

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).
345-
WARNING: Behaves strangely with autochdir set.
346-
347372
|g:nvim_tree_respect_buf_cwd| *g:nvim_tree_respect_buf_cwd*
348373

349374
Can be 0 or 1. 0 by default.

0 commit comments

Comments
 (0)