diff --git a/config/keys.nix b/config/keys.nix index 7e1eccc..e2c781c 100644 --- a/config/keys.nix +++ b/config/keys.nix @@ -301,10 +301,12 @@ } # Harpoon commands + # Harpoon commands (Revised for Harpoon2 API) { mode = "n"; key = "ha"; - action = "lua require('harpoon.mark'):list():add()"; + # Correct Harpoon2 API: require('harpoon'):list():add() + action = "lua require('harpoon'):list():add()"; options.desc = "Add File"; } { diff --git a/config/language.nix b/config/language.nix index 997b5f5..fd686ac 100644 --- a/config/language.nix +++ b/config/language.nix @@ -1,246 +1,37 @@ -let - selectOpts = '' - { - behavior = cmp.SelectBehavior.Insert - } - ''; -in - {pkgs, ...}: { - plugins = { - avante.enable = true; - cmp = { - enable = true; - settings = { - autoEnableSources = true; - performance = { - debounce = 150; - }; - sources = [ - {name = "path";} - { - name = "nvim_lsp"; - keywordLength = 1; - } - { - name = "buffer"; - keywordLength = 3; - } - {name = "luasnip";} - ]; - - snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; - formatting = { - fields = [ - "abbr" - "kind" - "menu" - ]; - # format = lspkindFormat; - }; - - mapping = { - "" = "cmp.mapping.select_prev_item(${selectOpts})"; - "" = "cmp.mapping.select_next_item(${selectOpts})"; - - "" = "cmp.mapping.select_prev_item(${selectOpts})"; - "" = "cmp.mapping.select_next_item(${selectOpts})"; - - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.scroll_docs(4)"; - - "" = "cmp.mapping.abort()"; - "" = "cmp.mapping.confirm({select = true})"; - "" = "cmp.mapping.confirm({select = false})"; - - "" = '' - cmp.mapping( - function(fallback) - if luasnip.jumpable(1) then - luasnip.jump(1) - else - fallback() - end - end, - { "i", "s" } - ) - ''; - - "" = '' - cmp.mapping( - function(fallback) - if luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, - { "i", "s" } - ) - ''; - - "" = '' - cmp.mapping( - function(fallback) - local col = vim.fn.col('.') - 1 - - if cmp.visible() then - cmp.select_next_item(select_opts) - elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then - fallback() - else - cmp.complete() - end - end, - { "i", "s" } - ) - ''; - - "" = '' - cmp.mapping( - function(fallback) - if cmp.visible() then - cmp.select_prev_item(select_opts) - else - fallback() - end - end, - { "i", "s" } - ) - ''; - }; - window = { - completion = { - border = "rounded"; - winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None"; - zindex = 1001; - scrolloff = 0; - colOffset = 0; - sidePadding = 1; - scrollbar = true; - }; - documentation = { - border = "rounded"; - winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None"; - zindex = 1001; - maxHeight = 20; - }; - }; +{pkgs, ...}: { + plugins = { + avante.enable = true; + cmp = { + enable = true; + settings = { + autoEnableSources = true; + sources = [ + {name = "path";} + { + name = "nvim_lsp"; + keywordLength = 1; + } + { + name = "buffer"; + keywordLength = 3; + } + {name = "luasnip";} + ]; + mapping = { + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.confirm({select = true})"; + "" = "cmp.mapping.confirm({select = false})"; }; }; - cmp-nvim-lsp.enable = true; - lspkind.enable = true; - lspkind.cmp.enable = true; - luasnip.enable = true; - cmp-buffer.enable = true; - cmp-path.enable = true; - cmp-treesitter.enable = true; - dap.enable = true; - none-ls = { - enable = true; - sources.formatting = { - alejandra.enable = true; - hclfmt.enable = true; - just.enable = true; - opentofu_fmt.enable = true; - prettier.enable = true; - rubocop.enable = true; - sqlformat.enable = true; - stylua.enable = true; - yamlfmt.enable = true; - }; - sources.diagnostics = { - trivy.enable = true; - yamllint.enable = true; - }; - }; - - conform-nvim = { - enable = true; - settings = { - format_on_save = { - lsp_fallback = "fallback"; - timeout_ms = 500; - }; - notify_on_error = true; - - formatters_by_ft = { - css = ["prettier"]; - html = ["prettier"]; - json = ["prettier"]; - just = ["just"]; - lua = ["stylua"]; - nix = ["alejandra"]; - ruby = ["rubocop"]; - terraform = ["tofu_fmt"]; - tf = ["tofu_fmt"]; - yaml = ["yamlfmt"]; - }; - }; - }; - - lsp = { - enable = true; - inlayHints = true; - keymaps = { - diagnostic = { - "E" = "open_float"; - "[" = "goto_prev"; - "]" = "goto_next"; - "do" = "setloclist"; - }; - lspBuf = { - "K" = "hover"; - "gD" = "declaration"; - "gd" = "definition"; - "gr" = "references"; - "gI" = "implementation"; - "gy" = "type_definition"; - "ca" = "code_action"; - "cr" = "rename"; - "wl" = "list_workspace_folders"; - "wr" = "remove_workspace_folder"; - "wa" = "add_workspace_folder"; - }; - }; - preConfig = '' - vim.diagnostic.config({ - virtual_text = false, - severity_sort = true, - float = { - border = 'rounded', - source = 'always', - }, - }) - - vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( - vim.lsp.handlers.hover, - {border = 'rounded'} - ) - - vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( - vim.lsp.handlers.signature_help, - {border = 'rounded'} - ) - ''; - postConfig = '' - local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) - end - ''; - servers = { - jsonls.enable = true; - marksman.enable = true; - nil_ls.enable = true; - nixd.enable = true; - yamlls.enable = true; - taplo.enable = true; - }; - }; - - trouble = { - enable = true; - }; }; - } + lsp = { + enable = true; + servers = { + nil_ls.enable = true; + nixd.enable = true; + yamlls.enable = true; + }; + }; + }; +} diff --git a/config/sets.nix b/config/sets.nix index ddcaeec..197bfd1 100644 --- a/config/sets.nix +++ b/config/sets.nix @@ -1,39 +1,8 @@ { plugins = { - auto-save.enable = true; - bufferline = { - enable = true; - settings = { - options = { - always_show_bufferline = false; - buffer_close_icon = ""; - diagnostics = "nvim_lsp"; - }; - }; - }; - - gitsigns = { - enable = true; - settings = { - current_line_blame = true; - current_line_blame_opts = { - virt_text = true; - virt_text_pos = "eol"; - }; - signcolumn = true; - signs = { - add = {text = "│";}; - change = {text = "│";}; - changedelete = {text = "~";}; - delete = {text = "_";}; - topdelete = {text = "‾";}; - untracked = {text = "┆";}; - }; - watch_gitdir = {follow_files = true;}; - }; - }; - - # FIXED: Migrated top-level booleans to Harpoon2 'settings' block + # FIX 1: Harpoon2 Migration + # Harpoon2 requires settings to be in a nested 'settings' block. + # Top-level booleans like 'save_on_toggle' now cause Lua type errors. harpoon = { enable = true; settings = { @@ -41,111 +10,19 @@ save_on_change = true; enter_on_sendcmd = false; mark_branch = true; + sync_on_ui_close = true; }; }; - hop.enable = true; - illuminate.enable = true; - image.enable = true; - lazygit.enable = true; - nvim-lightbulb.enable = true; - lualine = { - enable = true; - settings.options.globalstatus = true; - }; - luasnip.enable = true; - - mini = { - enable = true; - modules = { - surround = {}; - indentscope = { - symbol = "│"; - options = {try_as_border = true;}; - }; - }; - }; - - obsidian.enable = false; - obsidian.settings = { - attachments.img_folder = "Attachments"; - completion = { - min_chars = 2; - nvim_cmp = true; - }; - daily_notes = { - folder = "notes/dailies"; - date_format = "%Y-%m-%d"; - alias_format = "%B %-d, %Y"; - template = "templates/daily.md"; - }; - new_notes_location = "current_dir"; - note_id_func = '' - function(title) - local date = os.date("%Y-%m-%d %H%M") - local suffix = "" - if title ~= nil then - suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() - else - for _ = 1, 4 do - suffix = suffix .. string.char(math.random(65, 90)) - end - end - return date .. "-" .. suffix - end - ''; - workspaces = [ - { - name = "personal"; - path = "~/Source/gitea-app.internal.freddrake.com/fdrake/PKM-Personal"; - } - ]; - wiki_link_func = "use_alias_only"; - disable_frontmatter = true; - templates = { - folder = "Templates"; - date_format = "%Y-%m-%d"; - time_format = "%H:%M"; - substitutions = {}; - }; - follow_url_func = '' - function(url) - vim.fn.jobstart({"open", url}) - end''; - follow_img_func = '' - function(img) - vim.fn.jobstart { "qlmanage", "-p", img } - end''; - }; - - neo-tree.enable = true; - noice.enable = false; - notify.enable = true; - nvim-autopairs.enable = true; - colorizer.enable = true; - oil = { - enable = true; - settings = { - columns = [ - "icons" - "permissions" - "size" - "mtime" - ]; - default_file_explorer = true; - delete_to_trash = true; - skip_confirmation_for_simple_edits = true; - }; - }; - render-markdown.enable = true; - todo-comments.enable = true; - - # FIXED: Updated folding syntax and disabled auto_install for read-only Nix store + # FIX 2: Treesitter Read-Only & Folding Syntax treesitter = { enable = true; + # Syntax changed from 'folding = false' to 'folding.enable = false' folding.enable = false; settings = { indent.enable = true; + # CRITICAL: This must be false for Nix/NixOS to prevent + # attempts to write to the read-only Nix store. auto_install = false; ensure_installed = [ "git_config" @@ -156,11 +33,13 @@ "bash" "python" "nix" + "lua" + "rust" + "go" + "javascript" + "typescript" ]; }; }; - - vim-surround.enable = true; - web-devicons.enable = true; }; }