summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/core/nvimtree.lua
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-07-22 00:08:36 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-07-22 00:08:36 +0200
commitb51f1ae28924a752258e7607fbc3210f9b18eaac (patch)
tree8c8c095528990b3f6eb499dbcca15e9720e636d1 /.config/nvim/lua/core/nvimtree.lua
parentda936b0ed9ac4c171d3c7908e41af1875a82b08b (diff)
Updates based on Chris's lunarvim
Diffstat (limited to '.config/nvim/lua/core/nvimtree.lua')
-rw-r--r--.config/nvim/lua/core/nvimtree.lua88
1 files changed, 88 insertions, 0 deletions
diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua
new file mode 100644
index 0000000..a763c71
--- /dev/null
+++ b/.config/nvim/lua/core/nvimtree.lua
@@ -0,0 +1,88 @@
+local M = {}
+--
+M.config = function()
+ O.plugin.nvimtree = {
+ side = "left",
+ show_icons = {
+ git = 1,
+ folders = 1,
+ files = 1,
+ folder_arrows = 1,
+ tree_width = 30,
+ },
+ ignore = { ".git", "node_modules", ".cache" },
+ auto_open = 1,
+ auto_close = 1,
+ quit_on_open = 0,
+ follow = 1,
+ hide_dotfiles = 1,
+ git_hl = 1,
+ root_folder_modifier = ":t",
+ tab_open = 0,
+ allow_resize = 1,
+ lsp_diagnostics = 1,
+ auto_ignore_ft = { "startify", "dashboard" },
+ icons = {
+ default = "",
+ symlink = "",
+ git = {
+ unstaged = "",
+ staged = "S",
+ unmerged = "",
+ renamed = "➜",
+ deleted = "",
+ untracked = "U",
+ ignored = "◌",
+ },
+ folder = {
+ default = "",
+ open = "",
+ empty = "",
+ empty_open = "",
+ symlink = "",
+ },
+ },
+ }
+end
+--
+M.setup = function()
+ local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
+ if not status_ok then
+ return
+ end
+ local g = vim.g
+
+ for opt, val in pairs(O.plugin.nvimtree) do
+ g["nvim_tree_" .. opt] = val
+ end
+
+ local tree_cb = nvim_tree_config.nvim_tree_callback
+
+ 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
+--
+--
+M.toggle_tree = function()
+ local view_status_ok, view = pcall(require, "nvim-tree.view")
+ if not view_status_ok then
+ return
+ end
+ 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").toggle()
+ end
+end
+--
+return M