Make time between each tree refresh configurable (#599)

This commit is contained in:
Uy Ha 2021-08-30 18:53:14 +02:00 committed by GitHub
parent 4cc2abe3e2
commit 5bca2006cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -55,6 +55,7 @@ let g:nvim_tree_icon_padding = ' ' "one space by default, used for rendering the
let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target.
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_respect_buf_cwd = 1 "0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.
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.
let g:nvim_tree_window_picker_exclude = {
\ 'filetype': [
\ 'packer',
@ -161,17 +162,21 @@ highlight NvimTreeFolderIcon guibg=blue
### Setup
You can disable default mappings with
```vim
" let g:nvim_tree_disable_keybindings=1
```
But you won't be able to map any keys from the setup with nvim_tree_bindings. Use with caution.
You can use only your mappings with
```vim
let g:nvim_tree_disable_default_keybindings = 1
```
You can define your own keymaps with this syntax:
```vim
lua <<EOF
vim.g.nvim_tree_bindings = {
@ -180,7 +185,9 @@ lua <<EOF
}
EOF
```
Notes:
- `key` can be either a string or a table of strings
- `mode` is `n` by default if you don't specify it
- `cb` is the command that will be called when the keymap is triggered
@ -227,6 +234,7 @@ lua <<EOF
}
EOF
```
You can toggle the help UI by pressing `g?`.
## Note

View File

@ -200,7 +200,7 @@ function M.refresh_tree(disable_clock)
end
if not disable_clock then
vim.defer_fn(function() refreshing = false end, 1000)
vim.defer_fn(function() refreshing = false end, vim.g.nvim_tree_refresh_wait or 1000)
end
end