diff --git a/flake.lock b/flake.lock index 22ec5e3..687c21c 100644 --- a/flake.lock +++ b/flake.lock @@ -68,23 +68,6 @@ "type": "github" } }, - "diagram.nvim": { - "flake": false, - "locked": { - "lastModified": 1724882438, - "narHash": "sha256-FH9i/I2DiCBpU1b8aTHCNDviBIS7IBng2D30OQH29RU=", - "owner": "3rd", - "repo": "diagram.nvim", - "rev": "1022def2b5b2c70895e381f13a75abee6327a23c", - "type": "github" - }, - "original": { - "owner": "3rd", - "ref": "feature/toggle", - "repo": "diagram.nvim", - "type": "github" - } - }, "fioul": { "inputs": { "flake-utils": "flake-utils", @@ -505,11 +488,11 @@ ] }, "locked": { - "lastModified": 1735882644, - "narHash": "sha256-3FZAG+pGt3OElQjesCAWeMkQ7C/nB1oTHLRQ8ceP110=", + "lastModified": 1737043064, + "narHash": "sha256-I/OuxGwXwRi5gnFPsyCvVR+IfFstA+QXEpHu1hvsgD8=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "a5a961387e75ae44cc20f0a57ae463da5e959656", + "rev": "94ee657f6032d913fe0ef49adaa743804635b0bb", "type": "github" }, "original": { @@ -610,11 +593,11 @@ ] }, "locked": { - "lastModified": 1736089250, - "narHash": "sha256-/LPWMiiJGPHGd7ZYEgmbE2da4zvBW0acmshUjYC3WG4=", + "lastModified": 1737075266, + "narHash": "sha256-u1gk5I1an975FOAMMdS6oBKnSIsZza5ZKhaeBZAskVo=", "owner": "nix-community", "repo": "home-manager", - "rev": "172b91bfb2b7f5c4a8c6ceac29fd53a01ef07196", + "rev": "12851ae7467bad8ef422b20806ab4d6d81e12d29", "type": "github" }, "original": { @@ -805,11 +788,11 @@ ] }, "locked": { - "lastModified": 1736085891, - "narHash": "sha256-bTl9fcUo767VaSx4Q5kFhwiDpFQhBKna7lNbGsqCQiA=", + "lastModified": 1736819234, + "narHash": "sha256-deQVtIH4UJueELJqluAICUtX7OosD9paTP+5FgbiSwI=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "ba9b3173b0f642ada42b78fb9dfc37ca82266f6c", + "rev": "bd921223ba7cdac346477d7ea5204d6f4736fcc6", "type": "github" }, "original": { @@ -1193,11 +1176,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1736219611, - "narHash": "sha256-osQC3uZOQQrTPTlhEBE6mesPCkYDDOSLsJNNATQZqmw=", + "lastModified": 1737385899, + "narHash": "sha256-/zyvdstDpPhc5lhFMtKgyQdU2oXGXDb0cg4BY91NKvg=", "owner": "nix-community", "repo": "nixvim", - "rev": "a352bb89b0cd180f5c767689c4cc310109cd4ad8", + "rev": "115994f18e439a1cca9cdaaf15c004870256814d", "type": "github" }, "original": { @@ -1305,7 +1288,6 @@ "root": { "inputs": { "comma": "comma", - "diagram.nvim": "diagram.nvim", "fioul": "fioul", "flake-parts": "flake-parts", "flake-root": "flake-root", @@ -1329,8 +1311,7 @@ "rust-overlay": "rust-overlay_8", "simulationcraft": "simulationcraft", "treefmt-nix": "treefmt-nix_3", - "vim-headerguard": "vim-headerguard", - "wiki.vim": "wiki.vim" + "vim-headerguard": "vim-headerguard" } }, "rust-overlay": { @@ -1715,11 +1696,11 @@ ] }, "locked": { - "lastModified": 1736115332, - "narHash": "sha256-FBG9d7e0BTFfxVdw4b5EmNll2Mv7hfRc54hbB4LrKko=", + "lastModified": 1737054102, + "narHash": "sha256-saLiCRQ5RtdTnznT/fja7GxcYRAzeY3k8S+IF/2s/2A=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "1788ca5acd4b542b923d4757d4cfe4183cc6a92d", + "rev": "97871d416166803134ba64597a1006f3f670fbde", "type": "github" }, "original": { @@ -1825,22 +1806,6 @@ "repo": "vim-headerguard", "type": "github" } - }, - "wiki.vim": { - "flake": false, - "locked": { - "lastModified": 1735084629, - "narHash": "sha256-GL0++z5mmBkJ1SpM6jbvkVQQMgWTtqHpwagc7Jn1BVs=", - "owner": "lervag", - "repo": "wiki.vim", - "rev": "80bb6dd1684a6cf13025733e4d810e36ad0ae9f3", - "type": "github" - }, - "original": { - "owner": "lervag", - "repo": "wiki.vim", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index f6a355d..b7911da 100644 --- a/flake.nix +++ b/flake.nix @@ -88,14 +88,6 @@ url = "github:drmikehenry/vim-headerguard"; flake = false; }; - "wiki.vim" = { - url = "github:lervag/wiki.vim"; - flake = false; - }; - "diagram.nvim" = { - url = "github:3rd/diagram.nvim/feature/toggle"; - flake = false; - }; }; outputs = @@ -112,9 +104,9 @@ imports = [ ./pkgs - ./neovim/pkg.nix ./hostconfig ./templates + ./neovim inputs.treefmt-nix.flakeModule inputs.flake-root.flakeModule ]; diff --git a/hostconfig/thinkpad-nixos/work.nix b/hostconfig/thinkpad-nixos/work.nix index 17baa3b..8c33936 100644 --- a/hostconfig/thinkpad-nixos/work.nix +++ b/hostconfig/thinkpad-nixos/work.nix @@ -20,26 +20,23 @@ in config = { workAddr = "quentin.boyer@${decode workDomain}"; - extraNixvim = [ - ( - { helpers, ... }: - { - extraConfigLuaPre = '' - team_picker = dofile("${./telescope-team.lua}") - ''; - keymaps = [ - { - key = "R"; - mode = [ "n" ]; - action = helpers.mkRaw "team_picker"; - } - ]; - commands = { - Review = "lua team_picker()"; - }; - } - ) - ]; + programs.nixvim = + { lib, ... }: + { + extraConfigLuaPre = '' + team_picker = dofile("${./telescope-team.lua}") + ''; + keymaps = [ + { + key = "R"; + mode = [ "n" ]; + action = lib.nixvim.mkRaw "team_picker"; + } + ]; + commands = { + Review = "lua team_picker()"; + }; + }; home.packages = [ (pkgs.writeShellScriptBin "nwadminSendmail" '' diff --git a/minimal/hm.nix b/minimal/hm.nix index 90cf759..18cae01 100644 --- a/minimal/hm.nix +++ b/minimal/hm.nix @@ -15,13 +15,9 @@ default = ""; }; - options.extraNixvim = lib.mkOption { - type = lib.types.listOf lib.types.anything; - default = [ ]; - }; - imports = [ inputs.nix-index-database.hmModules.nix-index + inputs.nixvim.homeManagerModules.nixvim extraInfo ]; @@ -45,52 +41,55 @@ EDITOR = "nvim"; }; - home.packages = - (with pkgs; [ - bat - comma - fd - sd - choose - file - gdb - gnumake - jq - man-pages - oscclip - pandoc - raclette - ripgrep - rsync - tokei - unzip - wget - frg - nix-output-monitor - bat-extras.prettybat - just - bottom - keychain - rclone - nix-du + programs.nixvim = _: { + enable = true; + imports = [ flake.nixvimModules.neovimTraxys ]; + }; - # Useful for pandoc to latex - (texlive.combine { - inherit (texlive) - scheme-medium - fncychap - wrapfig - capt-of - framed - upquote - needspace - tabulary - varwidth - titlesec - ; - }) - ]) - ++ [ (pkgs.neovimTraxys.extend { imports = config.extraNixvim; }) ]; + home.packages = with pkgs; [ + bat + comma + fd + sd + choose + file + gdb + gnumake + jq + man-pages + oscclip + pandoc + raclette + ripgrep + rsync + tokei + unzip + wget + frg + nix-output-monitor + bat-extras.prettybat + just + bottom + keychain + rclone + nix-du + + # Useful for pandoc to latex + (texlive.combine { + inherit (texlive) + scheme-medium + fncychap + wrapfig + capt-of + framed + upquote + needspace + tabulary + varwidth + titlesec + ; + }) + ]; nix.registry = { "my".flake = flake; diff --git a/neovim/completion.nix b/neovim/config/completion.nix similarity index 100% rename from neovim/completion.nix rename to neovim/config/completion.nix diff --git a/neovim/config/default.nix b/neovim/config/default.nix new file mode 100644 index 0000000..20f8260 --- /dev/null +++ b/neovim/config/default.nix @@ -0,0 +1,466 @@ +{ flake }: +{ + pkgs, + config, + helpers, + lib, + ... +}: +{ + imports = [ + ./lsp.nix + ./notes.nix + ./completion.nix + ]; + + _module.args.flake = flake; + + colorschemes.tokyonight = { + settings.style = "night"; + enable = true; + }; + + plugins.mini = { + enable = true; + modules.icons = { }; + mockDevIcons = true; + }; + + performance = { + byteCompileLua = { + enable = true; + nvimRuntime = true; + configs = true; + plugins = true; + }; + combinePlugins = { + enable = true; + standalonePlugins = [ + "vimplugin-treesitter-grammar-nix" + "nvim-treesitter" + "openscad.nvim" + "yanky.nvim" + ]; + }; + }; + + plugins.lz-n.enable = true; + + autoGroups.BigFileOptimizer = { }; + autoCmd = [ + { + event = "BufReadPost"; + pattern = [ + "*.md" + "*.rs" + "*.lua" + "*.sh" + "*.bash" + "*.zsh" + "*.js" + "*.jsx" + "*.ts" + "*.tsx" + "*.c" + ".h" + "*.cc" + ".hh" + "*.cpp" + ".cph" + ]; + group = "BigFileOptimizer"; + callback = helpers.mkRaw '' + function(auEvent) + local bufferCurrentLinesCount = vim.api.nvim_buf_line_count(0) + + if bufferCurrentLinesCount > 2048 then + vim.notify("bigfile: disabling features", vim.log.levels.WARN) + + vim.cmd("TSBufDisable refactor.highlight_definitions") + vim.g.matchup_matchparen_enabled = 0 + require("nvim-treesitter.configs").setup({ + matchup = { + enable = false + } + }) + end + end + ''; + } + ]; + + globals = { + neo_tree_remove_legacy_commands = 1; + mapleader = " "; + }; + + opts = { + termguicolors = true; + number = true; + tabstop = 4; + shiftwidth = 4; + scrolloff = 7; + signcolumn = "yes"; + cmdheight = 2; + pumheight = 15; + cot = [ + "menu" + "menuone" + "noselect" + ]; + updatetime = 100; + colorcolumn = "100"; + # Too many false positives + spell = false; + listchars = "tab:>-,lead:·,nbsp:␣,trail:•"; + fsync = true; + + timeout = true; + timeoutlen = 300; + }; + + commands = { + "SpellFr" = "setlocal spelllang=fr"; + }; + + filetype = { + filename = { + Jenkinsfile = "groovy"; + }; + extension = { + lalrpop = "lalrpop"; + }; + }; + + keymaps = + let + modeKeys = + mode: + lib.attrsets.mapAttrsToList ( + key: action: + { inherit key mode; } // (if builtins.isString action then { inherit action; } else action) + ); + nm = modeKeys [ "n" ]; + in + helpers.keymaps.mkKeymaps { options.silent = true; } (nm { + "ft" = "Neotree"; + "fG" = "Neotree git_status"; + "fR" = "Neotree remote"; + "fc" = "Neotree close"; + "bp" = "Telescope buffers"; + + "" = "Telescope spell_suggest"; + "mk" = "Telescope keymaps"; + "fg" = "Telescope git_files"; + + "gr" = "Telescope lsp_references"; + "gI" = "Telescope lsp_implementations"; + "gW" = "Telescope lsp_workspace_symbols"; + "gF" = "Telescope lsp_document_symbols"; + "ge" = "Telescope diagnostics bufnr=0"; + "gE" = "Telescope diagnostics"; + + "h" = { + action = "lua vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())"; + options = { + desc = "toggle inlay hints"; + }; + }; + "yH" = { + action = "Telescope yank_history"; + options.desc = "history"; + }; + "wS" = { + action = helpers.mkRaw '' + function() + require('telescope.builtin').live_grep({ + cwd = "~/wiki", + glob_pattern = "*.md" + }) + end + ''; + options.desc = "search in wiki"; + }; + "Y" = { + action = helpers.mkRaw '' + function () + vim.go.operatorfunc = "v:lua.osc52_yank_cb"; + local yank = require('vim.ui.clipboard.osc52').copy('+') + end + ''; + options = { + desc = "yank through osc52"; + expr = true; + }; + }; + }) + ++ [ + { + key = "rn"; + mode = [ "n" ]; + action = helpers.mkRaw '' + function() + return ":IncRename " .. vim.fn.expand("") + end + ''; + options.expr = true; + } + ]; + + plugins.nvim-osc52 = { + enable = true; + package = pkgs.vimPlugins.nvim-osc52; + keymaps.enable = true; + }; + + plugins.gitsigns.enable = true; + plugins.gitmessenger.enable = true; + + # plugins.firenvim.enable = false; + + plugins.telescope = { + enable = true; + extensions = { + ui-select.enable = true; + }; + settings = { + defaults.layout_strategy = "vertical"; + }; + }; + + extraFiles."queries/rust/injections.scm".text = '' + ;; extends + + (call_expression + function: ((identifier) @_func (#eq? @_func "JS")) + arguments: (arguments (raw_string_literal (string_content) @injection.content)) + (#set! injection.language "javascript")) + + (token_tree + (identifier) @_func (#eq? @_func "JS") + (token_tree (raw_string_literal (string_content) @injection.content)) + (#set! injection.language "javascript")) + ''; + + plugins.treesitter = { + enable = true; + + settings = { + indent.enable = true; + highlight.enable = true; + }; + + nixvimInjections = true; + + grammarPackages = with config.plugins.treesitter.package.passthru.builtGrammars; [ + arduino + asm + bash + bitbake + c + cpp + cuda + dart + devicetree + diff + dockerfile + editorconfig + fish + gitattributes + gitcommit + gitignore + git_rebase + groovy + html + ini + javascript + json + just + lalrpop + latex + linkerscript + lua + make + markdown + markdown_inline + mermaid + meson + ninja + nix + printf + python + regex + rst + rust + slint + sql + tlaplus + toml + typst + vim + vimdoc + xml + yaml + zig + ]; + }; + + plugins.treesitter-refactor = { + enable = true; + highlightDefinitions = { + enable = true; + clearOnCursorMove = true; + }; + smartRename = { + enable = true; + }; + navigation = { + enable = true; + }; + }; + + plugins.treesitter-context = { + enable = true; + }; + + plugins.vim-matchup = { + treesitter = { + enable = true; + include_match_words = true; + }; + enable = true; + }; + plugins.headerguard.enable = true; + + plugins.comment = { + enable = true; + }; + + plugins.neo-tree = { + enable = true; + }; + + plugins.plantuml-syntax.enable = true; + + plugins.indent-blankline = { + enable = true; + + settings = { + scope = { + enabled = true; + + show_start = true; + }; + }; + }; + + plugins.typst-vim.enable = true; + + plugins.lualine = { + enable = true; + }; + + plugins.trouble = { + enable = true; + lazyLoad.settings.cmd = "Trouble"; + }; + + plugins.noice = { + enable = true; + + settings = { + messages = { + view = "mini"; + view_error = "mini"; + view_warn = "mini"; + }; + + lsp.override = { + "vim.lsp.util.convert_input_to_markdown_lines" = true; + "vim.lsp.util.stylize_markdown" = true; + "cmp.entry.get_documentation" = true; + }; + presets = { + bottom_search = true; + command_palette = true; + long_message_to_split = true; + inc_rename = true; + lsp_doc_border = false; + }; + }; + }; + + plugins.openscad = { + enable = false; + settings = { + load_snippets = true; + }; + }; + + plugins.snacks.enable = true; + + extraConfigLuaPre = lib.mkBefore '' + if vim.env.PROF then + require("snacks.profiler").startup({ + startup = { + event = "VimEnter" + } + }) + end + ''; + + extraConfigLuaPost = '' + require("luasnip.loaders.from_snipmate").lazy_load() + + require("cmp_git").setup({}) + + -- debug.sethook(function() + -- local file = io.open("/home/traxys/nvim_bt", "a") + -- file:write(debug.traceback("backtrace")) + -- file:close() + -- end, "c", 43) + ''; + + plugins.which-key.enable = true; + + plugins.leap.enable = true; + + plugins.yanky = { + enable = true; + settings.picker.telescope = { + useDefaultMappings = true; + enable = true; + }; + }; + + files."ftplugin/nix.lua" = { + opts = { + tabstop = 2; + shiftwidth = 2; + expandtab = true; + }; + extraConfigLua = '' + vim.lsp.inlay_hint.enable(true) + ''; + }; + + files."ftdetect/sql.lua" = { + globals.omni_sql_no_default_maps = 0; + globals.omni_sql_default_compl_type = "syntax"; + }; + + extraPackages = with pkgs; [ + # sca2d + djlint + muon + gh + ]; + + extraPlugins = with pkgs.vimPlugins; [ + telescope-ui-select-nvim + vim-snippets + vim-just + ltex_extra-nvim + vim-wakatime + ]; +} diff --git a/neovim/lsp.nix b/neovim/config/lsp.nix similarity index 100% rename from neovim/lsp.nix rename to neovim/config/lsp.nix diff --git a/neovim/notes.nix b/neovim/config/notes.nix similarity index 100% rename from neovim/notes.nix rename to neovim/config/notes.nix diff --git a/neovim/default.nix b/neovim/default.nix index baf235a..ffb1b68 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -1,469 +1,49 @@ -{ - pkgs, - config, - helpers, - lib, - ... -}: +{ inputs, self, ... }: { imports = [ - ./lsp.nix - ./notes.nix - ./completion.nix - - ./modules/commands.nix - - ./plugins/headerguard.nix - ./plugins/lsp-signature.nix - ./plugins/diagram-nvim.nix + inputs.nixvim.flakeModules.default ]; - colorschemes.tokyonight = { - settings.style = "night"; - enable = true; + nixvim = { + packages.enable = true; + checks.enable = true; }; - plugins.mini = { - enable = true; - modules.icons = { }; - mockDevIcons = true; - }; - - performance = { - byteCompileLua = { - enable = true; - nvimRuntime = true; - configs = true; - plugins = true; + flake.nixvimModules = { + config = import ./config { flake = self; }; + plugins = import ./plugins { + inherit (inputs) vim-headerguard; }; - combinePlugins = { - enable = true; - standalonePlugins = [ - "vimplugin-treesitter-grammar-nix" - "nvim-treesitter" - "openscad.nvim" - "yanky.nvim" + modules = ./modules; + + neovimTraxys = { + imports = [ + self.nixvimModules.config + self.nixvimModules.plugins + self.nixvimModules.modules ]; }; }; - plugins.lz-n.enable = true; - - autoGroups.BigFileOptimizer = { }; - autoCmd = [ + perSystem = { - event = "BufReadPost"; - pattern = [ - "*.md" - "*.rs" - "*.lua" - "*.sh" - "*.bash" - "*.zsh" - "*.js" - "*.jsx" - "*.ts" - "*.tsx" - "*.c" - ".h" - "*.cc" - ".hh" - "*.cpp" - ".cph" - ]; - group = "BigFileOptimizer"; - callback = helpers.mkRaw '' - function(auEvent) - local bufferCurrentLinesCount = vim.api.nvim_buf_line_count(0) - - if bufferCurrentLinesCount > 2048 then - vim.notify("bigfile: disabling features", vim.log.levels.WARN) - - vim.cmd("TSBufDisable refactor.highlight_definitions") - vim.g.matchup_matchparen_enabled = 0 - require("nvim-treesitter.configs").setup({ - matchup = { - enable = false - } - }) - end - end - ''; - } - ]; - - globals = { - neo_tree_remove_legacy_commands = 1; - mapleader = " "; - }; - - opts = { - termguicolors = true; - number = true; - tabstop = 4; - shiftwidth = 4; - scrolloff = 7; - signcolumn = "yes"; - cmdheight = 2; - pumheight = 15; - cot = [ - "menu" - "menuone" - "noselect" - ]; - updatetime = 100; - colorcolumn = "100"; - # Too many false positives - spell = false; - listchars = "tab:>-,lead:·,nbsp:␣,trail:•"; - fsync = true; - - timeout = true; - timeoutlen = 300; - }; - - commands = { - "SpellFr" = "setlocal spelllang=fr"; - }; - - filetype = { - filename = { - Jenkinsfile = "groovy"; - }; - extension = { - lalrpop = "lalrpop"; - }; - }; - - keymaps = - let - modeKeys = - mode: - lib.attrsets.mapAttrsToList ( - key: action: - { inherit key mode; } // (if builtins.isString action then { inherit action; } else action) - ); - nm = modeKeys [ "n" ]; - in - helpers.keymaps.mkKeymaps { options.silent = true; } (nm { - "ft" = "Neotree"; - "fG" = "Neotree git_status"; - "fR" = "Neotree remote"; - "fc" = "Neotree close"; - "bp" = "Telescope buffers"; - - "" = "Telescope spell_suggest"; - "mk" = "Telescope keymaps"; - "fg" = "Telescope git_files"; - - "gr" = "Telescope lsp_references"; - "gI" = "Telescope lsp_implementations"; - "gW" = "Telescope lsp_workspace_symbols"; - "gF" = "Telescope lsp_document_symbols"; - "ge" = "Telescope diagnostics bufnr=0"; - "gE" = "Telescope diagnostics"; - - "h" = { - action = "lua vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())"; - options = { - desc = "toggle inlay hints"; + system, + ... + }: + { + nixvimConfigurations = { + neovimTraxys = inputs.nixvim.lib.evalNixvim { + inherit system; + modules = [ + self.nixvimModules.neovimTraxys + { + test.warnings = expect: [ + (expect "count" 1) + (expect "any" "As of Neovim 0.10, native support for OSC52 has been added.") + ]; + } + ]; }; }; - "yH" = { - action = "Telescope yank_history"; - options.desc = "history"; - }; - "wS" = { - action = helpers.mkRaw '' - function() - require('telescope.builtin').live_grep({ - cwd = "~/wiki", - glob_pattern = "*.md" - }) - end - ''; - options.desc = "search in wiki"; - }; - "Y" = { - action = helpers.mkRaw '' - function () - vim.go.operatorfunc = "v:lua.osc52_yank_cb"; - local yank = require('vim.ui.clipboard.osc52').copy('+') - end - ''; - options = { - desc = "yank through osc52"; - expr = true; - }; - }; - }) - ++ [ - { - key = "rn"; - mode = [ "n" ]; - action = helpers.mkRaw '' - function() - return ":IncRename " .. vim.fn.expand("") - end - ''; - options.expr = true; - } - ]; - - plugins.nvim-osc52 = { - enable = true; - package = pkgs.vimPlugins.nvim-osc52; - keymaps.enable = true; - }; - - plugins.gitsigns.enable = true; - plugins.gitmessenger.enable = true; - - # plugins.firenvim.enable = false; - - plugins.telescope = { - enable = true; - extensions = { - ui-select.enable = true; }; - settings = { - defaults.layout_strategy = "vertical"; - }; - }; - - extraFiles."queries/rust/injections.scm".text = '' - ;; extends - - (call_expression - function: ((identifier) @_func (#eq? @_func "JS")) - arguments: (arguments (raw_string_literal (string_content) @injection.content)) - (#set! injection.language "javascript")) - - (token_tree - (identifier) @_func (#eq? @_func "JS") - (token_tree (raw_string_literal (string_content) @injection.content)) - (#set! injection.language "javascript")) - ''; - - plugins.treesitter = { - enable = true; - - settings = { - indent.enable = true; - highlight.enable = true; - }; - - nixvimInjections = true; - - grammarPackages = with config.plugins.treesitter.package.passthru.builtGrammars; [ - arduino - asm - bash - bitbake - c - cpp - cuda - dart - devicetree - diff - dockerfile - editorconfig - fish - gitattributes - gitcommit - gitignore - git_rebase - groovy - html - ini - javascript - json - just - lalrpop - latex - linkerscript - lua - make - markdown - markdown_inline - mermaid - meson - ninja - nix - printf - python - regex - rst - rust - slint - sql - tlaplus - toml - typst - vim - vimdoc - xml - yaml - zig - ]; - }; - - plugins.treesitter-refactor = { - enable = true; - highlightDefinitions = { - enable = true; - clearOnCursorMove = true; - }; - smartRename = { - enable = true; - }; - navigation = { - enable = true; - }; - }; - - plugins.treesitter-context = { - enable = true; - }; - - plugins.vim-matchup = { - treesitter = { - enable = true; - include_match_words = true; - }; - enable = true; - }; - plugins.headerguard.enable = true; - - plugins.comment = { - enable = true; - }; - - plugins.neo-tree = { - enable = true; - }; - - plugins.plantuml-syntax.enable = true; - - plugins.indent-blankline = { - enable = true; - - settings = { - scope = { - enabled = true; - - show_start = true; - }; - }; - }; - - plugins.typst-vim.enable = true; - - plugins.lualine = { - enable = true; - }; - - plugins.trouble = { - enable = true; - lazyLoad.settings.cmd = "Trouble"; - }; - - plugins.noice = { - enable = true; - - settings = { - messages = { - view = "mini"; - view_error = "mini"; - view_warn = "mini"; - }; - - lsp.override = { - "vim.lsp.util.convert_input_to_markdown_lines" = true; - "vim.lsp.util.stylize_markdown" = true; - "cmp.entry.get_documentation" = true; - }; - presets = { - bottom_search = true; - command_palette = true; - long_message_to_split = true; - inc_rename = true; - lsp_doc_border = false; - }; - }; - }; - - plugins.openscad = { - enable = false; - settings = { - load_snippets = true; - }; - }; - - plugins.snacks.enable = true; - - extraConfigLuaPre = lib.mkBefore '' - if vim.env.PROF then - require("snacks.profiler").startup({ - startup = { - event = "VimEnter" - } - }) - end - ''; - - extraConfigLuaPost = '' - require("luasnip.loaders.from_snipmate").lazy_load() - - require("cmp_git").setup({}) - - -- debug.sethook(function() - -- local file = io.open("/home/traxys/nvim_bt", "a") - -- file:write(debug.traceback("backtrace")) - -- file:close() - -- end, "c", 43) - ''; - - plugins.which-key.enable = true; - - plugins.leap.enable = true; - - plugins.yanky = { - enable = true; - settings.picker.telescope = { - useDefaultMappings = true; - enable = true; - }; - }; - - files."ftplugin/nix.lua" = { - opts = { - tabstop = 2; - shiftwidth = 2; - expandtab = true; - }; - extraConfigLua = '' - vim.lsp.inlay_hint.enable(true) - ''; - }; - - files."ftdetect/sql.lua" = { - globals.omni_sql_no_default_maps = 0; - globals.omni_sql_default_compl_type = "syntax"; - }; - - extraPackages = with pkgs; [ - # sca2d - djlint - muon - gh - ]; - - extraPlugins = with pkgs.vimPlugins; [ - telescope-ui-select-nvim - vim-snippets - vim-just - ltex_extra-nvim - vim-wakatime - ]; } diff --git a/neovim/modules/default.nix b/neovim/modules/default.nix new file mode 100644 index 0000000..0ca4756 --- /dev/null +++ b/neovim/modules/default.nix @@ -0,0 +1,3 @@ +{ + imports = [ ./commands.nix ]; +} diff --git a/neovim/pkg.nix b/neovim/pkg.nix deleted file mode 100644 index 388f719..0000000 --- a/neovim/pkg.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ inputs, self, ... }: -{ - perSystem = - { - inputs', - self', - pkgs, - system, - ... - }: - { - packages = { - neovimTraxys = inputs'.nixvim.legacyPackages.makeNixvimWithModule { - module = { - imports = [ ./default.nix ]; - }; - extraSpecialArgs = { - flake = self; - }; - pkgs = pkgs.extend ( - final: prev: - { - inherit (inputs'.nixpkgs-ts.legacyPackages) tree-sitter; - vimPlugins = prev.vimPlugins.extend ( - final': prev': { - vim-headerguard = prev.vimUtils.buildVimPlugin { - pname = "vim-headerguard"; - src = inputs.vim-headerguard; - version = inputs.vim-headerguard.shortRev; - }; - wiki-vim = prev.vimUtils.buildVimPlugin { - pname = "wiki.vim"; - src = inputs."wiki.vim"; - version = inputs."wiki.vim".shortRev; - - dependencies = with prev'; [ - plenary-nvim - telescope-nvim - ]; - }; - diagram-nvim = prev.vimUtils.buildVimPlugin { - pname = "diagram.nvim"; - src = inputs."diagram.nvim"; - version = inputs."diagram.nvim".shortRev; - - dependencies = with prev'; [ image-nvim ]; - }; - - nvim-cmp = final'.blink-compat; - } - ); - } - // self'.packages - ); - }; - }; - - checks.launch-neovim = inputs.nixvim.lib.${system}.check.mkTestDerivationFromNvim { - nvim = self'.packages.neovimTraxys.extend ( - { lib, ... }: - { - test.checkWarnings = false; - plugins.image.enable = lib.mkForce false; - plugins.diagram-nvim.enable = lib.mkForce false; - } - ); - name = "Neovim configuration"; - }; - }; -} diff --git a/neovim/plugins/default.nix b/neovim/plugins/default.nix new file mode 100644 index 0000000..28d2a9c --- /dev/null +++ b/neovim/plugins/default.nix @@ -0,0 +1,8 @@ +{ vim-headerguard }: +{ + imports = [ + ./diagram-nvim.nix + (import ./headerguard.nix { inherit vim-headerguard; }) + ./lsp-signature.nix + ]; +} diff --git a/neovim/plugins/headerguard.nix b/neovim/plugins/headerguard.nix index 78693f0..5a5d28d 100644 --- a/neovim/plugins/headerguard.nix +++ b/neovim/plugins/headerguard.nix @@ -1,3 +1,4 @@ +{ vim-headerguard }: { config, lib, @@ -17,7 +18,21 @@ with lib; cfg = config.plugins.headerguard; in mkIf cfg.enable { - extraPlugins = with pkgs.vimPlugins; [ vim-headerguard ]; + nixpkgs.overlays = [ + (final: prev: { + vimPlugins = prev.vimPlugins.extend ( + final': prev': { + vim-headerguard = prev.vimUtils.buildVimPlugin { + pname = "vim-headerguard"; + src = vim-headerguard; + version = vim-headerguard.shortRev; + }; + } + ); + }) + ]; + + extraPlugins = [ pkgs.vimPlugins.vim-headerguard ]; globals.headerguard_use_cpp_comments = cfg.useCppComment; };