my-nvim-setup/lua/nvimTree.lua

94 lines
2.3 KiB
Lua
Raw Normal View History

2021-05-10 18:30:48 +01:00
local cmd = vim.cmd
local g = vim.g
2021-03-13 01:23:02 +00:00
vim.o.termguicolors = true
2021-03-07 14:22:30 +00:00
2021-04-02 06:36:20 +01:00
g.nvim_tree_side = "left"
2021-05-10 18:30:48 +01:00
g.nvim_tree_width = 26
2021-04-02 06:36:20 +01:00
g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
g.nvim_tree_auto_open = 0
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
2021-05-10 18:30:48 +01:00
g.nvim_tree_root_folder_modifier = ":t"
g.nvim_tree_tab_open = 0
2021-04-02 06:36:20 +01:00
g.nvim_tree_allow_resize = 1
g.nvim_tree_show_icons = {
2021-03-13 01:23:02 +00:00
git = 1,
folders = 1,
files = 1
}
2021-03-07 14:22:30 +00:00
2021-04-02 06:36:20 +01:00
g.nvim_tree_icons = {
2021-03-13 01:23:02 +00:00
default = "",
symlink = "",
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = ""
},
folder = {
default = "",
open = "",
symlink = ""
}
}
2021-03-07 14:22:30 +00:00
2021-03-13 01:23:02 +00:00
local get_lua_cb = function(cb_name)
return string.format(":lua require'nvim-tree'.on_keypress('%s')<CR>", cb_name)
2021-03-07 14:22:30 +00:00
end
-- Mappings for nvimtree
2021-03-13 01:23:02 +00:00
vim.api.nvim_set_keymap(
"n",
"<C-n>",
":NvimTreeToggle<CR>",
{
noremap = true,
silent = true
}
)
2021-03-07 14:22:30 +00:00
2021-04-02 06:36:20 +01:00
g.nvim_tree_bindings = {
2021-03-13 01:23:02 +00:00
["<CR>"] = get_lua_cb("edit"),
["o"] = get_lua_cb("edit"),
["<2-LeftMouse>"] = get_lua_cb("edit"),
["<2-RightMouse>"] = get_lua_cb("cd"),
["<C-]>"] = get_lua_cb("cd"),
["<C-v>"] = get_lua_cb("vsplit"),
["<C-x>"] = get_lua_cb("split"),
["<C-t>"] = get_lua_cb("tabnew"),
["<BS>"] = get_lua_cb("close_node"),
["<S-CR>"] = get_lua_cb("close_node"),
["<Tab>"] = get_lua_cb("preview"),
["I"] = get_lua_cb("toggle_ignored"),
["H"] = get_lua_cb("toggle_dotfiles"),
["R"] = get_lua_cb("refresh"),
["a"] = get_lua_cb("create"),
["d"] = get_lua_cb("remove"),
["r"] = get_lua_cb("rename"),
["<C-r>"] = get_lua_cb("full_rename"),
["x"] = get_lua_cb("cut"),
["c"] = get_lua_cb("copy"),
["p"] = get_lua_cb("paste"),
["[c"] = get_lua_cb("prev_git_item"),
["]c"] = get_lua_cb("next_git_item"),
["-"] = get_lua_cb("dir_up"),
["q"] = get_lua_cb("close")
2021-03-07 14:22:30 +00:00
}
2021-04-11 04:14:56 +01:00
cmd "hi NvimTreeFolderIcon guifg = #61afef"
cmd "hi NvimTreeFolderName guifg = #61afef"
cmd "hi NvimTreeIndentMarker guifg=#383c44"
cmd "hi NvimTreeNormal guibg=#1b1f27"
cmd "hi NvimTreeVertSplit guifg=#1e222a"
2021-05-10 18:30:48 +01:00
cmd "hi NvimTreeRootFolder guifg=#f9929b"