Skip to content

Commit 5bca200

Browse files
authored
Make time between each tree refresh configurable (#599)
1 parent 4cc2abe commit 5bca200

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ let g:nvim_tree_icon_padding = ' ' "one space by default, used for rendering the
5555
let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target.
5656
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.
5757
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.
58+
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.
5859
let g:nvim_tree_window_picker_exclude = {
5960
\ 'filetype': [
6061
\ 'packer',
@@ -161,17 +162,21 @@ highlight NvimTreeFolderIcon guibg=blue
161162
### Setup
162163

163164
You can disable default mappings with
165+
164166
```vim
165167
" let g:nvim_tree_disable_keybindings=1
166168
```
169+
167170
But you won't be able to map any keys from the setup with nvim_tree_bindings. Use with caution.
168171

169172
You can use only your mappings with
173+
170174
```vim
171175
let g:nvim_tree_disable_default_keybindings = 1
172176
```
173177

174178
You can define your own keymaps with this syntax:
179+
175180
```vim
176181
lua <<EOF
177182
vim.g.nvim_tree_bindings = {
@@ -180,7 +185,9 @@ lua <<EOF
180185
}
181186
EOF
182187
```
188+
183189
Notes:
190+
184191
- `key` can be either a string or a table of strings
185192
- `mode` is `n` by default if you don't specify it
186193
- `cb` is the command that will be called when the keymap is triggered
@@ -227,6 +234,7 @@ lua <<EOF
227234
}
228235
EOF
229236
```
237+
230238
You can toggle the help UI by pressing `g?`.
231239

232240
## Note

lua/nvim-tree/lib.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function M.refresh_tree(disable_clock)
200200
end
201201

202202
if not disable_clock then
203-
vim.defer_fn(function() refreshing = false end, 1000)
203+
vim.defer_fn(function() refreshing = false end, vim.g.nvim_tree_refresh_wait or 1000)
204204
end
205205
end
206206

0 commit comments

Comments
 (0)