This commit is contained in:
2025-06-10 13:27:05 -05:00
parent 8ee847db45
commit 39e6719d12
4 changed files with 148 additions and 145 deletions

View File

@@ -1,39 +1,39 @@
return { return {
"stevearc/conform.nvim", "stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
config = function() config = function()
local conform = require("conform") local conform = require("conform")
conform.setup({ conform.setup({
formatters_by_ft = { formatters_by_ft = {
javascript = { "prettier" }, javascript = { "prettier" },
typescript = { "prettier" }, typescript = { "prettier" },
javascriptreact = { "prettier" }, javascriptreact = { "prettier" },
typescriptreact = { "prettier" }, typescriptreact = { "prettier" },
svelte = { "prettier" }, svelte = { "prettier" },
css = { "prettier" }, css = { "prettier" },
html = { "prettier" }, html = { "prettier", "djlint" },
json = { "prettier" }, json = { "prettier" },
yaml = { "prettier" }, yaml = { "prettier" },
markdown = { "prettier" }, markdown = { "prettier" },
graphql = { "prettier" }, graphql = { "prettier" },
liquid = { "prettier" }, liquid = { "prettier" },
lua = { "stylua" }, lua = { "stylua" },
python = { "isort", "black" }, python = { "isort", "black" },
}, },
format_on_save = { format_on_save = {
lsp_fallback = true, lsp_fallback = true,
async = false, async = false,
timeout_ms = 1000, timeout_ms = 1000,
}, },
}) })
vim.keymap.set({ "n", "v" }, "<leader>mp", function() vim.keymap.set({ "n", "v" }, "<leader>mp", function()
conform.format({ conform.format({
lsp_fallback = true, lsp_fallback = true,
async = false, async = false,
timeout_ms = 1000, timeout_ms = 1000,
}) })
end, { desc = "Format file or range (in visual mode)" }) end, { desc = "Format file or range (in visual mode)" })
end, end,
} }

View File

@@ -49,6 +49,7 @@ return {
"pylint", -- python linter "pylint", -- python linter
"eslint_d", -- js linter "eslint_d", -- js linter
"django-template-lsp", "django-template-lsp",
"djlint",
}, },
}) })
end, end,

View File

@@ -1,63 +1,63 @@
return { return {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
event = "InsertEnter", event = "InsertEnter",
dependencies = { dependencies = {
"hrsh7th/cmp-buffer", -- source for text in buffer "hrsh7th/cmp-buffer", -- source for text in buffer
"hrsh7th/cmp-path", -- source for file system paths "hrsh7th/cmp-path", -- source for file system paths
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
-- follow latest release. -- follow latest release.
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release) version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!). -- install jsregexp (optional!).
build = "make install_jsregexp", build = "make install_jsregexp",
}, },
"saadparwaiz1/cmp_luasnip", -- for autocompletion "saadparwaiz1/cmp_luasnip", -- for autocompletion
"rafamadriz/friendly-snippets", -- useful snippets "rafamadriz/friendly-snippets", -- useful snippets
"onsails/lspkind.nvim", -- vs-code like pictograms "onsails/lspkind.nvim", -- vs-code like pictograms
}, },
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
local lspkind = require("lspkind") local lspkind = require("lspkind")
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets) -- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({ cmp.setup({
completion = { completion = {
completeopt = "menu,menuone,preview,noselect", completeopt = "menu,menuone,preview,noselect",
}, },
snippet = { -- configure how nvim-cmp interacts with snippet engine snippet = { -- configure how nvim-cmp interacts with snippet engine
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
end, end,
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion ["<S-Tab>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion ["<Tab>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions ["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-e>"] = cmp.mapping.abort(), -- close completion window ["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<CR>"] = cmp.mapping.confirm({ select = false }), ["<CR>"] = cmp.mapping.confirm({ select = false }),
}), }),
-- sources for autocompletion -- sources for autocompletion
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "nvim_lsp"}, { name = "nvim_lsp" },
{ name = "luasnip" }, -- snippets { name = "luasnip" }, -- snippets
{ name = "buffer" }, -- text within current buffer { name = "buffer" }, -- text within current buffer
{ name = "path" }, -- file system paths { name = "path" }, -- file system paths
}), }),
-- configure lspkind for vs-code like pictograms in completion menu -- configure lspkind for vs-code like pictograms in completion menu
formatting = { formatting = {
format = lspkind.cmp_format({ format = lspkind.cmp_format({
maxwidth = 50, maxwidth = 50,
ellipsis_char = "...", ellipsis_char = "...",
}), }),
}, },
}) })
end, end,
} }

View File

@@ -1,57 +1,59 @@
return { return {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate", build = ":TSUpdate",
dependencies = { dependencies = {
"windwp/nvim-ts-autotag", "windwp/nvim-ts-autotag",
}, },
config = function() config = function()
-- import nvim-treesitter plugin -- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs") local treesitter = require("nvim-treesitter.configs")
-- configure treesitter -- configure treesitter
treesitter.setup({ -- enable syntax highlighting treesitter.setup({ -- enable syntax highlighting
highlight = { highlight = {
enable = true, enable = true,
}, },
-- enable indentation -- enable indentation
indent = { enable = true }, indent = { enable = true },
-- enable autotagging (w/ nvim-ts-autotag plugin) -- enable autotagging (w/ nvim-ts-autotag plugin)
autotag = { autotag = {
enable = true, enable = true,
}, },
-- ensure these language parsers are installed -- ensure these language parsers are installed
ensure_installed = { ensure_installed = {
"json", "json",
"javascript", "javascript",
"typescript", "typescript",
"tsx", "tsx",
"yaml", "yaml",
"html", "html",
"css", "htmldjango",
"prisma", "php",
"markdown", "css",
"markdown_inline", "prisma",
"svelte", "markdown",
"graphql", "markdown_inline",
"bash", "python",
"lua", "svelte",
"vim", "bash",
"dockerfile", "lua",
"gitignore", "vim",
"query", "dockerfile",
"vimdoc", "gitignore",
"c", "query",
}, "vimdoc",
incremental_selection = { "c",
enable = true, },
keymaps = { incremental_selection = {
init_selection = "<C-space>", enable = true,
node_incremental = "<C-space>", keymaps = {
scope_incremental = false, init_selection = "<C-space>",
node_decremental = "<bs>", node_incremental = "<C-space>",
}, scope_incremental = false,
}, node_decremental = "<bs>",
}) },
end, },
})
end,
} }