LunarVim/lua/lv-nvimtree/init.lua

86 lines
1.9 KiB
Lua
Raw Normal View History

--if not package.loaded['nvim-tree.view'] then
-- return
--end
2021-06-28 04:11:33 +02:00
local M = {}
2021-07-07 02:42:29 +02:00
local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
if not status_ok then
return
end
2021-04-15 06:17:48 +02:00
2021-06-28 04:11:33 +02:00
M.config = function()
2021-07-05 03:14:01 +02:00
local g = vim.g
2021-04-15 06:17:48 +02:00
2021-07-05 03:14:01 +02:00
vim.o.termguicolors = true
2021-06-28 04:11:33 +02:00
2021-07-05 03:14:01 +02:00
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" }
2021-06-28 04:11:33 +02:00
2021-07-05 03:14:01 +02:00
g.nvim_tree_show_icons = {
git = 1,
folders = 1,
files = 1,
folder_arrows = 1,
}
2021-07-05 03:14:01 +02:00
vim.g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
unstaged = "",
staged = "S",
unmerged = "",
renamed = "",
deleted = "",
untracked = "U",
ignored = "",
},
folder = {
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
},
}
2021-07-07 02:42:29 +02:00
local tree_cb = nvim_tree_config.nvim_tree_callback
2021-07-05 03:14:01 +02:00
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
2021-07-05 03:14:01 +02:00
local view = require "nvim-tree.view"
2021-06-30 00:55:01 +02:00
M.toggle_tree = function()
2021-07-05 03:14:01 +02:00
if view.win_open() then
require("nvim-tree").close()
if package.loaded["bufferline.state"] then
require("bufferline.state").set_offset(0)
2021-06-30 00:55:01 +02:00
end
2021-07-05 03:14:01 +02:00
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
2021-06-30 00:55:01 +02:00
end
2021-06-28 04:11:33 +02:00
return M