update to nixvim scala metals and copilot configs

This commit is contained in:
Salar Rahmanian 2025-10-11 12:49:37 -07:00
parent c543995d4d
commit 0860e967f3
6 changed files with 81 additions and 5 deletions

View file

@ -0,0 +1,10 @@
{
"permissions": {
"allow": [
"WebFetch(domain:github.com)",
"WebFetch(domain:raw.githubusercontent.com)"
],
"deny": [],
"ask": []
}
}

View file

@ -230,6 +230,15 @@ Adjust these in `options.nix` and `completion.nix` respectively.
| `<leader>j` | Normal | Next diagnostic |
| `<leader>k` | Normal | Previous diagnostic |
### Metals (Scala Development)
| Key | Mode | Action |
|-----|------|--------|
| `<leader>ws` | Normal | Hover Metals Worksheet |
| `<leader>sm` | Normal | Telescope Metals Commands |
| `<leader>tt` | Normal | Toggle tree view |
| `<leader>tr` | Normal | Reveal in tree |
### Terminal (Floaterm)
| Key | Mode | Action |

View file

@ -30,5 +30,12 @@
pattern = ["swift" "json" "lua" "nix"];
command = "setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab";
}
# Metals (Scala) - Refresh codelens
{
event = ["BufEnter" "CursorHold" "InsertLeave"];
pattern = ["*.scala" "*.sbt" "*.java"];
command = "lua vim.lsp.codelens.refresh()";
}
];
}

View file

@ -30,6 +30,11 @@
"<C-Right>" = ":vertical resize -2<CR>";
"<M-k>" = ":move-2<CR>";
"<M-j>" = ":move+<CR>";
# Metals (Scala) keybindings
"<leader>ws" = "<cmd>lua require('metals').hover_worksheet()<CR>";
"<leader>sm" = "<cmd>lua require('telescope').extensions.metals.commands()<CR>";
"<leader>tt" = "<cmd>lua require('metals.tvp').toggle_tree_view()<CR>";
"<leader>tr" = "<cmd>lua require('metals.tvp').reveal_in_tree()<CR>";
};
visual =
lib.mapAttrsToList

View file

@ -4,14 +4,33 @@
programs.nixvim = {
plugins = {
# GitHub Copilot
copilot-vim.enable = true;
copilot-vim = {
enable = true;
};
# Avante AI assistant (imported from separate file)
# avante config is in avante.nix
};
globals = {
copilot_node_command = lib.mkForce "${pkgs.nodejs-slim}/bin/node";
copilot_node_command = lib.mkForce "${pkgs.nodejs}/bin/node";
copilot_no_tab_map = true;
copilot_assume_mapped = true;
};
# Copilot keymapping - use Ctrl+J to accept suggestion
keymaps = [
{
mode = "i";
key = "<C-J>";
action = "copilot#Accept(\"\\<CR>\")";
options = {
silent = true;
script = true;
expr = true;
replace_keycodes = false;
};
}
];
};
}
}

View file

@ -52,7 +52,33 @@
marksman.enable = true;
# Scala
metals.enable = true;
metals = {
enable = true;
settings.settings = {
bloopSbtAlreadyInstalled = true;
defaultBspToBuildTool = true;
enableBestEffort = true;
excludedPackages = [
"akka.actor.typed.javadsl"
"com.github.swagger.akka.javadsl"
];
initOptions = {
statusBarProvider = "on";
};
inlayHints = {
typeParameters.enable = true;
hintsInPatternMatch.enable = true;
};
mcpClient = "claude";
serverVersion = "latest.snapshot";
showImplicitArguments = true;
showImplicitConversionsAndClasses = true;
showInferredType = true;
startMcpServer = true;
superMethodLensesEnabled = true;
useGlobalExecutable = true;
};
};
# Nix
nil_ls.enable = true;
@ -76,4 +102,4 @@
tinymist.enable = true;
};
};
}
}