1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2026-03-28 10:24:47 +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",
},
},
config = function()
require("conform").setup({
opts = {
formatters_by_ft = {
lua = { "stylua" },
markdown = { "mdformat" },
@@ -22,6 +21,5 @@ return {
tex = { "latexindent" },
yaml = { "yamlfmt" },
},
})
end,
},
}

View File

@@ -3,8 +3,7 @@ return {
"hat0uma/csvview.nvim",
ft = "csv",
cmd = { "CsvViewEnable", "CsvViewDisable", "CsvViewToggle" },
config = function()
require("csvview").setup({
opts = {
parser = { comments = { "#", "//" } },
keymaps = {
textobject_field_inner = { "if", mode = { "o", "x" } },
@@ -14,7 +13,10 @@ return {
jump_next_row = { "<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,
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -19,47 +19,32 @@ return {
end,
},
},
config = function()
require("mason-lspconfig").setup({
opts = {
automatic_setup = true,
ensure_installed = {
-- assembler
"asm_lsp",
-- c
"clangd",
-- docker
"dockerls",
-- go
"gopls",
-- html
"html",
-- json
"jsonls",
-- xml
"lemminx",
-- latex
"ltex",
"texlab",
-- lua
"lua_ls",
-- markdown
"marksman",
-- nim
"nimls",
-- python
"pyright",
-- r
"r_language_server",
-- shell
"bashls",
-- sql
"sqlls",
-- typescript / javascript
"ts_ls",
-- yaml
"yamlls",
},
})
},
config = function(_, opts)
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup(opts)
local default_flags = {
debounce_text_changes = 150,
allow_incremental_sync = true,
@@ -69,7 +54,6 @@ return {
ltex = {
settings = {
ltex = {
-- language = "de-DE",
enabled = { "latex", "markdown" },
dictionary = Dictionaries,
},
@@ -95,10 +79,16 @@ return {
})
)
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.declaration, 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", "gr", vim.lsp.buf.references, opts)
end,
})
end,
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,11 +3,14 @@ return {
"rachartier/tiny-inline-diagnostic.nvim",
event = "VeryLazy",
priority = 1000,
config = function()
require("tiny-inline-diagnostic").setup({
opts = {
preset = "classic",
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,
}

View File

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

View File

@@ -3,5 +3,5 @@ return {
"preservim/vim-markdown",
ft = { "markdown" },
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
"tiyn/viper.nvim",
event = { "BufReadPre *.vpr", "FileType viper" },
config = function()
require("viper").setup()
end,
opts = {}
}

View File

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