From 26275d8001dc39f7b47074cd357be9daee40ba49 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Mon, 7 Feb 2022 17:58:08 -0600 Subject: nvim: add neotree --- nvim/.config/nvim/lua/neotree_config.lua | 93 ++++++++++++++++++++++++++++++++ nvim/.config/nvim/lua/plugins.lua | 10 ++++ 2 files changed, 103 insertions(+) create mode 100644 nvim/.config/nvim/lua/neotree_config.lua (limited to 'nvim/.config') diff --git a/nvim/.config/nvim/lua/neotree_config.lua b/nvim/.config/nvim/lua/neotree_config.lua new file mode 100644 index 0000000..12dd435 --- /dev/null +++ b/nvim/.config/nvim/lua/neotree_config.lua @@ -0,0 +1,93 @@ +require("neo-tree").setup({ + enable_git_status = true, + filesystem = { + filters = { --These filters are applied to both browsing and searching + show_hidden = false, + respect_gitignore = true, + }, + + -- This will find and focus the file in the + -- active buffer every time the current file is changed while the tree is open. + follow_current_file = true, + + -- This will use the OS level file watchers + -- to detect changes instead of relying on nvim autocmd events. + use_libuv_file_watcher = true, + + window = { + position = "left", + width = 40, + mappings = { + ["<2-LeftMouse>"] = "open", + [""] = "open", + ["S"] = "open_split", + ["s"] = "open_vsplit", + ["C"] = "close_node", + [""] = "navigate_up", + ["."] = "set_root", + ["H"] = "toggle_hidden", + ["I"] = "toggle_gitignore", + ["R"] = "refresh", + ["/"] = "filter_as_you_type", + --["/"] = "none" -- Assigning a key to "none" will remove the default mapping + ["f"] = "filter_on_submit", + [""] = "clear_filter", + ["a"] = "add", + ["d"] = "delete", + ["r"] = "rename", + ["c"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + ["bd"] = "buffer_delete", + } + } + }, + buffers = { + show_unloaded = true, + window = { + position = "left", + mappings = { + ["<2-LeftMouse>"] = "open", + [""] = "open", + ["S"] = "open_split", + ["s"] = "open_vsplit", + [""] = "navigate_up", + ["."] = "set_root", + ["R"] = "refresh", + ["a"] = "add", + ["d"] = "delete", + ["r"] = "rename", + ["c"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + } + }, + }, + git_status = { + window = { + position = "float", + mappings = { + ["<2-LeftMouse>"] = "open", + [""] = "open", + ["S"] = "open_split", + ["s"] = "open_vsplit", + ["C"] = "close_node", + ["R"] = "refresh", + ["d"] = "delete", + ["r"] = "rename", + ["c"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + ["A"] = "git_add_all", + ["gu"] = "git_unstage_file", + ["ga"] = "git_add_file", + ["gr"] = "git_revert_file", + ["gc"] = "git_commit", + ["gp"] = "git_push", + ["gg"] = "git_commit_and_push", + } + } + } +}) + +vim.cmd([[nnoremap \ :NeoTreeReveal]]) diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 3ae9936..da0097f 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -35,5 +35,15 @@ return require('packer').startup(function() 'neovim/nvim-lspconfig', config = function() require('lsp_config') end } + + use { + 'nvim-neo-tree/neo-tree.nvim', + requires = { + 'nvim-lua/plenary.nvim', + 'kyazdani42/nvim-web-devicons', + 'MunifTanjim/nui.nvim' + }, + config = function() require('neotree_config') end + } end) -- cgit v1.2.3