|
| 1 | + |
| 2 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 3 | +-- ─────────────────────────────────────────────────-- |
| 4 | +-- Plugin: nvim-tree.lua |
| 5 | +-- Github: github.com/kyazdani42/nvim-tree.lua |
| 6 | +-- ─────────────────────────────────────────────────-- |
| 7 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 14 | +-- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- |
| 15 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 16 | +local gl = vim.g |
| 17 | +local keymap = vim.api.nvim_set_keymap |
| 18 | +local options = {noremap = true, silent = true} |
| 19 | +local tree_cb = require'nvim-tree.config'.nvim_tree_callback |
| 20 | +local cmd = vim.cmd -- execute Vim commands |
| 21 | +cmd('autocmd ColorScheme * highlight highlight NvimTreeBg guibg=None') |
| 22 | +cmd('autocmd FileType NvimTree setlocal winhighlight=Normal:NvimTreeBg') |
| 23 | + |
| 24 | +-- gl.nvim_tree_ignore = { '.git', 'node_modules', '.cache' } --empty by default |
| 25 | +-- gl.nvim_tree_gitignore = 1 --0 by default |
| 26 | +-- gl.nvim_tree_auto_open = 0 --0 by default, opens the tree when typing `vim $DIR` or `vim` |
| 27 | +-- gl.nvim_tree_auto_close = 1 --0 by default, closes the tree when it's the last window |
| 28 | +-- gl.nvim_tree_auto_ignore_ft = { 'startify', 'dashboard' } --empty by default, don't auto open tree on specific filetypes. |
| 29 | +-- gl.nvim_tree_quit_on_open = 1 --0 by default, closes the tree when you open a file |
| 30 | +-- gl.nvim_tree_follow = 1 --0 by default, this option allows the cursor to be updated when entering a buffer |
| 31 | +gl.nvim_tree_indent_markers = 1 -- 0 by default, this option shows indent markers when folders are open |
| 32 | +-- gl.nvim_tree_hide_dotfiles = 1 --0 by default, this option hides files and folders starting with a dot `.` |
| 33 | +-- gl.nvim_tree_git_hl = 1 --0 by default, will enable file highlight for git attributes (can be used without the icons). |
| 34 | +gl.nvim_tree_highlight_opened_files = 1 -- 0 by default, will enable folder and file icon highlight for opened files/directories. |
| 35 | +-- gl.nvim_tree_root_folder_modifier = ':~' --This is the default. See :help filename-modifiers for more options |
| 36 | +-- gl.nvim_tree_tab_open = 1 --0 by default, will open the tree when entering a new tab and the tree was previously open |
| 37 | +-- gl.nvim_tree_auto_resize = 0 --1 by default, will resize the tree to its saved width when opening a file |
| 38 | +-- gl.nvim_tree_disable_netrw = 0 --1 by default, disables netrw |
| 39 | +-- gl.nvim_tree_hijack_netrw = 0 --1 by default, prevents netrw from automatically opening when opening directories (but lets you keep its other utilities) |
| 40 | +-- gl.nvim_tree_add_trailing = 1 --0 by default, append a trailing slash to folder names |
| 41 | +-- gl.nvim_tree_group_empty = 1 -- 0 by default, compact folders that only contain a single folder into one node in the file tree |
| 42 | +-- gl.nvim_tree_lsp_diagnostics = 0 --0 by default, will show lsp diagnostics in the signcolumn. See :help nvim_tree_lsp_diagnostics |
| 43 | +-- gl.nvim_tree_disable_window_picker = 1 --0 by default, will disable the window picker. |
| 44 | +-- gl.nvim_tree_hijack_cursor = 0 --1 by default, when moving cursor in the tree, will position the cursor at the start of the file on the current line |
| 45 | +-- gl.nvim_tree_icon_padding = ' ' --one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font. |
| 46 | +-- gl.nvim_tree_update_cwd = 1 --0 by default, will update the tree cwd when changing nvim's directory (DirChanged event). Behaves strangely with autochdir set. |
| 47 | + |
| 48 | +-- each of these are documented in `:help nvim-tree.OPTION_NAME` |
| 49 | +require'nvim-tree'.setup { |
| 50 | + disable_netrw = true, |
| 51 | + hijack_netrw = true, |
| 52 | + open_on_setup = false, |
| 53 | + ignore_ft_on_setup = {}, |
| 54 | + auto_close = false, |
| 55 | + open_on_tab = false, |
| 56 | + hijack_cursor = false, |
| 57 | + update_cwd = false, |
| 58 | + update_to_buf_dir = {enable = true, auto_open = true}, |
| 59 | + diagnostics = { |
| 60 | + enable = false, |
| 61 | + icons = {hint = "", info = "", warning = "", error = ""}, |
| 62 | + }, |
| 63 | + git = {enable = false}, |
| 64 | + update_focused_file = {enable = false, update_cwd = false, ignore_list = {}}, |
| 65 | + system_open = {cmd = nil, args = {}}, |
| 66 | + filters = {dotfiles = false, custom = {}}, |
| 67 | + |
| 68 | + view = { |
| 69 | + width = 25, |
| 70 | + height = 30, |
| 71 | + hide_root_folder = false, |
| 72 | + side = 'left', |
| 73 | + auto_resize = true, |
| 74 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 75 | +-- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- |
| 76 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 82 | +-- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━-- |
| 83 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 84 | + mappings = { |
| 85 | + custom_only = false, |
| 86 | + list = { |
| 87 | + {key = "g?", cb = tree_cb("toggle_help")}, |
| 88 | + -- { key = "<C-v>", cb = tree_cb("vsplit") }, |
| 89 | + -- { key = "<C-x>", cb = tree_cb("split") }, |
| 90 | + -- { key = "<C-t>", cb = tree_cb("tabnew") }, |
| 91 | + -- { key = "<", cb = tree_cb("prev_sibling") }, |
| 92 | + -- { key = ">", cb = tree_cb("next_sibling") }, |
| 93 | + -- { key = "P", cb = tree_cb("parent_node") }, |
| 94 | + -- { key = "<BS>", cb = tree_cb("close_node") }, |
| 95 | + -- { key = "<S-CR>", cb = tree_cb("close_node") }, |
| 96 | + -- { key = "<Tab>", cb = tree_cb("preview") }, |
| 97 | + -- { key = "K", cb = tree_cb("first_sibling") }, |
| 98 | + -- { key = "J", cb = tree_cb("last_sibling") }, |
| 99 | + -- { key = "I", cb = tree_cb("toggle_ignored") }, |
| 100 | + -- { key = "H", cb = tree_cb("toggle_dotfiles") }, |
| 101 | + -- { key = "R", cb = tree_cb("refresh") }, |
| 102 | + -- { key = "a", cb = tree_cb("create") }, |
| 103 | + -- { key = "d", cb = tree_cb("remove") }, |
| 104 | + -- { key = "r", cb = tree_cb("rename") }, |
| 105 | + -- { key = "<C-r>", cb = tree_cb("full_rename") }, |
| 106 | + -- { key = "x", cb = tree_cb("cut") }, |
| 107 | + -- { key = "c", cb = tree_cb("copy") }, |
| 108 | + -- { key = "p", cb = tree_cb("paste") }, |
| 109 | + -- { key = "y", cb = tree_cb("copy_name") }, |
| 110 | + -- { key = "Y", cb = tree_cb("copy_path") }, |
| 111 | + -- { key = "gy", cb = tree_cb("copy_absolute_path") }, |
| 112 | + -- { key = "[c", cb = tree_cb("prev_git_item") }, |
| 113 | + -- { key = "]c", cb = tree_cb("next_git_item") }, |
| 114 | + -- { key = "-", cb = tree_cb("dir_up") }, |
| 115 | + -- { key = "q", cb = tree_cb("close") }, |
| 116 | + -- { key = {"<CR>", "o", "<2-LeftMouse>"}, cb = tree_cb("edit") }, |
| 117 | + -- { key = {"<2-RightMouse>", "<C-]>"}, cb = tree_cb("cd") }, |
| 118 | + }, |
| 119 | + }, |
| 120 | + |
| 121 | + }, |
| 122 | +} |
| 123 | + |
| 124 | +-- Toggle Nvim-Tree |
| 125 | +keymap('n', '<leader>f', ':NvimTreeToggle<CR>', options) |
| 126 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 127 | +-- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━-- |
| 128 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- |
| 129 | + |
0 commit comments