nvim/lua/plugins/nvim-tree.lua

34 lines
1.5 KiB
Lua

local tree_cb = require('nvim-tree.config').nvim_tree_callback
require("nvim-tree").setup {
auto_close = true,
view = {
width = "15%",
side = "left",
mappings = {
custom_only = true,
list = {
{ key = {"<CR>", "<2-LeftMouse>"}, cb = tree_cb("edit") },
{ key = "vs", cb = tree_cb("vsplit") },
{ key = "s", cb = tree_cb("split") },
{ key = "t", cb = tree_cb("tabnew") },
{ key = "<Tab>", cb = tree_cb("preview") },
{ key = "K", cb = tree_cb("first_sibling") },
{ key = "J", cb = tree_cb("last_sibling") },
{ key = "R", cb = tree_cb("refresh") },
{ key = "ma", cb = tree_cb("create") },
{ key = "md", cb = tree_cb("remove") },
{ key = "mm", cb = tree_cb("rename") },
{ key = "<C-r>", cb = tree_cb("full_rename") },
{ key = "mc", cb = ':lua require"nvim-tree".on_keypress("copy");require"nvim-tree".on_keypress("paste")<CR>' },
{ key = "?", cb = tree_cb("toggle_help") },
}
}
}
}
-- Hide statusline in nvim-tree buffer/tabs.
-- vim.cmd('au BufEnter,BufWinEnter,WinEnter,CmdwinEnter * if bufname("%") == "NvimTree" | set laststatus=0 | else | set laststatus=2 | endif')