Files
public-dotfiles/nvim/lua/plugins/plugins.lua
2026-03-20 16:44:13 +01:00

247 lines
7.4 KiB
Lua

return {
-- Theme
{
-- Theme inspired by Atom
'navarasu/onedark.nvim',
priority = 1000,
lazy = false,
config = function()
require('onedark').setup {
-- Set a style preset. 'dark' is default.
style = 'dark', -- dark, darker, cool, deep, warm, warmer, light
hightlights = {
Comment = { fg = '#5c6370', bg = 'NONE', fmt = 'italic' }, -- gray foreground
["@comment"] = { fg = '#5c6370', bg = 'NONE', fmt = 'italic' }, -- gray foreground
["@comment.go"] = { fg = '#5c6370', fmt = 'italic' },
}
}
require('onedark').load()
-- Force override after theme loads
vim.schedule(function()
local comment_gray = '#5c6370'
vim.api.nvim_set_hl(0, 'Comment', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, '@comment', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, '@comment.go', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, '@comment.documentation', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, 'SpecialComment', { fg = comment_gray, italic = true })
vim.api.nvim_set_hl(0, '@lsp.type.comment', { fg = comment_gray, italic = true })
end)
end,
},
-- Icons (used by telescope, mini.files, etc.)
"nvim-tree/nvim-web-devicons",
-- Vim plugins
"windwp/nvim-autopairs",
-- Git
"tpope/vim-fugitive",
"tpope/vim-rhubarb",
{
"linrongbin16/gitlinker.nvim",
cmd = "GitLink",
opts = {},
keys = {
{ "<leader>gy", "<cmd>GitLink<cr>", mode = { "n", "v" }, desc = "Yank git link" },
{ "<leader>gY", "<cmd>GitLink!<cr>", mode = { "n", "v" }, desc = "Open git link" },
},
},
-- Vim
{
"lervag/vimtex",
lazy = false, -- we don't want to lazy load VimTeX
-- tag = "v2.15", -- uncomment to pin to a specific release
init = function()
-- VimTeX configuration goes here, e.g.
vim.g.vimtex_view_method = "zathura"
end
},
"tpope/vim-commentary",
"tpope/vim-surround",
-- "christoomey/vim-tmux-navigator",
"AndrewRadev/linediff.vim",
{ "echasnovski/mini.files", version = false },
-- Nvim plugins
{"nvim-treesitter/nvim-treesitter", branch = 'master', lazy = false, build = ":TSUpdate"},
{ "nvim-treesitter/nvim-treesitter-context" },
'danymat/neogen',
"lukas-reineke/indent-blankline.nvim",
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip"
},
config = function()
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local cmp = require('cmp')
local luasnip = require('luasnip')
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
completion = {
autocomplete = { require('cmp.types').cmp.TriggerEvent.TextChanged },
},
mapping = cmp.mapping.preset.insert ({
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<s-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<c-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select=true }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
}
})
end
},
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-path",
{
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim"
},
config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('mason').setup()
require('mason-lspconfig').setup({
ensure_installed = { "pyright", "gopls" },
handlers = {
-- Default handler for all servers
function(server_name)
require('lspconfig')[server_name].setup({
capabilities = capabilities,
})
end,
-- gopls with Go-specific settings
["gopls"] = function()
require('lspconfig').gopls.setup({
capabilities = capabilities,
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
gofumpt = true,
},
},
})
end,
},
})
end
},
"nvim-lua/plenary.nvim",
-- "jose-elias-alvarez/null-ls.nvim",
-- "jose-elias-alvarez/typescript.nvim",
-- "iamcco/markdown-preview.nvim", -- { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
-- { "olimorris/persisted.nvim", dev = true },
-- "folke/tokyonight.nvim", -- { 'branch': 'main' }
"lewis6991/gitsigns.nvim",
"williamboman/mason.nvim", -- { 'do': ':MasonUpdate' }
"williamboman/mason-lspconfig.nvim",
{
'ThePrimeagen/harpoon',
branch = 'harpoon2',
opts = {
menu = {
width = vim.api.nvim_win_get_width(0) - 4,
},
},
keys = {
{
'<leader>q',
function()
require('harpoon'):list():add()
end,
desc = 'Harpoon File',
},
{
'<C-e>',
function()
local harpoon = require('harpoon')
harpoon.ui:toggle_quick_menu(harpoon:list())
end,
desc = 'Harpoon Quick Menu',
},
{
'<M-q>',
function()
require('harpoon'):list():select(1)
end,
desc = 'Harpoon to File 1',
},
{
'<M-w>',
function()
require('harpoon'):list():select(2)
end,
desc = 'Harpoon to File 2',
},
{
'<M-e>',
function()
require('harpoon'):list():select(3)
end,
desc = 'Harpoon to File 3',
},
{
'<M-r>',
function()
require('harpoon'):list():select(4)
end,
desc = 'Harpoon to File 4',
},
{
'<M-t>',
function()
require('harpoon'):list():select(5)
end,
desc = 'Harpoon to File 5',
},
},
},
}