Files
nvim/lua/plugins.lua
T

107 lines
4.5 KiB
Lua

vim.pack.add({
{ src = "https://github.com/ellisonleao/gruvbox.nvim" },
{ src = "https://github.com/stevearc/oil.nvim" },
{ src = "https://github.com/echasnovski/mini.pick" },
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", version = "main" },
{ src = "https://github.com/Saghen/blink.cmp", version = "v1.7.0" },
{ src = "https://github.com/mason-org/mason.nvim" },
{ src = "https://github.com/nvim-lualine/lualine.nvim.git" },
{ src = "https://github.com/chomosuke/typst-preview.nvim" },
{ src = "https://codeberg.org/mfussenegger/nvim-jdtls.git" },
{ src = "https://github.com/windwp/nvim-autopairs" },
{ src = "https://codeberg.org/mfussenegger/nvim-dap.git" },
{ src = "https://github.com/romgrk/barbar.nvim" },
{ src = "https://github.com/nvim-tree/nvim-web-devicons" },
{ src = "https://github.com/echasnovski/mini.ai" },
{ src = "https://github.com/windwp/nvim-ts-autotag" },
{ src = "https://github.com/folke/todo-comments.nvim" },
{ src = "https://github.com/stevearc/conform.nvim" },
{ src = "https://github.com/folke/flash.nvim" },
{ src = "https://github.com/lewis6991/gitsigns.nvim" },
{ src = "https://github.com/folke/trouble.nvim" },
{ src = "https://github.com/nvim-neotest/nvim-nio" },
{ src = "https://github.com/rcarriga/nvim-dap-ui" },
})
pcall(vim.cmd.colorscheme, "gruvbox")
vim.api.nvim_set_hl(0, "FlashLabel", { fg = "#1d2021", bg = "#fe8019", bold = true })
-- Simple setup({}) plugins
for _, name in ipairs({
"oil", "mini.pick", "mason", "typst-preview", "nvim-autopairs",
"trouble", "gitsigns", "nvim-web-devicons", "barbar",
"mini.ai", "nvim-ts-autotag", "todo-comments", "flash",
}) do
pcall(function() require(name).setup() end)
end
require("conform").setup({
formatters_by_ft = {
python = { "black" },
c = { "clang-format" },
cpp = { "clang-format" },
java = { "clang-format" },
javascript = { "prettierd", "prettier", stop_after_first = true },
typescript = { "prettierd", "prettier", stop_after_first = true },
svelte = { "prettierd", "prettier", stop_after_first = true },
css = { "prettierd", "prettier", stop_after_first = true },
html = { "prettierd", "prettier", stop_after_first = true },
json = { "prettierd", "prettier", stop_after_first = true },
},
format_on_save = { timeout_ms = 500, lsp_format = "fallback" },
})
require("lualine").setup({ options = { theme = "gruvbox_dark" } })
require("blink.cmp").setup({ keymap = { preset = "super-tab" } })
-- Treesitter (main branch: no configs.setup; install parsers manually)
require("nvim-treesitter").install({
"lua", "vim", "vimdoc", "bash", "c", "cpp", "rust", "python",
"javascript", "typescript", "tsx", "svelte", "css", "html",
"json", "toml", "yaml", "markdown", "markdown_inline",
"java", "typst", "vala",
})
vim.api.nvim_create_autocmd("FileType", {
callback = function()
local lang = vim.treesitter.language.get_lang(vim.bo.filetype)
if lang and not pcall(vim.treesitter.language.inspect, lang) then
require("nvim-treesitter").install(lang)
end
pcall(vim.treesitter.start)
end,
})
-- TS textobjects
local tso = require("nvim-treesitter-textobjects.select")
local textobj = { af = "@function.outer", ["if"] = "@function.inner",
ac = "@class.outer", ic = "@class.inner" }
for lhs, query in pairs(textobj) do
vim.keymap.set({ "x", "o" }, lhs,
function() tso.select_textobject(query, "textobjects") end)
end
-- Mason: ensure tools
local registry = require("mason-registry")
local ensure = {
"bash-language-server", "clang-format", "clangd", "java-debug-adapter",
"jdtls", "json-lsp", "lua-language-server", "rust-analyzer",
"svelte-language-server", "tailwindcss-language-server", "taplo",
"typescript-language-server", "pylsp", "black", "vala",
"prettierd",
}
registry.refresh(function()
for _, tool in ipairs(ensure) do
local ok, pkg = pcall(registry.get_package, tool)
if ok and not pkg:is_installed() then pkg:install() end
end
end)
-- DAP UI wiring
local dap, dapui = require("dap"), require("dapui")
dapui.setup()
dap.listeners.before.attach.dapui_config = function() dapui.open() end
dap.listeners.before.launch.dapui_config = function() dapui.open() end