nvim-tree.lua/doc/nvim-tree-lua.txt
2020-07-17 10:25:57 +02:00

251 lines
6.9 KiB
Plaintext

*nvim-tree.lua* A file explorer written in lua
Minimum version of neovim: 0.4.0
Author: Yazdani Kiyan <yazdani.kiyan@protonmail.com>
==============================================================================
INTRODUCTION *nvim-tree-introduction*
This file explorer doesn't work on windows and requires neovim `nightly`
==============================================================================
QUICK START *nvim-tree-quickstart*
open the tree with :LuaTreeToggle
>
nnoremap <C-n> :LuaTreeToggle<CR>
lua require 'tree'.toggle()
<
==============================================================================
COMMANDS *nvim-tree-commands*
|:LuaTreeOpen| *:LuaTreeOpen*
opens the tree
|:LuaTreeClose| *:LuaTreeClose*
closes the tree
|:LuaTreeToggle| *:LuaTreeToggle*
open or close the tree
|:LuaTreeRefresh| *:LuaTreeRefresh*
refresh the tree
|:LuaTreeFindFile| *:LuaTreeFindFile*
The command will change the cursor in the tree for the current bufname.
It will also open the leafs of the tree leading to the file in the buffer
(if you opened a file with something else than the LuaTree, like `fzf` or
`:split`)
==============================================================================
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 load and display.
useful to hide large data/cache folders.
>
example: let g:lua_tree_ignore = [ '.git', 'node_modules' ]
|g:lua_tree_show_icons| *g:lua_tree_show_icons*
Dictionnary, if your terminal or font doesn't support certain unicode
character, the tree UI might be messed up. The following configuration
can disable icons per type:
>
let g:lua_tree_show_icons = {
\ 'git': 1,
\ 'folders': 1,
\ 'icons': 1
\}
Can be one of `1` and `0` for each key. By default the tree will try
to render the icons. The `icons` key can only work if `nvim-web-devicons`
is installed and in your |runtimepath|
(https://github.com/kyazdani42/nvim-web-devicons)
|g:lua_tree_icons| *g:lua_tree_icons*
You can set some icons for the git status and the default icon that shows
when no icon is found for a file.
>
let g:lua_tree_icons = {
\ 'default': '',
\ 'git': {
\ 'unstaged': "✗",
\ 'staged': "✓",
\ 'unmerged': "═",
\ 'renamed': "➜",
\ 'untracked': "★"
\ }
\ }
<
|g:lua_tree_follow| *g:lua_tree_follow*
Can be `0` or `1`. When `1`, will update the cursor to update to the correct
location in the tree on |BufEnter|.
Default is 0
|g:lua_tree_auto_open| *g:lua_tree_auto_open*
Can be `0` or `1`. When `1`, will bind |VimEnter| to automatically
open tree on startup if no files are specified.
Default is 0
|g:lua_tree_auto_close| *g:lua_tree_auto_close*
Can be `0` or `1`. When `1`, will bind |BufEnter| to automatically
close the tree if it's the last window.
Default is 0
|g:lua_tree_disable_keybindings| *g:lua_tree_disable_keybindings*
Can be `0` or `1`. When `1`, will disable all keybindings by the plugin.
|g:lua_tree_bindings| as well as default bindings will not take effect.
Default is 0
|g:lua_tree_indent_markers| *g:lua_tree_indent_markers*
Can be `0` or `1`. When `1`, will display indent markers when folders are open
==============================================================================
INFORMATIONS *nvim-tree-info*
|KeyBindings| *nvim-tree-keybindings*
- move around like in any vim buffer
- '<CR>' on '..' will cd in the above directory
- typing '<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
- '<C-v>' will open the file in a vertical split
- '<C-x>' will open the file in a horizontal split
- '<C-t>' will open the file in a new tab
- '<Tab>' will open the file as a preview (keeps the cursor in the tree)
- 'I' will toggle visibility of folders hidden via |g:lua_tree_ignore|
- 'gx' opens the file with the `open` command on macos and `xdg-open`
on linux.
- Double left click acts like '<CR>'
- Double right click acts like '<C-]>'
|g:lua_tree_bindings| *g:lua_tree_bindings*
you can change default keybindings by defining this variable.
default keybindings will be applied to undefined keys.
>
let g:lua_tree_bindings = {
\ edit: '<cr>',
\ edit_vsplit: '<c-v>',
\ edit_split: '<c-x>',
\ edit_tab: '<c-t>',
\ cd: '<c-]>',
\ preview: '<Tab>',
\ create: 'a',
\ remove: 'd',
\ rename: 'r'
\ }
|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 the correct fonts.
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
- ✓ ★ ✗ new file staged and has unstaged modifications
- ═ merging
- ➜ renamed
Mouse support defined in |KeyBindings|
==============================================================================
HIGHLIGHT GROUPS *nvim-tree-highlight*
|lua_tree_highlight| *lua_tree_highlight*
All the following highlight groups can be configured by hand. It is not
advised to colorize the background of these groups.
Example (in your `init.vim`):
>
highlight LuaTreeSymlink guifg=blue gui=bold,underline
<
You should have 'termguicolors' enabled, otherwise, colors will not be
applied.
LuaTreeSymlink
LuaTreeFolderName
LuaTreeFolderIcon
LuaTreeExecFile
LuaTreeSpecialFile
LuaTreeImageFile
LuaTreeMarkdownFile
LuaTreeIndentMarker
LuaTreeLicenseIcon
LuaTreeYamlIcon
LuaTreeTomlIcon
LuaTreeGitignoreIcon
LuaTreeJsonIcon
LuaTreeLuaIcon
LuaTreePythonIcon
LuaTreeShellIcon
LuaTreeJavascriptIcon
LuaTreeCIcon
LuaTreeReactIcon
LuaTreeHtmlIcon
LuaTreeRustIcon
LuaTreeVimIcon
LuaTreeTypescriptIcon
LuaTreeGitDirty
LuaTreeGitStaged
LuaTreeGitMerge
LuaTreeGitRenamed
LuaTreeGitNew
There are also links to normal bindings to style the tree itself.
Normal
EndOfBuffer
CursorLine
VertSplit
CursorColumn
vim:tw=78:ts=8:noet:ft=help:norl: