From abe2d72d03a9da751be3074109c76b5012787613 Mon Sep 17 00:00:00 2001 From: A Farzat Date: Mon, 7 Oct 2024 10:38:17 +0900 Subject: Replace nerdtree with nvim-tree --- early-settings/nvim-tree.lua | 2 ++ plugin-settings/nvim-tree.lua | 19 +++++++++++++++++++ plugins.vim | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 early-settings/nvim-tree.lua create mode 100644 plugin-settings/nvim-tree.lua diff --git a/early-settings/nvim-tree.lua b/early-settings/nvim-tree.lua new file mode 100644 index 0000000..5db19d7 --- /dev/null +++ b/early-settings/nvim-tree.lua @@ -0,0 +1,2 @@ +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 diff --git a/plugin-settings/nvim-tree.lua b/plugin-settings/nvim-tree.lua new file mode 100644 index 0000000..a8dcd46 --- /dev/null +++ b/plugin-settings/nvim-tree.lua @@ -0,0 +1,19 @@ +local function my_on_attach(bufnr) + local api = require "nvim-tree.api" + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + -- custom mappings + vim.keymap.set('n', '', api.tree.change_root_to_parent, opts('Up')) + vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help')) +end + +-- pass to setup along with your other options +require("nvim-tree").setup { + on_attach = my_on_attach, +} diff --git a/plugins.vim b/plugins.vim index 70c559b..fdb74f0 100644 --- a/plugins.vim +++ b/plugins.vim @@ -58,7 +58,7 @@ Plug 'https://github.com/rafamadriz/friendly-snippets' " Set of preconfigured sn " Plugins not for vscode. if !exists('g:vscode') - Plug 'https://github.com/scrooloose/nerdtree' " A tree explorer plugin for vim. + Plug 'https://github.com/nvim-tree/nvim-tree.lua' " A file explorer tree for neovim written in lua endif " Only if started by a browser. -- cgit v1.2.3-70-g09d2