diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2021-10-03 09:27:02 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2021-10-03 09:27:02 +0200 |
commit | 139b854f860a1eebc651834c9b705b14c8d4bc1a (patch) | |
tree | 6561ebb2d6a878a6dbbbe22dfae7b17f6181b65e | |
parent | 77a478f4ce58078b301ce8edc39f77e0c3b22a26 (diff) | |
download | dotfiles-139b854f860a1eebc651834c9b705b14c8d4bc1a.tar.gz dotfiles-139b854f860a1eebc651834c9b705b14c8d4bc1a.tar.xz dotfiles-139b854f860a1eebc651834c9b705b14c8d4bc1a.zip |
nvim:plugins: Update nvim-tree config
-rw-r--r-- | nvim/.config/nvim/lua/plugins/nvim-tree.lua | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/nvim/.config/nvim/lua/plugins/nvim-tree.lua b/nvim/.config/nvim/lua/plugins/nvim-tree.lua index aca5674..fc84b8f 100644 --- a/nvim/.config/nvim/lua/plugins/nvim-tree.lua +++ b/nvim/.config/nvim/lua/plugins/nvim-tree.lua @@ -1,12 +1,68 @@ -vim.g.nvim_tree_width = 50 -- default window width vim.g.nvim_tree_ignore = { '.git', 'node_modules', '.cache', '.clangd' } vim.g.nvim_tree_gitignore = 1 -- use .gitignore -vim.g.nvim_tree_auto_close = 1 -- closes the tree when it's the last window vim.g.nvim_tree_add_trailing = 1 -- append a trailing slash to folder names -vim.g.nvim_tree_auto_open = 0 -- opens the tree when typing `vim $DIR` or `vim` vim.g.nvim_tree_show_icons = { git = 1, folders = 1, files = 1, folder_arrows = 1, } + +local tree_cb = require'nvim-tree.config'.nvim_tree_callback +require('nvim-tree').setup({ + disable_netrw = true, + hijack_netrw = false, + open_on_setup = false, + ignore_ft_on_setup = {}, + auto_close = true, + open_on_tab = false, + hijack_cursor = false, + update_cwd = false, + lsp_diagnostics = false, + update_focused_file = { + enable = false, + update_cwd = false, + ignore_list = {} + }, + view = { + width = 50, + side = 'left', + auto_resize = false, + mappings = { + custom_only = false, + list = { + { key = {"<CR>", "o", "<2-LeftMouse>"}, cb = tree_cb("edit") }, + { key = {"<2-RightMouse>", "<C-]>"}, cb = tree_cb("cd") }, + { key = "<C-v>", cb = tree_cb("vsplit") }, + { key = "<C-s>", cb = tree_cb("split") }, + { key = "<C-t>", cb = tree_cb("tabnew") }, + { key = "<", cb = tree_cb("prev_sibling") }, + { key = ">", cb = tree_cb("next_sibling") }, + { key = "P", cb = tree_cb("parent_node") }, + { key = "<BS>", cb = tree_cb("close_node") }, + { key = "<S-CR>", cb = tree_cb("close_node") }, + { key = "<Tab>", cb = tree_cb("preview") }, + { key = "K", cb = tree_cb("first_sibling") }, + { key = "J", cb = tree_cb("last_sibling") }, + { key = "I", cb = tree_cb("toggle_ignored") }, + { key = "H", cb = tree_cb("toggle_dotfiles") }, + { key = "R", cb = tree_cb("refresh") }, + { key = "a", cb = tree_cb("create") }, + { key = "d", cb = tree_cb("remove") }, + { key = "r", cb = tree_cb("rename") }, + { key = "<C-r>", cb = tree_cb("full_rename") }, + { key = "x", cb = tree_cb("cut") }, + { key = "c", cb = tree_cb("copy") }, + { key = "p", cb = tree_cb("paste") }, + { key = "y", cb = tree_cb("copy_name") }, + { key = "Y", cb = tree_cb("copy_path") }, + { key = "gy", cb = tree_cb("copy_absolute_path") }, + { key = "[c", cb = tree_cb("prev_git_item") }, + { key = "]c", cb = tree_cb("next_git_item") }, + { key = "-", cb = tree_cb("dir_up") }, + { key = "s", cb = tree_cb("system_open") }, + { key = "q", cb = tree_cb("close") }, + } + } + } +}) |