From 58552a7a728836ee672698093236531bb58fbb42 Mon Sep 17 00:00:00 2001 From: pika Date: Sat, 17 Aug 2024 21:02:18 +0200 Subject: [PATCH] addet some configurations --- lua/pika/plugins/neo-tree.lua | 78 +++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/lua/pika/plugins/neo-tree.lua b/lua/pika/plugins/neo-tree.lua index 84a7885..e623bbe 100644 --- a/lua/pika/plugins/neo-tree.lua +++ b/lua/pika/plugins/neo-tree.lua @@ -2,21 +2,83 @@ return { { "nvim-neo-tree/neo-tree.nvim", opts = { + sources = { "filesystem", "buffers", "git_status" }, + open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, + close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + filesystem = { + bind_to_cwd = false, + follow_current_file = { enabled = true }, + use_libuv_file_watcher = true, + components = { + name = function(config, node, state) + local result = require("neo-tree.sources.filesystem.components").name(config, node, state) + + -- Check if the file is open in a buffer + local is_open = false + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + if vim.api.nvim_buf_get_name(buf) == node.path then + is_open = true + break + end + end + + -- Add an indicator if the file is open + if is_open then + result.text = result.text .. " 󱞇" + end + + return result + end, + }, + }, window = { mappings = { ["l"] = "open", - ["o"] = "open", ["h"] = "close_node", - ["C-v"] = "open_split", + [""] = "none", + ["Y"] = { + function(state) + local node = state.tree:get_node() + local path = node:get_id() + vim.fn.setreg("+", path, "c") + end, + desc = "Copy Path to Clipboard", + }, + ["O"] = { + function(state) + require("lazy.util").open(state.tree:get_node().path, { system = true }) + end, + desc = "Open with System Application", + }, + ["P"] = { "toggle_preview", config = { use_float = false } }, }, }, - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - -- "MunifTanjim/nui.nvim", - "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + + default_component_configs = { + indent = { + with_expanders = true, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + git_status = { + symbols = { + unstaged = "󰄱", + staged = "󰱒", + }, + }, } + }, + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + -- "MunifTanjim/nui.nvim", + "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information } } } +