diff --git a/config/nvim/lua/fschauen/plugins/gitlinker.lua b/config/nvim/lua/fschauen/plugins/gitlinker.lua index dc8e095..1338db0 100644 --- a/config/nvim/lua/fschauen/plugins/gitlinker.lua +++ b/config/nvim/lua/fschauen/plugins/gitlinker.lua @@ -37,12 +37,14 @@ return { -- stylua: ignore end }, - opts = function(_, opts) - return vim.tbl_deep_extend("force", opts or {}, { + -- This really does need to be a function, because we need to defer requiring + -- the `gitlinker.hosts` module until after the plugin is loaded. + opts = function() + return { mappings = nil, -- I'm defining my own mappings above. callbacks = { ["git.schauenburg.me"] = require("gitlinker.hosts").get_gitea_type_url, }, - }) + } end, } diff --git a/config/nvim/lua/fschauen/plugins/headlines.lua b/config/nvim/lua/fschauen/plugins/headlines.lua index 5466320..e3fa083 100644 --- a/config/nvim/lua/fschauen/plugins/headlines.lua +++ b/config/nvim/lua/fschauen/plugins/headlines.lua @@ -5,7 +5,7 @@ return { ft = "markdown", - config = function() + opts = function() -- These work well with gruvbox. vim.cmd([[highlight Headline1 guibg=#161613]]) vim.cmd([[highlight Headline2 guibg=#191915]]) @@ -16,7 +16,7 @@ return { vim.cmd([[highlight Quote guifg=#076678]]) vim.cmd([[highlight Dash guifg=#d5c4a1]]) - require("headlines").setup { + return { markdown = { headline_highlights = { "Headline1", diff --git a/config/nvim/lua/fschauen/plugins/indent-blankline.lua b/config/nvim/lua/fschauen/plugins/indent-blankline.lua index 6def074..44de5e0 100644 --- a/config/nvim/lua/fschauen/plugins/indent-blankline.lua +++ b/config/nvim/lua/fschauen/plugins/indent-blankline.lua @@ -14,23 +14,21 @@ return { keys = { -- stylua: ignore start - { "si", "IBLToggle", desc = ui.Toggle.." toggle indent lines" }, - { "so", "IBLToggleScope", desc = ui.Toggle.." toggle indent line scope" }, + { "si", "IBLToggle", desc = ui.Toggle.." toggle [i]ndent lines" }, + { "so", "IBLToggleScope", desc = ui.Toggle.." toggle indent line sc[o]pe" }, -- stylua: ignore end }, main = "ibl", - opts = function(_, opts) - return vim.tbl_deep_extend("force", opts or {}, { + opts = { + enabled = false, + indent = { char = ui.LineLeft }, + scope = { + char = ui.LineLeftBold, enabled = false, - indent = { char = ui.LineLeft }, - scope = { - char = ui.LineLeftBold, - enabled = false, - show_start = false, - show_end = false, - }, - }) - end, + show_start = false, + show_end = false, + }, + }, } diff --git a/config/nvim/lua/fschauen/plugins/lsp.lua b/config/nvim/lua/fschauen/plugins/lsp.lua index 3a4f9aa..5ff4ec2 100644 --- a/config/nvim/lua/fschauen/plugins/lsp.lua +++ b/config/nvim/lua/fschauen/plugins/lsp.lua @@ -19,20 +19,18 @@ local lsp_handlers = function() } end -local lsp_on_attach = function( --[[client]]_, buffer) - local map = vim.keymap.set - local opts = { buffer = buffer } - local buf = vim.lsp.buf +local lsp_on_attach = function(--[[client]]_, buffer) + local map, opts = vim.keymap.set, { buffer = buffer } -- stylua: ignore start - map("n", "c", buf.code_action, opts) - map("n", "f", buf.format, opts) - map("n", "gd", buf.definition, opts) - map("n", "gD", buf.declaration, opts) - map("n", "gi", buf.implementation, opts) - map("n", "grr", buf.rename, opts) - map("n", "gt", buf.type_definition, opts) - map("n", "K", buf.hover, opts) - map("i", "", buf.signature_help, opts) + map("n", "c", vim.lsp.buf.code_action, opts) + map("n", "f", vim.lsp.buf.format, opts) + map("n", "gd", vim.lsp.buf.definition, opts) + map("n", "gD", vim.lsp.buf.declaration, opts) + map("n", "gi", vim.lsp.buf.implementation, opts) + map("n", "grr", vim.lsp.buf.rename, opts) + map("n", "gt", vim.lsp.buf.type_definition, opts) + map("n", "K", vim.lsp.buf.hover, opts) + map("i", "", vim.lsp.buf.signature_help, opts) -- stylua: ignore end end diff --git a/config/nvim/lua/fschauen/plugins/neogit.lua b/config/nvim/lua/fschauen/plugins/neogit.lua index 55ed78e..b4db747 100644 --- a/config/nvim/lua/fschauen/plugins/neogit.lua +++ b/config/nvim/lua/fschauen/plugins/neogit.lua @@ -11,30 +11,28 @@ return { { "gs", "Neogit", desc = ui.Git .. " [s]tatus (Neogit)" }, }, - opts = function(_, opts) - return vim.tbl_deep_extend("force", opts or {}, { - commit_editor = { kind = "tab" }, - disable_hint = true, - signs = { - section = { - ui.Folder, - ui.EmptyFolderOpen, - }, - item = { - ui.ChevronRight, - ui.ChevronDown, - }, - hunk = { - ui.ChevronSmallRight, - ui.ChevronSmallDown, - }, + opts = { + commit_editor = { kind = "tab" }, + disable_hint = true, + signs = { + section = { + ui.Folder, + ui.EmptyFolderOpen, }, - mappings = { - status = { - o = "GoToFile", - ["="] = "Toggle", - }, + item = { + ui.ChevronRight, + ui.ChevronDown, }, - }) - end, + hunk = { + ui.ChevronSmallRight, + ui.ChevronSmallDown, + }, + }, + mappings = { + status = { + o = "GoToFile", + ["="] = "Toggle", + }, + }, + }, } diff --git a/config/nvim/lua/fschauen/plugins/nvim-notify.lua b/config/nvim/lua/fschauen/plugins/nvim-notify.lua index 3a44228..f5ee53b 100644 --- a/config/nvim/lua/fschauen/plugins/nvim-notify.lua +++ b/config/nvim/lua/fschauen/plugins/nvim-notify.lua @@ -30,9 +30,11 @@ return { lazy = false, - opts = function(_, opts) + config = function() + local notify = require("notify") local icons = require("fschauen.util.icons") - return vim.tbl_deep_extend("force", opts or {}, { + + notify.setup { icons = { ERROR = icons.diagnostics_bold.Error, WARN = icons.diagnostics_bold.Warn, @@ -48,12 +50,8 @@ return { time_formats = { notification_history = "%F %T │ ", }, - }) - end, + } - config = function(_, opts) - local notify = require("notify") - notify.setup(opts) vim.notify = notify end, } diff --git a/config/nvim/lua/fschauen/plugins/nvim-tree.lua b/config/nvim/lua/fschauen/plugins/nvim-tree.lua index 189d884..d35eed5 100644 --- a/config/nvim/lua/fschauen/plugins/nvim-tree.lua +++ b/config/nvim/lua/fschauen/plugins/nvim-tree.lua @@ -22,7 +22,7 @@ local on_attach = function(buffer) -- stylua: ignore end end -local icon = require("fschauen.util.icons").ui.FileTree +local icons = require("fschauen.util.icons") return { "nvim-tree/nvim-tree.lua", @@ -31,63 +31,60 @@ return { keys = { -- stylua: ignore start - { "tt", "NvimTreeToggle", desc = icon.." [t]oggle [t]ree" }, - { "tf", "NvimTreeFindFile", desc = icon.." Open [t]ree to current [f]ile " }, + { "tt", "NvimTreeToggle", desc = icons.ui.FileTree.." [t]oggle [t]ree" }, + { "tf", "NvimTreeFindFile", desc = icons.ui.FileTree.." Open [t]ree to current [f]ile " }, -- stylua: ignore end }, - opts = function( --[[plugin]]_, opts) - local icons = require("fschauen.util.icons") - return vim.tbl_deep_extend("force", opts or {}, { - disable_netrw = true, -- replace netrw with nvim-tree - hijack_cursor = true, -- keep the cursor on begin of the filename - sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree - on_attach = on_attach, - git = { - ignore = false, -- don't hide files from .gitignore - show_on_open_dirs = false, -- don't show indication if dir is open - }, - view = { - adaptive_size = true, -- resize the window based on the longest line - cursorline = false, -- don't enable 'cursorline' in the tree - width = 35, -- a little wider than the default 30 - }, - filters = { - dotfiles = false, -- show files starting with a . - custom = { "^\\.git" }, -- don't show .git directory - }, - renderer = { - add_trailing = true, -- add trailing / to folders - highlight_git = true, -- enable highlight based on git attributes - icons = { - webdev_colors = false, -- highlight icons with NvimTreeFileIcon - git_placement = "signcolumn", - glyphs = { - default = icons.ui.File, - symlink = icons.ui.FileSymlink, - modified = icons.ui.Circle, - folder = { - arrow_closed = icons.ui.ChevronSmallRight, - arrow_open = icons.ui.ChevronSmallDown, - default = icons.ui.Folder, - open = icons.ui.FolderOpen, - empty = icons.ui.EmptyFolder, - empty_open = icons.ui.EmptyFolderOpen, - symlink = icons.ui.FolderSymlink, - symlink_open = icons.ui.FolderSymlink, - }, - git = { - untracked = icons.git.file.Untracked, - unstaged = icons.git.file.Unstaged, - staged = icons.git.file.Staged, - deleted = icons.git.file.Deleted, - unmerged = icons.git.file.Unmerged, - renamed = icons.git.file.Renamed, - ignored = icons.git.file.Ignored, - }, + opts = { + disable_netrw = true, -- replace netrw with nvim-tree + hijack_cursor = true, -- keep the cursor on begin of the filename + sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree + on_attach = on_attach, + git = { + ignore = false, -- don't hide files from .gitignore + show_on_open_dirs = false, -- don't show indication if dir is open + }, + view = { + adaptive_size = true, -- resize the window based on the longest line + cursorline = false, -- don't enable 'cursorline' in the tree + width = 35, -- a little wider than the default 30 + }, + filters = { + dotfiles = false, -- show files starting with a . + custom = { "^\\.git" }, -- don't show .git directory + }, + renderer = { + add_trailing = true, -- add trailing / to folders + highlight_git = true, -- enable highlight based on git attributes + icons = { + webdev_colors = false, -- highlight icons with NvimTreeFileIcon + git_placement = "signcolumn", + glyphs = { + default = icons.ui.File, + symlink = icons.ui.FileSymlink, + modified = icons.ui.Circle, + folder = { + arrow_closed = icons.ui.ChevronSmallRight, + arrow_open = icons.ui.ChevronSmallDown, + default = icons.ui.Folder, + open = icons.ui.FolderOpen, + empty = icons.ui.EmptyFolder, + empty_open = icons.ui.EmptyFolderOpen, + symlink = icons.ui.FolderSymlink, + symlink_open = icons.ui.FolderSymlink, + }, + git = { + untracked = icons.git.file.Untracked, + unstaged = icons.git.file.Unstaged, + staged = icons.git.file.Staged, + deleted = icons.git.file.Deleted, + unmerged = icons.git.file.Unmerged, + renamed = icons.git.file.Renamed, + ignored = icons.git.file.Ignored, }, }, }, - }) - end, + }, + }, } diff --git a/config/nvim/lua/fschauen/plugins/telescope.lua b/config/nvim/lua/fschauen/plugins/telescope.lua index 260a8a4..961ce11 100644 --- a/config/nvim/lua/fschauen/plugins/telescope.lua +++ b/config/nvim/lua/fschauen/plugins/telescope.lua @@ -102,7 +102,7 @@ return { -- stylua: ignore end }, - opts = function(_, opts) + opts = function() local actions = require("telescope.actions") local layout = require("telescope.actions.layout") local state = require("telescope.actions.state") @@ -135,7 +135,7 @@ return { [""] = actions.smart_send_to_loclist + actions.open_loclist, } - return vim.tbl_deep_extend("force", opts or {}, { + return { defaults = { mappings = { i = mappings, n = mappings }, @@ -170,7 +170,7 @@ return { colorscheme = { theme = "dropdown" }, spell_suggest = { theme = "cursor" }, }, - }) + } end, config = function(_, opts) diff --git a/config/nvim/lua/fschauen/plugins/todo-comments.lua b/config/nvim/lua/fschauen/plugins/todo-comments.lua index eedacdd..eb0d31f 100644 --- a/config/nvim/lua/fschauen/plugins/todo-comments.lua +++ b/config/nvim/lua/fschauen/plugins/todo-comments.lua @@ -1,3 +1,5 @@ +local ui = require("fschauen.util.icons").ui + local helper = require("fschauen.plugins.telescope").keymap_helper local lhs, desc = helper.lhs, helper.description @@ -15,25 +17,22 @@ return { { lhs("t"), "TodoTelescope", desc = desc("[t]odos") }, }, - opts = function(_, opts) - local icons = require("fschauen.util.icons") - return vim.tbl_deep_extend("force", opts or {}, { - keywords = { - TODO = { icon = icons.ui.Checkbox }, - FIX = { icon = icons.ui.Bug }, - HACK = { icon = icons.ui.Fire }, - WARN = { icon = icons.ui.Warning }, - PERF = { icon = icons.ui.Gauge }, - NOTE = { icon = icons.ui.Note }, - TEST = { icon = icons.ui.TestTube }, - }, - gui_style = { fg = "bold" }, - highlight = { - multiline = false, - before = "fg", - keyword = "wide_fg", - after = "", - }, - }) - end, + opts = { + keywords = { + TODO = { icon = ui.Checkbox }, + FIX = { icon = ui.Bug }, + HACK = { icon = ui.Fire }, + WARN = { icon = ui.Warning }, + PERF = { icon = ui.Gauge }, + NOTE = { icon = ui.Note }, + TEST = { icon = ui.TestTube }, + }, + gui_style = { fg = "bold" }, + highlight = { + multiline = false, + before = "fg", + keyword = "wide_fg", + after = "", + }, + }, } diff --git a/config/nvim/lua/fschauen/plugins/virt-column.lua b/config/nvim/lua/fschauen/plugins/virt-column.lua index 438a39d..a47164d 100644 --- a/config/nvim/lua/fschauen/plugins/virt-column.lua +++ b/config/nvim/lua/fschauen/plugins/virt-column.lua @@ -17,9 +17,7 @@ return { { "sc", toggle_colorcolumn, desc = ui.Toggle .. " toggle virtual colunn" }, }, - opts = function(_, opts) - return vim.tbl_deep_extend("force", opts or {}, { - char = ui.LineMiddle, - }) - end, + opts = { + char = ui.LineMiddle, + }, }