257 lines
7.5 KiB
Lua
257 lines
7.5 KiB
Lua
return {
|
|
{
|
|
"mason-org/mason.nvim",
|
|
lazy = false,
|
|
--cmd = { "Mason", "MasonInstall", "MasonUninstall", "MasonUpdate", "MasonUninstallAll", "MasonLog" },
|
|
opts = {},
|
|
},
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
lazy = false,
|
|
build = ":TSUpdate",
|
|
event = { "BufRead" },
|
|
opts = {
|
|
sync_install = false,
|
|
auto_install = true,
|
|
highlight = {
|
|
enable = true,
|
|
-- disable for files bigger than 500KB
|
|
disable = function(lang, buf)
|
|
local max_filesize = 500 * 1024 -- 500 KB
|
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
|
if ok and stats and stats.size > max_filesize then return true end
|
|
end,
|
|
additional_vim_regex_highlighting = false,
|
|
},
|
|
indent = {
|
|
enable = true,
|
|
},
|
|
ensure_installed = {
|
|
"html",
|
|
"javascript",
|
|
"gdscript",
|
|
"lua",
|
|
"php",
|
|
"python",
|
|
"rust",
|
|
"typescript",
|
|
"vim",
|
|
},
|
|
},
|
|
},
|
|
{
|
|
"mason-org/mason-lspconfig.nvim",
|
|
lazy = false,
|
|
opts = {
|
|
ensure_installed = {
|
|
"rust_analyzer",
|
|
"ruff",
|
|
--"quick_lint_js",
|
|
--"eslint",
|
|
"html",
|
|
"cssls",
|
|
"gdscript",
|
|
"sqls",
|
|
"hyprls",
|
|
"lua_ls",
|
|
"ast-grep",
|
|
-- "pylyzer",
|
|
"vimls",
|
|
"ts_ls",
|
|
},
|
|
automatic_enable = { true, rust_analyzer = false },
|
|
},
|
|
config = function()
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
|
callback = function(ev)
|
|
-- Enable completion triggered by <c-x><c-o>
|
|
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
|
vim.keymap.set("n", "<leader>le", vim.diagnostic.open_float)
|
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
|
vim.keymap.set("n", "<leader>K", vim.lsp.buf.hover, opts)
|
|
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
|
|
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
|
vim.keymap.set("n", "<leader>f", function() vim.lsp.buf.format({ async = true }) end, opts)
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
lazy = false, -- REQUIRED: tell lazy.nvim to start this plugin at startup
|
|
dependencies = {
|
|
-- main one
|
|
{ "ms-jpq/coq_nvim", branch = "coq", lazy = false },
|
|
|
|
-- 9000+ Snippets
|
|
{ "ms-jpq/coq.artifacts", branch = "artifacts", lazy = false },
|
|
|
|
-- lua & third party sources -- See https://github.com/ms-jpq/coq.thirdparty
|
|
-- Need to **configure separately**
|
|
--{ "ms-jpq/coq.thirdparty", branch = "3p", lazy = false },
|
|
-- - shell repl
|
|
-- - nvim lua api
|
|
-- - scientific calculator
|
|
-- - comment banner
|
|
-- - etc
|
|
},
|
|
init = function()
|
|
vim.g.coq_settings = {
|
|
auto_start = true, -- if you want to start COQ at startup
|
|
-- Your COQ settings here
|
|
display = { statusline = { helo = false } }, -- disable greeting notification
|
|
}
|
|
end,
|
|
config = function()
|
|
vim.lsp.config(
|
|
"rust_analyzer",
|
|
coq.lsp_ensure_capabilities({
|
|
settings = {
|
|
["rust-analyzer"] = {
|
|
imports = {
|
|
granularity = {
|
|
group = "module",
|
|
},
|
|
prefix = "self",
|
|
},
|
|
cargo = {
|
|
buildScripts = {
|
|
enable = true,
|
|
},
|
|
},
|
|
procMacro = {
|
|
enable = true,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
)
|
|
vim.lsp.config("gdscript", coq.lsp_ensure_capabilities({}))
|
|
|
|
--vim.lsp.enable({ "lua_ls" })
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
|
callback = function(ev)
|
|
-- Enable completion triggered by <c-x><c-o>
|
|
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
|
vim.keymap.set("n", "<leader>le", vim.diagnostic.open_float)
|
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
|
vim.keymap.set("n", "<leader>K", vim.lsp.buf.hover, opts)
|
|
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
|
|
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
|
vim.keymap.set("n", "<leader>f", function() vim.lsp.buf.format({ async = true }) end, opts)
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
{
|
|
"mfussenegger/nvim-lint",
|
|
event = { "BufWritePre", "InsertLeave" },
|
|
lazy = true,
|
|
opts = {
|
|
linters_by_ft = {
|
|
cpp = { "cpplint" },
|
|
gdscript = { "gdlint" },
|
|
gitcommit = { "commitlint" },
|
|
lua = { "ast-grep" },
|
|
fish = { "fish_lsp" },
|
|
markdown = {},
|
|
sql = { "sqruff" },
|
|
python = { "ruff" },
|
|
r = { "r-languageserver" },
|
|
javascript = { "eslint" },
|
|
typescript = { "eslint" },
|
|
},
|
|
},
|
|
config = function()
|
|
local lint = require("lint")
|
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
|
callback = function() lint.try_lint() end,
|
|
})
|
|
end,
|
|
},
|
|
-- supposedly faster formatter
|
|
{
|
|
"stevearc/conform.nvim",
|
|
lazy = true,
|
|
event = { "BufWritePre" },
|
|
|
|
--keys = { "<leader>i", "F3" },
|
|
opts = {
|
|
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
|
pattern = "*",
|
|
callback = function(args) require("conform").format({ bufnr = args.buf }) end,
|
|
}),
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
rust = { "rustfmt", lsp_format = "fallback" },
|
|
-- Conform will run multiple formatters sequentially
|
|
python = { "ruff", "autopep8", lsp_format = "fallback" },
|
|
gdscript = { "gdformat" },
|
|
bash = { "shellharden" },
|
|
javascript = { "biome" },
|
|
typescript = { "biome" },
|
|
markdown = { "prettier" },
|
|
r = { "air" }, -- how to make air use tabs not spaces
|
|
css = { "ast-grep" },
|
|
html = { "ast-grep" },
|
|
-- sql = { "sqruff" },
|
|
json = { "biome" },
|
|
yaml = { "biome" },
|
|
vue = { "biome" },
|
|
},
|
|
format_on_save = {
|
|
timeout_ms = 700,
|
|
lsp_format = "fallback",
|
|
},
|
|
log_level = vim.log.levels.WARNING,
|
|
function()
|
|
require("conform").formatters.prettier = {
|
|
inherit = true,
|
|
command = "prettier",
|
|
prepend_args = { "--tab-width", "4" },
|
|
}
|
|
require("conform").formatters.biome = {
|
|
command = "biome format",
|
|
prepend_args = "--indent-width=4 --use-editorconfig=true",
|
|
}
|
|
require("lua").formatters.stylua = {
|
|
prepend = "--column-width=80",
|
|
}
|
|
end,
|
|
},
|
|
},
|
|
{ "nvim-treesitter/nvim-treesitter-textobjects", lazy = true, event = "BufRead" },
|
|
{
|
|
"nvim-treesitter/nvim-treesitter-context",
|
|
lazy = true,
|
|
event = "BufRead",
|
|
opts = {
|
|
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
|
max_lines = 4, -- How many lines the window should span. Values <= 0 mean no limit.
|
|
min_window_height = 35, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
|
line_numbers = true,
|
|
lazy = true,
|
|
multiline_threshold = 4, -- Maximum number of lines to show for a single context
|
|
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
|
mode = "topline", -- Line used to calculate context. Choices: 'cursor', 'topline'.
|
|
-- Separator between context and content. Should be a single character string, like '-'.
|
|
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
|
separator = "—",
|
|
zindex = 20, -- The Z-index of the context window
|
|
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
|
|
},
|
|
},
|
|
{
|
|
"jubnzv/virtual-types.nvim",
|
|
lazy = false,
|
|
},
|
|
}
|