Add nvim-tree configuration
This commit is contained in:
@@ -77,7 +77,10 @@
|
|||||||
},
|
},
|
||||||
"to": [
|
"to": [
|
||||||
{
|
{
|
||||||
"shell_command": "/Applications/kitty.app/Contents/MacOS/kitty --single-instance"
|
"key_code": "vk_none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"shell_command": "/Applications/kitty.app/Contents/MacOS/kitty --single-instance --directory ~"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "basic"
|
"type": "basic"
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
local ensure_packer = function()
|
local ensure_packer = function()
|
||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||||
@@ -110,7 +113,7 @@ require("packer").startup(function(use)
|
|||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
requires = {
|
requires = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"kyazdani42/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
"nvim-telescope/telescope-live-grep-args.nvim",
|
"nvim-telescope/telescope-live-grep-args.nvim",
|
||||||
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
|
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
|
||||||
},
|
},
|
||||||
@@ -119,6 +122,17 @@ require("packer").startup(function(use)
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- File tree sidebar for project-style navigation.
|
||||||
|
use({
|
||||||
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
requires = {
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("tracer.plugins.nvim-tree")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Automatically set up your configuration after cloning packer.nvim
|
-- Automatically set up your configuration after cloning packer.nvim
|
||||||
-- Put this at the end after all plugins
|
-- Put this at the end after all plugins
|
||||||
if packer_bootstrap then
|
if packer_bootstrap then
|
||||||
|
|||||||
53
nvim/lua/tracer/plugins/nvim-tree.lua
Normal file
53
nvim/lua/tracer/plugins/nvim-tree.lua
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
require("nvim-tree").setup({
|
||||||
|
git = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
hijack_cursor = true,
|
||||||
|
sync_root_with_cwd = false,
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true,
|
||||||
|
update_root = false,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
width = 36,
|
||||||
|
preserve_window_proportions = true,
|
||||||
|
},
|
||||||
|
renderer = {
|
||||||
|
group_empty = true,
|
||||||
|
icons = {
|
||||||
|
show = {
|
||||||
|
folder_arrow = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
indent_markers = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filters = {
|
||||||
|
dotfiles = false,
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
open_file = {
|
||||||
|
resize_window = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<CR>", { silent = true })
|
||||||
|
vim.keymap.set("n", "<leader>t", ":NvimTreeFindFileToggle<CR>")
|
||||||
|
|
||||||
|
local project_tree_group = vim.api.nvim_create_augroup("tracer_project_tree", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
|
group = project_tree_group,
|
||||||
|
callback = function(data)
|
||||||
|
if vim.fn.argc() ~= 1 or vim.fn.isdirectory(data.file) ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd.cd(data.file)
|
||||||
|
vim.cmd.enew()
|
||||||
|
vim.cmd.bwipeout(data.buf)
|
||||||
|
require("nvim-tree.api").tree.open()
|
||||||
|
end,
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user