Replace neotree with nvim-tree
This commit is contained in:
parent
39dfc1554a
commit
767ad054bd
|
@ -0,0 +1,24 @@
|
||||||
|
-- Neotree mappings
|
||||||
|
|
||||||
|
return function(buffer)
|
||||||
|
local api = require "nvim-tree.api"
|
||||||
|
|
||||||
|
local nmap = require("core.utils").createNmap({
|
||||||
|
buffer = buffer,
|
||||||
|
desc = 'nvim-tree: : ',
|
||||||
|
noremap = true,
|
||||||
|
silent = true,
|
||||||
|
nowait = true
|
||||||
|
})
|
||||||
|
|
||||||
|
-- default mappings
|
||||||
|
api.config.mappings.default_on_attach(buffer)
|
||||||
|
|
||||||
|
nmap('<leader><space>', api.tree.toggle, 'File Tree')
|
||||||
|
nmap('t', api.node.open.tab, 'Toggle Node')
|
||||||
|
nmap('<leader>f', function()
|
||||||
|
api.tree.open({
|
||||||
|
find_file = true
|
||||||
|
})
|
||||||
|
end, 'Reveal File In Tree')
|
||||||
|
end
|
|
@ -1,6 +1,5 @@
|
||||||
local import = require('core.utils').createImporter("core.keymaps")
|
local import = require('core.utils').createImporter("core.keymaps")
|
||||||
|
|
||||||
import('general')
|
import('general')
|
||||||
import('project-tree')
|
|
||||||
import('file-search')
|
import('file-search')
|
||||||
import('diagnostics')
|
import('diagnostics')
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
-- Neotree mappings
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader><space>', ':Neotree toggle<cr>', { desc = 'File tree' })
|
|
||||||
vim.keymap.set('n', '<leader>nf', ':Neotree filesystem reveal<cr>', { desc = 'Reveal in file tree' })
|
|
|
@ -129,7 +129,8 @@ local plugins = {
|
||||||
|
|
||||||
require 'core.plugins.todo-comments',
|
require 'core.plugins.todo-comments',
|
||||||
|
|
||||||
require 'core.plugins.neo-tree',
|
-- require 'core.plugins.neo-tree',
|
||||||
|
require 'core.plugins.project-tree',
|
||||||
|
|
||||||
require 'core.plugins.nvim-ufo',
|
require 'core.plugins.nvim-ufo',
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
return {
|
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
|
||||||
branch = "v3.x",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
|
||||||
"MunifTanjim/nui.nvim",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require('neo-tree').setup {
|
|
||||||
filesystem = {
|
|
||||||
filtered_items = {
|
|
||||||
visible = true,
|
|
||||||
hide_hidden = false,
|
|
||||||
hide_gitignored = true,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
local setup = require "core.setup.async.project-tree"
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'nvim-tree/nvim-tree.lua',
|
||||||
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
|
init = function()
|
||||||
|
setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,14 @@
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
|
-- As in nvim-tree docs
|
||||||
|
|
||||||
|
-- disable netrw at the very start of your init.lua
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
-- set termguicolors to enable highlight groups
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
-- Disale Swap Files
|
-- Disale Swap Files
|
||||||
vim.opt.swapfile = false
|
vim.opt.swapfile = false
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
local keymaps = require('core.keymaps.async.project-tree')
|
||||||
|
|
||||||
|
return function()
|
||||||
|
local on_attach = function(bufnr)
|
||||||
|
keymaps(bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- HACK A temporary way to subscribe to the fact that
|
||||||
|
-- the setup is complete
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "NvimTreeSetup",
|
||||||
|
callback = function(data)
|
||||||
|
on_attach(data.buf)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
require("nvim-tree").setup({
|
||||||
|
-- TODO uncomment this in a version that it actually works
|
||||||
|
-- on_attach = on_attach
|
||||||
|
})
|
||||||
|
end
|
Loading…
Reference in New Issue