Added comment and toggle to neotree

This commit is contained in:
Pablu23
2024-05-21 09:53:41 +02:00
parent c39bd34324
commit f011aa49f1
4 changed files with 64 additions and 56 deletions

7
lua/plugins/comment.lua Normal file
View File

@@ -0,0 +1,7 @@
return {
'numToStr/Comment.nvim',
opts = {
-- add any options here
},
lazy = false,
}

View File

@@ -1,44 +1,44 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
-- Setup Harpoon with Telescope
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require("telescope.pickers")
.new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
})
:find()
end
require("telescope.pickers")
.new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
})
:find()
end
-- Setup Harpoon keybinds
harpoon:setup()
vim.keymap.set("n", "<leader>a", function()
harpoon:list():add()
end)
vim.keymap.set("n", "<C-e>", function()
toggle_telescope(harpoon:list())
end)
harpoon:setup()
vim.keymap.set("n", "<leader>a", function()
harpoon:list():add()
end)
vim.keymap.set("n", "<C-e>", function()
toggle_telescope(harpoon:list())
end)
vim.keymap.set("n", "<A-p>", function()
harpoon:list():prev()
end)
vim.keymap.set("n", "<A-n>", function()
harpoon:list():next()
end)
end,
-- vim.keymap.set("n", "<A-p>", function()
-- harpoon:list():prev()
-- end)
-- vim.keymap.set("n", "<A-n>", function()
-- harpoon:list():next()
-- end)
end,
}

View File

@@ -1,22 +1,22 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
config = function()
require("neo-tree").setup({
event_handlers = {
{
event = "file_opened",
handler = function(file_path)
require("neo-tree.command").execute({ action = "close" })
end,
},
},
})
vim.keymap.set("n", "<C-n>", ":Neotree filesystem reveal right<CR>", {}) -- toggle
end,
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
config = function()
require("neo-tree").setup({
event_handlers = {
{
event = "file_opened",
handler = function(file_path)
require("neo-tree.command").execute({ action = "close" })
end,
},
},
})
vim.keymap.set("n", "<C-n>", ":Neotree filesystem reveal right toggle<CR>", {})
end,
}