配置文件如下:
~/.config/nvim/after/plugin/nvim-tree.lua
内容如下:
-- following options are the default
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
require'nvim-tree'.setup {
-- disables netrw completely
disable_netrw = false,
-- hijack netrw window on startup
hijack_netrw = true,
-- open the tree when running this setup function
open_on_setup = true,
-- will not open on setup if the filetype is in this list
ignore_ft_on_setup = {},
-- closes neovim automatically when the tree is the last **WINDOW** in the view
auto_close = true,
-- opens the tree when changing/opening a new tab if the tree wasn't previously opened
open_on_tab = true,
-- hijacks new directory buffers when they are opened.
update_to_buf_dir = {
-- enable the feature
enable = true,
-- allow to open the tree if it was previously closed
auto_open = true,
},
-- hijack the cursor in the tree to put it at the start of the filename
hijack_cursor = false,
-- updates the root directory of the tree on `DirChanged` (when your run `:cd` usually)
update_cwd = false,
-- show lsp diagnostics in the signcolumn
lsp_diagnostics = false,
-- update the focused file on `BufEnter`, un-collapses the folders recursively until it finds the file
update_focused_file = {
-- enables the feature
enable = false,
-- update the root directory of the tree to the one of the folder containing the file if the file is not under the current root directory
-- only relevant when `update_focused_file.enable` is true
update_cwd = false,
-- list of buffer names / filetypes that will not update the cwd if the file isn't found under the current root directory
-- only relevant when `update_focused_file.update_cwd` is true and `update_focused_file.enable` is true
ignore_list = {}
},
-- configuration options for the system open command (`s` in the tree by default)
system_open = {
-- the command to run this, leaving nil should work in most cases
cmd = nil,
-- the command arguments as a list
args = {}
},
view = {
-- width of the window, can be either a number (columns) or a string in `%`, for left or right side placement
width = 30,
-- height of the window, can be either a number (columns) or a string in `%`, for top or bottom side placement
height = 30,
-- side of the tree, can be one of 'left' | 'right' | 'top' | 'bottom'
side = 'left',
-- if true the tree will resize itself after opening a file
auto_resize = true,
mappings = {
-- custom only false will merge the list with the default mappings
-- if true, it will only use your list to set the mappings
custom_only = true,
-- list of mappings to set on the tree manually
list = {
{ key = {"", "o", "","l"}, cb = tree_cb("edit") },
{ key = {"", ""}, cb = tree_cb("cd") },
{ key = "", cb = tree_cb("vsplit") },
{ key = "", cb = tree_cb("split") },
{ key = "", cb = tree_cb("tabnew") },
{ key = "
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?