add better doc and add user ignore list
This commit is contained in:
parent
3527a67a9e
commit
f28dbfa998
@ -15,8 +15,9 @@ Plug 'kyazdani42/nvim-tree.lua'
|
|||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
let g:lua_tree_side = 'right' | 'left' "left by default
|
let g:lua_tree_side = 'right' | 'left' "left by default
|
||||||
let g:lua_tree_size = 40 "30 by default
|
let g:lua_tree_size = 40 "30 by default
|
||||||
|
let g:lua_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default
|
||||||
|
|
||||||
nnoremap <C-n> :LuaTreeToggle<CR>
|
nnoremap <C-n> :LuaTreeToggle<CR>
|
||||||
nnoremap <leader>n :LuaTreeRefresh<CR>
|
nnoremap <leader>n :LuaTreeRefresh<CR>
|
||||||
@ -53,8 +54,8 @@ nnoremap <leader>n :LuaTreeRefresh<CR>
|
|||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
- use libuv functions instead of `touch` and `mkdir` in `create_file()` and allow file creation with path like `foo/bar/baz`
|
- use libuv functions instead of `touch` and `mkdir` in `create_file()` and allow file creation with path like `foo/bar/baz`
|
||||||
- better vim help docs
|
|
||||||
- cd command to move faster accross the fs if needed
|
- cd command to move faster accross the fs if needed
|
||||||
- quickly find file in the directory structure
|
- quickly find file in the directory structure
|
||||||
- tree should always stay on the side no matter what
|
- tree should always stay on the side no matter what
|
||||||
- add global ignore parameter
|
- add global ignore parameter
|
||||||
|
- html docs ?
|
||||||
|
|||||||
@ -5,10 +5,10 @@ Minimum version of neovim: 0.4.0
|
|||||||
Author: Yazdani Kiyan <yazdani.kiyan@protonmail.com>
|
Author: Yazdani Kiyan <yazdani.kiyan@protonmail.com>
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
INTRODUCTION *nvim-tree-lua-introduction*
|
INTRODUCTION *nvim-tree-introduction*
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
QUICK START *nvim-tree-lua-quickstart*
|
QUICK START *nvim-tree-quickstart*
|
||||||
|
|
||||||
open the tree with :LuaTreeToggle
|
open the tree with :LuaTreeToggle
|
||||||
>
|
>
|
||||||
@ -17,7 +17,7 @@ open the tree with :LuaTreeToggle
|
|||||||
<
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
COMMANDS *nvim-tree-lua-commands*
|
COMMANDS *nvim-tree-commands*
|
||||||
|
|
||||||
|:LuaTreeToggle| *:LuaTreeToggle*
|
|:LuaTreeToggle| *:LuaTreeToggle*
|
||||||
|
|
||||||
@ -26,6 +26,68 @@ open or close the tree
|
|||||||
|:LuaTreeRefresh| *:LuaTreeRefresh*
|
|:LuaTreeRefresh| *:LuaTreeRefresh*
|
||||||
|
|
||||||
refresh the tree
|
refresh the tree
|
||||||
|
==============================================================================
|
||||||
|
OPTIONS *nvim-tree-options*
|
||||||
|
|
||||||
|
|g:lua_tree_size| *g:lua_tree_size*
|
||||||
|
|
||||||
|
width of the window (default to 30)
|
||||||
|
|
||||||
|
|g:lua_tree_side| *g:lua_tree_side*
|
||||||
|
|
||||||
|
where the window will open (default to 'left')
|
||||||
|
- 'left' or 'right'
|
||||||
|
|
||||||
|
|g:lua_tree_ignore| *g:lua_tree_ignore*
|
||||||
|
|
||||||
|
An array of strings that the tree won't display.
|
||||||
|
Each pattern is passed into the 'ls' function as `--ignore=PATTERN`
|
||||||
|
>
|
||||||
|
example: let g:lua_tree_ignore = [ '.git', 'node_modules' ]
|
||||||
|
<
|
||||||
|
==============================================================================
|
||||||
|
INFORMATIONS *nvim-tree-info*
|
||||||
|
|
||||||
|
|KeyBindings| *nvim-tree-keybindings*
|
||||||
|
|
||||||
|
- move around like in any vim buffer
|
||||||
|
- '<CR>' on '..' will cd in the above directory
|
||||||
|
- '<C-[>' will cd in the directory under the cursor
|
||||||
|
|
||||||
|
- type 'a' to add a file
|
||||||
|
- type 'r' to rename a file
|
||||||
|
- type 'd' to delete a file (will prompt for confirmation)
|
||||||
|
|
||||||
|
- if the file is a directory, '<CR>' will open the directory
|
||||||
|
- otherwise it will open the file in the buffer near the tree
|
||||||
|
- if the file is a symlink, '<CR>' will follow the symlink
|
||||||
|
- type '<C-v>' will open the file in a vertical split
|
||||||
|
- type '<C-x>' will open the file in a horizontal split
|
||||||
|
|
||||||
|
- Double left click acts like '<CR>'
|
||||||
|
- Double right click acts like '<C-[>'
|
||||||
|
|
||||||
|
|Features| *nvim-tree-features*
|
||||||
|
|
||||||
|
File icons with vim-devicons.
|
||||||
|
|
||||||
|
Uses other type of icons so a good font support is recommended.
|
||||||
|
If the tree renders weird glyphs, install correct fonts or try to change
|
||||||
|
your terminal.
|
||||||
|
|
||||||
|
Syntax highlighting uses g:terminal_color_ from colorschemes, fallbacks to
|
||||||
|
ugly colors otherwise.
|
||||||
|
|
||||||
|
Git integration tells when a file is:
|
||||||
|
- ✗ unstaged or folder is dirty
|
||||||
|
- ✓ staged
|
||||||
|
- ★ new file
|
||||||
|
- ✓✗ partially staged
|
||||||
|
- ✓★ new file staged
|
||||||
|
- ═ merging
|
||||||
|
- ➜ renamed
|
||||||
|
|
||||||
|
Mouse support defined in |KeyBindings|
|
||||||
|
|
||||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||||
|
|
||||||
|
|||||||
13
doc/tags
13
doc/tags
@ -1,6 +1,13 @@
|
|||||||
:LuaTreeRefresh nvim-tree-lua.txt /*:LuaTreeRefresh*
|
:LuaTreeRefresh nvim-tree-lua.txt /*:LuaTreeRefresh*
|
||||||
:LuaTreeToggle nvim-tree-lua.txt /*:LuaTreeToggle*
|
:LuaTreeToggle nvim-tree-lua.txt /*:LuaTreeToggle*
|
||||||
nvim-tree-lua-commands nvim-tree-lua.txt /*nvim-tree-lua-commands*
|
g:lua_tree_ignore nvim-tree-lua.txt /*g:lua_tree_ignore*
|
||||||
nvim-tree-lua-introduction nvim-tree-lua.txt /*nvim-tree-lua-introduction*
|
g:lua_tree_side nvim-tree-lua.txt /*g:lua_tree_side*
|
||||||
nvim-tree-lua-quickstart nvim-tree-lua.txt /*nvim-tree-lua-quickstart*
|
g:lua_tree_size nvim-tree-lua.txt /*g:lua_tree_size*
|
||||||
|
nvim-tree-commands nvim-tree-lua.txt /*nvim-tree-commands*
|
||||||
|
nvim-tree-features nvim-tree-lua.txt /*nvim-tree-features*
|
||||||
|
nvim-tree-info nvim-tree-lua.txt /*nvim-tree-info*
|
||||||
|
nvim-tree-introduction nvim-tree-lua.txt /*nvim-tree-introduction*
|
||||||
|
nvim-tree-keybindings nvim-tree-lua.txt /*nvim-tree-keybindings*
|
||||||
|
nvim-tree-options nvim-tree-lua.txt /*nvim-tree-options*
|
||||||
|
nvim-tree-quickstart nvim-tree-lua.txt /*nvim-tree-quickstart*
|
||||||
nvim-tree.lua nvim-tree-lua.txt /*nvim-tree.lua*
|
nvim-tree.lua nvim-tree-lua.txt /*nvim-tree.lua*
|
||||||
|
|||||||
@ -17,8 +17,19 @@ end
|
|||||||
|
|
||||||
local Tree = {}
|
local Tree = {}
|
||||||
|
|
||||||
|
local IGNORE_LIST = ""
|
||||||
|
|
||||||
|
if api.nvim_call_function('exists', { 'g:lua_tree_ignore' }) == 1 then
|
||||||
|
local ignore_patterns = api.nvim_get_var('lua_tree_ignore')
|
||||||
|
if type(ignore_patterns) == 'table' then
|
||||||
|
for _, pattern in pairs(ignore_patterns) do
|
||||||
|
IGNORE_LIST = IGNORE_LIST .. '--ignore='..pattern..' '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function list_dirs(path)
|
local function list_dirs(path)
|
||||||
local ls_cmd = 'ls -A --ignore=.git ' ..path
|
local ls_cmd = 'ls -A '..IGNORE_LIST..path
|
||||||
return syslist(ls_cmd)
|
return syslist(ls_cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user