diff --git a/README.md b/README.md index 4cbe2f6..cef57e2 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ dotfiles/ ### Extras +- fzf +- tree-sitter-cli - lesspipe - cbonsai @@ -125,7 +127,7 @@ sudo apt update && sudo apt install terraform sudo apt install alacritty zsh tmux stow zsh-syntax-highlighting less python3-libtmux cbonsai shfmt shellcheck lua-check # Homebrew packages -brew install neovim stylua lua-language-server bash-language-server prettier terraform-ls tflint ruff markdownlint-cli2 +brew install neovim stylua lua-language-server bash-language-server prettier terraform-ls tflint ruff markdownlint-cli2 fzf tree-sitter-cli # Node packages npm install --save-dev prettier prettier-plugin-go-template diff --git a/nvim-old/.config/nvim/.luacheckrc b/nvim-old/.config/nvim/.luacheckrc deleted file mode 100644 index f5cda50..0000000 --- a/nvim-old/.config/nvim/.luacheckrc +++ /dev/null @@ -1,15 +0,0 @@ --- 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" } } diff --git a/nvim-old/.config/nvim/after/ftplugin/rust.lua b/nvim-old/.config/nvim/after/ftplugin/rust.lua deleted file mode 100644 index 698fe6c..0000000 --- a/nvim-old/.config/nvim/after/ftplugin/rust.lua +++ /dev/null @@ -1,21 +0,0 @@ -local bufnr = vim.api.nvim_get_current_buf() --- vim.keymap.set("n", "a", function() --- vim.cmd.RustLsp("codeAction") -- supports rust-analyzer's grouping --- -- or vim.lsp.buf.codeAction() if you don't want grouping. --- end, { silent = true, buffer = bufnr }) --- vim.keymap.set( --- "n", --- "K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions --- function() --- vim.cmd.RustLsp({ "hover", "actions" }) --- end, --- { silent = true, buffer = bufnr } --- ) --- vim.keymap.set( --- "n", --- "?", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions --- function() --- vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) --- end, --- { buffer = bufnr } --- ) diff --git a/nvim-old/.config/nvim/init.lua b/nvim-old/.config/nvim/init.lua deleted file mode 100644 index ca2162a..0000000 --- a/nvim-old/.config/nvim/init.lua +++ /dev/null @@ -1,2 +0,0 @@ -require("ink") -require("config.lazy") diff --git a/nvim-old/.config/nvim/lsp/bashls.lua b/nvim-old/.config/nvim/lsp/bashls.lua deleted file mode 100644 index a38d1b4..0000000 --- a/nvim-old/.config/nvim/lsp/bashls.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - cmd = { "bash-language-server" }, - filetypes = { "sh", "bash", "zsh" }, - settings = {}, -} diff --git a/nvim-old/.config/nvim/lsp/gopls.lua b/nvim-old/.config/nvim/lsp/gopls.lua deleted file mode 100644 index 8af03df..0000000 --- a/nvim-old/.config/nvim/lsp/gopls.lua +++ /dev/null @@ -1,27 +0,0 @@ -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, - }, - }, - }, -} diff --git a/nvim-old/.config/nvim/lsp/luals.lua b/nvim-old/.config/nvim/lsp/luals.lua deleted file mode 100644 index 84fe9ee..0000000 --- a/nvim-old/.config/nvim/lsp/luals.lua +++ /dev/null @@ -1,17 +0,0 @@ -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" }, - }, - }, -} diff --git a/nvim-old/.config/nvim/lsp/rust.lua b/nvim-old/.config/nvim/lsp/rust.lua deleted file mode 100644 index 1b39767..0000000 --- a/nvim-old/.config/nvim/lsp/rust.lua +++ /dev/null @@ -1,31 +0,0 @@ -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" }, - }, - }, - }, - }, -} diff --git a/nvim-old/.config/nvim/lsp/terraform.lua b/nvim-old/.config/nvim/lsp/terraform.lua deleted file mode 100644 index 21ccf7d..0000000 --- a/nvim-old/.config/nvim/lsp/terraform.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - cmd = { "terraform-ls", "serve" }, - root_markers = { ".terraform.lock", "backend.tf" }, - filetypes = { "terraform", "tf" }, - settings = {}, -} diff --git a/nvim-old/.config/nvim/lua/config/lazy.lua b/nvim-old/.config/nvim/lua/config/lazy.lua deleted file mode 100644 index f51dd9d..0000000 --- a/nvim-old/.config/nvim/lua/config/lazy.lua +++ /dev/null @@ -1,35 +0,0 @@ --- 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, - }, -}) diff --git a/nvim-old/.config/nvim/lua/ink/init.lua b/nvim-old/.config/nvim/lua/ink/init.lua deleted file mode 100644 index 9228f3a..0000000 --- a/nvim-old/.config/nvim/lua/ink/init.lua +++ /dev/null @@ -1,144 +0,0 @@ -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 --- 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", "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 -}) diff --git a/nvim-old/.config/nvim/lua/ink/lsp.lua b/nvim-old/.config/nvim/lua/ink/lsp.lua deleted file mode 100644 index 9a07f81..0000000 --- a/nvim-old/.config/nvim/lua/ink/lsp.lua +++ /dev/null @@ -1,70 +0,0 @@ ---- [[ 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", "ca", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code action (menu)" }) - vim.keymap.set("v", "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", "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", "ci", function() - vim.lsp.buf.code_action({ - context = { - only = { "source.organizeImports.rust", "source.organizeImports" }, - }, - apply = true, - }) - end, { buffer = bufnr, desc = "Organize imports" }) - end, -}) diff --git a/nvim-old/.config/nvim/lua/ink/remap.lua b/nvim-old/.config/nvim/lua/ink/remap.lua deleted file mode 100644 index 722b369..0000000 --- a/nvim-old/.config/nvim/lua/ink/remap.lua +++ /dev/null @@ -1,63 +0,0 @@ --- 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" }, "", "", { silent = true }) --- vim.keymap.set("n", "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", "sn", "noautocmd w ", { 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", "", ":bnext", { desc = "Switch to next buffer" }) -map("n", "", ":bprev", { desc = "Switch to previous buffer" }) -map("n", "x", ":bdelete!", { desc = "Close buffer" }) -map("n", "b", " enew ", { desc = "Open new buffer" }) - -map("n", "v", "v", { desc = "Split vertical" }) -map("n", "h", "s", { desc = "Split horizontal" }) -map("n", "se", "=", { desc = "Reset split sizes" }) -map("n", "xs", ":close", { desc = "Close split" }) - -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", "zz") -map("n", "C-u", "zz") -map("n", "C-f", "zz") -map("n", "C-b", "zz") - --- map('n', '', 'za', { desc = 'Toggle cursor fold' }) --- map('n', '', 'zm', { desc = 'Toggle all folds at cursor' }) --- map('n', '', 'zM', { desc = 'Close all open folds' }) --- map('n', '', 'zr', { desc = 'Open all folds' }) --- map('n', '', 'zR', { desc = 'Open all folds' }) - --- map("n", "", "", { desc = "Move to split upwards" }) --- map("n", "", "", { desc = "Move to split upwards" }) --- map("n", "", "", { desc = "Move to split left" }) --- map("n", "", "", { desc = "Move to split right" }) - -map("n", "", "", { desc = "Move screen up one line" }) -map("n", "", "", { desc = "Move screen down one line" }) -map("v", "", "", { desc = "Move screen up one line" }) -map("v", "", "", { desc = "Move screen down one line" }) diff --git a/nvim-old/.config/nvim/lua/ink/tabline.lua b/nvim-old/.config/nvim/lua/ink/tabline.lua deleted file mode 100644 index c5b450d..0000000 --- a/nvim-old/.config/nvim/lua/ink/tabline.lua +++ /dev/null @@ -1,27 +0,0 @@ ---- @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()" diff --git a/nvim-old/.config/nvim/lua/plugins/avante.lua b/nvim-old/.config/nvim/lua/plugins/avante.lua deleted file mode 100644 index 8859b4b..0000000 --- a/nvim-old/.config/nvim/lua/plugins/avante.lua +++ /dev/null @@ -1,98 +0,0 @@ --- 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 = { - { "", "AvanteToggle", mode = { "n", "v", "i" }, desc = "Toggle Avante Chat" }, - { "aa", "AvanteAsk", desc = "Avante Ask" }, - { "ae", "AvanteEdit", desc = "Avante Edit" }, - { "ar", "AvanteRefresh", 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" }, - }, - }, - }, -} diff --git a/nvim-old/.config/nvim/lua/plugins/basic.lua b/nvim-old/.config/nvim/lua/plugins/basic.lua deleted file mode 100644 index 6cab50b..0000000 --- a/nvim-old/.config/nvim/lua/plugins/basic.lua +++ /dev/null @@ -1,81 +0,0 @@ -return { - -- keymap helper - { "folke/which-key.nvim", opts = {} }, - { -- undo tree - "mbbill/undotree", - opts = {}, - keys = { - { "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 = { - { "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", - }, - { - "", - mode = { "c" }, - function() - require("flash").toggle() - end, - desc = "Toggle Flash Search", - }, - }, - }, -} diff --git a/nvim-old/.config/nvim/lua/plugins/completion.lua b/nvim-old/.config/nvim/lua/plugins/completion.lua deleted file mode 100644 index 8899389..0000000 --- a/nvim-old/.config/nvim/lua/plugins/completion.lua +++ /dev/null @@ -1,114 +0,0 @@ -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 - [""] = { "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" }, - }, -} diff --git a/nvim-old/.config/nvim/lua/plugins/file_explorer.lua b/nvim-old/.config/nvim/lua/plugins/file_explorer.lua deleted file mode 100644 index 0d1acd0..0000000 --- a/nvim-old/.config/nvim/lua/plugins/file_explorer.lua +++ /dev/null @@ -1,21 +0,0 @@ -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 = { - { "pv", "Oil", desc = "Open current directory" }, - }, - }, -} diff --git a/nvim-old/.config/nvim/lua/plugins/formatting.lua b/nvim-old/.config/nvim/lua/plugins/formatting.lua deleted file mode 100644 index 91557c1..0000000 --- a/nvim-old/.config/nvim/lua/plugins/formatting.lua +++ /dev/null @@ -1,133 +0,0 @@ -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" }, "mp", function() - conform.format({ - lsp_fallback = true, - async = false, - timeout_ms = 5000, - }) - end, { desc = "Format file or range (in visual mode)" }) - end, - }, -} diff --git a/nvim-old/.config/nvim/lua/plugins/linting.lua b/nvim-old/.config/nvim/lua/plugins/linting.lua deleted file mode 100644 index 413d486..0000000 --- a/nvim-old/.config/nvim/lua/plugins/linting.lua +++ /dev/null @@ -1,39 +0,0 @@ -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", "l", function() - lint.try_lint() - end, { desc = "Trigger linting for current file" }) - vim.keymap.set("n", "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, - }, -} diff --git a/nvim-old/.config/nvim/lua/plugins/telescope.lua b/nvim-old/.config/nvim/lua/plugins/telescope.lua deleted file mode 100644 index 219ff98..0000000 --- a/nvim-old/.config/nvim/lua/plugins/telescope.lua +++ /dev/null @@ -1,149 +0,0 @@ -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 = { - [""] = actions.move_selection_previous, -- move to prev result - [""] = actions.move_selection_next, -- move to next result - [""] = 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", "pf", builtin.find_files, { desc = "Telescope find files" }) - vim.keymap.set("n", "", builtin.git_files, { desc = "Telescope find git files" }) - vim.keymap.set("n", "ps", function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }) - end, { desc = "Telescope grep" }) - vim.keymap.set("n", "gc", builtin.git_commits, { desc = "Search [G]it [C]ommits" }) - vim.keymap.set( - "n", - "gcf", - builtin.git_bcommits, - { desc = "Search [G]it [C]ommits for current [F]ile" } - ) - vim.keymap.set("n", "gb", builtin.git_branches, { desc = "Search [G]it [B]ranches" }) - vim.keymap.set("n", "gs", builtin.git_status, { desc = "Search [G]it [S]tatus (diff view)" }) - - vim.keymap.set("n", "?", builtin.oldfiles, { desc = "[?] Find recently opened files" }) - vim.keymap.set("n", "sb", builtin.buffers, { desc = "[S]earch existing [B]uffers" }) - - vim.keymap.set("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) - vim.keymap.set("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) - vim.keymap.set("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) - vim.keymap.set("n", "sr", builtin.resume, { desc = "[S]earch [R]resume" }) - vim.keymap.set("n", "s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set("n", "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", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) - vim.keymap.set("n", "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", "/", 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, - }, -} diff --git a/nvim-old/.config/nvim/lua/plugins/tmux.lua b/nvim-old/.config/nvim/lua/plugins/tmux.lua deleted file mode 100644 index 95c8d44..0000000 --- a/nvim-old/.config/nvim/lua/plugins/tmux.lua +++ /dev/null @@ -1,34 +0,0 @@ -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", - "", - nvim_tmux_nav.NvimTmuxNavigateLeft, - { desc = "Move to the split to the left" } - ) - vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateDown, { desc = "Move to the split below" }) - vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateUp, { desc = "Move to the split above" }) - vim.keymap.set( - "n", - "", - nvim_tmux_nav.NvimTmuxNavigateRight, - { desc = "Move to the split to the right" } - ) - vim.keymap.set( - "n", - "", - nvim_tmux_nav.NvimTmuxNavigateLastActive, - { desc = "Move to the last active split" } - ) - vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateNext, { desc = "Move to the next split" }) - end, - }, -} diff --git a/nvim-old/.config/nvim/lua/plugins/ui.lua b/nvim-old/.config/nvim/lua/plugins/ui.lua deleted file mode 100644 index e8a8ab1..0000000 --- a/nvim-old/.config/nvim/lua/plugins/ui.lua +++ /dev/null @@ -1,207 +0,0 @@ -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", "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 = { - { "gk", "GitBlameToggle", 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, - }, -} diff --git a/nvim-old/.config/nvim/snippets/bash.lua b/nvim-old/.config/nvim/snippets/bash.lua deleted file mode 100644 index 318868a..0000000 --- a/nvim-old/.config/nvim/snippets/bash.lua +++ /dev/null @@ -1,353 +0,0 @@ --- Lua snippets -local ls = require("luasnip") -local s = ls.snippet -local t = ls.text_node -local i = ls.insert_node -local f = ls.function_node -local c = ls.choice_node -local d = ls.dynamic_node -local sn = ls.snippet_node -local fmt = require("luasnip.extras.fmt").fmt -local rep = require("luasnip.extras").rep - --- Return a table of snippets for Bash --- stylua: ignore start -return { - -- Shebang - s("shebang", { - t("#!/usr/bin/env bash"), - }), - - -- Bash strict mode - s("strict", fmt([[ - set -euo pipefail - IFS=$'\n\t' - ]], {})), - - -- Function definition - s("func", fmt([[ - {}() {{ - {} - }} - ]], { - i(1, "function_name"), - i(2, "# function body"), - })), - - -- If statement - s("if", fmt([[ - if [ {} ]; then - {} - fi - ]], { - i(1, "condition"), - i(2, "# code"), - })), - - -- If-else statement - s("ifelse", fmt([[ - if [ {} ]; then - {} - else - {} - fi - ]], { - i(1, "condition"), - i(2, "# if code"), - i(3, "# else code"), - })), - - -- If-elif-else statement - s("ifelif", fmt([[ - if [ {} ]; then - {} - elif [ {} ]; then - {} - else - {} - fi - ]], { - i(1, "condition1"), - i(2, "# if code"), - i(3, "condition2"), - i(4, "# elif code"), - i(5, "# else code"), - })), - - -- For loop - s("for", fmt([[ - for {} in {}; do - {} - done - ]], { - i(1, "item"), - i(2, "items"), - i(3, "# loop body"), - })), - - -- For loop with range - s("fori", fmt([[ - for ((i={}; i<{}; i++)); do - {} - done - ]], { - i(1, "0"), - i(2, "10"), - i(3, "# loop body"), - })), - - -- While loop - s("while", fmt([[ - while [ {} ]; do - {} - done - ]], { - i(1, "condition"), - i(2, "# loop body"), - })), - - -- Until loop - s("until", fmt([[ - until [ {} ]; do - {} - done - ]], { - i(1, "condition"), - i(2, "# loop body"), - })), - - -- Case statement - s("case", fmt([[ - case {} in - {}) - {} - ;; - {}) - {} - ;; - *) - {} - ;; - esac - ]], { - i(1, "variable"), - i(2, "pattern1"), - i(3, "# code for pattern1"), - i(4, "pattern2"), - i(5, "# code for pattern2"), - i(6, "# default code"), - })), - - -- Read input - s("read", fmt([[ - read -p "{}" {} - ]], { - i(1, "Enter value: "), - i(2, "variable"), - })), - - -- Command substitution - s("cmd", fmt([[ - {}=$({}$) - ]], { - i(1, "result"), - i(2, "command"), - })), - - -- Variable declaration - s("var", fmt([[ - {}="{}" - ]], { - i(1, "variable"), - i(2, "value"), - })), - - -- Array declaration - s("array", fmt([[ - {}=({}) - ]], { - i(1, "array"), - i(2, "item1 item2 item3"), - })), - - -- Check if command exists - s("cmdexists", fmt([[ - if command -v {} &> /dev/null; then - {} - else - {} - fi - ]], { - i(1, "command"), - i(2, "# command exists"), - i(3, "# command does not exist"), - })), - - -- Check if file exists - s("fileexists", fmt([[ - if [ -f {} ]; then - {} - else - {} - fi - ]], { - i(1, "file"), - i(2, "# file exists"), - i(3, "# file does not exist"), - })), - - -- Check if directory exists - s("direxists", fmt([[ - if [ -d {} ]; then - {} - else - {} - fi - ]], { - i(1, "directory"), - i(2, "# directory exists"), - i(3, "# directory does not exist"), - })), - - -- Check if variable is empty - s("isempty", fmt([[ - if [ -z "${{{}}}" ]; then - {} - else - {} - fi - ]], { - i(1, "variable"), - i(2, "# variable is empty"), - i(3, "# variable is not empty"), - })), - - -- Check if variable is not empty - s("isnotempty", fmt([[ - if [ -n "${{{}}}" ]; then - {} - else - {} - fi - ]], { - i(1, "variable"), - i(2, "# variable is not empty"), - i(3, "# variable is empty"), - })), - - -- Error handling - s("error", fmt([[ - error() {{ - echo "[ERROR] $1" >&2 - exit 1 - }} - ]], {})), - - -- Parse command line arguments - s("getopts", fmt([[ - while getopts ":{}:" opt; do - case $opt in - {}) - {} - ;; - {}) - {} - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - exit 1 - ;; - esac - done - shift $((OPTIND-1)) - ]], { - i(1, "ab:c:"), - i(2, "a"), - i(3, "# handle option a"), - i(4, "b"), - i(5, "# handle option b with value in $OPTARG"), - })), - - -- Trap signals - s("trap", fmt([[ - trap '{}' {} - ]], { - i(1, "echo 'Caught signal, cleaning up...; exit 1'"), - i(2, "SIGINT SIGTERM"), - })), - - -- Cleanup function with trap - s("cleanup", fmt([[ - cleanup() {{ - {} - }} - - trap cleanup EXIT - ]], { - i(1, "# cleanup code here"), - })), - - -- Redirect stdout and stderr to file - s("redirect", fmt([[ - {} > {} 2>&1 - ]], { - i(1, "command"), - i(2, "logfile.log"), - })), - - -- Check exit status - s("checkstatus", fmt([[ - if [ $? -eq 0 ]; then - {} - else - {} - fi - ]], { - i(1, "# success"), - i(2, "# failure"), - })), - - -- Here document - s("heredoc", fmt([[ - cat << EOF > {} - {} - EOF - ]], { - i(1, "output.txt"), - i(2, "content goes here"), - })), - - -- Here string - s("herestring", fmt([[ - {} <<< "{}" - ]], { - i(1, "command"), - i(2, "string"), - })), - - -- Script usage/help - s("usage", fmt([[ - usage() {{ - cat << EOF - Usage: $(basename $0) [options] - - Options: - -h, --help Show this help message and exit - -v, --verbose Enable verbose output - {} - - Examples: - $(basename $0) {} - EOF - exit ${1:-0} - }} - ]], { - i(1, "-o, --option Description of option"), - i(2, "example_argument"), - })), -} --- stylua: ignore end diff --git a/nvim-old/.config/nvim/snippets/lua.lua b/nvim-old/.config/nvim/snippets/lua.lua deleted file mode 100644 index 58b2473..0000000 --- a/nvim-old/.config/nvim/snippets/lua.lua +++ /dev/null @@ -1,79 +0,0 @@ --- Lua snippets -local ls = require("luasnip") -local s = ls.snippet -local t = ls.text_node -local i = ls.insert_node -local f = ls.function_node -local c = ls.choice_node -local d = ls.dynamic_node -local sn = ls.snippet_node -local fmt = require("luasnip.extras.fmt").fmt -local rep = require("luasnip.extras").rep - --- Return a table of snippets for Lua --- stylua: ignore start -return { - -- Basic print statement - s("pr", { - t('print("'), - i(1, "text"), - t('")'), - }), - - -- Function definition - s("fn", fmt([[ - local function {}({}) - {} - end - ]], { - i(1, "name"), - i(2, ""), - i(3, "-- TODO: implement"), - })), - - -- Module pattern - s("mod", fmt([[ - local {} = {{}} - - function {}:new(o) - o = o or {{}} - setmetatable(o, self) - self.__index = self - return o - end - - {} - - return {} - ]], { - i(1, "ModuleName"), - rep(1), - i(2, "-- TODO: add methods"), - rep(1), - })), - - -- For loop - s("for", fmt([[ - for {} = {}, {} do - {} - end - ]], { - i(1, "i"), - i(2, "1"), - i(3, "10"), - i(4, "-- TODO: loop body"), - })), - - -- For pairs loop - s("forp", fmt([[ - for {}, {} in pairs({}) do - {} - end - ]], { - i(1, "k"), - i(2, "v"), - i(3, "table"), - i(4, "-- TODO: loop body"), - })), -} --- stylua: ignore end diff --git a/nvim-old/.config/nvim/snippets/python.lua b/nvim-old/.config/nvim/snippets/python.lua deleted file mode 100644 index fb37813..0000000 --- a/nvim-old/.config/nvim/snippets/python.lua +++ /dev/null @@ -1,75 +0,0 @@ --- Python snippets -local ls = require("luasnip") -local s = ls.snippet -local t = ls.text_node -local i = ls.insert_node -local f = ls.function_node -local c = ls.choice_node -local d = ls.dynamic_node -local sn = ls.snippet_node -local fmt = require("luasnip.extras.fmt").fmt -local rep = require("luasnip.extras").rep - --- Return a table of snippets for Python --- stylua: ignore start -return { - -- Print statement - s("pr", { - t("print("), - i(1, "text"), - t(")"), - }), - - -- Function definition - s("def", fmt([[ - def {}({}): - {} - ]], { - i(1, "function_name"), - i(2, ""), - i(3, "pass"), - })), - - -- Class definition - s("class", fmt([[ - class {}: - def __init__(self, {}): - {} - ]], { - i(1, "ClassName"), - i(2, ""), - i(3, "pass"), - })), - - -- For loop - s("for", fmt([[ - for {} in {}: - {} - ]], { - i(1, "item"), - i(2, "iterable"), - i(3, "pass"), - })), - - -- If statement - s("if", fmt([[ - if {}: - {} - ]], { - i(1, "condition"), - i(2, "pass"), - })), - - -- Try/except - s("try", fmt([[ - try: - {} - except {}: - {} - ]], { - i(1, "# code"), - i(2, "Exception"), - i(3, "pass"), - })), -} --- stylua: ignore end diff --git a/nvim-old/.config/nvim/snippets/rust.lua b/nvim-old/.config/nvim/snippets/rust.lua deleted file mode 100644 index 1619551..0000000 --- a/nvim-old/.config/nvim/snippets/rust.lua +++ /dev/null @@ -1,340 +0,0 @@ --- Lua snippets -local ls = require("luasnip") -local s = ls.snippet -local t = ls.text_node -local i = ls.insert_node -local f = ls.function_node -local c = ls.choice_node -local d = ls.dynamic_node -local sn = ls.snippet_node -local fmt = require("luasnip.extras.fmt").fmt -local rep = require("luasnip.extras").rep - --- Return a table of snippets for Rust --- stylua: ignore start -return { - -- Basic main function - s("main", fmt([[ - fn main() {{ - {} - }} - ]], { - i(1, "// Your code here"), - })), - - -- Function definition - s("fn", fmt([[ - fn {}({}) {} {{ - {} - }} - ]], { - i(1, "function_name"), - i(2, ""), - c(3, { - t(""), - t("-> ()"), - sn(nil, {t("-> "), i(1, "ReturnType")}), - }), - i(4, "// Function body"), - })), - - -- Public function - s("pfn", fmt([[ - pub fn {}({}) {} {{ - {} - }} - ]], { - i(1, "function_name"), - i(2, ""), - c(3, { - t(""), - t("-> ()"), - sn(nil, {t("-> "), i(1, "ReturnType")}), - }), - i(4, "// Function body"), - })), - - -- Struct definition - s("struct", fmt([[ - struct {} {{ - {} - }} - ]], { - i(1, "StructName"), - i(2, "// fields"), - })), - - -- Public struct - s("pstruct", fmt([[ - pub struct {} {{ - {} - }} - ]], { - i(1, "StructName"), - i(2, "// fields"), - })), - - -- Struct implementation - s("impl", fmt([[ - impl {} {{ - {} - }} - ]], { - i(1, "StructName"), - i(2, "// methods"), - })), - - -- Trait implementation - s("implfor", fmt([[ - impl {} for {} {{ - {} - }} - ]], { - i(1, "Trait"), - i(2, "Type"), - i(3, "// trait implementation"), - })), - - -- Trait definition - s("trait", fmt([[ - trait {} {{ - {} - }} - ]], { - i(1, "TraitName"), - i(2, "// trait methods"), - })), - - -- Public trait - s("ptrait", fmt([[ - pub trait {} {{ - {} - }} - ]], { - i(1, "TraitName"), - i(2, "// trait methods"), - })), - - -- Enum definition - s("enum", fmt([[ - enum {} {{ - {}, - }} - ]], { - i(1, "EnumName"), - i(2, "// variants"), - })), - - -- Public enum - s("penum", fmt([[ - pub enum {} {{ - {}, - }} - ]], { - i(1, "EnumName"), - i(2, "// variants"), - })), - - -- Match expression - s("match", fmt([[ - match {} {{ - {} => {}, - _ => {}, - }} - ]], { - i(1, "expression"), - i(2, "pattern"), - i(3, "result"), - i(4, "default_result"), - })), - - -- If let expression - s("iflet", fmt([[ - if let {} = {} {{ - {} - }} - ]], { - i(1, "pattern"), - i(2, "expression"), - i(3, "// code"), - })), - - -- While let loop - s("whilelet", fmt([[ - while let {} = {} {{ - {} - }} - ]], { - i(1, "pattern"), - i(2, "expression"), - i(3, "// loop body"), - })), - - -- For loop - s("for", fmt([[ - for {} in {} {{ - {} - }} - ]], { - i(1, "item"), - i(2, "iterator"), - i(3, "// loop body"), - })), - - -- Loop - s("loop", fmt([[ - loop {{ - {} - - {} - }} - ]], { - i(1, "// loop body"), - i(2, "break;"), - })), - - -- Closure - s("closure", fmt([[ - |{}| {} {{ - {} - }} - ]], { - i(1, "args"), - c(2, { - t(""), - sn(nil, {t("-> "), i(1, "ReturnType")}), - }), - i(3, "// closure body"), - })), - - -- Derive attribute - s("derive", fmt([[ - #[derive({})] - ]], { - i(1, "Debug, Clone"), - })), - - -- Module - s("mod", fmt([[ - mod {} {{ - {} - }} - ]], { - i(1, "module_name"), - i(2, "// module contents"), - })), - - -- Public module - s("pmod", fmt([[ - pub mod {} {{ - {} - }} - ]], { - i(1, "module_name"), - i(2, "// module contents"), - })), - - -- Use statement - s("use", fmt([[ - use {}; - ]], { - i(1, "path::to::module"), - })), - - -- Test module - s("testmod", fmt([[ - #[cfg(test)] - mod tests {{ - use super::*; - - #[test] - fn {}() {{ - {} - }} - }} - ]], { - i(1, "test_name"), - i(2, "// test code"), - })), - - -- Test function - s("test", fmt([[ - #[test] - fn {}() {{ - {} - }} - ]], { - i(1, "test_name"), - i(2, "// test code"), - })), - - -- Async function - s("async", fmt([[ - async fn {}({}) {} {{ - {} - }} - ]], { - i(1, "function_name"), - i(2, ""), - c(3, { - t(""), - t("-> ()"), - sn(nil, {t("-> "), i(1, "ReturnType")}), - }), - i(4, "// async function body"), - })), - - -- Result type - s("result", fmt([[ - Result<{}, {}> - ]], { - i(1, "T"), - i(2, "Error"), - })), - - -- Option type - s("option", fmt([[ - Option<{}> - ]], { - i(1, "T"), - })), - - -- Unwrap with error message - s("expect", fmt([[ - .expect("{}") - ]], { - i(1, "Failed to unwrap value"), - })), - - -- Print debug - s("dbg", fmt([[ - dbg!({}); - ]], { - i(1, "expression"), - })), - - -- Print - s("print", fmt([[ - println!("{}", {}); - ]], { - i(1, "{}"), - i(2, "expression"), - })), - - -- Let statement - s("let", fmt([[ - let {} = {}; - ]], { - i(1, "variable"), - i(2, "value"), - })), - - -- Let mut statement - s("letmut", fmt([[ - let mut {} = {}; - ]], { - i(1, "variable"), - i(2, "value"), - })), -} --- stylua: ignore end diff --git a/nvim-old/.config/nvim/snippets/terraform.lua b/nvim-old/.config/nvim/snippets/terraform.lua deleted file mode 100644 index 56442ae..0000000 --- a/nvim-old/.config/nvim/snippets/terraform.lua +++ /dev/null @@ -1,297 +0,0 @@ --- Terraform snippets -local ls = require("luasnip") -local s = ls.snippet -local t = ls.text_node -local i = ls.insert_node -local f = ls.function_node -local c = ls.choice_node -local d = ls.dynamic_node -local sn = ls.snippet_node -local fmt = require("luasnip.extras.fmt").fmt -local rep = require("luasnip.extras").rep - --- Return a table of snippets for Terraform --- stylua: ignore start -return { - -- Terraform block - s("terraform", fmt([[ - terraform {{ - required_version = ">= {}" - - required_providers {{ - {} - }} - - {} - }} - ]], { - i(1, "1.0.0"), - i(2, 'aws = {\n source = "hashicorp/aws"\n version = "~> 4.0"\n }'), - i(3, ""), - })), - - -- Provider block - s("provider", fmt([[ - provider "{}" {{ - {} - }} - ]], { - i(1, "aws"), - i(2, 'region = "us-west-2"'), - })), - - -- AWS Provider with profile - s("aws", fmt([[ - provider "aws" {{ - region = "{}" - profile = "{}" - }} - ]], { - i(1, "us-west-2"), - i(2, "default"), - })), - - -- Resource block - s("resource", fmt([[ - resource "{}" "{}" {{ - {} - }} - ]], { - i(1, "aws_s3_bucket"), - i(2, "example"), - i(3, ""), - })), - - -- Data source block - s("data", fmt([[ - data "{}" "{}" {{ - {} - }} - ]], { - i(1, "aws_ami"), - i(2, "example"), - i(3, 'owners = ["amazon"]'), - })), - - -- Variable block - s("variable", fmt([[ - variable "{}" {{ - description = "{}" - type = {} - default = {} - {} - }} - ]], { - i(1, "example"), - i(2, "Example variable"), - c(3, { - t("string"), - t("number"), - t("bool"), - t("list(string)"), - t("map(string)"), - t("object({})"), - sn(nil, {t("list(object({"), i(1, "name = string, value = string"), t("}))")}), - }), - c(4, { - t('null'), - sn(nil, {t('"'), i(1, "default_value"), t('"')}), - sn(nil, {t('true')}), - sn(nil, {t('false')}), - sn(nil, {t('123')}), - sn(nil, {t('['), i(1, '"item1", "item2"'), t(']')}), - sn(nil, {t('{'), i(1, 'key = "value"'), t('}')}), - }), - i(5, ""), - })), - - -- Output block - s("output", fmt([[ - output "{}" {{ - description = "{}" - value = {} - {} - }} - ]], { - i(1, "example"), - i(2, "Example output"), - i(3, "aws_instance.example.id"), - c(4, { - t(""), - t("sensitive = true"), - }), - })), - - -- Local block - s("locals", fmt([[ - locals {{ - {} = {} - }} - ]], { - i(1, "example"), - i(2, '"value"'), - })), - - -- Module block - s("module", fmt([[ - module "{}" {{ - source = "{}" - - {} - }} - ]], { - i(1, "example"), - i(2, "./modules/example"), - i(3, "# Module inputs"), - })), - - -- Backend block - s("backend", fmt([[ - backend "{}" {{ - {} - }} - ]], { - i(1, "s3"), - i(2, 'bucket = "terraform-state"\nkey = "path/to/state.tfstate"\nregion = "us-west-2"'), - })), - - -- Conditional expression - s("condition", fmt([[ - {} ? {} : {} - ]], { - i(1, "var.environment == \"prod\""), - i(2, "\"production\""), - i(3, "\"development\""), - })), - - -- For expression - s("for", fmt([[ - [for {} in {} : {}] - ]], { - i(1, "item"), - i(2, "var.list"), - i(3, "item.name"), - })), - - -- For expression with index - s("fori", fmt([[ - [for {}, {} in {} : {}] - ]], { - i(1, "index"), - i(2, "item"), - i(3, "var.list"), - i(4, "\"${index}-${item.name}\""), - })), - - -- For expression with map - s("formap", fmt([[ - {{for {} in {} : {} => {}}} - ]], { - i(1, "item"), - i(2, "var.list"), - i(3, "item.key"), - i(4, "item.value"), - })), - - -- Count parameter - s("count", fmt([[ - count = {} - - {}[count.index] - ]], { - i(1, "var.create_resource ? 1 : 0"), - i(2, "# Reference this resource elsewhere using aws_instance.example"), - })), - - -- For each parameter - s("foreach", fmt([[ - for_each = {} - - {} - ]], { - c(1, { - sn(nil, {t("toset(["), i(1, "\"item1\", \"item2\""), t("])")}), - sn(nil, {t("{"), i(1, "key1 = \"value1\", key2 = \"value2\""), t("}")}), - sn(nil, {t("var."), i(1, "map_variable")}), - }), - i(2, "# Reference this resource elsewhere using aws_instance.example[each.key]"), - })), - - -- Dynamic block - s("dynamic", fmt([[ - dynamic "{}" {{ - for_each = {} - content {{ - {} - }} - }} - ]], { - i(1, "ingress"), - i(2, "var.ingress_rules"), - i(3, "from_port = ingress.value.from_port\n to_port = ingress.value.to_port\n protocol = ingress.value.protocol\n cidr_blocks = ingress.value.cidr_blocks"), - })), - - -- Lifecycle block - s("lifecycle", fmt([[ - lifecycle {{ - {} - }} - ]], { - c(1, { - t("create_before_destroy = true"), - t("prevent_destroy = true"), - t("ignore_changes = [tags]"), - sn(nil, {t("ignore_changes = ["), i(1, "attribute"), t("]")}), - t("create_before_destroy = true\n prevent_destroy = true\n ignore_changes = [tags]"), - }), - })), - - -- Terraform workspace - s("workspace", fmt([[ - terraform.workspace - ]], {})), - - -- Depends on - s("depends", fmt([[ - depends_on = [ - {}, - ] - ]], { - i(1, "aws_iam_role_policy.example"), - })), - - -- Provisioner - s("provisioner", fmt([[ - provisioner "{}" {{ - {} - }} - ]], { - c(1, { - t("local-exec"), - t("remote-exec"), - t("file"), - }), - c(2, { - sn(nil, {t('command = "'), i(1, "echo hello"), t('"')}), - sn(nil, {t('inline = [\n "'), i(1, "echo hello"), t('",\n ]')}), - sn(nil, {t('source = "'), i(1, "scripts/setup.sh"), t('"\n destination = "'), i(2, "/tmp/setup.sh"), t('"')}), - }), - })), - - -- Null resource - s("null", fmt([[ - resource "null_resource" "{}" {{ - triggers = {{ - {} = {} - }} - - {} - }} - ]], { - i(1, "example"), - i(2, "trigger"), - i(3, "uuid()"), - i(4, "# Provisioners or depends_on go here"), - })), -} --- stylua: ignore end diff --git a/nvim-old/.config/nvim/README.md b/nvim/.config/nvim/README.md similarity index 100% rename from nvim-old/.config/nvim/README.md rename to nvim/.config/nvim/README.md diff --git a/nvim/.config/nvim/lsp/rust.lua b/nvim/.config/nvim/lsp/rust.lua index 1c32159..9ec45f0 100644 --- a/nvim/.config/nvim/lsp/rust.lua +++ b/nvim/.config/nvim/lsp/rust.lua @@ -9,12 +9,11 @@ return { loadOutDirsFromCheck = true, runBuildScripts = true, }, - checkOnSave = { + check = { command = "clippy", }, completion = { autoself = { enable = true }, - snippets = { enable = true }, }, diagnostics = { enable = true, diff --git a/nvim/.config/nvim/lua/ink/lsp.lua b/nvim/.config/nvim/lua/ink/lsp.lua index d97f602..ef037c2 100644 --- a/nvim/.config/nvim/lua/ink/lsp.lua +++ b/nvim/.config/nvim/lua/ink/lsp.lua @@ -19,6 +19,11 @@ vim.lsp.config("*", { }, }) +-- Add rounded borders to diagnostic floating windows +vim.diagnostic.config({ + float = { border = "rounded" }, +}) + -- Consolidate all LSP actions into a single LspAttach autocmd vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", { clear = true }), @@ -48,6 +53,25 @@ vim.api.nvim_create_autocmd("LspAttach", { vim.opt_local.foldmethod = "expr" end + -- [[ NAVIGATION ]] + vim.keymap.set("n", "gd", function() + require("fzf-lua").lsp_definitions() + end, { buffer = bufnr, desc = "Go to definition" }) + + vim.keymap.set("n", "gr", function() + require("fzf-lua").lsp_references() + end, { buffer = bufnr, desc = "Find references" }) + + vim.keymap.set("n", "gI", function() + require("fzf-lua").lsp_implementations() + end, { buffer = bufnr, desc = "Go to implementation" }) + + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { buffer = bufnr, desc = "Go to declaration" }) + + vim.keymap.set("n", "K", function() + vim.lsp.buf.hover({ border = "rounded", max_width = 120 }) + end, { buffer = bufnr, desc = "Show documentation" }) + -- [[ CODE ACTIONS ]] -- Note: Neovim 0.11+ automatically maps 'gra' to code actions natively. diff --git a/nvim/.config/nvim/lua/plugins/ai/init.lua b/nvim/.config/nvim/lua/plugins/ai/init.lua index 0f36267..e4fc947 100644 --- a/nvim/.config/nvim/lua/plugins/ai/init.lua +++ b/nvim/.config/nvim/lua/plugins/ai/init.lua @@ -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 = { [""] = { "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) diff --git a/nvim/.config/nvim/lua/plugins/basic/init.lua b/nvim/.config/nvim/lua/plugins/basic/init.lua index 9c80365..bd091e6 100644 --- a/nvim/.config/nvim/lua/plugins/basic/init.lua +++ b/nvim/.config/nvim/lua/plugins/basic/init.lua @@ -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", "pv", "Oil", { desc = "Open current directory" }) vim.keymap.set({ "n", "x", "o" }, "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", "pf", function() + require("fzf-lua").files({ cwd = get_project_root() }) +end, { desc = "Fuzzy find project files" }) + +vim.keymap.set("n", "ps", function() + require("fzf-lua").live_grep({ cwd = get_project_root() }) +end, { desc = "Live grep project text" }) + +vim.keymap.set("n", "", function() + require("fzf-lua").buffers() +end, { desc = "Fuzzy find open files" }) + +vim.keymap.set("n", "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, +}) diff --git a/nvim/.config/nvim/lua/plugins/linting/init.lua b/nvim/.config/nvim/lua/plugins/linting/init.lua index 0b0e461..9d90612 100644 --- a/nvim/.config/nvim/lua/plugins/linting/init.lua +++ b/nvim/.config/nvim/lua/plugins/linting/init.lua @@ -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", "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, }) diff --git a/nvim/.config/nvim/lua/plugins/ui/init.lua b/nvim/.config/nvim/lua/plugins/ui/init.lua index 2a6bd57..4d75450 100644 --- a/nvim/.config/nvim/lua/plugins/ui/init.lua +++ b/nvim/.config/nvim/lua/plugins/ui/init.lua @@ -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", "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" }, diff --git a/nvim/.config/nvim/nvim-pack-lock.json b/nvim/.config/nvim/nvim-pack-lock.json index f6b600d..ba6d531 100644 --- a/nvim/.config/nvim/nvim-pack-lock.json +++ b/nvim/.config/nvim/nvim-pack-lock.json @@ -13,6 +13,14 @@ "rev": "086a40dc7ed8242c03be9f47fbcee68699cc2395", "src": "https://github.com/stevearc/conform.nvim" }, + "fidget.nvim": { + "rev": "889e2e96edef4e144965571d46f7a77bcc4d0ddf", + "src": "https://github.com/j-hui/fidget.nvim" + }, + "fzf-lua": { + "rev": "9f0432fdd7825ab163520045831a40b6df82ea28", + "src": "https://github.com/ibhagwan/fzf-lua" + }, "git-blame.nvim": { "rev": "5c536e2d4134d064aa3f41575280bc8a2a0e03d7", "src": "https://github.com/f-person/git-blame.nvim" diff --git a/nvim-old/.config/nvim/queries/gotmpl/injections.scm b/nvim/.config/nvim/queries/gotmpl/injections.scm similarity index 100% rename from nvim-old/.config/nvim/queries/gotmpl/injections.scm rename to nvim/.config/nvim/queries/gotmpl/injections.scm