diff --git a/README.md b/README.md index a82e66a1..4eb4a250 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ home-manager.users..home.packages = [ ### Utils +- `archlens.nix`: Installs and configures the published ArchLens Neovim plugin. - `trouble.nix`: Provides persistent diagnostics, quickfix, location-list, and TODO triage views. - `overseer.nix`: Runs bounded, repo-aware validation tasks while keeping persistent sessions in cmux. - `telescope.nix`: Configures the Telescope plugin for fuzzy finding and picking. diff --git a/config/auto_cmds.nix b/config/auto_cmds.nix index 3c363286..05eb6d25 100644 --- a/config/auto_cmds.nix +++ b/config/auto_cmds.nix @@ -23,6 +23,7 @@ event = [ "FileType" ]; pattern = [ "help" + "archlens" "snacks_dashboard" "neo-tree" "Trouble" diff --git a/config/default.nix b/config/default.nix index 884f595d..e9bb8700 100644 --- a/config/default.nix +++ b/config/default.nix @@ -50,6 +50,7 @@ _: { ./plugins/git/gitsigns.nix # Utils + ./plugins/utils/archlens.nix ./plugins/utils/trouble.nix ./plugins/utils/overseer.nix ./plugins/utils/telescope.nix diff --git a/config/plugins/lsp/ocaml.nix b/config/plugins/lsp/ocaml.nix index 645c48e9..bebbaef8 100644 --- a/config/plugins/lsp/ocaml.nix +++ b/config/plugins/lsp/ocaml.nix @@ -10,9 +10,12 @@ packageFallback = true; }; - # OCaml-LSP delegates formatting to ocamlformat. Keep the Nix package as a - # fallback so a project-local/opam version remains authoritative. - extraPackagesAfter = [ pkgs.ocamlPackages.ocamlformat ]; + # OCaml-LSP needs Dune to load project documents and delegates formatting to + # ocamlformat. Keep both as fallbacks so project-local tools remain authoritative. + extraPackagesAfter = [ + pkgs.dune_3 + pkgs.ocamlPackages.ocamlformat + ]; autoCmd = [ { diff --git a/config/plugins/utils/archlens.nix b/config/plugins/utils/archlens.nix new file mode 100644 index 00000000..704a679d --- /dev/null +++ b/config/plugins/utils/archlens.nix @@ -0,0 +1,44 @@ +{ + archlens, + lib, + pkgs, + ... +}: +{ + extraPlugins = [ archlens ]; + extraPackagesAfter = [ + pkgs.ast-grep + pkgs.ripgrep + ]; + + extraConfigLua = lib.mkAfter '' + require("archlens").setup({ + width = 64, + max_items = 8, + include_external = false, + ast_grep = { + command = "${lib.getExe pkgs.ast-grep}", + timeout_ms = 15000, + max_results = 80, + min_name_length = 5, + }, + imports = { + inbound = { + command = "${lib.getExe pkgs.ripgrep}", + }, + }, + }) + ''; + + keymaps = [ + { + mode = "n"; + key = "cm"; + action = "ArchLensHere"; + options = { + desc = "Map local and project relationships"; + silent = true; + }; + } + ]; +} diff --git a/config/plugins/utils/telescope.nix b/config/plugins/utils/telescope.nix index f38fdd55..093de2a5 100644 --- a/config/plugins/utils/telescope.nix +++ b/config/plugins/utils/telescope.nix @@ -1,6 +1,10 @@ +{ pkgs, ... }: { + extraPlugins = [ pkgs.vimPlugins.telescope-hierarchy-nvim ]; + plugins.telescope = { enable = true; + enabledExtensions = [ "hierarchy" ]; extensions = { file-browser = { enable = true; @@ -18,6 +22,11 @@ }; sorting_strategy = "ascending"; }; + extensions.hierarchy = { + initial_multi_expand = false; + multi_depth = 5; + layout_strategy = "horizontal"; + }; }; keymaps = { "" = { @@ -173,6 +182,22 @@ }; }; keymaps = [ + { + mode = "n"; + key = "ci"; + action = "Telescope hierarchy incoming_calls"; + options = { + desc = "Incoming call hierarchy"; + }; + } + { + mode = "n"; + key = "co"; + action = "Telescope hierarchy outgoing_calls"; + options = { + desc = "Outgoing call hierarchy"; + }; + } { mode = "n"; key = "sd"; diff --git a/config/plugins/utils/trouble.nix b/config/plugins/utils/trouble.nix index 56a3b6f1..6bd10b76 100644 --- a/config/plugins/utils/trouble.nix +++ b/config/plugins/utils/trouble.nix @@ -12,6 +12,18 @@ _: { }; keymaps = [ + { + mode = "n"; + key = "cs"; + action = "Trouble symbols toggle focus=false"; + options.desc = "Document symbols"; + } + { + mode = "n"; + key = "cl"; + action = "Trouble lsp toggle focus=false win.position=right"; + options.desc = "LSP locations"; + } { mode = "n"; key = "xx"; diff --git a/flake.lock b/flake.lock index 1e8bbea2..3197f348 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,31 @@ { "nodes": { + "archlens": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "nixpkgs": [ + "nixpkgs" + ], + "nixvim": [ + "nixvim" + ] + }, + "locked": { + "lastModified": 1785754423, + "narHash": "sha256-xYVTi6/3p4bFqoTYKrgUqXBQP8H1ZOq5qv7aqW6AcQ4=", + "owner": "dc-tec", + "repo": "archlens", + "rev": "1c5454f1d559c1e1b9744ea8b31037cc3ce44aa7", + "type": "github" + }, + "original": { + "owner": "dc-tec", + "repo": "archlens", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -216,6 +242,7 @@ }, "root": { "inputs": { + "archlens": "archlens", "flake-parts": "flake-parts", "md-render": "md-render", "mmdr": "mmdr", diff --git a/flake.nix b/flake.nix index 96acf752..b8c1b12f 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,14 @@ pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; }; + archlens = { + url = "github:dc-tec/archlens"; + inputs = { + flake-parts.follows = "flake-parts"; + nixpkgs.follows = "nixpkgs"; + nixvim.follows = "nixvim"; + }; + }; md-render = { url = "github:delphinus/md-render.nvim/v3.4.0"; flake = false; @@ -52,6 +60,7 @@ module = import ./config; # import the module directly # You can use `extraSpecialArgs` to pass additional arguments to your module files extraSpecialArgs = { + archlens = inputs.archlens.packages.${system}.default; mdRender = inputs.md-render; mmdr = inputs.mmdr.packages.${system}.default; };