194 lines
5.3 KiB
Lua
Executable File
194 lines
5.3 KiB
Lua
Executable File
return {
|
|
{
|
|
"nvim-telescope/telescope.nvim",
|
|
config = function()
|
|
local builtin = require("telescope.builtin")
|
|
vim.keymap.set("n", "<leader>pf", builtin.find_files, {})
|
|
vim.keymap.set("n", "<C-p>", builtin.git_files, {})
|
|
vim.keymap.set("n", "<leader>ps", function()
|
|
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
|
end)
|
|
end,
|
|
},
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
opts = {
|
|
ensure_installed = {
|
|
"c",
|
|
"lua",
|
|
"vim",
|
|
"vimdoc",
|
|
"query",
|
|
"markdown",
|
|
"markdown_inline",
|
|
"javascript",
|
|
"typescript",
|
|
"tsx",
|
|
"rust",
|
|
"zig",
|
|
},
|
|
sync_install = true,
|
|
auto_install = true,
|
|
highlight = {
|
|
enable = true,
|
|
additional_vim_regex_highlighting = false,
|
|
},
|
|
indent = {
|
|
enable = true,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
dependencies = {
|
|
"williamboman/mason.nvim",
|
|
"williamboman/mason-lspconfig.nvim",
|
|
"hrsh7th/cmp-nvim-lsp",
|
|
"hrsh7th/nvim-cmp",
|
|
"j-hui/fidget.nvim",
|
|
"L3MON4D3/LuaSnip",
|
|
"saadparwaiz1/cmp_luasnip",
|
|
"hrsh7th/cmp-nvim-lsp-signature-help",
|
|
},
|
|
config = function()
|
|
require("fidget").setup({})
|
|
require("mason").setup()
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
require("mason-lspconfig").setup({
|
|
ensure_installed = {
|
|
"ts_ls",
|
|
"lua_ls",
|
|
"rust_analyzer",
|
|
},
|
|
handlers = {
|
|
function(server)
|
|
require("lspconfig")[server].setup({ capabilities = capabilities })
|
|
end,
|
|
},
|
|
})
|
|
|
|
local cmp = require("cmp")
|
|
|
|
cmp.setup({
|
|
preselect = "item",
|
|
completion = {
|
|
completeopt = "menu,menuone,noinsert"
|
|
},
|
|
snippet = {
|
|
-- REQUIRED - you must specify a snippet engine
|
|
expand = function(args)
|
|
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
|
end,
|
|
},
|
|
|
|
mapping = cmp.mapping.preset.insert({
|
|
-- Simple tab complete
|
|
["<Tab>"] = cmp.mapping(function(fallback)
|
|
local col = vim.fn.col(".") - 1
|
|
|
|
if cmp.visible() then
|
|
cmp.select_next_item({ behavior = "select" })
|
|
elseif col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then
|
|
fallback()
|
|
else
|
|
cmp.complete()
|
|
end
|
|
end, { "i", "s" }),
|
|
|
|
-- Go to previous item
|
|
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = "select" }),
|
|
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
|
}),
|
|
|
|
sources = cmp.config.sources({
|
|
{ name = "nvim_lsp" },
|
|
{ name = "nvim_lsp_signature_help" },
|
|
}, {
|
|
{ name = "buffer" },
|
|
}),
|
|
})
|
|
end,
|
|
},
|
|
{
|
|
"stevearc/conform.nvim",
|
|
opts = {
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
rust = { "rustfmt", lsp_format = "fallback" },
|
|
javascript = { "prettier" },
|
|
typescript = { "prettier" },
|
|
json = { "prettier" },
|
|
tsx = { "prettier" },
|
|
},
|
|
format_on_save = {
|
|
-- These options will be passed to conform.format()
|
|
timeout_ms = 500,
|
|
lsp_format = "fallback",
|
|
},
|
|
},
|
|
},
|
|
{
|
|
"ThePrimeagen/harpoon",
|
|
branch = "harpoon2",
|
|
dependencies = { "nvim-lua/plenary.nvim" },
|
|
config = function()
|
|
local harpoon = require("harpoon")
|
|
harpoon:setup()
|
|
vim.keymap.set("n", "<leader>a", function()
|
|
harpoon:list():add()
|
|
end)
|
|
vim.keymap.set("n", "<C-e>", function()
|
|
harpoon.ui:toggle_quick_menu(harpoon:list())
|
|
end)
|
|
|
|
vim.keymap.set("n", "<C-h>", function()
|
|
harpoon:list():select(1)
|
|
end)
|
|
vim.keymap.set("n", "<C-t>", function()
|
|
harpoon:list():select(2)
|
|
end)
|
|
vim.keymap.set("n", "<C-n>", function()
|
|
harpoon:list():select(3)
|
|
end)
|
|
vim.keymap.set("n", "<C-s>", function()
|
|
harpoon:list():select(4)
|
|
end)
|
|
|
|
-- Toggle previous & next buffers stored within Harpoon list
|
|
vim.keymap.set("n", "<C-S-P>", function()
|
|
harpoon:list():prev()
|
|
end)
|
|
vim.keymap.set("n", "<C-S-N>", function()
|
|
harpoon:list():next()
|
|
end)
|
|
end,
|
|
},
|
|
{
|
|
"m4xshen/autoclose.nvim",
|
|
opts = {
|
|
keys = {
|
|
["("] = { escape = false, close = true, pair = "()" },
|
|
["["] = { escape = false, close = true, pair = "[]" },
|
|
["{"] = { escape = false, close = true, pair = "{}" },
|
|
|
|
[">"] = { escape = true, close = false, pair = "<>" },
|
|
[")"] = { escape = true, close = false, pair = "()" },
|
|
["]"] = { escape = true, close = false, pair = "[]" },
|
|
["}"] = { escape = true, close = false, pair = "{}" },
|
|
|
|
['"'] = { escape = true, close = true, pair = '""' },
|
|
["'"] = { escape = true, close = true, pair = "''" },
|
|
["`"] = { escape = true, close = true, pair = "``" },
|
|
},
|
|
options = {
|
|
disabled_filetypes = { "text", "TelescopePrompt" },
|
|
disable_when_touch = false,
|
|
touch_regex = "[%w(%[{]",
|
|
pair_spaces = false,
|
|
auto_indent = true,
|
|
disable_command_mode = false,
|
|
},
|
|
},
|
|
},
|
|
}
|