Added Harpoon and changed some confgis
This commit is contained in:
44
lua/plugins/harpoon.lua
Normal file
44
lua/plugins/harpoon.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
return {
|
||||
"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
|
||||
|
||||
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)
|
||||
|
||||
vim.keymap.set("n", "<A-p>", function()
|
||||
harpoon:list():prev()
|
||||
end)
|
||||
vim.keymap.set("n", "<A-n>", function()
|
||||
harpoon:list():next()
|
||||
end)
|
||||
end,
|
||||
}
|
||||
@@ -1,36 +1,40 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"gopls"
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"gopls",
|
||||
"rust_analyzer",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
lspconfig.gopls.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
|
||||
vim.keymap.set({'n', 'v'}, '<leader>ca', vim.lsp.buf.code_action, {})
|
||||
end
|
||||
}
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lspconfig.gopls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lspconfig.rust_analyzer.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
|
||||
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, {})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user