chore(cleanup): sops, opencode, etc
This commit is contained in:
@@ -3,24 +3,29 @@ local llm_assistant_model = "devstral-small-2-instruct"
|
||||
local llm_infill_model = "qwen2.5-coder-3b-instruct"
|
||||
|
||||
-- Default Llama - Toggle Llama & Copilot
|
||||
-- vim.g.copilot_filetypes = { ["*"] = false }
|
||||
local current_mode = "copilot"
|
||||
local function toggle_llm_fim_provider()
|
||||
if current_mode == "llama" then
|
||||
vim.g.copilot_filetypes = { ["*"] = true }
|
||||
vim.cmd("Copilot enable")
|
||||
vim.cmd("LlamaDisable")
|
||||
current_mode = "copilot"
|
||||
vim.notify("Copilot FIM enabled", vim.log.levels.INFO)
|
||||
else
|
||||
local current_fim = "llama"
|
||||
local function switch_llm_fim_provider(switch_to)
|
||||
if switch_to == "llama" then
|
||||
vim.g.copilot_filetypes = { ["*"] = true }
|
||||
vim.cmd("Copilot disable")
|
||||
vim.cmd("LlamaEnable")
|
||||
current_mode = "llama"
|
||||
current_fim = "llama"
|
||||
vim.notify("Llama FIM enabled", vim.log.levels.INFO)
|
||||
else
|
||||
vim.g.copilot_filetypes = { ["*"] = true }
|
||||
vim.cmd("Copilot enable")
|
||||
vim.cmd("LlamaDisable")
|
||||
current_fim = "copilot"
|
||||
vim.notify("Copilot FIM enabled", vim.log.levels.INFO)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
switch_llm_fim_provider(current_fim)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Copilot Configuration
|
||||
vim.g.copilot_no_tab_map = true
|
||||
|
||||
@@ -75,7 +80,13 @@ codecompanion.setup({
|
||||
|
||||
-- Create KeyMaps for Code Companion
|
||||
vim.keymap.set("n", "<leader>aa", codecompanion.actions, { desc = "Actions" })
|
||||
vim.keymap.set("n", "<leader>af", toggle_llm_fim_provider, { desc = "Toggle FIM (Llama / Copilot)" })
|
||||
vim.keymap.set("n", "<leader>af", function()
|
||||
if current_fim == "llama" then
|
||||
switch_llm_fim_provider("copilot")
|
||||
else
|
||||
switch_llm_fim_provider("llama")
|
||||
end
|
||||
end, { desc = "Toggle FIM (Llama / Copilot)" })
|
||||
vim.keymap.set("n", "<leader>ao", function() require("snacks.terminal").toggle("opencode") end,
|
||||
{ desc = "Toggle OpenCode" })
|
||||
vim.keymap.set("v", "<leader>ai", ":CodeCompanion<cr>", { desc = "Inline Prompt" })
|
||||
|
||||
@@ -134,7 +134,13 @@ setup_lsp("cssls", {
|
||||
setup_lsp("ts_ls", {
|
||||
on_attach = on_attach_no_formatting,
|
||||
cmd = { nix_vars.tsls, "--stdio" },
|
||||
filetypes = { "typescript", "typescriptreact" },
|
||||
filetypes = { "typescript", "typescriptreact", "javascript" },
|
||||
})
|
||||
|
||||
-- ESLint LSP
|
||||
setup_lsp("eslint", {
|
||||
on_attach = on_attach_no_formatting,
|
||||
cmd = { nix_vars.vscls .. "/bin/vscode-eslint-language-server", "--stdio" },
|
||||
})
|
||||
|
||||
-- C LSP Configuration
|
||||
@@ -149,6 +155,11 @@ setup_lsp("lua_ls", {
|
||||
filetypes = { "lua" },
|
||||
})
|
||||
|
||||
-- Lua LSP Configuration
|
||||
setup_lsp("sqls", {
|
||||
cmd = { nix_vars.sqls },
|
||||
})
|
||||
|
||||
-- Nix LSP Configuration
|
||||
setup_lsp("nil_ls", {
|
||||
filetypes = { "nix" },
|
||||
@@ -205,44 +216,19 @@ setup_lsp("golangci_lint_ls", {
|
||||
------------------------------------------------------
|
||||
local none_ls = require("null-ls")
|
||||
|
||||
local eslintFiles = {
|
||||
".eslintrc",
|
||||
".eslintrc.js",
|
||||
".eslintrc.cjs",
|
||||
".eslintrc.yaml",
|
||||
".eslintrc.yml",
|
||||
".eslintrc.json",
|
||||
"eslint.config.js",
|
||||
"eslint.config.mjs",
|
||||
"eslint.config.cjs",
|
||||
"eslint.config.ts",
|
||||
"eslint.config.mts",
|
||||
"eslint.config.cts",
|
||||
}
|
||||
|
||||
local has_eslint_in_parents = function(fname)
|
||||
local root_file = require("lspconfig").util.insert_package_json(eslintFiles, "eslintConfig", fname)
|
||||
return require("lspconfig").util.root_pattern(unpack(root_file))(fname)
|
||||
end
|
||||
|
||||
none_ls.setup({
|
||||
sources = {
|
||||
-- Prettier Formatting
|
||||
-- Formatting
|
||||
none_ls.builtins.formatting.prettier,
|
||||
none_ls.builtins.formatting.prettier.with({ filetypes = { "template" } }),
|
||||
require("none-ls.diagnostics.eslint_d").with({
|
||||
condition = function(utils)
|
||||
return has_eslint_in_parents(vim.fn.getcwd())
|
||||
end,
|
||||
}),
|
||||
none_ls.builtins.completion.spell,
|
||||
none_ls.builtins.formatting.nixpkgs_fmt, -- TODO: nixd native LSP?
|
||||
none_ls.builtins.diagnostics.sqlfluff,
|
||||
none_ls.builtins.formatting.sqlfluff,
|
||||
require("none-ls.formatting.autopep8").with({
|
||||
filetypes = { "starlark", "python" },
|
||||
extra_args = { "--max-line-length", "100" },
|
||||
}),
|
||||
|
||||
-- Completion
|
||||
none_ls.builtins.completion.spell,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client:supports_method("textDocument/formatting") then
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, namespace
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
@@ -178,6 +179,7 @@ in
|
||||
sveltels = "${pkgs.nodePackages.svelte-language-server}/bin/svelteserver",
|
||||
tsls = "${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server",
|
||||
vscls = "${pkgs.nodePackages.vscode-langservers-extracted}",
|
||||
sqls = "${pkgs.sqls}/bin/sqls",
|
||||
}
|
||||
return nix_vars
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user