1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2026-03-28 18:34:46 +01:00

NVIM: Split opts and config for lazy plugins

This commit is contained in:
2026-03-26 07:53:23 +01:00
parent 3c3cfd333d
commit d1e73e1c7d
25 changed files with 341 additions and 388 deletions

View File

@@ -10,8 +10,7 @@ return {
desc = "LSP: format", desc = "LSP: format",
}, },
}, },
config = function() opts = {
require("conform").setup({
formatters_by_ft = { formatters_by_ft = {
lua = { "stylua" }, lua = { "stylua" },
markdown = { "mdformat" }, markdown = { "mdformat" },
@@ -22,6 +21,5 @@ return {
tex = { "latexindent" }, tex = { "latexindent" },
yaml = { "yamlfmt" }, yaml = { "yamlfmt" },
}, },
}) },
end,
} }

View File

@@ -3,8 +3,7 @@ return {
"hat0uma/csvview.nvim", "hat0uma/csvview.nvim",
ft = "csv", ft = "csv",
cmd = { "CsvViewEnable", "CsvViewDisable", "CsvViewToggle" }, cmd = { "CsvViewEnable", "CsvViewDisable", "CsvViewToggle" },
config = function() opts = {
require("csvview").setup({
parser = { comments = { "#", "//" } }, parser = { comments = { "#", "//" } },
keymaps = { keymaps = {
textobject_field_inner = { "if", mode = { "o", "x" } }, textobject_field_inner = { "if", mode = { "o", "x" } },
@@ -14,7 +13,10 @@ return {
jump_next_row = { "<Enter>", mode = { "n", "v" } }, jump_next_row = { "<Enter>", mode = { "n", "v" } },
jump_prev_row = { "<S-Enter>", mode = { "n", "v" } }, jump_prev_row = { "<S-Enter>", mode = { "n", "v" } },
}, },
}) },
require("csvview").enable() config = function(_, opts)
local csvview = require("csvview")
csvview.setup(opts)
csvview.enable()
end, end,
} }

View File

@@ -46,12 +46,11 @@ return {
desc = "LSP: close all preview windows", desc = "LSP: close all preview windows",
}, },
}, },
config = function() opts = {
require("goto-preview").setup({
border = "rounded", border = "rounded",
preview_window_title = { enable = true, position = "center" }, preview_window_title = { enable = true, position = "center" },
post_open_hook = function(bufnr, winid) post_open_hook = function(bufnr, _)
local close = function() local close = function()
require("goto-preview").close_all_win() require("goto-preview").close_all_win()
end end
@@ -59,6 +58,5 @@ return {
vim.keymap.set("n", "<c-h>", close, { buffer = bufnr, silent = true }) vim.keymap.set("n", "<c-h>", close, { buffer = bufnr, silent = true })
vim.keymap.set("n", "q", close, { buffer = bufnr, silent = true }) vim.keymap.set("n", "q", close, { buffer = bufnr, silent = true })
end, end,
}) },
end,
} }

View File

@@ -4,9 +4,7 @@ return {
keys = { keys = {
{ {
"<leader>p", "<leader>p",
function() function() require("knap").toggle_autopreviewing() end,
require("knap").toggle_autopreviewing()
end,
desc = "Knap: toggle autopreview", desc = "Knap: toggle autopreview",
}, },
}, },

View File

@@ -2,17 +2,14 @@ return {
-- statusline -- statusline
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
dependencies = { dependencies = {
{
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
lazy = true, "tiyn/tccs.nvim",
},
{ {
"f-person/git-blame.nvim", "f-person/git-blame.nvim",
config = function() config = function()
vim.g.gitblame_display_virtual_text = 0 vim.g.gitblame_display_virtual_text = 0
end, end,
}, },
{ "tiyn/tccs.nvim" },
{ {
"tiyn/action-hints.nvim", "tiyn/action-hints.nvim",
config = function() config = function()
@@ -27,8 +24,7 @@ return {
end, end,
}, },
}, },
config = function() opts = {
require("lualine").setup({
options = { options = {
globalstatus = true, globalstatus = true,
symbols = { symbols = {
@@ -44,13 +40,19 @@ return {
sections = { sections = {
lualine_b = { lualine_b = {
{ {
require("gitblame").get_current_blame_text, function()
cond = require("gitblame").is_blame_text_available, return require("gitblame").get_current_blame_text()
end,
cond = function()
return require("gitblame").is_blame_text_available()
end,
}, },
}, },
lualine_c = {}, lualine_c = {},
lualine_x = { lualine_x = {
require("action-hints").statusline, function()
return require("action-hints").statusline()
end,
"encoding", "encoding",
"fileformat", "fileformat",
{ {
@@ -75,6 +77,5 @@ return {
}, },
lualine_z = { "progress", "location" }, lualine_z = { "progress", "location" },
}, },
}) },
end,
} }

View File

@@ -1,7 +1,5 @@
return { return {
-- decorations for the current line mode -- decorations for the current line mode
"mvllow/modes.nvim", "mvllow/modes.nvim",
config = function() opts = {},
require("modes").setup()
end,
} }

View File

@@ -65,8 +65,7 @@ return {
desc = "Quarto: Run all cells of all languages", desc = "Quarto: Run all cells of all languages",
}, },
}, },
config = function() opts = {
require("quarto").setup({
lspFeatures = { lspFeatures = {
languages = { "python" }, languages = { "python" },
chunks = "all", chunks = "all",
@@ -82,11 +81,14 @@ return {
enabled = true, enabled = true,
default_method = "molten", default_method = "molten",
}, },
}) },
config = function(_, opts)
local quarto = require("quarto")
quarto.setup(opts)
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown", pattern = "markdown",
callback = function() callback = function()
require("quarto").activate() quarto.activate()
end, end,
}) })
end, end,

View File

@@ -17,7 +17,7 @@ return {
end, end,
version = "v2.*", version = "v2.*",
-- build = "make install_jsregexp", -- build = "make install_jsregexp",
dependencies = { "saadparwaiz1/cmp_luasnip" }, dependencies = "saadparwaiz1/cmp_luasnip",
}, },
}, },
config = function() config = function()

View File

@@ -3,8 +3,7 @@ return {
"martineausimon/nvim-lilypond-suite", "martineausimon/nvim-lilypond-suite",
ft = "lilypond", ft = "lilypond",
dependencies = "uga-rosa/cmp-dictionary", dependencies = "uga-rosa/cmp-dictionary",
config = function() opts = {
require("nvls").setup({
lilypond = { lilypond = {
mappings = { mappings = {
player = "<NOP>", player = "<NOP>",
@@ -27,7 +26,10 @@ return {
}, },
}, },
}, },
}) },
config = function(_, opts)
local nvls = require("nvls")
nvls.setup(opts)
local lily_dicts = { local lily_dicts = {
"~/.local/share/nvim/lazy/nvim-lilypond-suite/lilywords/keywords", "~/.local/share/nvim/lazy/nvim-lilypond-suite/lilywords/keywords",
"~/.local/share/nvim/lazy/nvim-lilypond-suite/lilywords/musicCommands", "~/.local/share/nvim/lazy/nvim-lilypond-suite/lilywords/musicCommands",
@@ -37,37 +39,30 @@ return {
} }
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = "lilypond", pattern = "lilypond",
callback = function() callback = function(args)
local bufnr = args.buf
require("cmp_dictionary").setup({ require("cmp_dictionary").setup({
paths = lily_dicts, paths = lily_dicts,
}) })
end,
})
local fluidsynth_job = nil local fluidsynth_job = nil
vim.keymap.set("n", "<leader>pm", function() vim.keymap.set("n", "<leader>pm", function()
local midi = vim.fn.expand("%:r") .. ".midi" local midi = vim.fn.expand("%:r") .. ".midi"
if fluidsynth_job then if fluidsynth_job then
vim.fn.jobstop(fluidsynth_job) vim.fn.jobstop(fluidsynth_job)
fluidsynth_job = nil fluidsynth_job = nil
print("fluidsynth stopped") print("fluidsynth stopped")
return return
end end
fluidsynth_job = vim.fn.jobstart({ "fluidsynth", "-i", midi }) fluidsynth_job = vim.fn.jobstart({ "fluidsynth", "-i", midi })
print("fluidsynth playing (Ctrl-C to stop)") print("fluidsynth playing (Ctrl-C to stop)")
end, { end, {
buffer = bufnr, buffer = bufnr,
desc = "Lilypond: output MIDI", desc = "Lilypond: output MIDI",
}) })
vim.keymap.set("n", "<leader>pp", "<cmd>Viewer<CR>", { vim.keymap.set("n", "<leader>pp", "<cmd>Viewer<CR>", {
buffer = bufnr, buffer = bufnr,
desc = "Lilypond: open PDF", desc = "Lilypond: open PDF",
}) })
vim.keymap.set("n", "<C-c>", function() vim.keymap.set("n", "<C-c>", function()
if fluidsynth_job then if fluidsynth_job then
vim.fn.jobstop(fluidsynth_job) vim.fn.jobstop(fluidsynth_job)
@@ -80,16 +75,16 @@ return {
buffer = bufnr, buffer = bufnr,
desc = "Stop MIDI playback", desc = "Stop MIDI playback",
}) })
if vim.b[bufnr].first_start_lilypond then
if vim.b.first_start_lilypond then
return return
end end
vim.b.first_start_lilypond = true vim.b[bufnr].first_start_lilypond = true
vim.schedule(function() vim.schedule(function()
if vim.fn.exists(":Viewer") == 2 then if vim.fn.exists(":Viewer") == 2 then
vim.cmd.Viewer() vim.cmd.Viewer()
end end
end) end)
end, end,
})
end,
} }

View File

@@ -19,47 +19,32 @@ return {
end, end,
}, },
}, },
config = function() opts = {
require("mason-lspconfig").setup({
automatic_setup = true, automatic_setup = true,
ensure_installed = { ensure_installed = {
-- assembler
"asm_lsp", "asm_lsp",
-- c
"clangd", "clangd",
-- docker
"dockerls", "dockerls",
-- go
"gopls", "gopls",
-- html
"html", "html",
-- json
"jsonls", "jsonls",
-- xml
"lemminx", "lemminx",
-- latex
"ltex", "ltex",
"texlab", "texlab",
-- lua
"lua_ls", "lua_ls",
-- markdown
"marksman", "marksman",
-- nim
"nimls", "nimls",
-- python
"pyright", "pyright",
-- r
"r_language_server", "r_language_server",
-- shell
"bashls", "bashls",
-- sql
"sqlls", "sqlls",
-- typescript / javascript
"ts_ls", "ts_ls",
-- yaml
"yamlls", "yamlls",
}, },
}) },
config = function(_, opts)
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup(opts)
local default_flags = { local default_flags = {
debounce_text_changes = 150, debounce_text_changes = 150,
allow_incremental_sync = true, allow_incremental_sync = true,
@@ -69,7 +54,6 @@ return {
ltex = { ltex = {
settings = { settings = {
ltex = { ltex = {
-- language = "de-DE",
enabled = { "latex", "markdown" }, enabled = { "latex", "markdown" },
dictionary = Dictionaries, dictionary = Dictionaries,
}, },
@@ -95,10 +79,16 @@ return {
}) })
) )
end end
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local bufnr = args.buf
local opts = { buffer = bufnr }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, opts) vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, opts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
end, end,
})
end,
} }

View File

@@ -5,39 +5,18 @@ return {
"kevinhwang91/nvim-hlslens", "kevinhwang91/nvim-hlslens",
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
}, },
config = function() opts = {
require("scrollbar").setup({
marks = { marks = {
Cursor = { Cursor = { highlight = "Normal" },
highlight = "Normal", Search = { highlight = "Special" },
}, Error = { highlight = "DiagnosticSignError" },
Search = { Warn = { highlight = "DiagnosticSignWarn" },
highlight = "Special", Info = { highlight = "DiagnosticSignInfo" },
}, Hint = { highlight = "DiagnosticSignHint" },
Error = { Misc = { highlight = "Special" },
highlight = "DiagnosticSignError", GitAdd = { highlight = "GitGutterAdd" },
}, GitChange = { highlight = "GitGutterChange" },
Warn = { GitDelete = { highlight = "GitGutterDelete" },
highlight = "DiagnosticSignWarn",
},
Info = {
highlight = "DiagnosticSignInfo",
},
Hint = {
highlight = "DiagnosticSignHint",
},
Misc = {
highlight = "Special",
},
GitAdd = {
highlight = "GitGutterAdd",
},
GitChange = {
highlight = "GitGutterChange",
},
GitDelete = {
highlight = "GitGutterDelete",
},
}, },
excluded_filetypes = { excluded_filetypes = {
"cmp_docs", "cmp_docs",
@@ -50,7 +29,10 @@ return {
"FTerm", "FTerm",
"", "",
}, },
}) },
config = function(_, opts)
local scrollbar = require("scrollbar")
scrollbar.setup(opts)
require("scrollbar.handlers.search").setup() require("scrollbar.handlers.search").setup()
require("scrollbar.handlers.gitsigns").setup() require("scrollbar.handlers.gitsigns").setup()
end, end,

View File

@@ -15,8 +15,7 @@ return {
desc = "File tree: toggle", desc = "File tree: toggle",
}, },
}, },
config = function() opts = {
require("nvim-tree").setup({
sort_by = "case_sensitive", sort_by = "case_sensitive",
view = { view = {
width = 30, width = 30,
@@ -32,6 +31,5 @@ return {
}, },
}, },
}, },
}) },
end,
} }

View File

@@ -4,9 +4,16 @@ return {
build = ":TSUpdate", build = ":TSUpdate",
dependencies = { dependencies = {
-- automatically close html-tags -- automatically close html-tags
{
"windwp/nvim-ts-autotag", "windwp/nvim-ts-autotag",
-- color brackets opts = {
-- 'p00f/nvim-ts-rainbow', opts = {
enable_close = true,
enable_rename = true,
},
},
},
-- 'p00f/nvim-ts-rainbow', -- color brackets
"nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/nvim-treesitter-context",
}, },
config = function() config = function()
@@ -24,11 +31,5 @@ return {
"lua", "lua",
"yaml", "yaml",
}) })
require("nvim-ts-autotag").setup({
opts = {
enable_close = true,
enable_rename = true,
},
})
end, end,
} }

View File

@@ -8,14 +8,11 @@ return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
{ {
"folke/edgy.nvim", "folke/edgy.nvim",
event = "VeryLazy", event = "VeryLazy",
init = function() init = function()
vim.opt.laststatus = 3 vim.opt.laststatus = 3
vim.opt.splitkeep = "screen" -- or "topline" or "screen" vim.opt.splitkeep = "screen" -- or "topline" or "screen"
end, end,
opts = { opts = {
exit_when_last = false, exit_when_last = false,
animate = { animate = {

View File

@@ -1,4 +1,5 @@
return { return {
-- tree-like outline sidebar
"hedyhli/outline.nvim", "hedyhli/outline.nvim",
keys = { keys = {
{ {
@@ -7,14 +8,12 @@ return {
desc = "CTags: toggle", desc = "CTags: toggle",
}, },
}, },
config = function() opts = {
require("outline").setup({
outline_window = { outline_window = {
width = 25, width = 25,
}, },
symbols = { symbols = {
icon_source = "lspkind", icon_source = "lspkind",
}, },
}) },
end,
} }

View File

@@ -7,10 +7,7 @@ return {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
}, },
config = function() opts = {
require("papis").setup({
-- Your configuration goes here
enable_keymaps = false, enable_keymaps = false,
}) },
end,
} }

View File

@@ -14,22 +14,22 @@ return {
desc = "Telescope: find projects", desc = "Telescope: find projects",
}, },
}, },
config = function() opts = {
require("projections").setup({ workspaces = {
workspaces = { -- Default workspaces to search for
{ "~/code/main", { ".git" } }, { "~/code/main", { ".git" } },
{ "~/code/uni", { ".git" } }, { "~/code/uni", { ".git" } },
}, },
store_hooks = { store_hooks = {
pre = function() pre = function()
-- nvim-tree local ok, api = pcall(require, "nvim-tree.api")
local nvim_tree_present, api = pcall(require, "nvim-tree.api") if ok then
if nvim_tree_present then
api.tree.close() api.tree.close()
end end
end, end,
}, },
}) },
config = function(_, opts)
require("projections").setup(opts)
require("telescope").load_extension("projections") require("telescope").load_extension("projections")
end, end,
} }

View File

@@ -1,6 +1,5 @@
return { return {
-- improve spelling check for coding to feature camelcase, etc -- improve spelling check for coding to feature camelcase, etc
{
"kamykn/spelunker.vim", "kamykn/spelunker.vim",
dependencies = { "kamykn/popup-menu.nvim" }, dependencies = { "kamykn/popup-menu.nvim" },
keys = { keys = {
@@ -20,5 +19,4 @@ return {
vim.g.enable_spelunker_vim = 0 vim.g.enable_spelunker_vim = 0
vim.g.spelunker_disable_acronym_checking = 1 vim.g.spelunker_disable_acronym_checking = 1
end, end,
},
} }

View File

@@ -3,9 +3,7 @@ return {
"tiyn/tccs.nvim", "tiyn/tccs.nvim",
lazy = false, lazy = false,
priority = 1000, priority = 1000,
config = function() opts = {
require("tccs").setup({
require("tccs").load(), require("tccs").load(),
}) },
end,
} }

View File

@@ -3,11 +3,12 @@ return {
"mcauley-penney/tidy.nvim", "mcauley-penney/tidy.nvim",
branch = "main", branch = "main",
ft = { "markdown", "tex" }, ft = { "markdown", "tex" },
config = function() opts = {
local tidy = require("tidy")
tidy.setup({
filetype_exclude = { "diff" }, filetype_exclude = { "diff" },
}) },
config = function(_, opts)
local tidy = require("tidy")
tidy.setup(opts)
tidy.opts.enabled_on_save = false tidy.opts.enabled_on_save = false
vim.api.nvim_create_autocmd("BufLeave", { vim.api.nvim_create_autocmd("BufLeave", {
pattern = { "*.md", "*.tex" }, pattern = { "*.md", "*.tex" },

View File

@@ -3,11 +3,14 @@ return {
"rachartier/tiny-inline-diagnostic.nvim", "rachartier/tiny-inline-diagnostic.nvim",
event = "VeryLazy", event = "VeryLazy",
priority = 1000, priority = 1000,
config = function() opts = {
require("tiny-inline-diagnostic").setup({
preset = "classic", preset = "classic",
transparent_bg = true, transparent_bg = true,
},
config = function(_, opts)
require("tiny-inline-diagnostic").setup(opts)
vim.diagnostic.config({
virtual_text = false,
}) })
vim.diagnostic.config({ virtual_text = false })
end, end,
} }

View File

@@ -10,7 +10,5 @@ return {
end, end,
}, },
}, },
config = function() opts = {},
require("treesj").setup()
end,
} }

View File

@@ -3,5 +3,5 @@ return {
"preservim/vim-markdown", "preservim/vim-markdown",
ft = { "markdown" }, ft = { "markdown" },
dependencies = { "godlygeek/tabular" }, dependencies = { "godlygeek/tabular" },
config = function() end, config = function() end, -- needed this way by the plugin
} }

View File

@@ -2,7 +2,5 @@ return {
-- highlighting for the viper verification language -- highlighting for the viper verification language
"tiyn/viper.nvim", "tiyn/viper.nvim",
event = { "BufReadPre *.vpr", "FileType viper" }, event = { "BufReadPre *.vpr", "FileType viper" },
config = function() opts = {}
require("viper").setup()
end,
} }

View File

@@ -11,13 +11,14 @@ return {
"romgrk/fzy-lua-native", "romgrk/fzy-lua-native",
"nixprime/cpsm", "nixprime/cpsm",
}, },
config = function() opts = {
local wilder = require("wilder")
wilder.setup({
modes = { ":", "/", "?" }, modes = { ":", "/", "?" },
accept_key = "<CR>", accept_key = "<CR>",
reject_key = "<C-e>", reject_key = "<C-e>",
}) },
config = function(_, opts)
local wilder = require("wilder")
wilder.setup(opts)
wilder.set_option("pipeline", { wilder.set_option("pipeline", {
wilder.branch( wilder.branch(
wilder.python_file_finder_pipeline({ wilder.python_file_finder_pipeline({