1
0

finalize 0.12.1 config

This commit is contained in:
2026-04-08 20:57:09 +02:00
parent 372f3a7720
commit ed1cc8eedf
37 changed files with 144 additions and 2492 deletions

View File

@@ -21,13 +21,13 @@ codecompanion.setup({
gemini = function()
return require("codecompanion.adapters").extend("gemini", {
env = {
-- We read the API key from the environment variable.
-- We read the API key from the environment variable.
-- You can also use "cmd:pass show gemini/api_key" or "cmd:cat ~/.gemini_api_key"
api_key = os.getenv("GEMINI_API_KEY") or "cmd:cat ~/.gemini_api_key",
},
schema = {
model = {
default = "gemini-3.1-pro-preview",
default = "gemini-3.1-pro-preview",
},
},
})
@@ -55,7 +55,10 @@ local blink = require("blink.cmp")
blink.setup({
keymap = { preset = "default" },
appearance = { nerd_font_variant = "mono" },
completion = { documentation = { auto_show = true } },
completion = {
menu = { border = "rounded" },
documentation = { auto_show = true, window = { border = "rounded" } },
},
cmdline = {
keymap = { ["<Tab>"] = { "show", "accept" } },
@@ -88,6 +91,16 @@ blink.setup({
fuzzy = { implementation = "prefer_rust_with_warning" },
})
-- Ensure borders stay colored even after toggling light/dark themes
vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "*",
callback = function()
vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { link = "Special" })
vim.api.nvim_set_hl(0, "BlinkCmpDocBorder", { link = "Special" })
vim.api.nvim_set_hl(0, "FloatBorder", { link = "Special" })
end,
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = blink.get_lsp_capabilities(capabilities)

View File

@@ -4,6 +4,7 @@ vim.pack.add({
{ src = "https://github.com/stevearc/oil.nvim" },
{ src = "https://github.com/echasnovski/mini.icons" },
{ src = "https://github.com/yorickpeterse/nvim-jump" },
{ src = "https://github.com/ibhagwan/fzf-lua" },
})
require("which-key").setup({
preset = "helix",
@@ -20,3 +21,55 @@ require("oil").setup({
vim.keymap.set("n", "<leader>pv", "<cmd>Oil<cr>", { desc = "Open current directory" })
vim.keymap.set({ "n", "x", "o" }, "<leader>f", require("jump").start, {})
local function get_project_root()
-- 1. Prioritize Terraform or nvim config project root (keeps search local to the TF module)
local tf_root = vim.fs.root(0, { ".terraform", ".terraform.lock.hcl" })
local nvim_root = vim.fs.root(0, { "nvim-pack-lock.json" })
-- 2. Fallback to Git root (prioritizes the top-level repo for Rust/Go/etc.)
local git_root = vim.fs.root(0, ".git")
-- 3. Fallback to language markers if not in a git repo
local lang_root = vim.fs.root(0, {
"Cargo.toml",
"go.mod",
"pyproject.toml",
"requirements.txt",
"pom.xml",
"build.gradle",
".luarc.json",
})
-- Chain them in the exact priority order you want
return tf_root or nvim_root or git_root or lang_root or vim.fn.getcwd()
end
vim.keymap.set("n", "<leader>pf", function()
require("fzf-lua").files({ cwd = get_project_root() })
end, { desc = "Fuzzy find project files" })
vim.keymap.set("n", "<leader>ps", function()
require("fzf-lua").live_grep({ cwd = get_project_root() })
end, { desc = "Live grep project text" })
vim.keymap.set("n", "<leader><space>", function()
require("fzf-lua").buffers()
end, { desc = "Fuzzy find open files" })
vim.keymap.set("n", "<leader>gf", function()
require("fzf-lua").git_files()
end, { desc = "Fuzzy find tracked Git files" })
vim.api.nvim_create_autocmd("BufEnter", {
group = vim.api.nvim_create_augroup("AutoChdirProjectRoot", { clear = true }),
callback = function(args)
-- Only change directory for normal files
if vim.bo[args.buf].buftype == "" and vim.api.nvim_buf_get_name(args.buf) ~= "" then
local root = get_project_root()
if root and root ~= vim.fn.getcwd() then
vim.api.nvim_set_current_dir(root)
end
end
end,
})

View File

@@ -34,8 +34,46 @@ vim.api.nvim_create_autocmd({ "BufReadPre", "BufNewFile" }, {
if vim.diagnostic.config().virtual_lines then
vim.diagnostic.config({ virtual_lines = false })
else
vim.diagnostic.config({ virtual_lines = { current_line = true } })
vim.diagnostic.config({
virtual_lines = {
current_line = true,
format = function(diagnostic)
local max_width = vim.api.nvim_win_get_width(0) - 15
max_width = math.max(max_width, 30)
local wrapped = ""
local current_len = 0
for word in diagnostic.message:gmatch("%S+") do
if current_len + #word + 1 > max_width and current_len > 0 then
wrapped = wrapped .. "\n" .. word
current_len = #word
else
wrapped = wrapped == "" and word or (wrapped .. " " .. word)
current_len = current_len + #word + 1
end
end
return wrapped
end,
},
})
end
end, { desc = "Toggle inline diagnostics" })
vim.keymap.set("n", "<leader>cd", function()
local line = vim.api.nvim_win_get_cursor(0)[1] - 1
local diagnostics = vim.diagnostic.get(0, { lnum = line })
if #diagnostics == 0 then
vim.notify("No diagnostics on current line", vim.log.levels.WARN)
return
end
local messages = {}
for _, diag in ipairs(diagnostics) do
table.insert(messages, diag.message)
end
vim.fn.setreg("+", table.concat(messages, "\n"))
vim.notify("Copied diagnostic(s) to clipboard", vim.log.levels.INFO)
end, { desc = "Copy diagnostic to clipboard" })
end,
})

View File

@@ -7,7 +7,6 @@ vim.opt.cmdheight = 2 -- more space in the neovim command line for displaying me
vim.pack.add({
{ src = "https://github.com/rose-pine/neovim" },
{ src = "https://github.com/zaldih/themery.nvim" },
{ src = "https://github.com/mvllow/modes.nvim", version = "v0.3.0" },
{ src = "https://github.com/brenoprata10/nvim-highlight-colors" },
})
@@ -27,7 +26,6 @@ vim.keymap.set("n", "<leader>tt", function()
end, { noremap = true, desc = "Alternate between light and dark mode" })
require("nvim-highlight-colors").setup()
require("modes").setup()
vim.pack.add({
{ src = "https://github.com/nvim-tree/nvim-web-devicons" },