Added neotree

This commit is contained in:
Oliver Hartmann
2022-03-28 11:03:20 +02:00
parent d57067ea70
commit 752814db02
2 changed files with 64 additions and 1 deletions

View File

@ -139,6 +139,15 @@ return require('packer').startup(function()
'nvim-treesitter/nvim-treesitter-textobjects', 'nvim-treesitter/nvim-treesitter-textobjects',
requires = 'nvim-treesitter/nvim-treesitter', requires = 'nvim-treesitter/nvim-treesitter',
}) })
use({
'nvim-neo-tree/neo-tree.nvim',
requires = {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
},
config = get_setup('neo-tree')
})
use({ use({
'mvllow/modes.nvim', 'mvllow/modes.nvim',
config = function() config = function()

54
lua/setup/neo-tree.lua Normal file
View File

@ -0,0 +1,54 @@
-- If you want icons for diagnostic errors, you'll need to define them somewhere:
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
local utils = require('utils')
require('neo-tree').setup({
window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for
-- possible options. These can also be functions that return these options.
position = 'float', -- left, right, float, current
width = 40, -- applies to left and right positions
popup = { -- settings that apply to float position only
size = {
height = '80%',
width = '50%',
},
position = '50%', -- 50% means center it
-- you can also specify border here, if you want a different setting from
-- the global popup_border_style.
},
-- Mappings for tree window. See `:h nep-tree-mappings` for a list of built-in commands.
-- You can also create your own commands by providing a function instead of a string.
mappings = {
['<space>'] = 'toggle_node',
['<2-LeftMouse>'] = 'open',
['<cr>'] = 'open',
['s'] = 'open_split',
['v'] = 'open_vsplit',
['C'] = 'close_node',
['z'] = 'close_all_nodes',
['R'] = 'refresh',
['a'] = 'add',
['A'] = 'add_directory',
['d'] = 'delete',
['r'] = 'rename',
['y'] = 'copy_to_clipboard',
['x'] = 'cut_to_clipboard',
['p'] = 'paste_from_clipboard',
['c'] = 'copy', -- takes text input for destination
['m'] = 'move', -- takes text input for destination
['q'] = 'close_window',
},
},
filesystem = {
filtered_items = {
hide_dotfiles = false,
hide_gitignored = false,
},
}
})
utils.map('n', '\\', '<cmd>Neotree reveal<cr>')
utils.map('n', '<leader>b', '<cmd>Neotree buffers<cr>')