Files
nvim/lua/plugins.lua
T
2026-05-18 08:33:31 +02:00

179 lines
6.6 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/MeanderingProgrammer/render-markdown.nvim" },
{ src = "https://github.com/folke/trouble.nvim" },
{ src = "https://github.com/nvim-neotest/nvim-nio" },
{ src = "https://github.com/rcarriga/nvim-dap-ui" },
{ src = "https://github.com/michaelrommel/nvim-silicon" },
{ src = "https://github.com/hat0uma/csvview.nvim.git" },
})
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", "cssview",
}) do
pcall(function() require(name).setup() end)
end
local prettier = { "prettierd", "prettier", stop_after_first = true }
require("conform").setup({
formatters_by_ft = {
python = { "black" },
c = { "clang-format" },
cpp = { "clang-format" },
java = { "clang-format" },
javascript = prettier,
typescript = prettier,
css = prettier,
html = prettier,
json = prettier,
markdown = prettier,
yaml = prettier,
haskell = { "fourmolu" },
},
formatters = {
prettier = { prepend_args = { "--tab-width", "4", "--use-tabs", "false" } },
prettierd = { env = { PRETTIERD_DEFAULT_CONFIG = vim.fn.expand("~/.config/nvim/.prettierrc.json") } },
},
format_on_save = { timeout_ms = 2000, lsp_format = "fallback" },
})
require("render-markdown").setup({
latex = { enabled = true },
code = { inline_pad = 0, highlight_inline = "RenderMarkdownCode" },
})
local silicon_bg = {
typescript = "#1e3a5f",
javascript = "#5c4a1a",
java = "#5c2a1a",
svelte = "#5c1f0a",
css = "#1f3a5c",
python = "#1a3556",
haskell = "#3d1f5c",
c = "#2a3a4d",
cpp = "#2a4d3d",
swift = "#5c3a1a",
lua = "#1f1f5c",
markdown = "#3a2e1f",
tex = "#3a2e1f",
typst = "#3a2e1f",
toml = "#2e2e2e",
yaml = "#2e2e2e",
conf = "#2e2e2e",
ini = "#2e2e2e",
json = "#2e2e2e",
}
require("nvim-silicon").setup({
font = "JetBrainsMono Nerd Font=16",
theme = "gruvbox-dark",
pad_horiz = 60,
pad_vert = 50,
shadow_color = "#0a0a0a",
shadow_blur_radius = 10,
no_round_corner = true,
output = function()
return vim.fn.expand("~/Desktop/silicon_")
.. os.date("!%Y%m%dT%H%M%SZ") .. ".png"
end,
window_title = function()
return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":t")
end,
})
local function silicon_shot(to_clipboard)
local s = require("nvim-silicon")
s.options.background = silicon_bg[vim.bo.filetype] or "#1d2021"
if to_clipboard then s.clip() else s.file() end
end
vim.keymap.set("x", "<leader>cc", function() silicon_shot(true) end,
{ desc = "Silicon copy" })
vim.keymap.set("x", "<leader>cs", function() silicon_shot(false) end,
{ desc = "Silicon save" })
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
local ok, list = pcall(require("nvim-treesitter").language_list)
if ok and vim.list_contains(list, lang) then
require("nvim-treesitter").install(lang)
end
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",
al = "@loop.outer",
il = "@loop.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