mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-10-24 05:23:19 +00:00
feat(nvim): phase 1 — triage and abandoned-plugin cleanup
Fix keymap collision on <leader>j/<leader>k (now resize-only;
location-list moved to ]l/[l). Migrate diagnostic signs from
deprecated vim.fn.sign_define to vim.diagnostic.config. Drop
orphan after/nvim-tree.lua and the bogus require("../current-theme").
Add foundation snacks.nvim spec. Remove playground, vim-maximizer,
poet-v, git-blame, render-markdown, and all five AI plugin specs.
Enable gitsigns current_line_blame.
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
local codecompanion = require("codecompanion")
|
||||
|
||||
codecompanion.setup({
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "openai",
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
mcphub = {
|
||||
callback = "mcphub.extensions.codecompanion",
|
||||
opts = {
|
||||
make_vars = true,
|
||||
make_slash_commands = true,
|
||||
show_result_in_chat = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local opts = {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<leader>ac", function()
|
||||
vim.cmd("CodeCompanionChat")
|
||||
end, opts)
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<leader>ai", function()
|
||||
local input = vim.fn.input("[Code Companion Inline]: ")
|
||||
local trimmed_input = vim.fn.trim(input)
|
||||
|
||||
if trimmed_input == "" then
|
||||
vim.notify("No input provided for inline code companion", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd("CodeCompanion" .. " " .. vim.fn.shellescape(trimmed_input))
|
||||
end, opts)
|
||||
@@ -1,36 +0,0 @@
|
||||
local gen = require("gen")
|
||||
|
||||
gen.setup({
|
||||
-- Custom Parameters (with defaults)
|
||||
model = "deepseek-r1:7b", -- The default model to use.
|
||||
quit_map = "q", -- set keymap to close the response window
|
||||
retry_map = "<c-r>", -- set keymap to re-send the current prompt
|
||||
accept_map = "<c-cr>", -- set keymap to replace the previous selection with the last result
|
||||
host = "localhost", -- The host running the Ollama service.
|
||||
port = "11434", -- The port on which the Ollama service is listening.
|
||||
display_mode = "split", -- The display mode. Can be "float" or "split" or "horizontal-split".
|
||||
show_prompt = false, -- Shows the prompt submitted to Ollama. Can be true (3 lines) or "full".
|
||||
show_model = false, -- Displays which model you are using at the beginning of your chat session.
|
||||
no_auto_close = false, -- Never closes the window automatically.
|
||||
file = false, -- Write the payload to a temporary file to keep the command short.
|
||||
hidden = false, -- Hide the generation window (if true, will implicitly set `prompt.replace = true`), requires Neovim >= 0.10
|
||||
init = function(options)
|
||||
pcall(io.popen, "ollama serve > /dev/null 2>&1 &")
|
||||
end,
|
||||
-- Function to initialize Ollama
|
||||
command = function(options)
|
||||
local body = { model = options.model, stream = true }
|
||||
return "curl --silent --no-buffer -X POST http://"
|
||||
.. options.host
|
||||
.. ":"
|
||||
.. options.port
|
||||
.. "/api/chat -d $body"
|
||||
end,
|
||||
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped).
|
||||
-- This can also be a command string.
|
||||
-- The executed command must return a JSON object with { response, context }
|
||||
-- (context property is optional).
|
||||
-- list_models = '<omitted lua function>', -- Retrieves a list of model names
|
||||
result_filetype = "markdown", -- Configure filetype of the result buffer
|
||||
debug = false, -- Prints errors and the command which is run.
|
||||
})
|
||||
@@ -1,3 +1,10 @@
|
||||
local gitsigns = require("gitsigns")
|
||||
|
||||
gitsigns.setup()
|
||||
gitsigns.setup({
|
||||
current_line_blame = true,
|
||||
current_line_blame_opts = {
|
||||
virt_text_pos = "eol",
|
||||
delay = 500,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
local llm = require("llm")
|
||||
local llmCompletion = require("llm.completion")
|
||||
|
||||
llm.setup({
|
||||
api_token = nil, -- cf Install paragraph
|
||||
model = "codellama:13b", -- the model ID, behavior depends on backend
|
||||
backend = "ollama", -- backend ID, "huggingface" | "ollama" | "openai" | "tgi"
|
||||
url = "http://localhost:11434", -- the http url of the backend
|
||||
-- tokens_to_clear = { "<|endoftext|>" }, -- tokens to remove from the model's output
|
||||
tokens_to_clear = { "<EOT>" },
|
||||
-- parameters that are added to the request body, values are arbitrary, you can set any field:value pair here it will be passed as is to the backend
|
||||
request_body = {
|
||||
parameters = {
|
||||
-- max_new_tokens = 60,
|
||||
temperature = 0.2,
|
||||
top_p = 0.95,
|
||||
},
|
||||
},
|
||||
-- set this if the model supports fill in the middle
|
||||
-- fim = {
|
||||
-- enabled = false,
|
||||
-- prefix = "<fim_prefix>",
|
||||
-- middle = "<fim_middle>",
|
||||
-- suffix = "<fim_suffix>",
|
||||
-- },
|
||||
fim = {
|
||||
enabled = true,
|
||||
prefix = "<PRE> ",
|
||||
middle = " <MID>",
|
||||
suffix = " <SUF>",
|
||||
},
|
||||
|
||||
debounce_ms = 150,
|
||||
accept_keymap = nil,
|
||||
dismiss_keymap = nil,
|
||||
tls_skip_verify_insecure = false,
|
||||
-- llm-ls configuration, cf llm-ls section
|
||||
|
||||
lsp = {
|
||||
bin_path = vim.api.nvim_call_function("stdpath", { "data" }) .. "/mason/bin/llm-ls",
|
||||
cmd_env = { LLM_LOG_LEVEL = "DEBUG" },
|
||||
},
|
||||
-- tokenizer = nil, -- cf Tokenizer paragraph
|
||||
tokenizer = {
|
||||
repository = "codellama/CodeLlama-13b-hf",
|
||||
},
|
||||
context_window = 4096,
|
||||
enable_suggestions_on_startup = false,
|
||||
enable_suggestions_on_files = { "*.py", "*.js", "*.ts", "*.astro", "*.vue", "*.lua" },
|
||||
disable_url_path_completion = false, -- cf Backend
|
||||
})
|
||||
|
||||
vim.keymap.set("i", "<Tab>", function()
|
||||
if llmCompletion.shown_suggestion ~= nil then
|
||||
llmCompletion.complete()
|
||||
else
|
||||
local keys = vim.api.nvim_replace_termcodes("<Tab>", true, false, true)
|
||||
vim.api.nvim_feedkeys(keys, "n", false)
|
||||
end
|
||||
end, { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set("n", "<Tab>", function()
|
||||
if llmCompletion.shown_suggestion ~= nil then
|
||||
llmCompletion.complete()
|
||||
else
|
||||
local keys = vim.api.nvim_replace_termcodes("<Tab>", true, false, true)
|
||||
vim.api.nvim_feedkeys(keys, "n", false)
|
||||
end
|
||||
end, { noremap = true, silent = true })
|
||||
|
||||
-- Debounce helper
|
||||
local debounce = function(func, timeout)
|
||||
if type(func) ~= "function" then
|
||||
error("Expected a function")
|
||||
end
|
||||
if type(timeout) ~= "number" or timeout <= 0 then
|
||||
error("Expected a positive number for timeout")
|
||||
end
|
||||
local timer = vim.uv.new_timer()
|
||||
return function(...)
|
||||
local args = { ... }
|
||||
timer:stop() -- Reset the timer
|
||||
timer:start(
|
||||
timeout,
|
||||
0,
|
||||
vim.schedule_wrap(function()
|
||||
func(unpack(args))
|
||||
end)
|
||||
)
|
||||
end
|
||||
end
|
||||
-- Define the function to be executed
|
||||
local function on_text_change()
|
||||
llmCompletion.lsp_suggest()
|
||||
end
|
||||
|
||||
-- Debounce the function
|
||||
local debounced_on_text_change = debounce(on_text_change, 3000)
|
||||
|
||||
-- Set up the autocommand
|
||||
vim.api.nvim_create_autocmd({ "InsertCharPre" }, {
|
||||
pattern = "*",
|
||||
callback = debounced_on_text_change,
|
||||
desc = "Run method after typing stops with debounce",
|
||||
})
|
||||
@@ -1,6 +1,5 @@
|
||||
-- Setup language servers.
|
||||
local conform = require("conform")
|
||||
local lspconfig = require("lspconfig")
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
@@ -70,27 +69,25 @@ end
|
||||
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
local signs = {
|
||||
Error = " ",
|
||||
Warn = " ",
|
||||
Hint = " ",
|
||||
Info = " ",
|
||||
}
|
||||
-- Configure diagnostic signs (Neovim 0.10+ API; required in 0.12)
|
||||
vim.diagnostic.config({
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
-- configure html server
|
||||
lspconfig["html"].setup({
|
||||
-- Configure LSP servers using vim.lsp.config
|
||||
vim.lsp.config("html", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure typescript server with plugin
|
||||
lspconfig["ts_ls"].setup({
|
||||
vim.lsp.config("ts_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
init_options = {
|
||||
@@ -105,21 +102,18 @@ lspconfig["ts_ls"].setup({
|
||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
|
||||
})
|
||||
|
||||
-- configure css server
|
||||
lspconfig["cssls"].setup({
|
||||
vim.lsp.config("cssls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure tailwindcss server
|
||||
lspconfig["tailwindcss"].setup({
|
||||
vim.lsp.config("tailwindcss", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "svelte", "vue", "astro" },
|
||||
})
|
||||
|
||||
-- configure svelte server
|
||||
lspconfig["svelte"].setup({
|
||||
vim.lsp.config("svelte", {
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
@@ -135,8 +129,7 @@ lspconfig["svelte"].setup({
|
||||
end,
|
||||
})
|
||||
|
||||
-- configure emmet language server
|
||||
lspconfig["emmet_ls"].setup({
|
||||
vim.lsp.config("emmet_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = {
|
||||
@@ -153,14 +146,12 @@ lspconfig["emmet_ls"].setup({
|
||||
},
|
||||
})
|
||||
|
||||
-- configure ruff server
|
||||
lspconfig["ruff"].setup({
|
||||
vim.lsp.config("ruff", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure pyright server
|
||||
lspconfig["pyright"].setup({
|
||||
vim.lsp.config("pyright", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "python" },
|
||||
@@ -175,20 +166,17 @@ lspconfig["pyright"].setup({
|
||||
},
|
||||
})
|
||||
|
||||
-- configure docker server
|
||||
lspconfig["dockerls"].setup({
|
||||
vim.lsp.config("dockerls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure json server
|
||||
lspconfig["jsonls"].setup({
|
||||
vim.lsp.config("jsonls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure vue server
|
||||
lspconfig["volar"].setup({
|
||||
vim.lsp.config("vue_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "vue" },
|
||||
@@ -221,9 +209,7 @@ lspconfig["volar"].setup({
|
||||
},
|
||||
})
|
||||
|
||||
-- configure rust server
|
||||
lspconfig.rust_analyzer.setup({
|
||||
-- Server-specific settings. See `:help lspconfig-setup`
|
||||
vim.lsp.config("rust_analyzer", {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
@@ -231,18 +217,15 @@ lspconfig.rust_analyzer.setup({
|
||||
},
|
||||
})
|
||||
|
||||
-- configure lua server (with special settings)
|
||||
lspconfig["lua_ls"].setup({
|
||||
vim.lsp.config("lua_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = { -- custom settings for lua
|
||||
settings = {
|
||||
Lua = {
|
||||
-- make the language server recognize "vim" global
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- make language server aware of runtime files
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
@@ -252,73 +235,45 @@ lspconfig["lua_ls"].setup({
|
||||
},
|
||||
})
|
||||
|
||||
-- configure css server
|
||||
lspconfig["cssls"].setup({
|
||||
vim.lsp.config("docker_compose_language_service", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
--configure docker file server
|
||||
lspconfig["dockerls"].setup({
|
||||
vim.lsp.config("eslint", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure docker compose server
|
||||
lspconfig["docker_compose_language_service"].setup({
|
||||
vim.lsp.config("astro", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure eslint server
|
||||
lspconfig["eslint"].setup({
|
||||
vim.lsp.config("kotlin_language_server", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure astro server
|
||||
lspconfig["astro"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
-- init_options = {
|
||||
-- typescript = {
|
||||
-- tsdk = ResolveTypescriptServer(),
|
||||
-- },
|
||||
-- },
|
||||
})
|
||||
|
||||
-- configure kotlin server
|
||||
lspconfig["kotlin_language_server"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure clang server
|
||||
|
||||
lspconfig["clangd"].setup({
|
||||
vim.lsp.config("clangd", {
|
||||
cmd = { "clangd", "--compile-commands-dir=./", "--background-index=false" },
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "c", "cpp", "objc", "objcpp" },
|
||||
})
|
||||
|
||||
-- configure bufls server
|
||||
|
||||
lspconfig["buf_ls"].setup({
|
||||
vim.lsp.config("buf_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "proto" },
|
||||
})
|
||||
|
||||
-- configure arduino language server
|
||||
|
||||
lspconfig["arduino_language_server"].setup({
|
||||
vim.lsp.config("arduino_language_server", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure biome server
|
||||
lspconfig["biome"].setup({
|
||||
vim.lsp.config("biome", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = {
|
||||
@@ -334,3 +289,28 @@ lspconfig["biome"].setup({
|
||||
"vue",
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable all configured LSP servers
|
||||
vim.lsp.enable({
|
||||
"html",
|
||||
"ts_ls",
|
||||
"cssls",
|
||||
"tailwindcss",
|
||||
"svelte",
|
||||
"emmet_ls",
|
||||
"ruff",
|
||||
"pyright",
|
||||
"dockerls",
|
||||
"jsonls",
|
||||
"vue_ls",
|
||||
"rust_analyzer",
|
||||
"lua_ls",
|
||||
"docker_compose_language_service",
|
||||
"eslint",
|
||||
"astro",
|
||||
"kotlin_language_server",
|
||||
"clangd",
|
||||
"buf_ls",
|
||||
"arduino_language_server",
|
||||
"biome",
|
||||
})
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
local nvimtree = require("absolute.disabled.nvim-tree")
|
||||
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
vim.cmd([[ highlight NvimTreeIndentMarker guifg=#3FC5FF ]])
|
||||
|
||||
vim.cmd([[ highlight NvimTreeFolderArrowClosed guifg=#3FC5FF ]])
|
||||
vim.cmd([[ highlight NvimTreeFolderArrowOpen guifg=#3FC5FF ]])
|
||||
|
||||
nvimtree.setup({
|
||||
view = {
|
||||
width = 45,
|
||||
relativenumber = true,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
},
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
icons = {
|
||||
glyphs = {
|
||||
|
||||
folder = {
|
||||
arrow_closed = "", -- arrow when folder is closed
|
||||
arrow_open = "", -- arrow when folder is open
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- disable window_picker for
|
||||
-- explorer to work well with
|
||||
-- window splits
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
custom = { ".DS_Store" },
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
},
|
||||
})
|
||||
@@ -1,20 +0,0 @@
|
||||
vim.g.poetv_executables = { "poetry" }
|
||||
vim.g.poetv_auto_activate = 0
|
||||
vim.g.poetv_set_environment = 1
|
||||
vim.g.poetv_statusline_symbol = "🐍"
|
||||
|
||||
-- Setup Autocommands
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = { "*/.venv/*", "*.py" },
|
||||
callback = function()
|
||||
-- check if poetv is activated
|
||||
|
||||
if vim.g.poetv_name ~= nil then
|
||||
return
|
||||
else
|
||||
vim.cmd([[ PoetvActivate ]])
|
||||
vim.cmd([[ LspRestart ]])
|
||||
end
|
||||
end,
|
||||
})
|
||||
Reference in New Issue
Block a user