1
0

test 0.12.1 config

This commit is contained in:
2026-04-08 19:19:43 +02:00
parent 0763449f80
commit 372f3a7720
43 changed files with 950 additions and 120 deletions

View File

@@ -0,0 +1,15 @@
-- Rerun tests only if their modification time changed.
cache = true
ignore = {
"122", -- Setting a read-only field of a global variable.
"212", -- Unused argument, In the case of callback function, _arg_name is easier to understand than _, so this option is set to off.
}
-- Global objects defined by the C code
read_globals = {
"vim",
"Snacks",
}
files["snippets/*.lua"] = { ignore = { "211", "631" } }

View File

@@ -0,0 +1,2 @@
require("ink")
require("config.lazy")

View File

@@ -0,0 +1,5 @@
return {
cmd = { "bash-language-server" },
filetypes = { "sh", "bash", "zsh" },
settings = {},
}

View File

@@ -0,0 +1,27 @@
return {
cmd = { "gopls" },
root_markers = { "go.mod" },
filetypes = { "go", "golang" },
settings = {
gopls = {
completeUnimported = true,
usePlaceholders = true,
["completion.matcher"] = "fuzzy",
["completion.completeFunctionCalls"] = true,
analyses = {
unusedparams = true,
staticcheck = true,
unusedwrite = true,
shadow = true,
},
["ui.inlayhint.hints"] = {
compositeLiteralFields = true,
constantValues = true,
parameterNames = true,
assignVariableTypes = true,
functionTypeParameters = true,
rangeVariableTypes = true,
},
},
},
}

View File

@@ -0,0 +1,17 @@
return {
cmd = { "lua-language-server" },
root_markers = { ".luarc.json", ".luarc.jsonc" },
filetypes = { "lua" },
settings = {
Lua = {
completion = { callSnippet = "Both" },
hint = { enable = true },
workspace = {
library = {
vim.env.VIMRUNTIME,
},
},
runtime = { version = "LuaJIT" },
},
},
}

View File

@@ -0,0 +1,31 @@
return {
cmd = { "rust-analyzer" },
root_markers = { "Cargo.toml" },
filetypes = { "rust" },
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
},
checkOnSave = true,
completion = {
autoself = { enable = true },
snippets = { enable = true },
},
diagnostics = {
enable = true,
experimental = { enable = true },
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
},
}

View File

@@ -0,0 +1,6 @@
return {
cmd = { "terraform-ls", "serve" },
root_markers = { ".terraform.lock", "backend.tf" },
filetypes = { "terraform", "tf" },
settings = {},
}

View File

@@ -0,0 +1,144 @@
require("ink.remap")
require("ink.lsp")
require("ink.tabline")
vim.opt.hlsearch = false -- do not highlight matches
vim.wo.number = true
vim.opt.relativenumber = true
vim.opt.mouse = "a"
vim.opt.clipboard = "unnamedplus"
vim.opt.breakindent = true -- Enable break indent
vim.opt.undofile = true -- Save undo history
vim.opt.ignorecase = true -- ignore case in searches by default
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
vim.w.signcolumn = "yes" -- Keep signcolumn on by default
vim.opt.updatetime = 250 -- Decrease update time
vim.opt.timeoutlen = 300 -- time to wait for a mapped sequence to complete (in milliseconds)
vim.opt.backup = false -- creates a backup file
-- if a file is being edited by another program (or was written to file while editing with another program), it is not
-- allowed to be edited
vim.opt.writebackup = false
vim.opt.autoread = true -- reload files changed outside of neovim
vim.o.completeopt = "menuone,noinsert,popup,fuzzy"
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
vim.o.wrap = true -- 1. Enable line wrapping by default
vim.o.linebreak = true -- 2. Break lines at word boundaries (improves readability)
vim.o.showbreak = "" -- 3. Add a visual indicator for wrapped lines
vim.opt.scrolloff = 4 -- minimal number of screen lines to keep above and below the cursor
vim.opt.sidescrolloff = 8 -- minimal number of screen columns either side of cursor if wrap is `false`
vim.opt.numberwidth = 2 -- set number column width to 2 {default 4}
vim.opt.shiftwidth = 4 -- Number of spaces inserted when indenting
vim.opt.tabstop = 4 -- A TAB character looks like 4 spaces
vim.opt.softtabstop = 4 -- Number of spaces inserted instead of a TAB character
vim.opt.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character
vim.opt.cursorline = true
vim.opt.splitbelow = true -- open new vertical split bottom
vim.opt.splitright = true -- open new horizontal splits right
vim.opt.swapfile = false -- creates a swapfile
vim.opt.smartindent = true -- make indenting smarter again
vim.opt.showtabline = 2 -- always show tabs
vim.opt.backspace = "indent,eol,start" -- allow backspace on
vim.opt.pumheight = 10 -- pop up menu height
vim.wo.conceallevel = 0 -- so that `` is visible in markdown files
vim.opt.encoding = "utf-8" -- the encoding written to a file
vim.opt.cmdheight = 1 -- more space in the neovim command line for displaying messages
vim.opt.autoindent = true
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
-- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter>
-- in insert mode, or hitting 'o' or 'O' in normal mode.
vim.opt.formatoptions:remove({ "c", "r", "o" })
vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins from neovim in case vim still in use
-- Nice and simple folding:
vim.opt.foldenable = true
vim.opt.foldlevel = 99
vim.opt.foldmethod = "expr"
-- Default to treesitter folding
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
-- vim.opt.foldtext = "> "
vim.opt.fillchars:append({ fold = ">" })
vim.opt.incsearch = true -- search as characters are entered
-- Auto-reload buffers when files change on disk (e.g. from external tools or AI agents)
vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold" }, {
callback = function()
if vim.fn.getcmdwintype() == "" then
vim.cmd("checktime")
end
end,
})
-- remove trailing whitespace (keeppatterns avoids adding to search history)
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = { "*" },
callback = function()
local save_cursor = vim.fn.getpos(".")
pcall(function()
vim.cmd([[keeppatterns %s/\s\+$//e]])
end)
vim.fn.setpos(".", save_cursor)
end,
})
--
-- Set a keymap to toggle the 'wrap' option
vim.keymap.set("n", "<leader>w", function()
vim.opt.wrap:toggle()
end, { desc = "Toggle line wrapping" })
local uv = vim.uv
vim.api.nvim_create_autocmd({ "VimEnter", "VimLeave" }, {
callback = function()
if vim.env.TMUX_PLUGIN_MANAGER_PATH then
uv.spawn(vim.env.TMUX_PLUGIN_MANAGER_PATH .. "/tmux-window-name/scripts/rename_session_windows.py", {})
end
end,
})
--
-- Filetypes to enable spellcheck
local spell_types = { "text", "plaintex", "typst", "gitcommit", "markdown" }
-- add gotmpl filetypes for blueprint repos
-- *.ext.tmpl files use the filetype of ext (e.g. foo.json.tmpl -> json, bar.sh.tmpl -> bash)
vim.filetype.add({
extension = {
gotmpl = "gotmpl",
},
pattern = {
[".*/recipes/.*%.ya?ml"] = "gotmpl",
[".*%.tmpl$"] = function(path)
local name = vim.fn.fnamemodify(path, ":t")
local base = name:match("^(.+)%.tmpl$")
if base then
local ext = base:match("%.(%w+)$")
if ext then
if ext == "sh" then
return "bash"
end
return ext
end
end
return nil
end,
},
})
-- Set global spell option to false initially to disable it for all file types
vim.opt.spell = false
-- Create an augroup for spellcheck to group related autocommands
vim.api.nvim_create_augroup("Spellcheck", { clear = true })
-- Create an autocommand to enable spellcheck for specified file types
vim.api.nvim_create_autocmd({ "FileType" }, {
group = "Spellcheck", -- Grouping the command for easier management
pattern = spell_types, -- Only apply to these file types
callback = function()
vim.opt_local.spell = true -- Enable spellcheck for these file types
end,
desc = "Enable spellcheck for defined filetypes", -- Description for clarity
})

View File

@@ -0,0 +1,70 @@
--- [[ LSP setup]]
---
vim.lsp.enable("luals")
vim.lsp.enable("rust")
vim.lsp.enable("gopls")
vim.lsp.enable("bashls")
vim.lsp.enable("terraform")
vim.lsp.config("*", {
capabilities = {
textDocument = {
semanticTokens = {
multilineTokenSupport = true,
},
},
},
})
-- [[FOLDING SETUP
-- Prefer LSP folding if client supports it
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client ~= nil then
if client:supports_method("textDocument/foldingRange") then
local win = vim.api.nvim_get_current_win()
vim.wo[win].foldexpr = "v:lua.vim.lsp.foldexpr()"
end
end
end,
})
-- ]]
-- [[INLAY HINTS
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
end
end,
})
-- [[CODE ACTIONS
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local bufnr = args.data.bufnr
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code action (menu)" })
vim.keymap.set("v", "<leader>ca", function()
vim.lsp.buf.code_action({ context = { only = { "quickfix" } } })
end, { buffer = bufnr, desc = "Code action (selection)" })
-- Quickfix at cursor: apply single fix without menu when only one available
vim.keymap.set("n", "<leader>cf", function()
vim.lsp.buf.code_action({
context = { only = { "quickfix" } },
apply = true,
})
end, { buffer = bufnr, desc = "Apply fix at cursor" })
-- Organize imports (Rust: source.organizeImports.rust, Go: source.organizeImports)
vim.keymap.set("n", "<leader>ci", function()
vim.lsp.buf.code_action({
context = {
only = { "source.organizeImports.rust", "source.organizeImports" },
},
apply = true,
})
end, { buffer = bufnr, desc = "Organize imports" })
end,
})

View File

@@ -0,0 +1,63 @@
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- (mode, key, command)
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true })
-- vim.keymap.set("n", "<leader>pv", vim.cmd.Ex, { desc = "Open current directory" })
local function map(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
if opts.desc then
opts.desc = "keymaps.lua: " .. opts.desc
end
options = vim.tbl_extend("force", options, opts)
end
vim.keymap.set(mode, lhs, rhs, options)
end
map("n", "<leader>sn", "<cmd>noautocmd w <CR>", { desc = "Save without formatting" }) -- save without autoformat
map("n", "x", '"_x', { desc = "Remove character under cursor without clipboard" })
map("n", "n", "nzzzv", { desc = "Find next occurence of search" })
map("n", "N", "Nzzzv", { desc = "Find previous occurence of search" })
map("n", "<Tab>", ":bnext<CR>", { desc = "Switch to next buffer" })
map("n", "<S-Tab>", ":bprev<CR>", { desc = "Switch to previous buffer" })
map("n", "<leader>x", ":bdelete!<CR>", { desc = "Close buffer" })
map("n", "<leader>b", "<cmd> enew <CR>", { desc = "Open new buffer" })
map("n", "<leader>v", "<C-w>v", { desc = "Split vertical" })
map("n", "<leader>h", "<C-w>s", { desc = "Split horizontal" })
map("n", "<leader>se", "<C-w>=", { desc = "Reset split sizes" })
map("n", "<leader>xs", ":close<CR>", { desc = "Close split" })
map("v", "<", "<gv", { desc = "Indent left" })
map("v", ">", ">gv", { desc = "Indent right" })
map("v", "p", '"_dP', { desc = "Paste without yanking underlying text" })
map("n", "gl", "`.", { desc = "Jump to the last change in the file" })
map("n", "C-d", "<C-d>zz")
map("n", "C-u", "<C-u>zz")
map("n", "C-f", "<C-f>zz")
map("n", "C-b", "<C-b>zz")
-- map('n', '<C-f>', 'za', { desc = 'Toggle cursor fold' })
-- map('n', '<C-down>', 'zm', { desc = 'Toggle all folds at cursor' })
-- map('n', '<C-S-down>', 'zM', { desc = 'Close all open folds' })
-- map('n', '<C-up>', 'zr', { desc = 'Open all folds' })
-- map('n', '<C-S-up>', 'zR', { desc = 'Open all folds' })
-- map("n", "<S-up>", "<C-w><up>", { desc = "Move to split upwards" })
-- map("n", "<S-down>", "<C-w><down>", { desc = "Move to split upwards" })
-- map("n", "<S-left>", "<C-w><left>", { desc = "Move to split left" })
-- map("n", "<S-right>", "<C-w><right>", { desc = "Move to split right" })
map("n", "<C-up>", "<C-y>", { desc = "Move screen up one line" })
map("n", "<C-down>", "<C-e>", { desc = "Move screen down one line" })
map("v", "<C-up>", "<C-y>", { desc = "Move screen up one line" })
map("v", "<C-down>", "<C-e>", { desc = "Move screen down one line" })

View File

@@ -0,0 +1,27 @@
--- @return string
local function tab_info()
local fname = vim.fn.expand("%:p")
if fname == "" then
return ""
end
return "%#WildMenu# " .. fname .. " %*"
end
--- @return string
local function filestatus()
if vim.bo.modified == true then
return "%#Error# ● %*"
end
if vim.bo.readonly == true then
return "%#Error#  %*"
end
return ""
end
function _G.TabLine()
return table.concat({
tab_info(),
filestatus(),
})
end
vim.opt.tabline = "%!v:lua.TabLine()"

View File

@@ -1,2 +1,2 @@
require("ink") require("ink")
require("config.lazy") require("plugins")

View File

@@ -9,7 +9,9 @@ return {
loadOutDirsFromCheck = true, loadOutDirsFromCheck = true,
runBuildScripts = true, runBuildScripts = true,
}, },
checkOnSave = true, checkOnSave = {
command = "clippy",
},
completion = { completion = {
autoself = { enable = true }, autoself = { enable = true },
snippets = { enable = true }, snippets = { enable = true },

View File

@@ -1,28 +1,23 @@
require("ink.remap") require("ink.remap")
require("ink.lsp")
require("ink.tabline") require("ink.tabline")
require("ink.lsp")
vim.opt.hlsearch = false -- do not highlight matches
vim.wo.number = true
vim.opt.relativenumber = true
vim.opt.mouse = "a"
vim.opt.clipboard = "unnamedplus"
vim.opt.breakindent = true -- Enable break indent
vim.opt.undofile = true -- Save undo history
vim.opt.ignorecase = true -- ignore case in searches by default vim.opt.ignorecase = true -- ignore case in searches by default
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
vim.wo.number = true
vim.opt.relativenumber = true
vim.w.signcolumn = "yes" -- Keep signcolumn on by default vim.w.signcolumn = "yes" -- Keep signcolumn on by default
vim.opt.updatetime = 250 -- Decrease update time
vim.opt.timeoutlen = 300 -- time to wait for a mapped sequence to complete (in milliseconds) vim.opt.swapfile = false -- creates a swapfile
vim.opt.backup = false -- creates a backup file vim.opt.undofile = true -- Save undo history
-- if a file is being edited by another program (or was written to file while editing with another program), it is not -- if a file is being edited by another program (or was written to file while editing with another program), it is not
-- allowed to be edited -- allowed to be edited
vim.opt.writebackup = false vim.opt.writebackup = false
vim.opt.autoread = true -- reload files changed outside of neovim
vim.o.completeopt = "menuone,noinsert,popup,fuzzy" vim.opt.mouse = "a"
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups vim.opt.clipboard = "unnamedplus"
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
vim.o.wrap = true -- 1. Enable line wrapping by default
vim.o.linebreak = true -- 2. Break lines at word boundaries (improves readability) vim.o.linebreak = true -- 2. Break lines at word boundaries (improves readability)
vim.o.showbreak = "" -- 3. Add a visual indicator for wrapped lines vim.o.showbreak = "" -- 3. Add a visual indicator for wrapped lines
vim.opt.scrolloff = 4 -- minimal number of screen lines to keep above and below the cursor vim.opt.scrolloff = 4 -- minimal number of screen lines to keep above and below the cursor
@@ -32,18 +27,28 @@ vim.opt.shiftwidth = 4 -- Number of spaces inserted when indenting
vim.opt.tabstop = 4 -- A TAB character looks like 4 spaces vim.opt.tabstop = 4 -- A TAB character looks like 4 spaces
vim.opt.softtabstop = 4 -- Number of spaces inserted instead of a TAB character vim.opt.softtabstop = 4 -- Number of spaces inserted instead of a TAB character
vim.opt.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character vim.opt.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character
vim.opt.breakindent = true -- Enable break indent
vim.opt.smartindent = true -- make indenting smarter again
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
vim.opt.updatetime = 250 -- Decrease update time
vim.opt.timeoutlen = 300 -- time to wait for a mapped sequence to complete (in milliseconds)
vim.o.completeopt = "menuone,noinsert,popup,fuzzy"
-- Replicate blink's cmdline configuration
vim.opt.wildmode = "longest:full,full"
vim.opt.wildoptions = { "pum", "fuzzy" } -- Use a popup menu for cmdline with fuzzy matching
-- vim.keymap.set("i", "<C-Space>", "<C-x><C-o>", { desc = "Trigger LSP completion" })
-- Toggle signature help natively with <C-s> in insert mode (Neovim 0.11+ default)
vim.opt.cursorline = true vim.opt.cursorline = true
vim.opt.splitbelow = true -- open new vertical split bottom vim.opt.splitbelow = true -- open new vertical split bottom
vim.opt.splitright = true -- open new horizontal splits right vim.opt.splitright = true -- open new horizontal splits right
vim.opt.swapfile = false -- creates a swapfile
vim.opt.smartindent = true -- make indenting smarter again
vim.opt.showtabline = 2 -- always show tabs vim.opt.showtabline = 2 -- always show tabs
vim.opt.backspace = "indent,eol,start" -- allow backspace on
vim.opt.pumheight = 10 -- pop up menu height vim.opt.pumheight = 10 -- pop up menu height
vim.wo.conceallevel = 0 -- so that `` is visible in markdown files
vim.opt.encoding = "utf-8" -- the encoding written to a file
vim.opt.cmdheight = 1 -- more space in the neovim command line for displaying messages
vim.opt.autoindent = true
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
@@ -55,13 +60,9 @@ vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins fr
-- Nice and simple folding: -- Nice and simple folding:
vim.opt.foldenable = true vim.opt.foldenable = true
vim.opt.foldlevel = 99 vim.opt.foldlevel = 99
vim.opt.foldmethod = "expr"
-- Default to treesitter folding
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
-- vim.opt.foldtext = "> "
vim.opt.fillchars:append({ fold = ">" }) vim.opt.fillchars:append({ fold = ">" })
vim.opt.incsearch = true -- search as characters are entered -- vim.o.autocomplete = true -- Enables the overall completion feature.
-- Auto-reload buffers when files change on disk (e.g. from external tools or AI agents) -- Auto-reload buffers when files change on disk (e.g. from external tools or AI agents)
vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold" }, { vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold" }, {
@@ -101,44 +102,3 @@ vim.api.nvim_create_autocmd({ "VimEnter", "VimLeave" }, {
-- --
-- Filetypes to enable spellcheck -- Filetypes to enable spellcheck
local spell_types = { "text", "plaintex", "typst", "gitcommit", "markdown" } local spell_types = { "text", "plaintex", "typst", "gitcommit", "markdown" }
-- add gotmpl filetypes for blueprint repos
-- *.ext.tmpl files use the filetype of ext (e.g. foo.json.tmpl -> json, bar.sh.tmpl -> bash)
vim.filetype.add({
extension = {
gotmpl = "gotmpl",
},
pattern = {
[".*/recipes/.*%.ya?ml"] = "gotmpl",
[".*%.tmpl$"] = function(path)
local name = vim.fn.fnamemodify(path, ":t")
local base = name:match("^(.+)%.tmpl$")
if base then
local ext = base:match("%.(%w+)$")
if ext then
if ext == "sh" then
return "bash"
end
return ext
end
end
return nil
end,
},
})
-- Set global spell option to false initially to disable it for all file types
vim.opt.spell = false
-- Create an augroup for spellcheck to group related autocommands
vim.api.nvim_create_augroup("Spellcheck", { clear = true })
-- Create an autocommand to enable spellcheck for specified file types
vim.api.nvim_create_autocmd({ "FileType" }, {
group = "Spellcheck", -- Grouping the command for easier management
pattern = spell_types, -- Only apply to these file types
callback = function()
vim.opt_local.spell = true -- Enable spellcheck for these file types
end,
desc = "Enable spellcheck for defined filetypes", -- Description for clarity
})

View File

@@ -1,12 +1,14 @@
--- [[ LSP setup]] -- [[ LSP setup ]]
--- -- You can consolidate your enable calls into a single table
vim.lsp.enable({
vim.lsp.enable("luals") "luals",
vim.lsp.enable("rust") "rust",
vim.lsp.enable("gopls") "gopls",
vim.lsp.enable("bashls") "bashls",
vim.lsp.enable("terraform") "terraform",
})
-- Global capabilities override remains exactly the same
vim.lsp.config("*", { vim.lsp.config("*", {
capabilities = { capabilities = {
textDocument = { textDocument = {
@@ -17,47 +19,45 @@ vim.lsp.config("*", {
}, },
}) })
-- [[FOLDING SETUP -- Consolidate all LSP actions into a single LspAttach autocmd
-- Prefer LSP folding if client supports it
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client ~= nil then
if client:supports_method("textDocument/foldingRange") then
local win = vim.api.nvim_get_current_win()
vim.wo[win].foldexpr = "v:lua.vim.lsp.foldexpr()"
end
end
end,
})
-- ]]
-- [[INLAY HINTS
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", { clear = true }),
callback = function(args) callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
end
end,
})
-- [[CODE ACTIONS -- args.buf is the modern 0.12 standard. It guarantees you are acting
vim.api.nvim_create_autocmd("LspAttach", { -- exactly on the buffer that triggered the attach.
callback = function(args) local bufnr = args.buf
local bufnr = args.data.bufnr
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code action (menu)" }) -- [[ INLAY HINTS ]]
vim.keymap.set("v", "<leader>ca", function() if client:supports_method("textDocument/inlayHint") then
vim.lsp.buf.code_action({ context = { only = { "quickfix" } } }) -- Enable them by default when opening the file
end, { buffer = bufnr, desc = "Code action (selection)" }) vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
-- Quickfix at cursor: apply single fix without menu when only one available
-- Create a buffer-local keymap to toggle them on/off
vim.keymap.set("n", "<leader>th", function()
local is_enabled = vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr })
vim.lsp.inlay_hint.enable(not is_enabled, { bufnr = bufnr })
end, { buffer = bufnr, desc = "Toggle Inlay Hints" })
end
-- [[ FOLDING SETUP ]]
if client:supports_method("textDocument/foldingRange") then
-- opt_local cleanly applies to the attached buffer without risking
-- applying to the wrong window if attached in the background
vim.opt_local.foldexpr = "v:lua.vim.lsp.foldexpr()"
vim.opt_local.foldmethod = "expr"
end
-- [[ CODE ACTIONS ]]
-- Note: Neovim 0.11+ automatically maps 'gra' to code actions natively.
vim.keymap.set("n", "<leader>cf", function() vim.keymap.set("n", "<leader>cf", function()
vim.lsp.buf.code_action({ vim.lsp.buf.code_action({
context = { only = { "quickfix" } }, context = { only = { "quickfix" } },
apply = true, apply = true,
}) })
end, { buffer = bufnr, desc = "Apply fix at cursor" }) end, { buffer = bufnr, desc = "Apply fix at cursor" })
-- Organize imports (Rust: source.organizeImports.rust, Go: source.organizeImports)
vim.keymap.set("n", "<leader>ci", function() vim.keymap.set("n", "<leader>ci", function()
vim.lsp.buf.code_action({ vim.lsp.buf.code_action({
context = { context = {
@@ -68,3 +68,22 @@ vim.api.nvim_create_autocmd("LspAttach", {
end, { buffer = bufnr, desc = "Organize imports" }) end, { buffer = bufnr, desc = "Organize imports" })
end, end,
}) })
-- vim.api.nvim_create_autocmd("LspAttach", {
-- group = vim.api.nvim_create_augroup("lsp_completion", { clear = true }),
-- callback = function(args)
-- local client_id = args.data.client_id
-- if not client_id then
-- return
-- end
--
-- local client = vim.lsp.get_client_by_id(client_id)
-- if client and client:supports_method("textDocument/completion") then
-- -- Enable native LSP completion for this client + buffer
-- vim.lsp.completion.enable(true, client_id, args.buf, {
-- autotrigger = true, -- auto-show menu as you type (recommended)
-- -- You can also set { autotrigger = false } and trigger manually with <C-x><C-o>
-- })
-- end
-- end,
-- })

View File

@@ -1,11 +1,6 @@
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = "\\" vim.g.maplocalleader = "\\"
-- (mode, key, command) -- (mode, key, command)
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true })
-- vim.keymap.set("n", "<leader>pv", vim.cmd.Ex, { desc = "Open current directory" })
local function map(mode, lhs, rhs, opts) local function map(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true } local options = { noremap = true, silent = true }
@@ -41,10 +36,10 @@ map("v", "p", '"_dP', { desc = "Paste without yanking underlying text" })
map("n", "gl", "`.", { desc = "Jump to the last change in the file" }) map("n", "gl", "`.", { desc = "Jump to the last change in the file" })
map("n", "C-d", "<C-d>zz") map("n", "<C-d>", "<C-d>zz")
map("n", "C-u", "<C-u>zz") map("n", "<C-u>", "<C-u>zz")
map("n", "C-f", "<C-f>zz") map("n", "<C-f>", "<C-f>zz")
map("n", "C-b", "<C-b>zz") map("n", "<C-b>", "<C-b>zz")
-- map('n', '<C-f>', 'za', { desc = 'Toggle cursor fold' }) -- map('n', '<C-f>', 'za', { desc = 'Toggle cursor fold' })
-- map('n', '<C-down>', 'zm', { desc = 'Toggle all folds at cursor' }) -- map('n', '<C-down>', 'zm', { desc = 'Toggle all folds at cursor' })

View File

@@ -1,4 +1,3 @@
--- @return string
local function tab_info() local function tab_info()
local fname = vim.fn.expand("%:p") local fname = vim.fn.expand("%:p")
if fname == "" then if fname == "" then

View File

@@ -0,0 +1,105 @@
vim.pack.add({
{ src = "https://github.com/olimorris/codecompanion.nvim" },
{ src = "https://github.com/nvim-lua/plenary.nvim" },
{
src = "https://github.com/saghen/blink.cmp",
version = vim.version.range("^1"),
},
})
local codecompanion = require("codecompanion")
-- Dynamically choose the adapter based on the environment variable
local active_adapter = os.getenv("GEMINI_API_KEY") and "gemini" or "kiro"
codecompanion.setup({
strategies = {
chat = { adapter = active_adapter },
inline = { adapter = active_adapter },
agent = { adapter = active_adapter },
},
adapters = {
gemini = function()
return require("codecompanion.adapters").extend("gemini", {
env = {
-- 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",
},
},
})
end,
-- If 'kiro' is a custom CLI or local LLM, you must define it here.
-- This is a generic custom adapter stub for CodeCompanion:
kiro = function()
return require("codecompanion.adapters").extend("openai_compatible", {
name = "kiro",
env = {
url = "http://localhost:11434", -- Example endpoint
-- api_key = "...",
},
})
end,
},
})
-- Optional: Keymaps for CodeCompanion
vim.keymap.set({ "n", "v" }, "<leader>a", "<cmd>CodeCompanionChat Toggle<cr>", { noremap = true, silent = true })
vim.cmd([[cab cc CodeCompanion]])
vim.cmd("packadd blink.cmp")
local blink = require("blink.cmp")
blink.setup({
keymap = { preset = "default" },
appearance = { nerd_font_variant = "mono" },
completion = { documentation = { auto_show = true } },
cmdline = {
keymap = { ["<Tab>"] = { "show", "accept" } },
completion = { menu = { auto_show = true }, ghost_text = { enabled = true } },
},
-- By removing `snippets = { preset = 'luasnip' }`, Blink natively
-- defaults to Neovim 0.11+ built-in `vim.snippet` API.
sources = {
-- Added codecompanion, removed emoji
default = { "lsp", "path", "snippets", "buffer", "codecompanion" },
providers = {
cmdline = {
min_keyword_length = function(ctx)
if ctx.mode == "cmdline" and string.find(ctx.line, " ") == nil then
return 3
end
return 0
end,
},
-- Wire up CodeCompanion to Blink
codecompanion = {
name = "CodeCompanion",
module = "codecompanion.providers.completion.blink",
enabled = true,
},
},
},
fuzzy = { implementation = "prefer_rust_with_warning" },
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = blink.get_lsp_capabilities(capabilities)
-- Safely merge with existing global LSP capabilities so we don't overwrite settings from ink/lsp.lua
local existing_config = vim.lsp.config["*"]
if type(existing_config) == "table" and type(existing_config.capabilities) == "table" then
capabilities = vim.tbl_deep_extend("force", existing_config.capabilities, capabilities)
end
-- Apply to all natively loaded 0.12 LSP servers
vim.lsp.config("*", {
capabilities = capabilities,
-- Note: We DO NOT use vim.lsp.completion.enable() here because
-- Blink is taking over the UI rendering.
})

View File

@@ -0,0 +1,22 @@
vim.pack.add({
{ src = "https://github.com/folke/which-key.nvim" },
{ src = "https://github.com/tpope/vim-fugitive" },
{ src = "https://github.com/stevearc/oil.nvim" },
{ src = "https://github.com/echasnovski/mini.icons" },
{ src = "https://github.com/yorickpeterse/nvim-jump" },
})
require("which-key").setup({
preset = "helix",
})
vim.keymap.set("n", "<leader>gs", vim.cmd.Git, { desc = "Fugitive git command" })
require("oil").setup({
default_file_explorer = true,
view_options = {
show_hidden = true,
},
})
vim.keymap.set("n", "<leader>pv", "<cmd>Oil<cr>", { desc = "Open current directory" })
vim.keymap.set({ "n", "x", "o" }, "<leader>f", require("jump").start, {})

View File

@@ -0,0 +1,79 @@
vim.pack.add({
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
{ src = "https://github.com/stevearc/conform.nvim" },
})
require("nvim-treesitter").install({
--"zsh",
"cmake",
"dockerfile",
"gitignore",
"go",
"gotmpl",
"java",
"json",
"make",
"regex",
"rust",
"terraform",
"yaml",
})
-- Default to treesitter folding
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt.foldmethod = "expr"
vim.opt.foldtext = "> "
vim.api.nvim_create_autocmd({ "BufReadPre", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("LazyLoadConform", { clear = true }),
callback = function()
vim.cmd("packadd conform.nvim")
local conform = require("conform")
conform.setup({
formatters_by_ft = {
-- brew install stylua
lua = { "stylua" },
-- install rust
rust = { "rustfmt" },
-- brew install prettier
markdown = { "markdownlint-cli2" },
json = { "prettierd", "prettier" },
yaml = { "yamlfmt" },
-- install terraform
terraform = { "terraform_fmt" },
-- brew install shfmt
bash = { "shfmt" },
zsh = { "shfmt" },
sh = { "shfmt" },
-- brew install ruff
python = { "ruff" },
-- go install mvdan.cc/gofumpt@latest
go = { "gofumpt" },
},
formatters = {
prettier = {
prepend_args = { "--prose-wrap", "always" },
},
shfmt = {
prepend_args = { "-i", "4", "-ci" },
},
ruff = {
prepend_args = { "--extend-select", "I" },
},
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 3000,
},
})
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 5000,
})
end, { desc = "Format file or range (in visual mode)" })
end,
})

View File

@@ -0,0 +1,6 @@
require("plugins.basic")
require("plugins.tmux")
require("plugins.ui")
require("plugins.formatting")
require("plugins.linting")
require("plugins.ai")

View File

@@ -0,0 +1,41 @@
vim.pack.add({
{ src = "https://github.com/mfussenegger/nvim-lint" },
})
vim.api.nvim_create_autocmd({ "BufReadPre", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("LazyLoadNvimLint", { clear = true }),
callback = function()
vim.cmd("packadd lint.nvim")
local lint = require("lint")
lint.linters_by_ft = {
-- brew install luacheck
lua = { "luacheck" },
bash = { "shellcheck" },
sh = { "shellcheck" },
-- brew install tflint
terraform = { "tflint" },
-- brew install markdownlint-cli2
markdown = { "markdownlint-cli2" },
-- go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.0
go = { "golangcilint" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.keymap.set("n", "<leader>l", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
vim.keymap.set("n", "<leader>d", function()
if vim.diagnostic.config().virtual_lines then
vim.diagnostic.config({ virtual_lines = false })
else
vim.diagnostic.config({ virtual_lines = { current_line = true } })
end
end, { desc = "Toggle inline diagnostics" })
end,
})

View File

@@ -0,0 +1,16 @@
vim.pack.add({
{ src = "https://github.com/alexghergh/nvim-tmux-navigation" },
})
local nvim_tmux_nav = require("nvim-tmux-navigation")
nvim_tmux_nav.setup({
disable_when_zoomed = true, -- defaults to false
})
vim.keymap.set("n", "<S-left>", nvim_tmux_nav.NvimTmuxNavigateLeft, { desc = "Move to the split to the left" })
vim.keymap.set("n", "<S-down>", nvim_tmux_nav.NvimTmuxNavigateDown, { desc = "Move to the split below" })
vim.keymap.set("n", "<S-up>", nvim_tmux_nav.NvimTmuxNavigateUp, { desc = "Move to the split above" })
vim.keymap.set("n", "<S-right>", nvim_tmux_nav.NvimTmuxNavigateRight, { desc = "Move to the split to the right" })
vim.keymap.set("n", "<C-\\>", nvim_tmux_nav.NvimTmuxNavigateLastActive, { desc = "Move to the last active split" })
vim.keymap.set("n", "<C-Space>", nvim_tmux_nav.NvimTmuxNavigateNext, { desc = "Move to the next split" })

View File

@@ -0,0 +1,84 @@
require("vim._core.ui2").enable({
enable = true,
})
vim.opt.cmdheight = 2 -- more space in the neovim command line for displaying messages
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" },
})
require("themery").setup({
-- add the config here
themes = { "rose-pine-dawn", "rose-pine-main" }, -- Your list of installed colorschemes.
livePreview = true, -- Apply theme while picking. Default to true.
})
vim.keymap.set("n", "<leader>tt", function()
local themery = require("themery")
local currentTheme = themery.getCurrentTheme()
if currentTheme and currentTheme.name == "rose-pine-dawn" then
themery.setThemeByName("rose-pine-main", true)
else
themery.setThemeByName("rose-pine-dawn", true)
end
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" },
{ src = "https://github.com/nvim-lualine/lualine.nvim" },
{ src = "https://github.com/lukas-reineke/indent-blankline.nvim" },
})
require("lualine").setup({
options = {
section_separators = "",
component_separators = "",
theme = "rose-pine",
},
extensions = { "fugitive", "lazy" },
})
require("ibl").setup()
vim.pack.add({
{ src = "https://github.com/lewis6991/gitsigns.nvim" },
{ src = "https://github.com/f-person/git-blame.nvim" },
})
require("gitsigns").setup({
signs = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
},
signs_staged = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
},
})
vim.keymap.set("n", "<leader>gk", "<cmd>GitBlameToggle<cr>", { desc = "Toggle git-blame" })
vim.g.gitblame_display_virtual_text = false
-- schedule_event = "CursorHold"
-- clear_event = "CursorHoldI"
vim.g.gitblame_delay = 50 -- miliseconds
local git_blame = require("gitblame")
require("lualine").setup({
sections = {
lualine_c = {
{ "filename" },
{ git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available },
},
},
})

View File

@@ -0,0 +1,95 @@
{
"plugins": {
"blink.cmp": {
"rev": "78336bc89ee5365633bcf754d93df01678b5c08f",
"src": "https://github.com/saghen/blink.cmp",
"version": "1.0.0 - 2.0.0"
},
"codecompanion.nvim": {
"rev": "7d7957c26d33a97085d3a0c82eeb0147a0f51314",
"src": "https://github.com/olimorris/codecompanion.nvim"
},
"conform.nvim": {
"rev": "086a40dc7ed8242c03be9f47fbcee68699cc2395",
"src": "https://github.com/stevearc/conform.nvim"
},
"git-blame.nvim": {
"rev": "5c536e2d4134d064aa3f41575280bc8a2a0e03d7",
"src": "https://github.com/f-person/git-blame.nvim"
},
"gitsigns.nvim": {
"rev": "0d797daee85366bc242580e352a4f62d67557b84",
"src": "https://github.com/lewis6991/gitsigns.nvim"
},
"indent-blankline.nvim": {
"rev": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03",
"src": "https://github.com/lukas-reineke/indent-blankline.nvim"
},
"lualine.nvim": {
"rev": "8811f3f3f4dc09d740c67e9ce399e7a541e2e5b2",
"src": "https://github.com/nvim-lualine/lualine.nvim"
},
"mini.icons": {
"rev": "7fdae2443a0e2910015ca39ad74b50524ee682d3",
"src": "https://github.com/echasnovski/mini.icons"
},
"modes.nvim": {
"rev": "fc7bc0141500d9cf7c14f46fca846f728545a781",
"src": "https://github.com/mvllow/modes.nvim",
"version": "'v0.3.0'"
},
"neovim": {
"rev": "cf2a288696b03d0934da713d66c6d71557b5c997",
"src": "https://github.com/rose-pine/neovim"
},
"nvim-highlight-colors": {
"rev": "e2cb22089cc2358b2b995c09578224f142de6039",
"src": "https://github.com/brenoprata10/nvim-highlight-colors"
},
"nvim-jump": {
"rev": "41261ddebbb595decd0302cb9e5eec7ce230e382",
"src": "https://github.com/yorickpeterse/nvim-jump"
},
"nvim-lint": {
"rev": "4b03656c09c1561f89b6aa0665c15d292ba9499d",
"src": "https://github.com/mfussenegger/nvim-lint"
},
"nvim-tmux-navigation": {
"rev": "4898c98702954439233fdaf764c39636681e2861",
"src": "https://github.com/alexghergh/nvim-tmux-navigation"
},
"nvim-treesitter": {
"rev": "4916d6592ede8c07973490d9322f187e07dfefac",
"src": "https://github.com/nvim-treesitter/nvim-treesitter",
"version": "'main'"
},
"nvim-web-devicons": {
"rev": "95b7a002d5dba1a42eb58f5fac5c565a485eefd0",
"src": "https://github.com/nvim-tree/nvim-web-devicons"
},
"oil.nvim": {
"rev": "0fcc83805ad11cf714a949c98c605ed717e0b83e",
"src": "https://github.com/stevearc/oil.nvim"
},
"plenary.nvim": {
"rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509",
"src": "https://github.com/nvim-lua/plenary.nvim"
},
"snacks.nvim": {
"rev": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e",
"src": "https://github.com/folke/snacks.nvim"
},
"themery.nvim": {
"rev": "bfa58f4b279d21cb515b28023e1b68ec908584b2",
"src": "https://github.com/zaldih/themery.nvim"
},
"vim-fugitive": {
"rev": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0",
"src": "https://github.com/tpope/vim-fugitive"
},
"which-key.nvim": {
"rev": "3aab2147e74890957785941f0c1ad87d0a44c15a",
"src": "https://github.com/folke/which-key.nvim"
}
}
}