diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-07-07 01:05:06 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-07-07 01:05:06 +0200 |
commit | 0111b31cb0008f4fcc55ddc373e63f124652b156 (patch) | |
tree | 075490fb19c4838fc58129da9f902a3370f6029e /.config/nvim/lua/cfg/nvimtree | |
parent | 6fcc69113bd7cc7295ef9dc068da80d043cbb8bb (diff) |
Updated config based on Chris LunarVim release
Diffstat (limited to '.config/nvim/lua/cfg/nvimtree')
-rw-r--r-- | .config/nvim/lua/cfg/nvimtree/init.lua | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/.config/nvim/lua/cfg/nvimtree/init.lua b/.config/nvim/lua/cfg/nvimtree/init.lua new file mode 100644 index 0000000..37a931e --- /dev/null +++ b/.config/nvim/lua/cfg/nvimtree/init.lua @@ -0,0 +1,81 @@ +--if not package.loaded['nvim-tree.view'] then +-- return +--end + +local M = {} + +M.config = function() + local g = vim.g + + vim.o.termguicolors = true + + g.nvim_tree_side = "left" + g.nvim_tree_width = 30 + g.nvim_tree_ignore = { ".git", "node_modules", ".cache" } + g.nvim_tree_auto_open = 1 + g.nvim_tree_auto_close = 0 + g.nvim_tree_quit_on_open = 0 + g.nvim_tree_follow = 1 + g.nvim_tree_indent_markers = 1 + g.nvim_tree_hide_dotfiles = 1 + g.nvim_tree_git_hl = 1 + g.nvim_tree_root_folder_modifier = ":t" + g.nvim_tree_tab_open = 0 + g.nvim_tree_allow_resize = 1 + g.nvim_tree_lsp_diagnostics = 1 + g.nvim_tree_auto_ignore_ft = { "startify", "dashboard" } + + g.nvim_tree_show_icons = { + git = 1, + folders = 1, + files = 1, + folder_arrows = 1, + } + + vim.g.nvim_tree_icons = { + default = "", + symlink = "", + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "U", + ignored = "◌", + }, + folder = { + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + }, + } + local tree_cb = require("nvim-tree.config").nvim_tree_callback + + vim.g.nvim_tree_bindings = { + { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" }, + { key = "h", cb = tree_cb "close_node" }, + { key = "v", cb = tree_cb "vsplit" }, + } +end + +local view = require "nvim-tree.view" + +M.toggle_tree = function() + if view.win_open() then + require("nvim-tree").close() + if package.loaded["bufferline.state"] then + require("bufferline.state").set_offset(0) + end + else + if package.loaded["bufferline.state"] then + -- require'bufferline.state'.set_offset(31, 'File Explorer') + require("bufferline.state").set_offset(31, "") + end + require("nvim-tree").find_file(true) + end +end + +return M |