12

nvim-tree.lua 使用初体验

 1 year ago
source link: https://wsdjeg.spacevim.org/first-experience-with-nvim-tree/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

nvim-tree.lua 使用初体验


使用 Vim 有很长一段时间了,我记得最早期的时候, 还是在网上看各种 Vim 配置的教程。 而这些教程里面,大部分都会提到一个叫做文件树(File Explorer)的功能。

文件树插件,也是我日常使用 Vim 必备的插件。 刚开始接触 Vim 的时候,那时候插件还很少, 只有内置的 netrw。 后来接触到了 nerdtree 以及 Shougo 的vimfiler, 包括 Shougo 使用 neovim remote 插件特性重写的 defx.nvim

目前,SpaceVim 已经支持了以上这些文件树插件,可以通过 filemanager 选项进行设置:

[options]
    filemanager = "nerdtree"

Neovim 这一项目目前默认支持 lua,很多插件被使用 lua 重写, 文件树也不例外。 最近就看到一个不错的文件树插件nvim-tree.lua, 计划给 SpaceVim 也增加这个插件支持。在次之前,先体验一下这个插件到底有哪些功能:

测试版本:nvim-tree.lua@9049f364

启用 nvim-tree:

[options]
    filemanager = "nvim-tree"
image

存在的问题

  1. 如果当前目录修改后,再使用 :NvimTreeFindFile 无法发现当前文件。

  2. 禁用默认的快捷键

尝试搜索文档和issues,最终只找到一个:Default keymaps cannot be unset。 里面有一段回复:

vim.g.nvim_tree_disable_default_keybindings = 1

但是,设置后,启动就警告:

[NvimTree] Following options were moved to setup, see bit.ly/3vIpEOJ: nvim_tree_disable_default_keybindings

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK