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,35 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "rose-pine" } },
-- automatically check for plugin updates
checker = {
enabled = false,
concurrency = nil,
notify = false,
frequency = 3600,
check_pinned = false,
},
})

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

@@ -0,0 +1,98 @@
-- Avante.nvim: uses Cursor ACP when the agent binary is available,
-- otherwise falls back to the Gemini API (requires GEMINI_API_KEY).
local agent_path = os.getenv("HOME") .. "/.local/bin/agent"
local has_cursor_agent = vim.uv.fs_stat(agent_path) ~= nil
local provider = has_cursor_agent and "cursor" or "gemini"
return {
{
"yetone/avante.nvim",
event = "VeryLazy",
version = false,
build = "make",
opts = {
provider = provider,
mode = "agentic",
behaviour = {
auto_approve_tool_permissions = {
"web_search",
"fetch",
"view",
"ls",
"glob",
"grep",
"get_diagnostics",
"think",
"read_todos",
"read_file_toplevel_symbols",
"read_definitions",
},
auto_apply_diff_after_generation = false,
enable_fastapply = false,
},
acp_providers = {
cursor = {
command = agent_path,
args = { "acp" },
auth_method = "cursor_login",
env = {
HOME = os.getenv("HOME"),
PATH = os.getenv("PATH"),
},
},
},
providers = {
gemini = {
model = "gemini-2.5-flash",
},
},
},
config = function(_, opts)
require("avante").setup(opts)
vim.api.nvim_create_autocmd("FileType", {
pattern = "AvanteInput",
callback = function(args)
local buf = args.buf
local min_height = 5
local max_height = 20
local function resize_input()
local win = vim.fn.bufwinid(buf)
if win == -1 or not vim.api.nvim_win_is_valid(win) then
return
end
local lines = vim.api.nvim_buf_line_count(buf)
local height = math.max(min_height, math.min(lines + 1, max_height))
vim.api.nvim_win_set_height(win, height)
end
vim.api.nvim_create_autocmd({ "TextChanged", "TextChangedI" }, {
buffer = buf,
callback = resize_input,
})
resize_input()
end,
})
end,
keys = {
{ "<C-\\>", "<cmd>AvanteToggle<cr>", mode = { "n", "v", "i" }, desc = "Toggle Avante Chat" },
{ "<leader>aa", "<cmd>AvanteAsk<cr>", desc = "Avante Ask" },
{ "<leader>ae", "<cmd>AvanteEdit<cr>", desc = "Avante Edit" },
{ "<leader>ar", "<cmd>AvanteRefresh<cr>", desc = "Avante Refresh" },
},
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
{
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
},
}

View File

@@ -0,0 +1,81 @@
return {
-- keymap helper
{ "folke/which-key.nvim", opts = {} },
{ -- undo tree
"mbbill/undotree",
opts = {},
keys = {
{ "<Leader>u", vim.cmd.UndotreeToggle, desc = "Toggle undo tree" },
},
},
{ -- minimal and fast autopairs
"echasnovski/mini.pairs",
event = "VeryLazy",
opts = {
modes = { insert = true, command = true, terminal = false },
-- skip autopair when next character is one of these
skip_next = [=[[%w%%%'%[%"%.%`%$]]=],
-- skip autopair when the cursor is inside these treesitter nodes
skip_ts = { "string" },
-- skip autopair when next character is closing pair
-- and there are more closing pairs than opening pairs
skip_unbalanced = true,
-- better deal with markdown code blocks
markdown = true,
},
},
{ -- fugitive
"tpope/vim-fugitive",
keys = {
{ "<Leader>gs", vim.cmd.Git, desc = "Fugitive git command" },
},
},
{
"folke/flash.nvim",
event = "VeryLazy",
---@type Flash.Config
opts = {},
keys = {
{
"zk",
mode = { "n", "x", "o" },
function()
require("flash").jump()
end,
desc = "Flash",
},
{
"Zk",
mode = { "n", "x", "o" },
function()
require("flash").treesitter()
end,
desc = "Flash Treesitter",
},
{
"r",
mode = "o",
function()
require("flash").remote()
end,
desc = "Remote Flash",
},
{
"R",
mode = { "o", "x" },
function()
require("flash").treesitter_search()
end,
desc = "Treesitter Search",
},
{
"<c-s>",
mode = { "c" },
function()
require("flash").toggle()
end,
desc = "Toggle Flash Search",
},
},
},
}

View File

@@ -0,0 +1,114 @@
return {
{
"L3MON4D3/LuaSnip",
version = "v2.*",
dependencies = {
"rafamadriz/friendly-snippets",
},
-- install jsregexp (optional!).
build = "make install_jsregexp",
config = function()
local ls = require("luasnip")
local snippets_folder = vim.fn.stdpath("config") .. "/snippets"
-- Load all Lua files in the snippets directory except init.lua
local files = vim.fn.glob(snippets_folder .. "/*.lua", false, true)
for _, file in ipairs(files) do
local filename = vim.fn.fnamemodify(file, ":t")
-- Remove .lua extension to get the filetype
local ft = filename:match("(.+)%.lua$")
if ft then
-- Load the file which should return a table of snippets
local ok, snippets = pcall(dofile, file)
if ok and type(snippets) == "table" then
ls.add_snippets(ft, snippets)
end
end
end
end,
},
{
"saghen/blink.cmp",
-- use a release tag to download pre-built binaries
version = "1.*",
dependencies = {
"moyiz/blink-emoji.nvim",
},
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
enabled = function()
return vim.bo.filetype ~= "AvanteInput"
end,
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
-- 'super-tab' for mappings similar to vscode (tab to accept)
-- 'enter' for enter to accept
-- 'none' for no mappings
--
-- All presets have the following mappings:
-- C-space: Open menu or open docs if already open
-- C-n/C-p or Up/Down: Select next/previous item
-- C-e: Hide menu
-- C-k: Toggle signature help (if signature.enabled = true)
--
-- See :h blink-cmp-config-keymap for defining your own keymap
keymap = { preset = "default" },
appearance = {
nerd_font_variant = "mono",
},
-- (Default) Only show the documentation popup when manually triggered
completion = { documentation = { auto_show = true } },
cmdline = {
keymap = {
-- recommended, as the default keymap will only show and select the next item
["<Tab>"] = { "show", "accept" },
},
completion = {
menu = { auto_show = true },
ghost_text = { enabled = true },
},
},
snippets = { preset = "luasnip" },
-- Default list of enabled providers defined so that you can extend it
-- elsewhere in your config, without redefining it, due to `opts_extend`
sources = {
default = { "lsp", "path", "snippets", "buffer", "emoji" },
providers = {
cmdline = {
min_keyword_length = function(ctx)
-- when typing a command, only show when the keyword is 3 characters or longer
if ctx.mode == "cmdline" and string.find(ctx.line, " ") == nil then
return 3
end
return 0
end,
},
emoji = {
module = "blink-emoji",
name = "Emoji",
score_offset = 15, -- Tune by preference
opts = { insert = true }, -- Insert emoji (default) or complete its name
should_show_items = function()
return vim.tbl_contains(
-- Enable emoji completion only for git commits and markdown.
-- By default, enabled for all file-types.
{ "gitcommit", "markdown" },
vim.o.filetype
)
end,
},
},
},
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
--
-- See the fuzzy documentation for more information
fuzzy = { implementation = "prefer_rust_with_warning" },
},
opts_extend = { "sources.default" },
},
}

View File

@@ -0,0 +1,21 @@
return {
{
"stevearc/oil.nvim",
---@module 'oil'
---@type oil.SetupOpts
opts = {
default_file_explorer = true,
view_options = {
show_hidden = true,
},
},
-- Optional dependencies
dependencies = { { "echasnovski/mini.icons", opts = {} } },
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons
-- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations.
lazy = false,
keys = {
{ "<leader>pv", "<cmd>Oil<cr>", desc = "Open current directory" },
},
},
}

View File

@@ -0,0 +1,133 @@
return {
-- heuristic indent
{ "tpope/vim-sleuth" },
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
--@diagnostic disable-next-line: missing-fields
configs.setup({
ensure_installed = {
"bash",
--"zsh",
"c",
"cmake",
"dockerfile",
"gitignore",
"go",
"gotmpl",
"java",
"json",
"lua",
"make",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"rust",
"terraform",
"vim",
"vimdoc",
"yaml",
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (or "all")
ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers",
-- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = {},
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
-- disable = function(lang, buf)
-- local max_filesize = 100 * 1024 -- 100 KB
-- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
-- if ok and stats and stats.size > max_filesize then
-- return true
-- end
-- end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
indent = {
enable = false,
disable = {},
},
})
end,
},
{
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
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,39 @@
return {
{
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
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,149 @@
return {
{ -- file finder
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
event = "VimEnter",
dependencies = {
"nvim-lua/plenary.nvim",
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
cond = function()
return vim.fn.executable("make") == 1
end,
},
"nvim-telescope/telescope-ui-select.nvim",
-- Useful for getting pretty icons, but requires a Nerd Font.
"nvim-tree/nvim-web-devicons",
},
config = function()
local actions = require("telescope.actions")
local builtin = require("telescope.builtin")
require("telescope").setup({
defaults = {
mappings = {
i = {
["<C-k>"] = actions.move_selection_previous, -- move to prev result
["<C-j>"] = actions.move_selection_next, -- move to next result
["<C-l>"] = actions.select_default, -- open file
},
n = {
["q"] = actions.close,
},
},
},
pickers = {
find_files = {
file_ignore_patterns = {
"node_modules",
"target",
".terraform",
".venv",
".git",
-- Ignore git submodules
"^./.git/",
"^./*/.git/",
".gitmodules",
".gitignore",
".*/%.git/.*", -- Ignore any .git directories in subdirectories
},
hidden = true,
-- Ignore git submodules
follow = true,
},
git_files = {
recurse_submodules = false,
show_untracked = true,
},
buffers = {
initial_mode = "normal",
sort_lastused = true,
-- sort_mru = true,
mappings = {
n = {
["d"] = actions.delete_buffer,
["l"] = actions.select_default,
},
},
},
},
live_grep = {
file_ignore_patterns = {
"node_modules",
"target",
".terraform",
".git",
".venv",
},
additional_args = function(_)
return { "--hidden" }
end,
},
path_display = {
filename_first = {
reverse_directories = true,
},
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown(),
},
},
git_files = {
previewer = false,
},
})
-- Enable telescope fzf native, if installed
pcall(require("telescope").load_extension, "fzf")
pcall(require("telescope").load_extension, "ui-select")
vim.keymap.set("n", "<leader>pf", builtin.find_files, { desc = "Telescope find files" })
vim.keymap.set("n", "<C-p>", builtin.git_files, { desc = "Telescope find git files" })
vim.keymap.set("n", "<leader>ps", function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end, { desc = "Telescope grep" })
vim.keymap.set("n", "<leader>gc", builtin.git_commits, { desc = "Search [G]it [C]ommits" })
vim.keymap.set(
"n",
"<leader>gcf",
builtin.git_bcommits,
{ desc = "Search [G]it [C]ommits for current [F]ile" }
)
vim.keymap.set("n", "<leader>gb", builtin.git_branches, { desc = "Search [G]it [B]ranches" })
vim.keymap.set("n", "<leader>gs", builtin.git_status, { desc = "Search [G]it [S]tatus (diff view)" })
vim.keymap.set("n", "<leader>?", builtin.oldfiles, { desc = "[?] Find recently opened files" })
vim.keymap.set("n", "<leader>sb", builtin.buffers, { desc = "[S]earch existing [B]uffers" })
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]resume" })
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set("n", "<leader>sds", function()
builtin.lsp_document_symbols({
symbols = { "Class", "Function", "Method", "Constructor", "Interface", "Module", "Property" },
})
end, { desc = "[S]each LSP document [S]ymbols" })
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
vim.keymap.set("n", "<leader>s/", function()
builtin.live_grep({
grep_open_files = true,
prompt_title = "Live Grep in Open Files",
})
end, { desc = "[S]earch [/] in Open Files" })
vim.keymap.set("n", "<leader>/", function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
previewer = false,
}))
end, { desc = "[/] Fuzzily search in current buffer" })
end,
},
}

View File

@@ -0,0 +1,34 @@
return {
{ -- integration with tmux config
"alexghergh/nvim-tmux-navigation",
config = function()
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" })
end,
},
}

View File

@@ -0,0 +1,207 @@
return {
{
"zaldih/themery.nvim",
lazy = false,
config = function()
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" })
end,
},
{
"rose-pine/neovim",
name = "rose-pine",
config = function()
-- vim.cmd("colorscheme rose-pine")
end,
},
-- highlight color hex codes
{
"brenoprata10/nvim-highlight-colors",
opts = {},
config = function()
local highlight = require("nvim-highlight-colors")
highlight.setup()
end,
},
{ --statusline
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
lazy = false,
opts = {
options = {
section_separators = "",
component_separators = "",
theme = "rose-pine",
},
-- extensions = { "neo-tree", "lazy", "fzf" },
extensions = { "fugitive", "lazy" },
},
},
{ -- git symbols on sidebar
"lewis6991/gitsigns.nvim",
opts = {
signs = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
},
signs_staged = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
},
},
},
{
"f-person/git-blame.nvim",
-- load the plugin at startup
event = "VeryLazy",
keys = {
{ "<leader>gk", "<cmd>GitBlameToggle<cr>", desc = "Toggle git-blame" },
},
config = function()
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 },
},
},
})
end,
},
{ -- cosmetic indent lines
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
opts = {
indent = {
char = "",
},
scope = {
show_start = false,
show_end = false,
show_exact_scope = false,
},
exclude = {
filetypes = {
"help",
"startify",
"dashboard",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
},
},
},
},
{ -- colorful mode indicators
"mvllow/modes.nvim",
tag = "v0.2.1",
config = function()
require("modes").setup()
end,
},
{ -- dashboard snack
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
dashboard = {
preset = {
header = [[
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
]],
},
sections = {
{ section = "header" },
{
pane = 2,
section = "terminal",
cmd = "pokemon-colorscripts -n snorlax --no-title; sleep .1",
height = 20,
padding = 0,
},
{ section = "keys", gap = 1, padding = 1 },
{
pane = 2,
icon = "",
title = "Recent Files",
section = "recent_files",
indent = 2,
padding = 1,
},
{ pane = 2, icon = "", title = "Projects", section = "projects", indent = 2, padding = 1 },
{
pane = 2,
icon = "",
title = "Git Status",
section = "terminal",
enabled = function()
return Snacks.git.get_root() ~= nil
end,
cmd = "git status --short --branch --renames",
height = 5,
padding = 1,
ttl = 5 * 60,
indent = 3,
},
{ section = "startup" },
},
},
},
},
{
"MeanderingProgrammer/render-markdown.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {},
config = function()
require("render-markdown").setup({
completions = { lsp = { enabled = true } },
})
end,
},
}