disabled some plugins
This commit is contained in:
parent
ed876aa4b7
commit
7c94a7dd45
1 changed files with 0 additions and 0 deletions
119
lua/pika/plugins/neo-tree.lua.disabled
Normal file
119
lua/pika/plugins/neo-tree.lua.disabled
Normal file
|
@ -0,0 +1,119 @@
|
|||
local function setup_open_file_indicators()
|
||||
-- Table to store open buffers
|
||||
local open_buffers = {}
|
||||
|
||||
-- Function to update open_buffers table
|
||||
local function update_open_buffers()
|
||||
open_buffers = {}
|
||||
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.api.nvim_buf_is_valid(buf) and vim.bo[buf].buflisted then
|
||||
local file_path = vim.api.nvim_buf_get_name(buf)
|
||||
open_buffers[file_path] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Update open_buffers initially
|
||||
update_open_buffers()
|
||||
|
||||
-- Set up autocmds to update open_buffers and refresh Neo-tree
|
||||
local group = vim.api.nvim_create_augroup("NeoTreeOpenFileIndicator", { clear = true })
|
||||
vim.api.nvim_create_autocmd({ "BufAdd", "BufDelete", "BufWipeout" }, {
|
||||
group = group,
|
||||
callback = function()
|
||||
update_open_buffers()
|
||||
if package.loaded["neo-tree.sources.manager"] then
|
||||
require("neo-tree.sources.manager").refresh("filesystem")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Custom component to display open file indicator
|
||||
local function open_file_indicator(config, node, state)
|
||||
local result = require("neo-tree.sources.common.components").icon(config, node, state)
|
||||
if node.type == "file" and open_buffers[node:get_id()] then
|
||||
result.text = result.text .. " "
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
return open_file_indicator
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
opts = function()
|
||||
-- Set the keymap when the Neo-tree buffer is opened
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "neo-tree",
|
||||
callback = function()
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
0,
|
||||
"n",
|
||||
"<leader>cd",
|
||||
"<cmd>FineCmdline Neotree dir=<CR>",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end,
|
||||
})
|
||||
return {
|
||||
sources = { "filesystem", "buffers", "git_status" },
|
||||
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
||||
close_if_last_window = false,
|
||||
popup_border_style = "rounded",
|
||||
use_float = true,
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
filesystem = {
|
||||
bind_to_cwd = false,
|
||||
follow_current_file = { enabled = true },
|
||||
use_libuv_file_watcher = true,
|
||||
components = {
|
||||
icon = setup_open_file_indicators(),
|
||||
},
|
||||
},
|
||||
window = {
|
||||
mappings = {
|
||||
["l"] = "open",
|
||||
["o"] = "open",
|
||||
["C-v"] = "open_split",
|
||||
["h"] = "close_node",
|
||||
["<space>"] = "none",
|
||||
["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 = true } },
|
||||
},
|
||||
},
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
with_expanders = true,
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"3rd/image.nvim",
|
||||
},
|
||||
},
|
||||
|
||||
-- ─< Toggle NvimTree >─────────────────────────────────────────────────────────────────
|
||||
vim.keymap.set("n", "<leader>e", ":Neotree toggle<CR>", { noremap = true, silent = true, desc = "[e]xplorer" })
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue