diff --git a/config/nvim-old/.delete/nvim_task_keymaps.vim b/config/nvim-old/.delete/nvim_task_keymaps.vim new file mode 100644 index 0000000..e69de29 diff --git a/config/nvim-old/after/compiler/cargo.vim b/config/nvim-old/after/compiler/cargo.vim new file mode 100644 index 0000000..2ee5606 --- /dev/null +++ b/config/nvim-old/after/compiler/cargo.vim @@ -0,0 +1,8 @@ +" Override cargo compiler defaults +setlocal makeprg=cargo\ build\ --message-format=short + +setlocal errorformat= + \%f:%l:%c:\ %t%*[^:]:\ %m, + \%f:%l:%c:\ %m, + \%f:%l:\ %t%*[^:]:\ %m, + \%f:%l:\ %m diff --git a/config/nvim-old/after/compiler/cmake.vim b/config/nvim-old/after/compiler/cmake.vim new file mode 100644 index 0000000..17faff7 --- /dev/null +++ b/config/nvim-old/after/compiler/cmake.vim @@ -0,0 +1,2 @@ +let current_compiler = "cmake" +CompilerSet makeprg=cmake \ No newline at end of file diff --git a/config/nvim-old/after/compiler/npm.vim b/config/nvim-old/after/compiler/npm.vim new file mode 100644 index 0000000..b702788 --- /dev/null +++ b/config/nvim-old/after/compiler/npm.vim @@ -0,0 +1,2 @@ +let current_compiler = "npm" +CompilerSet makeprg=npm\ run \ No newline at end of file diff --git a/config/nvim-old/ftplugin/http.lua b/config/nvim-old/ftplugin/http.lua new file mode 100644 index 0000000..d18816a --- /dev/null +++ b/config/nvim-old/ftplugin/http.lua @@ -0,0 +1,30 @@ +vim.api.nvim_buf_set_keymap( + 0, + "n", + "", + "lua require('kulala').run()", + { noremap = true, silent = true, desc = "Execute the request" } +) + +vim.api.nvim_buf_set_keymap( + 0, + "n", + "[", + "lua require('kulala').jump_prev()", + { noremap = true, silent = true, desc = "Jump to the previous request" } +) +vim.api.nvim_buf_set_keymap( + 0, + "n", + "]", + "lua require('kulala').jump_next()", + { noremap = true, silent = true, desc = "Jump to the next request" } +) + +vim.api.nvim_buf_set_keymap( + 0, + "n", + "i", + "lua require('kulala').inspect()", + { noremap = true, silent = true, desc = "Inspect the current request" } +) \ No newline at end of file diff --git a/config/nvim-old/init.lua b/config/nvim-old/init.lua new file mode 100644 index 0000000..211669c --- /dev/null +++ b/config/nvim-old/init.lua @@ -0,0 +1,163 @@ +-- Steve Beaulac nvim configuration using kickstart git: 2ba39c6 -- +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +vim.g.have_nerd_fonts = true + +-- set as my leader key +vim.g.autoformat = true + +-- vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } + +vim.g.editorconfig = true + +vim.wo.number = true + +vim.opt.background = "dark" +vim.opt.backup = false +vim.opt.clipboard:append("unnamedplus") +vim.opt.modifiable = true +vim.opt.cmdheight = 1 +vim.opt.completeopt = { 'menuone', 'noinsert', 'noselect', 'fuzzy', 'popup' } +vim.opt.conceallevel = 0 +-- vim.opt.concealcursor = "" +vim.opt.encoding = "UTF-8" +vim.opt.lazyredraw = true +vim.opt.redrawtime = 10000 +vim.opt.maxmempattern = 20000 +vim.opt.synmaxcol = 300 +vim.opt.pumheight = 10 +vim.opt.pumblend = 10 +vim.opt.winblend = 0 +vim.opt.hlsearch = true +vim.opt.breakindent = true +vim.opt.ignorecase = true +vim.opt.backspace = "indent,eol,start" +vim.opt.formatoptions = "jcroqlnt" +vim.opt.grepformat = "%f:%l:%c:%m" +vim.opt.grepprg = "rg --vimgrep" +vim.opt.ignorecase = true +vim.opt.inccommand = "split" +vim.opt.list = true +vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } +vim.opt.mouse = "a" +vim.opt.pumblend = 10 +vim.opt.pumheight = 10 +vim.opt.showmode = false +vim.opt.showmatch = true +vim.opt.showtabline = 0 +vim.opt.smartcase = true +vim.opt.smartindent = true +vim.opt.splitbelow = true +vim.opt.splitright = true +-- vim.opt.splitkeep = "screen" +vim.opt.swapfile = false +vim.opt.termguicolors = true +vim.opt.undofile = true +vim.opt.undolevels = 10000 +vim.opt.updatetime = 250 -- default 250 +vim.opt.timeoutlen = 500 -- default 1000 +vim.opt.ttimeoutlen = 0 +-- vim.opt.timeout = false +vim.opt.autoread = true +vim.opt.autowrite = false +vim.opt.autochdir = false +vim.opt.writebackup = false +vim.opt.expandtab = true +vim.opt.shiftround = true +vim.opt.shiftwidth = 4 +vim.opt.softtabstop = 4 +vim.opt.tabstop = 4 +vim.opt.hidden = true +vim.opt.shortmess:append({ W = true, I = true, c = true, C = true }) +vim.opt.spelllang = { "en" } +vim.opt.selection = "inclusive" +vim.opt.cursorline = true +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.laststatus = 3 +vim.opt.showcmd = false +vim.opt.ruler = false +vim.opt.numberwidth = 4 +vim.opt.signcolumn = "yes" +vim.opt.wrap = false +vim.opt.scrolloff = 8 +vim.opt.sidescrolloff = 8 +vim.opt.shell = "/bin/bash" +vim.opt.sessionoptions = { "blank", "buffers", "curdir", "tabpages", "winsize", "winpos", "terminal", "localoptions", "help", "skiprtp", "folds" } +vim.opt.virtualedit = "block" +vim.opt.wildmode = "longest:full,full" +vim.opt.diffopt:append("linematch:60") + +vim.opt.winminwidth = 5 +-- vim.opt.hidden = false +-- vim.opt.cindent = true +-- vim.opt.autoindent = true + +if vim.fn.has("nvim-0.10") == 1 then + vim.opt.smoothscroll = true +end + +vim.opt.foldmethod = "expr" +vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" +vim.opt.foldlevel = 99 +vim.opt.errorbells = false +vim.opt.belloff = "all" +vim.opt.undodir = vim.fn.stdpath('data') .. "/undodir" +vim.opt.incsearch = true +vim.opt.fillchars = { eob = " " } +vim.opt.iskeyword:append("-") +vim.opt.path:append("**") +vim.opt.colorcolumn = "100" + +vim.diagnostic.config({ + virtual_text = { current_line = true } +}) + +-- Lazy plugin manager +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', lazyrepo, '--branch=stable', lazypath } + if vim.v.shell_error ~= 0 then + error('Error cloning lazy.nvim:\n' .. out) + end +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + { import = "plugins" } + }, + rocks = { + enabled = false, + hererocks = false, + }, + checker = { + enabled = true, + notify = false, + }, + change_detection = { + notify = false, + }, +}) + +vim.g.lazyvim_check_order = false + + +require("config.keymaps") +require("config.scripts") + +-- When Nvim is idle or you switch focus/buffers, check if files changed +vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHoldI" }, { + pattern = "*", + command = "checktime", +}) + +vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + require("config.autocmds") + end, +}) + diff --git a/config/nvim-old/json_snippets/copyright.json b/config/nvim-old/json_snippets/copyright.json new file mode 100644 index 0000000..62f47c3 --- /dev/null +++ b/config/nvim-old/json_snippets/copyright.json @@ -0,0 +1,10 @@ +{ + "gCopyright": { + "prefix": "copy", + "description": "Generic Copyright", + "body": [ + "Copyright (c) ${CURRENT_YEAR} ${1:Author} <${2:email}>. All Rights Reserved.", + "$0" + ] + } +} \ No newline at end of file diff --git a/config/nvim-old/json_snippets/json.json b/config/nvim-old/json_snippets/json.json new file mode 100644 index 0000000..97f26fe --- /dev/null +++ b/config/nvim-old/json_snippets/json.json @@ -0,0 +1,49 @@ +{ + "Starter Template": { + "prefix": "vsTaskHeader", + "body": [ + "{", + "\t\"version\": \"2.0.0\",", + "\t\"tasks\": [", + "\t\t$0", + "\t]", + "}" + ], + "scope": "json" + }, + "Tasks": { + "prefix": "vsTasks", + "body": [ + "{", + "\t\"label\": \"$1\",", + "\t\"type\": \"shell\",", + "\t\"command\": \"$2\",", + "\t\"args\": [ $3 ],", + "\t\"group\": {", + "\t\t\"kind\": \"build\",", + "\t\t\"isDefault\": true", + "\t}$0", + "}" + ], + "scope": "json" + }, + "Presentation": { + "prefix": "presentation", + "body": [ + "\"presentation\": {", + "\t\"reveal\": \"always\",", + "\t\"panel\": \"new\",", + "}" + ], + "scope": "json" + }, + "ProblemMatcher": { + "prefix": "problemMatcher", + "body": [ + "\"problemMatcher\": [", + "\t$0", + "]" + ], + "scope": "json" + } +} \ No newline at end of file diff --git a/config/nvim-old/json_snippets/package.json b/config/nvim-old/json_snippets/package.json new file mode 100644 index 0000000..cf8ee78 --- /dev/null +++ b/config/nvim-old/json_snippets/package.json @@ -0,0 +1,21 @@ +{ + "name": "sjb_snippets", + "contributes": { + "snippets": [ + { + "language": [ + "json" + ], + "path": "./json.json" + }, + { + "language": [ + "rust", + "global", + "all" + ], + "path": "./copyright.json" + } + ] + } + } \ No newline at end of file diff --git a/config/nvim/lua/config/autocmds.lua b/config/nvim-old/lua/config/autocmds.lua similarity index 100% rename from config/nvim/lua/config/autocmds.lua rename to config/nvim-old/lua/config/autocmds.lua diff --git a/config/nvim-old/lua/config/keymaps.lua b/config/nvim-old/lua/config/keymaps.lua new file mode 100644 index 0000000..6ca8a7b --- /dev/null +++ b/config/nvim-old/lua/config/keymaps.lua @@ -0,0 +1,78 @@ +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +--vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) + +-- Remap for dealing with word wrap +vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +-- save file +-- vim.keymap.set({ "i", "x", "n", "s" }, "", "w", { desc = "Save file" }) +-- vim.keymap.set({ "i", "x", "n", "s" }, "", ":qall", { desc = "Save file" }) + +-- better indenting +vim.keymap.set("v", "<", "", ">gv") + +-- better jumps +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") + +vim.keymap.set("i", "", "", { noremap = true, silent = true }) +vim.keymap.set("i", "", "", { noremap = true, silent = true }) +vim.keymap.set("i", "", "", { noremap = true, silent = true }) + +-- Paste over currently selected text without yanking it +vim.keymap.set("v", "p", '"_dP') + +vim.keymap.set("n", "p", [["_dP]], { desc = "Paste over currently selected text without yanking it" }) + +vim.keymap.set("n", "Y", [["+Y]], { noremap = true, silent = true }) +vim.keymap.set({ "n", "v" }, "y", [["+y]], { noremap = true, silent = true }) + +vim.keymap.set({"n", "v"}, "d", [["_d]], { noremap = true, silent = true }) + +-- new file +vim.keymap.set("n", "bn", "enew", { desc = "New File" }) +-- vim.keymap.set("n", "bd", "bdelete", { desc = "Unload Buffer" }) + +vim.keymap.set("n", "`", "e #", { desc = "Switch to Other Buffer" }) +vim.keymap.set("n", "bc", "tabclose", { desc = "Close Tab" }) + +-- Clear search with +vim.keymap.set('n', '', 'nohlsearch', { desc = "clear hlsearch" }) +-- vim.keymap.set("n", "", "nohlsearch", { desc = "clear hlsearch" }) + +-- Diagnostic keymaps +vim.keymap.set('n', 'cl', vim.diagnostic.setloclist, { desc = 'Send diagnostic to location list' }) +vim.keymap.set("n", "cq", vim.diagnostic.setqflist, { desc = "Send diagnostic to Quickfix" }) +-- vim.keymap.set("n", "gq", "copen", { desc = "Quickfix List" }) +-- vim.keymap.set("n", "gl", "lopen", { desc = "Location List" }) + +vim.keymap.set('n', 'eb', ".w !bash -e", { desc = "Send line to bash" }) +vim.keymap.set('n', 'eB', "%w !bash -e", { desc = "Send buffer to bash" }) +vim.keymap.set('n', 'e.', ".!bash -e", { desc = "Execute current line" }) +vim.keymap.set('n', 'e%', "% !bash -e", { desc = "Execute current buffer" }) +vim.keymap.set('n', 'ex', "!chmod +x %", { desc = "Make file executable" }) + +vim.keymap.set('n', "eL", "source %", { desc = "Source current buffer" }) +vim.keymap.set('n', "el", ".lua", { desc = "Source current line" }) +vim.keymap.set('v', "el", "lua", { desc = "Source current line" }) +vim.keymap.set('n', 'xu', 'Lazy sync', { desc = 'Lazy sync' }) + + +vim.keymap.set("n", "cx", function() + local file = vim.fn.expand "%" + local line = vim.fn.line "." + vim.fn.setreg("+", string.format("%s:%d", file, line)) + vim.notify "Copied line reference to clipboard" + end, { desc = "Copy line reference to clipboard" }) + +vim.keymap.set("n", "ktn", require('tasks').create_new_task, { desc = "create new task" } ) +vim.keymap.set("n", "kts", require('tasks').start_task, { desc = "start task" } ) +vim.keymap.set("n", "kte", require('tasks').stop_task, { desc = "stop task" } ) diff --git a/config/nvim/lua/config/scripts.lua b/config/nvim-old/lua/config/scripts.lua similarity index 100% rename from config/nvim/lua/config/scripts.lua rename to config/nvim-old/lua/config/scripts.lua diff --git a/config/nvim-old/lua/overseer/template/user/cmake_build.lua b/config/nvim-old/lua/overseer/template/user/cmake_build.lua new file mode 100644 index 0000000..30adc24 --- /dev/null +++ b/config/nvim-old/lua/overseer/template/user/cmake_build.lua @@ -0,0 +1,17 @@ +return { + name = "CMake Build", + builder = function() + return { + cmd = { "cmake" }, + args = { "--build", "build", "--target", "all" }, + components = { + { "on_output_quickfix", set_diagnostics = true }, + "on_result_diagnostics", + "default", + }, + } + end, + condition = { + filetype = { "cpp", "c" }, + }, +} \ No newline at end of file diff --git a/config/nvim-old/lua/overseer/template/user/cmake_create.lua b/config/nvim-old/lua/overseer/template/user/cmake_create.lua new file mode 100644 index 0000000..0b4c8c1 --- /dev/null +++ b/config/nvim-old/lua/overseer/template/user/cmake_create.lua @@ -0,0 +1,17 @@ +return { + name = "CMake Create", + builder = function() + return { + cmd = { "cmake" }, + args = { "-B", "build", "-S", "." }, + components = { + { "on_output_quickfix", set_diagnostics = true }, + "on_result_diagnostics", + "default", + }, + } + end, + condition = { + filetype = { "cpp", "c" }, + }, +} \ No newline at end of file diff --git a/config/nvim-old/lua/overseer/template/user/init.lua b/config/nvim-old/lua/overseer/template/user/init.lua new file mode 100644 index 0000000..67463d8 --- /dev/null +++ b/config/nvim-old/lua/overseer/template/user/init.lua @@ -0,0 +1 @@ +return { "user.cmake_create", "user.cmake_build" } \ No newline at end of file diff --git a/config/nvim-old/lua/overseer/template/vscode/provider/rustc.lua b/config/nvim-old/lua/overseer/template/vscode/provider/rustc.lua new file mode 100644 index 0000000..46cf4c2 --- /dev/null +++ b/config/nvim-old/lua/overseer/template/vscode/provider/rustc.lua @@ -0,0 +1,34 @@ +local M = {} + +M.problem_patterns = { + ["$rustc"] = { + { + regexp = "^(error|warning)(\\[E\\d+\\])*:(.*)$", + message = 3 + }, + { + regexp = "^\\s+-+>\\s*([^:]*):(\\d+):(\\d+)$", + kind = "location", + file = 1, + line = 2, + column = 3 + }, + { + regexp = "^(\\s|\\d)+(\\||=).*$" + }, + { + regexp = "^$" + } + } +} + +M.problem_matchers = { + ["$rustc"] = { + fileLocation = { "relative", "${cwd}" }, + pattern = "$rustc", + + + } +} +return M + \ No newline at end of file diff --git a/config/nvim/lua/plugins/ai.lua b/config/nvim-old/lua/plugins/ai.lua similarity index 99% rename from config/nvim/lua/plugins/ai.lua rename to config/nvim-old/lua/plugins/ai.lua index 9f67658..7457769 100644 --- a/config/nvim/lua/plugins/ai.lua +++ b/config/nvim-old/lua/plugins/ai.lua @@ -12,7 +12,6 @@ return { opts = {}, dependencies = { "nvim-lua/plenary.nvim", - "nvim-treesitter/nvim-treesitter", "franco-ruggeri/codecompanion-spinner.nvim", "ravitemer/codecompanion-history.nvim", "cairijun/codecompanion-agentskills.nvim", diff --git a/config/nvim/lua/plugins/ft.lua b/config/nvim-old/lua/plugins/ft.lua similarity index 100% rename from config/nvim/lua/plugins/ft.lua rename to config/nvim-old/lua/plugins/ft.lua diff --git a/config/nvim/lua/plugins/ide.lua b/config/nvim-old/lua/plugins/ide.lua similarity index 90% rename from config/nvim/lua/plugins/ide.lua rename to config/nvim-old/lua/plugins/ide.lua index aae9579..a813e85 100644 --- a/config/nvim/lua/plugins/ide.lua +++ b/config/nvim-old/lua/plugins/ide.lua @@ -483,22 +483,6 @@ return { }, opts = { notify_on_error = false, - -- format_on_save = function(bufnr) - -- -- Disable "format_on_save lsp_fallback" for languages that don't - -- -- have a well standardized coding style. You can add additional - -- -- languages here or re-enable it for the disabled ones. - -- local disable_filetypes = { c = true, cpp = true } - -- local lsp_format_opt - -- if disable_filetypes[vim.bo[bufnr].filetype] then - -- lsp_format_opt = 'never' - -- else - -- lsp_format_opt = 'fallback' - -- end - -- return { - -- timeout_ms = 500, - -- lsp_format = lsp_format_opt, - -- } - -- end, formatters = { shfmt = { prepend_args = { "-i", "2", "-ci" }, @@ -580,7 +564,8 @@ return { } }, { - "sindrets/diffview.nvim", + "dlyongemallo/diffview.nvim", + --"sindrets/diffview.nvim", }, { "NicolasGB/jj.nvim", @@ -688,6 +673,7 @@ return { { 'WhoIsSethDaniel/mason-tool-installer.nvim', lazy = true }, { 'neovim/nvim-lspconfig', + lazy = false, dependencies = { { 'SmiteshP/nvim-navic', lazy = true }, }, @@ -704,11 +690,7 @@ return { group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), callback = function(event) local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, bufnr) - else - return client.supports_method(method, { bufnr = bufnr }) - end + return client:supports_method(method, bufnr) end local client = vim.lsp.get_client_by_id(event.data.client_id) @@ -804,31 +786,63 @@ return { } }, -- csharp_ls = {}, - zls= {}, - clangd= { + zls = {}, + clangd = { settings = { ["clang"] = { cmd = { "clangd", "--background-index", "--compile-commands-dir=" .. vim.loop.cwd() .. "/build" }, } } }, - rust_analyzer={}, + rust_analyzer= { + settings = { + ['rust-analyzer'] = { + cargo = { + allFeatures = true, + }, + checkOnSave = true, + check = { + command = "clippy", + }, + procMacro = { + enable = true, + }, + lens = { + debug = { enable = true }, + enable = true, + implementations = { enable = true }, + references = { + adt = { enable = true }, + enumVariant = { enable = true }, + method = { enable = true }, + trait = { enable = true }, + }, + run = { enable = true }, + updateTest = { enable = true }, + }, + }, + } + }, ts_ls= {}, html= {}, eslint= {}, jsonls= {}, jdtls= {}, - -- copilot = { - -- cmd = { "copilot-language-server", "--stdio" }, - -- init_options = { - -- name = "Neovim", - -- version = tostring(vim.version()), + copilot = { + -- settings = { + -- ['copilot'] = { + -- cmd = { "copilot-language-server", "--stdio" }, + -- init_options = { + -- name = "Neovim", + -- version = tostring(vim.version()), + -- }, + -- editorPluginInfo = { + -- name = "Neovim", + -- version = tostring(vim.version()), + -- }, + -- }, -- }, - -- editorPluginInfo = { - -- name = "Neovim", - -- version = tostring(vim.version()), - -- }, - -- }, + }, } local ensure_installed = vim.tbl_keys(servers or {}) @@ -854,8 +868,8 @@ return { vim.lsp.config(server, cfg) vim.lsp.enable(server) end - -- vim.lsp.inline_completion.enable(); - vim.lsp.enable("rust-analyzer", false) + vim.lsp.inline_completion.enable(); + -- vim.lsp.enable("rust-analyzer", false) end @@ -940,82 +954,106 @@ return { }, }, }, - { - 'mrcjkb/rustaceanvim', - -- version = '^6', -- Recommended - lazy = true, - ft = {'rust'}, - opts = { - server = { - default_settings = { - cargo = { - allFeatures = false, - loadOutDirsFromCheck = true, - buildScripts = { enable = true }, - }, - }, - on_attach = function(_, bufnr) - vim.keymap.set("n", "lr", function() - vim.cmd.RustLsp("codeAction") - end, { desc = "Code Action", buffer = bufnr }) - vim.keymap.set("n", "ld", function() - vim.cmd.RustLsp("debuggables") - end, { desc = "Rust Debuggables", buffer = bufnr }) - vim.keymap.set("n", "lD", function() - vim.cmd.RustLsp("openDocs") - end, { desc = "Open Documents", buffer = bufnr }) - vim.keymap.set("n", "lc", function() - vim.cmd.RustLsp("openCargo") - end, { desc = "Open Documents", buffer = bufnr }) - end, - }, - }, - config = function(_, opts) - vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {}) - end, - }, + -- { + -- 'mrcjkb/rustaceanvim', + -- -- version = '^6', -- Recommended + -- lazy = true, + -- ft = {'rust'}, + -- opts = { + -- server = { + -- default_settings = { + -- cargo = { + -- allFeatures = false, + -- loadOutDirsFromCheck = true, + -- buildScripts = { enable = true }, + -- }, + -- }, + -- on_attach = function(_, bufnr) + -- vim.keymap.set("n", "lr", function() + -- vim.cmd.RustLsp("codeAction") + -- end, { desc = "Code Action", buffer = bufnr }) + -- vim.keymap.set("n", "ld", function() + -- vim.cmd.RustLsp("debuggables") + -- end, { desc = "Rust Debuggables", buffer = bufnr }) + -- vim.keymap.set("n", "lD", function() + -- vim.cmd.RustLsp("openDocs") + -- end, { desc = "Open Documents", buffer = bufnr }) + -- vim.keymap.set("n", "lc", function() + -- vim.cmd.RustLsp("openCargo") + -- end, { desc = "Open Documents", buffer = bufnr }) + -- end, + -- }, + -- }, + -- config = function(_, opts) + -- vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {}) + -- end, + -- }, { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', + branch = 'main', dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', -- 'p00f/nvim-ts-rainbow', }, config = function() - require('nvim-treesitter.configs').setup({ - -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { - 'c', - "lua", - "markdown", - "markdown_inline", - "vim", - "vimdoc", - "query", - "html", - "go", - "bash", - "zig", - "typescript", - "javascript", - "dockerfile", - "xml", - "regex", - "rust" - }, - ignore_install = { 'org' }, - auto_install = true, - -- disable = function(lang, buf) - -- local max_filesize = 100 * 1024 - -- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buff_get_name(buf)) - -- if ok and stats and stats.size > max_filesize then - -- return true - -- end - -- end, - highlight = { enable = true, }, - indent = { enable = true }, + local ts_parsers = { + "bash", + "dockerfile", + "git_config", "git_rebase", "gitattributes", "gitcommit", "gitignore", + "go", "gomod", "gosum", + "json", "toml", "yaml", + "lua", + "make", + "markdown", + "python", + "terraform", + "vim", "vimdoc", + 'c', + "lua", + "markdown", + "markdown_inline", + "query", + "html", "xml", + "zig", + "typescript", "javascript", "svelte", + "regex", + "rust", + "http", + } + + local nts = require("nvim-treesitter") + nts.install(ts_parsers) + -- vim.api.nvim_create_autocmd('PackChanged', { + -- callback = function() + -- nts.update() + -- end + -- }) + + vim.api.nvim_create_autocmd("FileType", { -- enable treesitter highlighting and indents + callback = function(args) + local filetype = args.match + local lang = vim.treesitter.language.get_lang(filetype) + if vim.treesitter.language.add(lang) then + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + vim.treesitter.start() + end + end }) + + -- vim.api.nvim_create_autocmd('FileType', { + -- pattern = ts_parsers, + -- callback = function() + -- vim.treesitter.start() + -- end, + -- }) + end, + }, + { + 'nvim-treesitter/nvim-treesitter-textobjects', + branch = "main", + init = function() + vim.g.no_plugin_maps = true end, }, { @@ -1028,7 +1066,16 @@ return { { 'nvim-treesitter/nvim-treesitter-context', enabled = true, - opts = { mode = "cursor", max_lines = 3 }, + config = function () + require("treesitter-context").setup({ + mode = "cursor", + max_lines = 3, + multiline_threshold = 1, + separator = '-', + min_window_height = 20, + line_numbers = true, + }) + end, }, { "mbbill/undotree", diff --git a/config/nvim/lua/plugins/init.lua b/config/nvim-old/lua/plugins/init.lua similarity index 100% rename from config/nvim/lua/plugins/init.lua rename to config/nvim-old/lua/plugins/init.lua diff --git a/config/nvim/lua/plugins/tools.lua b/config/nvim-old/lua/plugins/tools.lua similarity index 89% rename from config/nvim/lua/plugins/tools.lua rename to config/nvim-old/lua/plugins/tools.lua index a008635..cc91aa4 100644 --- a/config/nvim/lua/plugins/tools.lua +++ b/config/nvim-old/lua/plugins/tools.lua @@ -80,13 +80,8 @@ return { { "thunder-coding/zincoxide", opts = { - -- name of zoxide binary in your "$PATH" or path to the binary - -- the command is executed using vim.fn.system() - -- eg. "zoxide" or "/usr/bin/zoxide" zincoxide_cmd = "zoxide", - -- Kinda experimental as of now complete = true, - -- Available options { "tabs", "window", "global" } behaviour = "tabs", }, cmd = { "Z", "Zg", "Zt", "Zw" }, diff --git a/config/nvim/lua/plugins/ui.lua b/config/nvim-old/lua/plugins/ui.lua similarity index 99% rename from config/nvim/lua/plugins/ui.lua rename to config/nvim-old/lua/plugins/ui.lua index 73eb1de..c78f3da 100644 --- a/config/nvim/lua/plugins/ui.lua +++ b/config/nvim-old/lua/plugins/ui.lua @@ -178,8 +178,6 @@ return { { 'stevearc/quicker.nvim', ft = "qf", - ---@module "quicker" - ---@type quicker.SetupOptions opts = {}, }, { diff --git a/config/nvim-old/lua/snippets/zig.lua b/config/nvim-old/lua/snippets/zig.lua new file mode 100644 index 0000000..dcc9d2f --- /dev/null +++ b/config/nvim-old/lua/snippets/zig.lua @@ -0,0 +1,16 @@ +local ls = require("luasnip") + local s = ls.snippet + local t = ls.text_node + local i = ls.insert_node + -- local f = ls.function_node + return { + s({ trig = "fn", name = "Function", dscr = "Function" }, { + t("fn "), + i(1), + t("() "), + t("{\n"), + t("\t"), + i(0), + t("\n}\n"), + }) + } \ No newline at end of file diff --git a/config/nvim-old/lua/tasks.lua b/config/nvim-old/lua/tasks.lua new file mode 100644 index 0000000..1b370c3 --- /dev/null +++ b/config/nvim-old/lua/tasks.lua @@ -0,0 +1,92 @@ +local M = {} + +local function get_current_time() + return os.date("%H:%M") +end + +local function get_active_task_line() + local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) + local active_lines = {} + for i, line in ipairs(lines) do + if line:match("#status/in%-progress") then + table.insert(active_lines, {line = line, lnum = i}) + end + end + + if #active_lines == 0 then + print("No active task found (#status/in-progress).") + return nil, "no_active" + elseif #active_lines > 1 then + print("Multiple active tasks found. Please ensure only one task is #status/in-progress.") + return nil, "multiple_active" + else + return active_lines[1].line, active_lines[1].lnum + end +end + +function M.create_new_task() + local desc = vim.fn.input("Task Description: ") + if desc == '' then return end + + local project = vim.fn.input("Project (leave empty if none, e.g., '[[Project Name]]'): ") + local priority_options = {"high", "medium", "low"} + local priority_idx = vim.fn.inputlist("Priority:", priority_options) + local priority = priority_options[tonumber(priority_idx)] or "medium" + + local category_options = {"work", "meeting", "learning", "journal", "focused-work", "break"} + local category_idx = vim.fn.inputlist("Category:", category_options) + local category = category_options[tonumber(category_idx)] or "work" + + local new_task_line = string.format("- [ ] %s %s #status/todo #priority/%s #%s", + desc, project, priority, category) + + vim.api.nvim_put({new_task_line}, "l", true, true) + print("New task created: " .. new_task_line) +end + +function M.start_task() + local current_line, lnum = get_active_task_line() + if not current_line then return end + + local new_line = current_line + local current_time = get_current_time() + + if new_line:match("start:: %d%d:%d%d") then + print("Task already has a start time. Updating to current time.") + new_line = new_line:gsub("start:: %d%d:%d%d", "start:: " .. current_time) + else + new_line = new_line .. " start:: " .. current_time + end + + -- Clear end time if present when starting a task again + new_line = new_line:gsub(" end:: %d%d:%d%d", "") + + vim.api.nvim_buf_set_lines(0, lnum - 1, lnum, false, {new_line}) + print("Task started/resumed: " .. current_time) +end + +function M.stop_task() + local current_line, lnum = get_active_task_line() + if not current_line then return end + + local new_line = current_line + local current_time = get_current_time() + + if new_line:match("end:: %d%d:%d%d") then + print("Task already has an end time. Updating to current time.") + new_line = new_line:gsub("end:: %d%d:%d%d", "end:: " .. current_time) + else + new_line = new_line .. " end:: " .. current_time + end + + -- Option to change status to done + local change_status = vim.fn.confirm("Change status to #status/done?", "&Yes\n&No", 2) + if change_status == 1 then -- Yes + new_line = new_line:gsub("#status/in%-progress", "#status/done") + end + + vim.api.nvim_buf_set_lines(0, lnum - 1, lnum, false, {new_line}) + print("Task stopped: " .. current_time) +end + +return M diff --git a/config/nvim/after/plugin/autocmds.lua b/config/nvim/after/plugin/autocmds.lua new file mode 100644 index 0000000..1586a45 --- /dev/null +++ b/config/nvim/after/plugin/autocmds.lua @@ -0,0 +1,143 @@ +-- When Nvim is idle or you switch focus/buffers, check if files changed +vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHoldI" }, { + pattern = "*", + command = "checktime", +}) + +-- Check if we need to reload the file when it changed +vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { + desc = 'Check time', + group = vim.api.nvim_create_augroup("sjb-checktime", { clear = true}), + callback = function() + if vim.o.buftype ~= 'nofile' then + vim.cmd('checktime') + end + end, +}) + +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('sjb-highlight-yank', { clear = true }), + callback = function() + vim.hl.on_yank() + end, +}) + +-- windows to close +vim.api.nvim_create_autocmd("FileType", { + pattern = { + "OverseerForm", + "OverseerList", + "floggraph", + "fugitive", + "git", + "help", + "lspinfo", + "man", + "neotest-output", + "neotest-summary", + "qf", + "query", + "spectre_panel", + "startuptime", + "toggleterm", + "tsplayground", + "vim", + }, + group = vim.api.nvim_create_augroup('sjb-quick-close', { clear = true }), + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, +}) + +-- wrap and check for spell in text filetypes +vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("sjb-wrap-spell", { clear = true }), + pattern = { "gitcommit", "markdown" }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end, +}) + +-- Auto create dir when saving a file, in case some intermediate directory does not exist +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + group = vim.api.nvim_create_augroup("sjb-auto-create-dir", { clear = true}), + callback = function(event) + if event.match:match("^%w%w+://") then + return + end + local file = vim.loop.fs_realpath(event.match) or event.match + vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") + end, +}) + +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = "*", + callback = function() + if vim.fn.isdirectory(".jj") == 1 then + vim.fn.jobstart({"jj", "status"}, { + on_exit = function(_, exit_code) + if exit_code ~= 0 then + vim.notify("jj command failed", vim.log.levels.WARN) + end + end, + }) + end + end, +}) + +local gpgGroup = vim.api.nvim_create_augroup("customGpg", { clear = true }) + +vim.api.nvim_create_autocmd({ "BufReadPre", "FileReadPre" }, { + pattern = "*.gpg", + group = gpgGroup, + callback = function() + -- Make sure nothing is written to shada file while editing an encrypted file. + vim.opt_local.shada = nil + -- We don't want a swap file, as it writes unencrypted data to disk + vim.opt_local.swapfile = false + -- Switch to binary mode to read the encrypted file + vim.opt_local.bin = true + -- Save the current 'ch' value to a buffer-local variable + vim.b.ch_save = vim.opt_local.ch:get() + vim.cmd "set ch=2" + end, +}) + +vim.api.nvim_create_autocmd({ "BufReadPost", "FileReadPost" }, { + pattern = "*.gpg", + group = gpgGroup, + callback = function() + vim.cmd "'[,']!gpg --decrypt 2> /dev/null" + -- Switch to normal mode for editing + vim.opt_local.bin = false + -- Restore the 'ch' value from the buffer-local variable + vim.opt_local.ch = vim.b.ch_save + vim.cmd "unlet b:ch_save" + vim.cmd(":doautocmd BufReadPost " .. vim.fn.expand "%:r") + end, +}) + +-- Convert all text to encrypted text before writing +vim.api.nvim_create_autocmd({ "BufWritePre", "FileWritePre" }, { + pattern = "*.gpg", + group = gpgGroup, + callback = function() + -- Switch to binary mode to write the encrypted file + vim.opt_local.bin = true + -- So we can avoid the armor option + vim.cmd("'[,']!gpg --default-recipient-self -e 2>/dev/null") + end, +}) +-- Undo the encryption so we are back in the normal text, directly after the file has been written. +vim.api.nvim_create_autocmd({ "BufWritePost", "FileWritePost" }, { + pattern = "*.gpg", + group = gpgGroup, + callback = function() + vim.cmd("u") + -- Switch to normal mode for editing + vim.opt_local.bin = false + end, +}) diff --git a/config/nvim/lua/config/keymaps.lua b/config/nvim/after/plugin/keymaps.lua similarity index 98% rename from config/nvim/lua/config/keymaps.lua rename to config/nvim/after/plugin/keymaps.lua index a0c19c9..535a252 100644 --- a/config/nvim/lua/config/keymaps.lua +++ b/config/nvim/after/plugin/keymaps.lua @@ -71,4 +71,5 @@ vim.keymap.set("n", "cx", function() local line = vim.fn.line "." vim.fn.setreg("+", string.format("%s:%d", file, line)) vim.notify "Copied line reference to clipboard" - end, { desc = "Copy line reference to clipboard" }) \ No newline at end of file + end, { desc = "Copy line reference to clipboard" }) + diff --git a/config/nvim/after/plugin/websearch.lua b/config/nvim/after/plugin/websearch.lua new file mode 100644 index 0000000..9ee3617 --- /dev/null +++ b/config/nvim/after/plugin/websearch.lua @@ -0,0 +1,35 @@ + +function R(name) + require("plenary.reload").reload_module(name) +end + +function websearch(url, o) + -- Get visual selection or prompt for search + local search_term + + -- Check if there's a visual selection + if vim.fn.mode() == 'v' or vim.fn.mode() == 'V' then + -- Get the visual selection + local start_pos = vim.fn.getpos("'<") + local end_pos = vim.fn.getpos("'>") + local lines = vim.fn.getline(start_pos[2], end_pos[2]) + local selected_text = table.concat(lines, " ") + search_term = selected_text + else + search_term = (o and o.args) or vim.fn.input("Search: ") + end + + -- Encode the search term for URLs + local escaped = vim.uri_encode(search_term) + + -- Construct and execute the search URL + local search_url = (url):format(escaped) + + vim.ui.open(search_url) +end +-- Command to call the search function +vim.api.nvim_create_user_command('DuckDuckGo', function(o) websearch('https://duckduckgo.com/?q=%s', o) end, { nargs = 1 }) +vim.api.nvim_create_user_command('Docsrs', function(o) websearch('https://docs.rs/%s', o) end, { nargs = 1}) +vim.api.nvim_create_user_command('RustStd', function(o) websearch('https://doc.rust-lang.org/std/?search=%s', o) end, { nargs = 1}) + +vim.keymap.set({ 'n', 'v'}, 'sW', function() websearch('https://duckduckgo.com/?q=%s', null) end, { desc = "Search on DuckDuckGo" }) diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 211669c..50d98b7 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,19 +1,11 @@ --- Steve Beaulac nvim configuration using kickstart git: 2ba39c6 -- vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' vim.g.have_nerd_fonts = true - --- set as my leader key vim.g.autoformat = true - --- vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } - vim.g.editorconfig = true - vim.wo.number = true -vim.opt.background = "dark" +vim.opt.background = 'dark' vim.opt.backup = false vim.opt.clipboard:append("unnamedplus") vim.opt.modifiable = true @@ -114,50 +106,103 @@ vim.diagnostic.config({ virtual_text = { current_line = true } }) --- Lazy plugin manager -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', lazyrepo, '--branch=stable', lazypath } - if vim.v.shell_error ~= 0 then - error('Error cloning lazy.nvim:\n' .. out) - end -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup({ - spec = { - { import = "plugins" } - }, - rocks = { - enabled = false, - hererocks = false, - }, - checker = { - enabled = true, - notify = false, - }, - change_detection = { - notify = false, - }, +vim.filetype.add({ + extension = { + ['http'] = 'http', + }, }) -vim.g.lazyvim_check_order = false - - -require("config.keymaps") -require("config.scripts") - --- When Nvim is idle or you switch focus/buffers, check if files changed -vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHoldI" }, { - pattern = "*", - command = "checktime", +vim.pack.add({ + { src = "https://github.com/folke/snacks.nvim" }, + { src = "https://github.com/olimorris/codecompanion.nvim" }, + { src = 'https://github.com/L3MON4D3/LuaSnip' }, + { src = 'https://github.com/rafamadriz/friendly-snippets' }, + { src = 'https://github.com/MeanderingProgrammer/render-markdown.nvim' }, + { src = 'https://github.com/Saghen/blink.cmp', version = vim.version.range('1.*') }, + { src = 'https://github.com/cairijun/codecompanion-agentskills.nvim' }, + { src = 'https://github.com/fang2hou/blink-copilot' }, + { src = 'https://github.com/folke/todo-comments.nvim' }, + { src = 'https://github.com/franco-ruggeri/codecompanion-spinner.nvim' }, + { src = 'https://github.com/moyiz/blink-emoji.nvim' }, + { src = 'https://github.com/nvim-lua/plenary.nvim' }, + { src = 'https://github.com/ravitemer/codecompanion-history.nvim' }, + { src = 'https://github.com/ttgrules/cc-adapter-copilot-cli-acp' }, + { src = 'https://github.com/nvim-tree/nvim-web-devicons' }, + { src = 'https://github.com/SjB/orgmode', version = 'sjb-wip' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter', version = 'main' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter-textobjects', version = 'main' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter-context' }, + { src = 'https://github.com/nvim-mini/mini.extra' }, + { src = 'https://github.com/nvim-mini/mini.ai' }, + { src = 'https://github.com/nvim-mini/mini.move' }, + { src = 'https://github.com/nvim-mini/mini.align' }, + { src = 'https://github.com/nvim-mini/mini.bracketed' }, + { src = 'https://github.com/nvim-mini/mini.operators' }, + { src = 'https://github.com/nvim-mini/mini.surround' }, + { src = 'https://github.com/nvim-mini/mini.splitjoin' }, + { src = 'https://github.com/nvim-mini/mini.hipatterns' }, + { src = 'https://github.com/nvim-mini/mini.files' }, + { src = 'https://github.com/nvim-mini/mini.sessions' }, + { src = 'https://github.com/mfussenegger/nvim-ansible' }, + { src = 'https://github.com/obsidian-nvim/obsidian.nvim' }, + { src = 'https://github.com/salkin-mada/openscad.nvim' }, + { src = 'https://github.com/akinsho/org-bullets.nvim' }, + { src = 'https://github.com/chipsenkbeil/org-roam.nvim' }, + { src = 'https://github.com/iamcco/markdown-preview.nvim' }, + { src = 'https://github.com/lervag/vimtex' }, + { src = 'https://github.com/MeanderingProgrammer/render-markdown.nvim' }, + { src = 'https://github.com/hat0uma/csvview.nvim' }, + { src = 'https://github.com/j-hui/fidget.nvim' }, + { src = 'https://github.com/utilyre/barbecue.nvim' }, + { src = 'https://github.com/SmiteshP/nvim-navic' }, + { src = 'https://github.com/folke/flash.nvim' }, + { src = 'https://github.com/nvim-lualine/lualine.nvim' }, + { src = 'https://github.com/hedyhli/outline.nvim' }, + { src = 'https://github.com/stevearc/quicker.nvim' }, + { src = 'https://github.com/christoomey/vim-tmux-navigator' }, + { src = 'https://github.com/akinsho/toggleterm.nvim' }, + { src = 'https://github.com/ten3roberts/window-picker.nvim' }, + { src = 'https://github.com/folke/which-key.nvim' }, + { src = 'https://github.com/al1-ce/just.nvim' }, + { src = 'https://github.com/mistweaverco/kulala.nvim' }, + { src = 'https://github.com/HakonHarnes/img-clip.nvim' }, + { src = 'https://github.com/uhs-robert/sshfs.nvim' }, + { src = 'https://github.com/esmuellert/codediff.nvim' }, + { src = 'https://plugins.ejri.dev/mise.nvim' }, + { src = 'https://github.com/NeogitOrg/neogit' }, + { src = 'https://github.com/thunder-coding/zincoxide' }, + { src = 'https://github.com/sindrets/diffview.nvim' }, + { src = 'https://github.com/MunifTanjim/nui.nvim' }, + { src = 'https://github.com/stevearc/conform.nvim' }, + { src = 'https://github.com/lewis6991/gitsigns.nvim' }, + { src = 'https://github.com/NicolasGB/jj.nvim' }, + { src = 'https://github.com/julienvincent/hunk.nvim' }, + { src = 'https://github.com/rafikdraoui/jj-diffconflicts' }, + { src = 'https://github.com/Glhou/jjsigns.nvim', version = 'fix/skip-extra-lines' }, + { src = 'https://github.com/williamboman/mason.nvim' }, + { src = 'https://github.com/williamboman/mason-lspconfig.nvim' }, + { src = 'https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim' }, + { src = 'https://github.com/neovim/nvim-lspconfig' }, + { src = 'https://github.com/rcarriga/nvim-dap-ui' }, + { src = 'https://github.com/mfussenegger/nvim-dap' }, + { src = 'https://github.com/nvim-neotest/nvim-nio' }, + { src = 'https://github.com/jay-babu/mason-nvim-dap.nvim' }, + { src = 'https://github.com/Saecki/crates.nvim' }, + { src = 'https://github.com/JoosepAlviste/nvim-ts-context-commentstring' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter-context' }, + { src = 'https://github.com/mbbill/undotree' }, + { src = 'https://github.com/Civitasv/cmake-tools.nvim' }, + { src = 'https://github.com/folke/persistence.nvim' }, + { src = 'https://github.com/otavioschwanck/arrow.nvim' }, + { src = 'https://github.com/nvim-pack/nvim-spectre' }, + { src = 'https://github.com/stevearc/overseer.nvim' }, + { src = 'https://github.com/Davidyz/VectorCode' }, + { src = 'https://github.com/franco-ruggeri/codecompanion-spinner.nvim' }, + { src = 'https://github.com/ravitemer/codecompanion-history.nvim' }, + { src = 'https://github.com/cairijun/codecompanion-agentskills.nvim' }, + { src = 'https://github.com/ttgrules/cc-adapter-copilot-cli-acp' }, + { src = 'https://github.com/carlos-algms/agentic.nvim' }, + { src = 'https://github.com/zbirenbaum/copilot.lua' }, + { src = 'https://github.com/copilotlsp-nvim/copilot-lsp' }, + { src = 'https://github.com/PhantomYdn/fabric-ai.nvim' }, }) - -vim.api.nvim_create_autocmd("User", { - pattern = "VeryLazy", - callback = function() - require("config.autocmds") - end, -}) - diff --git a/config/nvim/plugin/agentic.lua b/config/nvim/plugin/agentic.lua new file mode 100644 index 0000000..7e0f4b1 --- /dev/null +++ b/config/nvim/plugin/agentic.lua @@ -0,0 +1,55 @@ +require('agentic').setup({ + -- Available by default: "claude-agent-acp" | "gemini-acp" | "codex-acp" | "opencode-acp" | "cursor-acp" | "auggie-acp" | "mistral-vibe-acp" + provider = "opencode-acp", -- setting the name here is all you need to get started + keymaps = { + -- Keybindings for ALL buffers in the widget (chat, prompt, code, files) + widget = { + close = "q", -- String for a single keybinding + change_mode = { + { + "", + mode = { "i", "n", "v" }, -- Specify modes for this keybinding + }, + }, + switch_provider = "ras", -- Switch ACP provider + switch_model = "ram", -- Switch model + }, + + -- Keybindings for the prompt buffer only + prompt = { + submit = { + "", -- Normal mode, just Enter + { + "", + mode = { "n", "v", "i" }, + }, + }, + + paste_image = { + { + "p", + mode = { "n" }, + }, + { + "", -- Same as Claude-code in insert mode + mode = { "i" }, + } + }, + }, + + -- Keybindings for diff preview navigation + diff_preview = { + next_hunk = "]c", + prev_hunk = "[c", + }, + }, +}) + + +vim.keymap.set({ "n", "v", "i" }, 'rat', function() require("agentic").toggle() end, { desc = "Toggle Agentic Chat" }) +vim.keymap.set({ "n", "v" }, '', function() require("agentic").add_selection_or_file_to_context() end, { desc = "Add file or selection to Agentic to Context" }) +vim.keymap.set({ "n", "v", "i" }, 'ran', function() require("agentic").new_session() end, { desc = "New Agentic Session" }) + +vim.keymap.set({ "n", "v", "i" }, 'r', function() require("agentic").restore_session() end, { desc = "Agentic Restore session" }) +vim.keymap.set({ "n" }, 'rad', function() require("agentic").add_current_line_diagnostics() end, { desc = "Add current line diagnostic to Agentic" }) +vim.keymap.set({ "n" }, 'raD', function() require("agentic").add_buffer_diagnostics() end, { desc = "Add all buffer diagnostics to Agentic" }) diff --git a/config/nvim/plugin/arrow.lua b/config/nvim/plugin/arrow.lua new file mode 100644 index 0000000..c31d880 --- /dev/null +++ b/config/nvim/plugin/arrow.lua @@ -0,0 +1,5 @@ +require('arrow').setup({ + show_icons = true, + leader_key = ';', -- Recommended to be a single key + buffer_leader_key = ';', -- Per Buffer Mappings +}) diff --git a/config/nvim/plugin/barbecue.lua b/config/nvim/plugin/barbecue.lua new file mode 100644 index 0000000..073b4af --- /dev/null +++ b/config/nvim/plugin/barbecue.lua @@ -0,0 +1 @@ +require('barbecue').setup() diff --git a/config/nvim/plugin/blink.lua b/config/nvim/plugin/blink.lua new file mode 100644 index 0000000..9583e5b --- /dev/null +++ b/config/nvim/plugin/blink.lua @@ -0,0 +1,150 @@ +require('blink.cmp').setup({ + enabled = function() + local filetype = vim.bo[0].filetype + if filetype == "TelescopePrompt" or filetype == "minifiles" or filetype == "snacks_picker_input" then + return false + end + return true + end, + snippets = { preset = 'luasnip' }, + completion = { + -- keyword = { + -- -- 'prefix' will fuzzy match on the text before the cursor + -- -- 'full' will fuzzy match on the text before *and* after the cursor + -- -- example: 'foo_|_bar' will match 'foo_' for 'prefix' and 'foo__bar' for 'full' + -- range = "full", + -- }, + menu = { + draw = { + treesitter = { 'lsp' } + } + -- border = "single", + }, + list = { + selection = { + preselect = false, + auto_insert = false, + } + }, + documentation = { + auto_show = true, + auto_show_delay_ms = 500, + -- window = { + -- border = "single", + -- }, + }, + ghost_text = { enabled = false }, + }, + cmdline = { + enabled = true, + }, + signature = { enabled = true }, + sources = { + per_filetype = { + org = {'orgmode'} + }, + default = { 'orgmode', 'lsp', 'copilot', 'snippets', 'path', 'omni', 'buffer', 'codecompanion', 'markdown' }, + providers = { + codecompanion = { + name = "CodeCompanion" , + module = "codecompanion.providers.completion.blink", + enabled = true, + }, + orgmode = { + name = 'Orgmode', + module = 'orgmode.org.autocompletion.blink', + fallbacks = { 'buffer' }, + }, + copilot = { + name = 'copilot', + module = 'blink-copilot', + score_offset = 100, + async = true, + }, + markdown = { + name = 'RenderMarkdown', + module = 'render-markdown.integ.blink', + score_offset = 80, + }, + lsp = { + name = 'lsp', -- IMPORTANT: use the same name as you would for nvim-cmp + enabled = true, + module = 'blink.cmp.sources.lsp', + -- fallbacks = { 'snippets', 'buffer', 'path' }, + score_offset = 100, + }, + path = { + name = 'path', -- IMPORTANT: use the same name as you would for nvim-cmp + module = 'blink.cmp.sources.path', + score_offset = 50, + fallbacks = { 'snippets', 'buffer' }, + opts = { + trailing_slash = false, + label_trailing_slash = true, + get_cwd = function(context) + return vim.fn.expand(("#%d:p:h"):format(context.bufnr)) + end, + show_hidden_files_by_default = true, + }, + }, + buffer = { + name = "Buffer", + enabled = true, + max_items = 3, + module = "blink.cmp.sources.buffer", + min_keyword_length = 4, + score_offset = 15, -- the higher the number, the higher the priority + }, + snippets = { + name = "snippets", + enabled = true, + max_items = 15, + min_keyword_length = 2, + module = "blink.cmp.sources.snippets", + score_offset = 90, -- the higher the number, the higher the priority + }, + emoji = { + module = "blink-emoji", + name = "Emoji", + score_offset = 0, -- the higher the number, the higher the priority + opts = { insert = true }, -- Insert emoji (default) or complete its name + }, + }, + }, + appearance = { + -- Blink does not expose its default kind icons so you must copy them all (or set your custom ones) and add Copilot + kind_icons = { + Copilot = "", + Text = '󰉿', + Method = '󰊕', + Function = '󰊕', + Constructor = '󰒓', + + Field = '󰜢', + Variable = '󰆦', + Property = '󰖷', + + Class = '󱡠', + Interface = '󱡠', + Struct = '󱡠', + Module = '󰅩', + + Unit = '󰪚', + Value = '󰦨', + Enum = '󰦨', + EnumMember = '󰦨', + + Keyword = '󰻾', + Constant = '󰏿', + + Snippet = '󱄽', + Color = '󰏘', + File = '󰈔', + Reference = '󰬲', + Folder = '󰉋', + Event = '󱐋', + Operator = '󰪚', + TypeParameter = '󰬛', + }, + }, + }) diff --git a/config/nvim/plugin/codecompanion.lua b/config/nvim/plugin/codecompanion.lua new file mode 100644 index 0000000..d9a1936 --- /dev/null +++ b/config/nvim/plugin/codecompanion.lua @@ -0,0 +1,706 @@ + +vim.keymap.set({'n', 'v'}, 'rct', 'CodeCompanionChat Toggle', { noremap = true, silent = true, desc = "CC Toggle" }) +vim.keymap.set({ 'n', 'v' }, 'rca', 'CodeCompanionActions', { noremap = true, silent = true, desc = "CC Action" }) +vim.keymap.set({ 'n' }, 'rce', 'CodeCompanion Explain', { desc = "CC Explain" }) +vim.keymap.set({ 'n' }, 'rcf', 'CodeCompanion Fix code', { desc = "CC fix" }) +vim.keymap.set({ 'v' }, 'rcc', 'CodeCompanionChat Add', { noremap = true, silent = true, desc = "CC Add" }) +vim.keymap.set({ 'v' }, 'rcr', 'CodeCompanion Code Review', { desc = 'Code Review' }) +vim.keymap.set({ 'v' }, 'rco', 'CodeCompanion Optimize Performance', { desc = 'Optimize Code' }) +vim.keymap.set({ 'v' }, 'rce', 'CodeCompanion Explain Code', { desc = 'Explain Code' }) +vim.keymap.set({ 'v' }, 'rcg', 'CodeCompanion Generate Tests', { desc = 'Generate Tests' }) +vim.keymap.set({ 'v' }, 'rcd', 'CodeCompanion Debug Analysis', { desc = 'Debug Analysis' }) + +-- TODO: run this command +-- build = "uv tool upgrade vectorcode", -- This helps keeping the CLI up-to-date +vim.api.nvim_create_autocmd('PackChanged', { + callback = function() + vim.system({ "uv", "tool", "upgrade", "vectorcode" }, {}):wait() + end +}) + +local function get_abacus_key() + local handle = io.popen("pass show abacus.ai-api") + if not handle then return "" end + local result = handle:read("*a") + handle:close() + -- Remove trailing newline that 'pass' often adds + return result:gsub("%s+", "") +end + +local codecompanion = require("codecompanion") +codecompanion.setup({ + adapters = { + http = { + opts = { + show_presets = true, + show_model_choices = true, + }, + -- openai = function() + -- return require("codecompanion.adapters").extend("openai", { + -- env = { api_key = "cmd:pass show api.openai.com" } + -- }) + -- end, + openrouter = function() + return require("codecompanion.adapters").extend("openai_compatible", { + env = { + url = "https://openrouter.ai/api", + api_key = "OPENROUTER_API_KEY", + chat_url = "/v1/chat/completions", + }, + schema = { + model = { + default = "anthropic/claude-3.7-sonnet", + }, + }, + }) + end, + abacus = function() + return require("codecompanion.adapters").extend("openai_compatible", { + name = "abacus", + formatted_name = "Abacus.AI", + env = { + url = "https://routellm.abacus.ai/v1", + -- IMPORTANT: include /v1 in the base url + api_key = get_abacus_key(), + chat_url = "/chat/completions" + }, + headers = { + ["Content-Type"] = "application/json", + ["Authorization"] = "Bearer ${api_key}", + }, + schema = { + model = { + order = 1, + mapping = "parameters", + type = "enum", + desc = "The model to use for chat completions.", + default = "route-llm", + choices = { + -- Routing Model + ["route-llm"] = { opts = { desc = "Intelligent routing to best model" } }, + + -- OpenAI Models + ["gpt-5.2"] = { opts = { has_vision = true } }, + ["gpt-5.1"] = { opts = { has_vision = true } }, + ["gpt-5.1-chat-latest"] = { opts = { has_vision = true } }, + ["gpt-5"] = { opts = { has_vision = true } }, + ["gpt-5-mini"] = { opts = { has_vision = true } }, + ["gpt-5-nano"] = { opts = { has_vision = true } }, + ["gpt-4o"] = { opts = { has_vision = true } }, + ["gpt-4o-mini"] = { opts = { has_vision = true } }, + ["o4-mini"] = { opts = { can_reason = true } }, + ["o3"] = { opts = { can_reason = true } }, + ["o3-pro"] = { opts = { can_reason = true } }, + + -- Anthropic Models + ["claude-4-5-sonnet"] = { opts = { has_vision = true } }, + ["claude-4-5-haiku"] = { opts = { has_vision = true } }, + ["claude-4-5-opus"] = { opts = { has_vision = true } }, + ["claude-3-opus"] = { opts = { has_vision = true } }, + + -- Google Models + ["gemini-3-pro"] = { opts = { has_vision = true } }, + ["gemini-3-flash"] = { opts = { has_vision = true } }, + ["gemini-2.5-pro"] = { opts = { has_vision = true } }, + ["gemini-2.5-flash"] = { opts = { has_vision = true } }, + + -- xAI Models + ["grok-4-1-fast"] = {}, + ["grok-4"] = {}, + ["grok-code-fast-1"] = {}, + + -- Meta Models + ["llama-4-Maverick-17B"] = {}, + ["llama-3.1-405B"] = {}, + ["llama-3.1-70B"] = {}, + + -- DeepSeek Models + ["deepseek-v3.2"] = {}, + ["deepseek-v3.1-Terminus"] = {}, + ["deepseek-R1"] = { opts = { can_reason = true } }, + + -- Qwen Models + ["qwen-3-Max"] = {}, + ["qwen3-coder-480b-a35b-instruct"] = {}, + ["qwen-3-32B"] = {}, + ["qwq-32B"] = { opts = { can_reason = true } }, + }, + }, + temperature = { + order = 2, + mapping = "parameters", + type = "number", + optional = true, + default = 1.0, + desc = "Controls randomness of output (0-2).", + validate = function(n) + return n >= 0 and n <= 2, "Must be between 0 and 2" + end, + }, + max_tokens = { + order = 3, + mapping = "parameters", + type = "integer", + optional = true, + default = nil, + desc = "Maximum tokens to generate.", + validate = function(n) + return n > 0, "Must be greater than 0" + end, + }, + top_p = { + order = 4, + mapping = "parameters", + type = "number", + optional = true, + default = 1.0, + desc = "Nucleus sampling parameter (0-1).", + validate = function(n) + return n >= 0 and n <= 1, "Must be between 0 and 1" + end, + }, + }, + }) + end, + ollama = function() + return require("codecompanion.adapters").extend("ollama", { + env = { + url = "http://129.100.33.66:11434", + }, + schema = { + model = { + default = "qwen3.5", -- change to whatever you pulled + }, + }, + }) + end, + copilot = function() + return require("codecompanion.adapters").extend("copilot", { + schema = { + model = { + default = "gpt-5-mini", -- Consistent model choice + }, + max_tokens = { + default = 16284, + } + } + }) + end, + }, + acp = { + opts = { + show_presets = true, + }, + copilot_cli = function() + return require("codecompanion.adapters").extend("copilot_cli", {}) + end, + codex = function() + return require("codecompanion.adapters").extend("codex", { + commands = { + default = { "codex-acp" }, + }, + schema = { + model = { + default = "github-copilot/gpt-5.2-codex", + }, + }, + defaults = { + timeout = 20000, + auth_method = "chatgpt", -- "openai-api-key"|"codex-api-key"|"chatgpt" + }, + }) + end, + opencode = function() + return require("codecompanion.adapters").extend("codex", { + commands = { + default = { "opencode", "acp" }, + }, + schema = { + model = { + default = "github-copilot/gpt-5.2-codex", + }, + }, + defaults = { + timeout = 20000, + auth_method = "chatgpt", -- "openai-api-key"|"codex-api-key"|"chatgpt" + }, + }) + end, + }, + }, + rules = { + opts = { + chat = { + enabled = true, + autoload = { "default" } + }, + }, + }, + opts = { + send_code = true, + log_level = "WARN", -- Change to DEBUG for troubleshooting + language = "English", + -- NEW: Performance improvements + job_start_delay = 500, -- Reduced from default 1500ms + submit_delay = 1000, -- Reduced from default 2000ms + }, + extensions = { + spinner = {}, + -- ddgr_search = { + -- opts = { + -- require_approval_before = false, + -- }, + -- }, + agentskills = { + opts = { + { "~/Documents/ai-skills", recursive = true }, + }, + }, + -- vectorcode = { lazy = true }, + history = { + lazy = true, + enabled = true, + opts = { + keymap = "ghf", + save_chat_keymap = "ghs", + picker = "snacks", + dir_to_save = vim.env.HOME .. "/Documents/ai-history", + title_generation_opts = { + adapter = "copilot", + model = "gpt-5-mini", + }, + summary = { + create_summary_keymap = "ghc", + browse_summaries_keymap = "ghb", + }, + }, + }, + -- mcphub = { + -- callback = "mcphub.extensions.codecompanion", + -- opts = { + -- make_vars = true, + -- make_slash_commands = true, + -- show_result_in_chat = true, + -- }, + -- }, + }, + interactions = { + chat = { + variables = { + project = { + callback = function() + -- Get project files structure + local files = vim.fn.systemlist("fd . -type f") + return table.concat(files, "\n") + end, + description = "Share project structure" + } + }, + tools = { + opts = { + auto_submit_errors = true, -- Send any errors to the LLM automatically? + auto_submit_success = true, -- Send any successful output to the LLM automatically? + system_prompt = { + enabled = true, + replace_main_system_prompt = false, + }, + default_tools = { + "file_search", + "read_file", + "cmd_runner", + -- "ddgr_search", + }, + }, + ["fetch_enhanced"] = { + callback = function(url, options) + options = options or {} + local max_length = options.max_length or 200000 -- 200KB default + local timeout = options.timeout or 60 + + -- Use curl for better control + local cmd = string.format( + 'curl -L -s --max-time %d --user-agent "CodeCompanion-Neovim" "%s"', + timeout, + url + ) + + local handle = io.popen(cmd) + if not handle then + return nil, "Failed to execute curl" + end + + local result = handle:read("*a") + local success = handle:close() + + if not success then + return nil, "Curl command failed" + end + + -- Truncate if too long + if #result > max_length then + result = result:sub(1, max_length) .. "\n[... truncated at " .. max_length .. " characters ...]" + end + + return result + end, + opts = { + requires_approval = false, + } + }, + ["fetch_unlimited"] = { + description = "Fetch a data from the web", + callback = function(url, options) + options = options or {} + + -- Use a local proxy service or direct system calls + local temp_file = vim.fn.tempname() + local cmd = string.format( + 'wget --timeout=60 --tries=3 --output-document="%s" "%s" 2>/dev/null && cat "%s" && rm "%s"', + temp_file, url, temp_file, temp_file + ) + + local handle = io.popen(cmd) + if not handle then + return nil, "Failed to fetch URL" + end + + local result = handle:read("*a") + handle:close() + + -- Optional: Process and clean the content + -- Remove excessive whitespace, clean HTML if needed + -- result = result:gsub("%s+", " "):gsub("^\s+", ""):gsub("%s+$", "") + + return result + end, + opts = { + requires_approval = false, + description = "Fetch web content with unlimited size" + } + }, + ["fetch"] = { + description = "Fetch a webpage in a markdown format", + callback = function(url, options) + local cmd = string.format( + 'reader -o -i none %s 2>/dev/null', + url + ) + local handle = io.popen(cmd) + if not handle then + return nil, "Failed to fetch URL" + end + + local result = handle:read("*a") + handle:close() + + return result + end, + }, + -- ["mcp"] = { -- Name this tool whatever you like + -- -- Callback provides the necessary functions to CodeCompanion + -- callback = function() + -- return require("mcphub.extensions.codecompanion") + -- end, + -- opts = { + -- -- If true, CodeCompanion will ask for approval before executing the MCP tool call + -- requires_approval = true, + -- -- Optional: Pass parameters like temperature to the underlying LLM if the chat strategy supports it + -- temperature = 0.7 + -- } + -- }, + groups = { + ['plan'] = { + description = "Planning my project and codes with enhanced web access", + prompt = "Using all the ${tools} at your disposal including enhanced web fetching. Analyze the codes and use it to help me with my query. You have access to unlimited web content fetching.", + tools = { + "fetch", -- Backup unlimited fetch + "file_search", + "grep_search", + "list_code_usages", + "next_edit_suggestion", + "read_file", + "cmd_runner", + }, + opts = { + collapse_tools = true, + -- Override default fetch behavior for this group + tool_config = { + fetch_enhanced = { + max_length = 500000, -- 500KB for planning tasks + chunk_processing = true, + }, + }, + }, + }, + ['research'] = { + description = "Deep research with unlimited web access", + prompt = "You are a research assistant with unlimited web access. Using the ${tools} fetch and analyze large documents, research papers, and comprehensive web content.", + tools = { + "fetch", + "fetch_enhanced", + "file_search", + "read_file", + }, + opts = { + collapse_tools = false, + }, + }, + -- NEW: Add development group for coding tasks + ['dev'] = { + description = "Full-stack development with all necessary tools", + prompt = "You are an expert full-stack developer. Use ${tools} to understand, modify, and test code. Always gather context before making changes.", + tools = { + "file_search", + "grep_search", + "fetch", + "list_code_usages", + "read_file", + "insert_edit_into_file", + "cmd_runner", + "next_edit_suggestion", + }, + opts = { + collapse_tools = true, + }, + }, + }, + }, + slash_commands = { + ["buffer"] = { opts = { provider = "snacks" } }, -- snacks + ["file"] = { opts = { provider = "snacks" } }, -- snackes + ['git_files'] = { + description = 'List git files', + ---@param chat CodeCompanion.Chat + callback = function(chat) + local handle = io.popen 'git ls-files' + if handle ~= nil then + local result = handle:read '*a' + handle:close() + chat:add_reference({ content = result }, 'git', '') + return vim.notify('Git files added to the chat.') + else + return vim.notify('No git files available', vim.log.levels.INFO, { title = 'CodeCompanion' }) + end + end, + opts = { + contains_code = false, + }, + }, + -- NEW: Add helpful workspace command + ["workspace"] = { + description = "Add workspace context", + callback = function(chat) + local cwd = vim.fn.getcwd() + local workspace_info = string.format("Working directory: %s", cwd) + + -- Get project type + local files = vim.fn.glob(cwd .. "/*", false, true) + for _, file in ipairs(files) do + local basename = vim.fn.fnamemodify(file, ":t") + if basename == "package.json" then + workspace_info = workspace_info .. "\nProject type: Node.js/JavaScript" + break + elseif basename == "Cargo.toml" then + workspace_info = workspace_info .. "\nProject type: Rust" + break + elseif basename == "go.mod" then + workspace_info = workspace_info .. "\nProject type: Go" + break + end + end + + chat:add_reference({ content = workspace_info }, 'workspace', '') + return vim.notify('Workspace context added.') + end, + opts = { + contains_code = false, + }, + }, + }, + -- adapter = { name = "abacus", model = "route-llm" }, + -- adapter = { name = "opencode", model = "github-copilot/gpt-5.2-codex" }, + adapter = { name = "copilot", model = "gpt-5-mini" }, + }, + inline = { + -- adapter = { name = "abacus", model = "route-llm" }, + adapter = { name = "copilot", model = "gpt-5.1-codex-mini" }, + }, + cmd = { + adapter = { name = "copilot", model = "gpt-5-mini" }, + }, + background = { + adapter = { name = "copilot", model = "gpt-5-mini" }, + }, + }, + prompt_library = { + markdown = { + dirs = { + vim.fn.getcwd() .. "/.prompts", + "~/.agents/prompts", + }, + }, + ["Code Review"] = { + interaction = "chat", + description = "Review the selected code for improvements", + opts = { + mapping = "rpc", + modes = { "v" }, + adapter = { + name = "copilot", + model = "chatgpt-5.1-codex", + }, + }, + prompts = { + { + role = "system", + content = "You are an expert code reviewer. Analyze the code for: 1) Logic errors 2) Performance issues 3) Security vulnerabilities 4) Best practices 5) Code clarity and maintainability. Provide specific, actionable feedback.", + }, + { + role = "user", + content = function(context) + local code = require("codecompanion.helpers.actions").get_code(context.start_line, context.end_line) + return "Please review this code:\n\n```" .. context.filetype .. "\n" .. code .. "\n```" + end, + }, + }, + cc_keywords = { "review", "critique", "smell", "security", "vulnerability", "best practice", "maintainab" }, + cc_threshold = 2, + }, + ["Optimize Performance"] = { + interaction = "chat", + description = "Get performance optimization suggestions", + opts = { + mapping = "rpo", + modes = { "v" }, + adapter = { + name = "copilot", + model = "chatgpt-5.2-codex", + }, + }, + prompts = { + { + role = "system", + content = "You are a performance optimization expert. Focus on: 1) Time complexity improvements 2) Space efficiency 3) Algorithm optimization 4) Framework-specific optimizations 5) Caching strategies.", + }, + { + role = "user", + content = function(context) + local code = require("codecompanion.helpers.actions").get_code(context.start_line, context.end_line) + return "How can I optimize the performance of this code?\n\n```" .. context.filetype .. "\n" .. code .. "\n```" + end, + }, + }, + cc_keywords = { "optimize", "performance", "slow", "latency", "throughput", "memory", "alloc" }, + }, + ["Debug Analysis"] = { + interaction = "chat", + description = "Analyze and debug problematic code", + opts = { + mapping = "rpd", + modes = { "v" }, + + adapter = { + name = "copilot", + model = "chatgpt-5.2-codex", + }, + }, + prompts = { + { + role = "system", + content = [[You are a debugging expert. Analyze code for: + 1. Potential bugs and issues + 2. Logic errors + 3. Runtime errors + 4. Common pitfalls + 5. Debugging strategies. + 6. Provide specific solutions.]], + }, + { + role = "user", + content = function(context) + local code = require("codecompanion.helpers.actions").get_code(context.start_line, context.end_line) + return fmt( + [[Help me debug this code from buffer %d and identify potential issues: + + ```%s + %s + ```]], + context.bufnr, + context.filetype, + code + ) + end, + opts = { + contains_code = true, + } + }, + }, + cc_keyword = { "bug", "debug", "error", "exception", "crash", "stacktrace", "broken", "issue" }, + }, + ["Architecture Review"] = { + interaction = "chat", + description = "Review architectural patterns and design", + opts = { + mapping = "rpa", + modes = { "v" }, + + adapter = { + name = "copilot", + model = "chatgpt-5.2-codex", + }, + }, + prompts = { + { + role = "system", + content = "You are a software architect. Review code for: 1) Design patterns usage 2) SOLID principles 3) Separation of concerns 4) Scalability considerations 5) Maintainability. Suggest architectural improvements.", + }, + { + role = "user", + content = function(context) + local code = require("codecompanion.helpers.actions").get_code(context.start_line, context.end_line) + return fmt( + [[Please review the architecture and design of this code from buffer %d: + + ```%s + %s + ```]], + context.bufnr, + context.filetype, + code + ) + end, + opts = { + contains_code = true, + } + }, + }, + cc_keywords = { "architecture", "design", "pattern", "solid", "scalab", "maintainab", "refactor" }, + }, + }, + display = { + action_palette = { + provider = "snacks", + opts = { + show_default_actions = true, + show_default_prompt_library = true, + } + }, + chat = { + show_settings = false, + render_headers = false, + icons = { + chat_context = "📎️", + }, + fold_context = true, + -- NEW: Better chat window configuration + window = { + layout = "vertical", + width = 0.45, + height = 0.8, + border = "rounded", -- Better visual + }, + auto_scroll = false, + start_in_insert_mode = false, -- More convenient + } + } +}) diff --git a/config/nvim/plugin/conform.lua b/config/nvim/plugin/conform.lua new file mode 100644 index 0000000..6e500c1 --- /dev/null +++ b/config/nvim/plugin/conform.lua @@ -0,0 +1,39 @@ + +local conform = require('conform') + +conform.setup({ + notify_on_error = false, + formatters = { + shfmt = { + prepend_args = { "-i", "2", "-ci" }, + }, + dprint = { + condition = function(ctx) + return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1] + end, + }, + }, + formatters_by_ft = { + c = { "clang_format" }, + cpp = { "clang_format" }, + lua = { 'stylua' }, + go = { "goimports", "gofmt" }, + rust = { "dprint", "rustfmt", lsp_format = "fallback" }, + python = { "isort", "black", stop_after_first = true }, + javascript = { "dprint", "prettier", stop_after_first = true }, + markdown = { "dprint", "prettier", stop_after_first = true }, + javascriptreact = { "dprint", "prettier", stop_after_first = true }, + typescript = { "dprint", "prettier", stop_after_first = true }, + typescriptreact = { "dprint", "prettier", stop_after_first = true }, + svelte = { "dprint", "prettier", stop_after_first = true }, + html = { "dprint", "prettier", stop_after_first = true }, + }, +}) + +vim.keymap.set({ 'n', 'v' }, 'bf', +function() + conform.format { async = true, lsp_format = 'fallback' } +end, +{ desc = 'Format buffer' }) + + diff --git a/config/nvim/plugin/copilot.lua b/config/nvim/plugin/copilot.lua new file mode 100644 index 0000000..8b1ad31 --- /dev/null +++ b/config/nvim/plugin/copilot.lua @@ -0,0 +1,16 @@ + +vim.g.copilot_nes_debounce = 500 + +require('copilot').setup({ + nes = { + enabled = false, + keymap = { + accept_and_goto = "", + accept = false, + dismiss = "", + }, + }, + panel = { + enabled = false, + }, +}) diff --git a/config/nvim/plugin/crates.lua b/config/nvim/plugin/crates.lua new file mode 100644 index 0000000..757fc80 --- /dev/null +++ b/config/nvim/plugin/crates.lua @@ -0,0 +1,36 @@ + +local crates = require("crates") +local opts = { silent = true } + +vim.keymap.set("n", "cct", crates.toggle, { desc = 'toggle' }) +vim.keymap.set("n", "ccr", crates.reload, { desc = 'reload' }) +vim.keymap.set("n", "ccv", crates.show_versions_popup, { desc = 'show versions' }) +vim.keymap.set("n", "ccf", crates.show_features_popup, { desc = 'show features' }) +vim.keymap.set("n", "ccd", crates.show_dependencies_popup, { desc = 'show dependencies' }) +vim.keymap.set("n", "ccu", crates.update_crate, { desc = 'update' }) +vim.keymap.set("v", "ccu", crates.update_crates, { desc = 'update' }) +vim.keymap.set("n", "cca", crates.update_all_crates, { desc = 'update all' }) +vim.keymap.set("n", "ccU", crates.upgrade_crate, { desc = 'upgrade' }) +vim.keymap.set("v", "ccU", crates.upgrade_crates, { desc = 'upgrade' }) +vim.keymap.set("n", "ccA", crates.upgrade_all_crates, { desc = 'upgrade all' }) +vim.keymap.set("n", "ccx", crates.expand_plain_crate_to_inline_table, { desc = 'expand' }) +vim.keymap.set("n", "ccX", crates.extract_crate_into_table, { desc = 'extract' }) +vim.keymap.set("n", "ccH", crates.open_homepage, { desc = 'open homepage' }) +vim.keymap.set("n", "ccR", crates.open_repository, { desc = 'open repository' }) +vim.keymap.set("n", "ccD", crates.open_documentation, { desc = 'open documents' }) +vim.keymap.set("n", "ccC", crates.open_crates_io, { desc = 'open crates.io' }) +vim.keymap.set("n", "ccL", crates.open_lib_rs, { desc = 'open lib.rs' }) + +require('crates').setup({ + completion = { + crates = { + enabled = true, + }, + }, + lsp = { + enabled = true, + actions = true, + completion = true, + hover = true, + }, +}) diff --git a/config/nvim/plugin/csvview.lua b/config/nvim/plugin/csvview.lua new file mode 100644 index 0000000..1bcd309 --- /dev/null +++ b/config/nvim/plugin/csvview.lua @@ -0,0 +1,12 @@ + +require('csvview').setup({ + parser = { comments = { "#", "//" } }, + keymaps = { + textobject_field_inner = { "if", mode = { "o", "x" } }, + textobject_field_outer = { "af", mode = { "o", "x" } }, + jump_next_field_end = { "", mode = { "n", "v" } }, + jump_prev_field_end = { "", mode = { "n", "v" } }, + jump_next_row = { "", mode = { "n", "v" } }, + jump_prev_row = { "", mode = { "n", "v" } }, + } +}) diff --git a/config/nvim/plugin/fabric-ai.lua b/config/nvim/plugin/fabric-ai.lua new file mode 100644 index 0000000..48728a7 --- /dev/null +++ b/config/nvim/plugin/fabric-ai.lua @@ -0,0 +1,15 @@ +require('fabric-ai').setup({ + -- Default configuration (all optional) + fabric_path = "fabric-ai", -- Path to Fabric CLI + patterns_path = nil, -- Custom patterns dir (auto-detect if nil) + timeout = 300000, -- Command timeout in ms (5 minutes) + window = { + width = 0.8, -- 80% of editor width + height = 0.8, -- 80% of editor height + border = "rounded", + }, +}) + +vim.keymap.set({ 'v' }, "fa", ":'<,'>Fabric", { desc = "Fabric AI" }) +vim.keymap.set({ 'n' }, 'fa', ':Fabric', { desc = "Fabric AI" }) +vim.keymap.set({ 'n' }, 'fu', ':Fabric url', { desc = "Fabric URL" }) diff --git a/config/nvim/plugin/flash.lua b/config/nvim/plugin/flash.lua new file mode 100644 index 0000000..0fb2d3f --- /dev/null +++ b/config/nvim/plugin/flash.lua @@ -0,0 +1,32 @@ + +require('flash').setup({ + modes = { + char = { + jump_labels = true, + search = { wrap = true }, + highlight = { backdrop = false }, + }, + search = { + -- when `true`, flash will be activated during regular search by default. + -- You can always toggle when searching with `require("flash").toggle()` + enabled = true, + highlight = { backdrop = false }, + jump = { history = true, register = true, nohlsearch = true, autojump = true }, + search = { + wrap = true, + -- `forward` will be automatically set to the search direction + -- `mode` is always set to `search` + -- `incremental` is set to `true` when `incsearch` is enabled + }, + }, + treesitter = { + search = { wrap = true }, + } + }, +}) + +vim.keymap.set({ "n" }, "/", function() require("flash").treesitter() end, { desc = "Flash Treesitter" }) +vim.keymap.set({ "x", "o" }, "s", function() require("flash").treesitter() end, { desc = "Flash Treesitter" }) +vim.keymap.set({ "o" }, "r", function() require("flash").remote() end, { desc = "Remote Flash" }) +vim.keymap.set({ "o", "x" }, "R", function() require("flash").treesitter_search() end, { desc = "Treesitter Search" }) +vim.keymap.set({ "c" }, "", function() require("flash").toggle() end, { desc = "Toggle Flash Search" }) diff --git a/config/nvim/plugin/git.lua b/config/nvim/plugin/git.lua new file mode 100644 index 0000000..d2f3a79 --- /dev/null +++ b/config/nvim/plugin/git.lua @@ -0,0 +1,51 @@ + +vim.keymap.set({ 'n' }, 'uG', "Gitsigns toggle_signs", { desc = 'Gitsigns toggle' }) + +require('gitsigns').setup({ + auto_attach = true, + signs_staged_enable = true, + signcolumn = true, + current_line_blame_opts = { + delay = 50 + }, + on_attach = function(bufnr) + local gitsigns = require('gitsigns') + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Actions + -- visual mode + map('v', 'vs', function() + gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + + map('v', 'vr', function() + gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + + -- normal mode + + map('n', '[v', function() gitsigns.nav_hunk 'prev' end, { desc = 'git previous hunk' }) + map('n', ']v', function() gitsigns.nav_hunk 'next' end, { desc = 'git next hunk' }) + map('n', 'vs', gitsigns.stage_hunk, { desc = 'git stage hunk' }) + map('n', 'vr', gitsigns.reset_hunk, { desc = 'git reset hunk' }) + map('n', 'vS', gitsigns.stage_buffer, { desc = 'git stage buffer' }) + map('n', 'vu', gitsigns.undo_stage_hunk, { desc = 'git undo stage hunk' }) + map('n', 'vR', gitsigns.reset_buffer, { desc = 'git reset buffer' }) + map('n', 'vP', gitsigns.preview_hunk, { desc = 'git preview hunk' }) + map('n', 'vb', gitsigns.blame_line, { desc = 'git blame line' }) + map('n', 'vP', gitsigns.diffthis, { desc = 'git diff against index' }) + map('n', 'vD', function() + gitsigns.diffthis '@' + end, { desc = 'git [D]iff against last commit' }) + -- Toggles + map('n', 'uvb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'uvd', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) + end, + }) + + diff --git a/config/nvim/plugin/jj.lua b/config/nvim/plugin/jj.lua new file mode 100644 index 0000000..578adea --- /dev/null +++ b/config/nvim/plugin/jj.lua @@ -0,0 +1,76 @@ + +local cmd = require("jj.cmd") +local annotate = require("jj.annotate") + +vim.keymap.set("n", "va", annotate.file, { desc = "JJ annotate file" }) +vim.keymap.set("n", "vA", annotate.line, { desc = "JJ annotate line" }) +vim.keymap.set("n", "vbc", cmd.bookmark_create, { desc = "JJ bookmark create" }) +vim.keymap.set("n", "vbd", cmd.bookmark_delete, { desc = "JJ bookmark delete" }) +vim.keymap.set("n", "vbm", cmd.bookmark_move, { desc = "JJ bookmark move" }) +vim.keymap.set("n", "vd", cmd.describe, { desc = "JJ describe" }) +vim.keymap.set("n", "vl", cmd.log, { desc = "JJ log" }) +vim.keymap.set("n", "ve", cmd.edit, { desc = "JJ edit" }) +vim.keymap.set("n", "vn", cmd.new, { desc = "JJ new" }) +vim.keymap.set("n", "vs", cmd.status, { desc = "JJ status" }) +vim.keymap.set("n", "vS", cmd.squash, { desc = "JJ squash" }) +vim.keymap.set("n", "vju", cmd.undo, { desc = "JJ undo" }) +vim.keymap.set("n", "vjr", cmd.redo, { desc = "JJ redo" }) +vim.keymap.set("n", "vr", cmd.rebase, { desc = "JJ rebase" }) +vim.keymap.set("n", "vf", cmd.fetch, { desc = "JJ fetch" }) +vim.keymap.set("n", "vx", cmd.abandon, { desc = "JJ abandon" }) +vim.keymap.set("n", "vp", cmd.push, { desc = "JJ push" }) +vim.keymap.set("n", "vpr", cmd.open_pr, { desc = "JJ open PR from bookmark in current revision or parent" }) +vim.keymap.set("n", "vpl", function() + cmd.open_pr { list_bookmarks = true } +end, { desc = "JJ open PR listing available bookmarks" }) + + +-- Diff commands +local diff = require("jj.diff") +vim.keymap.set("n", "vjd", function() diff.open_vdiff() end, { desc = "JJ diff current buffer" }) +vim.keymap.set("n", "vjD", function() diff.open_hsplit() end, { desc = "JJ hdiff current buffer" }) + +-- Pickers +local picker = require("jj.picker") +vim.keymap.set("n", "vjs", function() picker.status() end, { desc = "JJ Picker status" }) +vim.keymap.set("n", "vjh", function() picker.file_history() end, { desc = "JJ Picker history" }) + +-- Some functions like `log` can take parameters +vim.keymap.set("n", "vL", function() + cmd.log { + revisions = "all()", -- equivalent to jj log -r :: + } +end, { desc = "JJ log all" }) + + +-- This is an alias i use for moving bookmarks its so good +vim.keymap.set("n", "vt", function() + cmd.j "tug" + cmd.log {} +end, { desc = "JJ tug" }) + +require("jj").setup({ + diff = { + backend = "native", + }, + cmd = { + describe = { + editor = { + type = "buffer", + } + } + }, + describe = { + editor = { + type = "buffer", + } + } +}) + +require("hunk").setup() +require('jjsigns').setup({ + enabled = true, + attach = { + auto = false, + } +}) diff --git a/config/nvim/plugin/lsp.lua b/config/nvim/plugin/lsp.lua new file mode 100644 index 0000000..2a85f57 --- /dev/null +++ b/config/nvim/plugin/lsp.lua @@ -0,0 +1,205 @@ + +vim.keymap.set("i", "", function() + if not vim.lsp.inline_completion.get() then + return "" + end +end, { expr = true, desc = "Accept the current inline completion" }) + +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + local function client_supports_method(client, method, bufnr) + return client:supports_method(method, bufnr) + end + + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_completion, event.buf) then + vim.lsp.completion.enable(true, client.id, event.buf, { autotrigger = true }) + end + end, +}) + +-- Diagnostic Config +-- See :help vim.diagnostic.Opts +vim.diagnostic.config({ + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', + [vim.diagnostic.severity.WARN] = '󰀪 ', + [vim.diagnostic.severity.INFO] = '󰋽 ', + [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, +}) + + +require('mason').setup() +-- require('mason-lspconfig').setup() + +local servers = { + lua_ls = { + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false, + }, + completion = { + callSnippet = "Replace", + }, + diagnostics = { + disable = { 'missing-fields' }, + globals = { 'vim', 'require' }, + }, + + }, + } + }, + gopls = { + settings = { + gopls = { + experimentalPostfixCompletions = true, + analyses = { + unusedparams = true, + shadow = true, + }, + staticcheck = true, + hints = { + enabled = true, + rangeVariableTypes = true, + prameterNames = true, + functionTypeParameters = true, + constantValues = true, + compositeLiteralTypes = true, + compositeLiteralFields = true, + assignVariableTypes = true, + }, + }, + }, + }, + harper_ls = { + settings = { + ["harper-ls"] = { + linters = { + SentenceCapitalization = true, + SpellCheck = true + }, + dialect = "Canadian" + } + } + }, + -- csharp_ls = {}, + zls = {}, + clangd = { + settings = { + ["clang"] = { + cmd = { "clangd", "--background-index", "--compile-commands-dir=" .. vim.loop.cwd() .. "/build" }, + } + } + }, + rust_analyzer= { + settings = { + ['rust-analyzer'] = { + cargo = { + allFeatures = true, + }, + checkOnSave = true, + check = { + command = "clippy", + }, + procMacro = { + enable = true, + }, + lens = { + debug = { enable = true }, + enable = true, + implementations = { enable = true }, + references = { + adt = { enable = true }, + enumVariant = { enable = true }, + method = { enable = true }, + trait = { enable = true }, + }, + run = { enable = true }, + updateTest = { enable = true }, + }, + }, + } + }, + ts_ls= {}, + html= {}, + eslint= {}, + jsonls= {}, + jdtls= {}, + copilot = { + -- settings = { + -- ['copilot'] = { + -- cmd = { "copilot-language-server", "--stdio" }, + -- init_options = { + -- name = "Neovim", + -- version = tostring(vim.version()), + -- }, + -- editorPluginInfo = { + -- name = "Neovim", + -- version = tostring(vim.version()), + -- }, + -- }, + -- }, + }, +} + +local ensure_installed = vim.tbl_keys(servers or {}) +require('mason-tool-installer').setup ({ ensure_installed = ensure_installed }) + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = vim.tbl_deep_extend('force', capabilities, require('blink.cmp').get_lsp_capabilities({}, false)) +capabilities = vim.tbl_deep_extend('force', capabilities, { + general = { + -- dynamicRegistration = false, + positionEncodings = { "utf-16" }, + }, + textDocument = { + foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true + } + } +}) + +for server, cfg in pairs(servers) do + cfg.capabilities = vim.tbl_deep_extend('force', {}, capabilities, cfg.capabilities or {}) + vim.lsp.config(server, cfg) + vim.lsp.enable(server) +end +vim.lsp.inline_completion.enable(); +-- vim.lsp.enable("rust-analyzer", false) + + +require ('mason-nvim-dap').setup({ + handlers = { + function(config) + -- all sources with no handler get passed here + -- Keep original functionality + require('mason-nvim-dap').default_setup(config) + end, + }, +}) diff --git a/config/nvim/plugin/lualine.lua b/config/nvim/plugin/lualine.lua new file mode 100644 index 0000000..dcf010a --- /dev/null +++ b/config/nvim/plugin/lualine.lua @@ -0,0 +1,69 @@ +local function truncate_branch_name(branch) + if not branch or branch == "" then + return "" + end + + -- Match the branch name to the specified format + local _, _, ticket_number = string.find(branch, "skdillon/sko%-(%d+)%-") + + -- If the branch name matches the format, display sko-{ticket_number}, otherwise display the full branch name + if ticket_number then + return "sko-" .. ticket_number + else + return branch + end +end + +require("lualine").setup({ + options = { + -- theme = "rose-pine", + globalstatus = true, + -- component_separators = { left = "", right = "" }, + -- section_separators = { left = "█", right = "█" }, + icons_enabled = true, + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + tabline = { + lualine_a = {}, + lualine_b = {'branch'}, + lualine_c = {'filename'}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {} + }, + }, + sections = { + lualine_b = { + { "branch", icon = "", fmt = truncate_branch_name }, + "diff", + "diagnostics", + }, + lualine_c = { + { 'lsp_progress' }, + { + 'buffers', + show_filename_only = true, -- Shows shortened relative path when set to false. + hide_filename_extension = false, -- Hide filename extension when set to true. + show_modified_status = true, -- Shows indicator when the buffer is modified. + mode = 0, + max_length = vim.o.columns * 2 / 3, + filetype_names = { + TelescopePrompt = ' ', + }, + -- it can also be a function that returns + -- the value of `max_length` dynamically. + use_mode_colors = false, + symbols = { + modified = ' ●', -- Text to show when the buffer is modified + alternate_file = '#', -- Text to show to identify the alternate file + directory = '', -- Text to show when the buffer is a directory + }, + }, + }, + lualine_x = { + "windows", + "fileformat", + "filetype", + }, + }, +}) diff --git a/config/nvim/plugin/luasnip.lua b/config/nvim/plugin/luasnip.lua new file mode 100644 index 0000000..bd4f5e5 --- /dev/null +++ b/config/nvim/plugin/luasnip.lua @@ -0,0 +1,13 @@ +-- build = "make install_jsregexp", +require('luasnip.loaders.from_vscode').lazy_load() +require('luasnip.loaders.from_vscode').lazy_load({ paths = "./json_snippets" }) + +local luasnip = require("luasnip") +luasnip.add_snippets("zig", require("snippets.zig")) + +vim.api.nvim_create_autocmd('PackChanged', { + callback = function() + vim.system({ "make", "install_jsregexp" }, {}):wait() + end +}) + diff --git a/config/nvim/plugin/markdown-preview.lua b/config/nvim/plugin/markdown-preview.lua new file mode 100644 index 0000000..92fd40c --- /dev/null +++ b/config/nvim/plugin/markdown-preview.lua @@ -0,0 +1,10 @@ +vim.g.mkdp_filetypes = { "markdown" } + +vim.keymap.set("n", "xmp", "MarkdownPreview", { desc ="Markdown Preview" }) +vim.keymap.set("n", "xms", "MarkdownPreviewStop", { desc ="Markdown Preview Stop" }) + +vim.api.nvim_create_autocmd('PackChanged', { + callback = function() + vim.fn["mkdp#util#install"]() + end +}) diff --git a/config/nvim/plugin/mini.lua b/config/nvim/plugin/mini.lua new file mode 100644 index 0000000..6c7a477 --- /dev/null +++ b/config/nvim/plugin/mini.lua @@ -0,0 +1,79 @@ +local MiniExtra = require('mini.extra') +local ai = require('mini.ai') +local spec_treesitter = ai.gen_spec.treesitter + +ai.setup({ + custom_textobjects = { + F = spec_treesitter({ a = '@function.outer', i = '@function.inner' }), + C = spec_treesitter({ a = '@comment.outer', i = '@comment.inner' }), + P = spec_treesitter({ a = '@parameter.outer', i = '@parameter.inner' }), + O = spec_treesitter({ a = '@block.outter', i = '@block.inner' }), + k = spec_treesitter({ a = '@class.outer', i = '@class.inner' }), + o = spec_treesitter({ + a = { '@conditional.outer', '@loop.outer' }, + i = { '@conditional.inner', '@loop.inner' }, + }) + } +}) + +require('mini.move').setup() +require('mini.align').setup() +require('mini.bracketed').setup() +require('mini.operators').setup({ + evaluate = { prefix = 'g|', func = nil, }, + exchange = { prefix = 'g.', reindent_linewise = true, }, + multiply = { prefix = 'gm', func = nil, }, + replace = { prefix = 'gk', reindent_linewise = true, }, + sort = { prefix = 'gs', func = nil, } +}) + +require('mini.surround').setup({ + -- Add custom surroundings to be used on top of builtin ones. For more + -- information with examples, see `:h MiniSurround.config`. + -- custom_surroundings = { + -- s = { input = { '%[%[().-()%]%]' }, output = { left = '[[', right = ']]' } }, + -- }, + mappings = { + add = 'sa', -- Add surrounding in Normal and Visual modes + delete = 'sd', -- Delete surrounding + find = 'sf', -- Find surrounding (to the right) + find_left = 'sF', -- Find surrounding (to the left) + highlight = 'sh', -- Highlight surrounding + replace = 'sr', -- Replace surrounding + update_n_lines = 'sn', -- Update `n_lines` + + suffix_last = 'l', -- Suffix to search with "prev" method + suffix_next = 'n', -- Suffix to search with "next" method + } +}) + +require('mini.splitjoin').setup() + +local hi_words = MiniExtra.gen_highlighter.words +require('mini.hipatterns').setup({ + highlighters = { + -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' + fixme = hi_words({ 'FIXME', 'Fixme', 'fixme' }, "MiniHipatternsFixme"), + hack = hi_words({ 'HACK', 'Hack', 'hack' }, "MiniHipatternsHack"), + todo = hi_words({ 'TODO', 'Todo', 'todo' }, "MiniHipatternsTodo"), + note = hi_words({ 'NOTE', 'Note', 'note' }, "MiniHipatternsNote"), + done = hi_words({ 'DONE', 'Done', 'done' }, "MiniHipatternsFixme"), + + -- Highlight hex color strings (`#rrggbb`) using that color + -- hex_color = hipatterns.gen_highlighter.hex_color(), + }, +}) + +vim.keymap.set('n', "-", function() require("mini.files").open(vim.api.nvim_buf_get_name(0)) end, { desc = "Open parent directory" }) +vim.keymap.set('n', "-", function() require("mini.files").open() end, { desc = "File Explore" }) +require('mini.files').setup({ + mappings = { + go_in = "", -- Map both Enter and L to enter directories or open files + go_in_plus = "L", + go_out = "-", + go_out_plus = "H", + close = "", + }, +}) + +require('mini.sessions').setup() diff --git a/config/nvim/plugin/nvim-ansible.lua b/config/nvim/plugin/nvim-ansible.lua new file mode 100644 index 0000000..7beb162 --- /dev/null +++ b/config/nvim/plugin/nvim-ansible.lua @@ -0,0 +1,2 @@ +vim.keymap.set('v', 'te', function() require('ansible').run() end, { buffer = true, silent = true }) +vim.keymap.set('n', 'te', ":w :lua require('ansible').run()", { buffer = true, silent = true }) diff --git a/config/nvim/plugin/obsidian.lua b/config/nvim/plugin/obsidian.lua new file mode 100644 index 0000000..37814b4 --- /dev/null +++ b/config/nvim/plugin/obsidian.lua @@ -0,0 +1,76 @@ +require("obsidian").setup({ + legacy_commands = false, + picker = { + name = "snacks.pick", + }, + ui = { + enable = true, + }, + workspaces = { + { + name = "NCA notes", + path = vim.fn.expand "~" .. "/Documents/nca-notes/", + }, + }, + notes_subdir = "Inbox", + daily_notes = { + folder = "Dailies", + date_format = "%Y-%m-%d-%a", + alias_fomat = "%B %-d, %Y", + default_tags = { "daily-notes" }, + }, + new_notes_location = "notes_subdir", + templates = { + subdir = "Templates", + date_format = "%Y-%m-%d-%a", + time_format = "%H:%M", + tags = "", + }, + completion = { + nvim_cmp = false, + blink = true, + min_chars = 2, + }, + link = { + style = "wiki", + }, + note_id_func = function(title) + local suffix = "" + if title ~= nil then + suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() + else + for _ = 1, 4 do + suffix = suffix .. string.char(math.random(65, 90)) + suffix = tostring(os.time()) .. "-" .. suffix + end + end + return suffix + end, + + callbacks = { + enter_note = function(note) + vim.keymap.set('n', 'k.', 'Obsidian toggle_checkbox', { desc = 'toggle checkbox', buffer = note.bufnr, silent = true }) + vim.keymap.set('n', 'kp', 'Obsidian paste_img', { desc = 'paste img', buffer = note.bufnr, silent = true }) + vim.keymap.set('n', 'kt', 'Obsidian tags', { desc = 'tags', buffer = note.bufnr, silent = true }) + vim.keymap.set('n', 'k`', 'Obsidian backlinks', { desc = 'backlinks', buffer = note.bufnr, silent = true }) + vim.keymap.set('n', 'kx', 'Obsidian follow_link', { desc = 'follow link', buffer = note.bufnr, silent = true }) + vim.keymap.set('n', 'ksl', 'Obsidian links', { desc = 'links', buffer = note.bufnr, silent = true }) + vim.keymap.set('n', 'kr', 'Obsidian rename', { desc = 'rename', buffer = note.bufnr, silent = true }) + vim.keymap.set('n', 'ksc', 'Obsidian toc', { desc = 'toc', buffer = note.bufnr, silent = true }) + vim.keymap.set('v', 'kx', 'Obsidian link', { desc = 'links', buffer = note.bufnr, silent = true }) + vim.keymap.set('v', 'kl', 'Obsidian link_new', { desc = 'links', buffer = note.bufnr, silent = true }) + end, + }, +}) + +vim.keymap.set("v", "kx", "Obsidian extract_note", { desc = "Extract Note" }) +vim.keymap.set("n", "knn", "Obsidian new", { desc = "New Obsidian note" }) +vim.keymap.set("n", "knt", "Obsidian new_from_template", { desc = "New from template" }) +vim.keymap.set("n", "ksq", "Obsidian quick_switch", { desc = "Quick Switch" }) +vim.keymap.set("n", "kss", "Obsidian search", { desc = "Search Obsidian notes" }) +vim.keymap.set("n", "kdt", "Obsidian today", { desc = "Daily Today" }) +vim.keymap.set("n", "kdy", "Obsidian yesterday", { desc = "Daily Yesterday" }) +vim.keymap.set("n", "kdw", "Obsidian tomorrow", { desc = "Daily Tomorrow" }) +vim.keymap.set("n", "kdd", "Obsidian dailies", { desc = "Dailies" }) +vim.keymap.set("n", "kw", "Obsidian workspace", { desc = "Change Workspace" }) + diff --git a/config/nvim/plugin/openscad.lua b/config/nvim/plugin/openscad.lua new file mode 100644 index 0000000..7a1b854 --- /dev/null +++ b/config/nvim/plugin/openscad.lua @@ -0,0 +1,2 @@ +vim.g.openscad_load_snippets = true +require("openscad").setup({}) diff --git a/config/nvim/plugin/orgmode.lua b/config/nvim/plugin/orgmode.lua new file mode 100644 index 0000000..9d70e60 --- /dev/null +++ b/config/nvim/plugin/orgmode.lua @@ -0,0 +1,70 @@ + +require('orgmode').setup({ + ui = { + input = { + use_vim_ui = true + } + }, + org_agenda_files = {'~/Documents/notes/*project*org', '~/Documents/notes/Inbox*org', '~/Documents/journals/*.org'}, + org_default_notes_file = "~/Documents/notes/Inbox.org", + org_todo_keywords = { 'TODO(t)', 'NEXT(n)', '|', 'DONE(d)', 'DELEGATED(a)' }, + mappings = { + capture = { + org_capture_refile = 'R', + } + }, + org_capture_templates = { + t = { + description = "Todo item", + template = "* TODO %?\n SCHEDULED: %t\n DEADLINE: %T\n", -- Template content + headline = "Tasks", + }, + j = { + description = "Journal entry", + target = "~/Documents/notes/journals/%<%Y-%m-%d>.org", + template = "* %<%Y-%m-%d %H:%M> %?\n", + }, + }, +}) + +require("org-bullets").setup({ + concealcursor = false, -- If false then when the cursor is on a line underlying characters are visible + symbols = { + -- list symbol + list = "•", + -- headlines can be a list + headlines = { "◉", "○", "✸", "✿" }, + -- or a function that receives the defaults and returns a list + headlines = function(default_list) + table.insert(default_list, "♥") + return default_list + end, + -- or false to disable the symbol. Works for all symbols + headlines = false, + -- or a table of tables that provide a name + -- and (optional) highlight group for each headline level + headlines = { + { "◉", "MyBulletL1" }, + { "○", "MyBulletL2" }, + { "✸", "MyBulletL3" }, + { "✿", "MyBulletL4" }, + }, + checkboxes = { + half = { "", "@org.checkbox.halfchecked" }, + done = { "✓", "@org.keyword.done" }, + todo = { "˟", "@org.keyword.todo" }, + }, + } +}) + +require('org-roam').setup({ + bindings = { + prefix = "oO", + }, + directory = "~/Documents/notes", + extensions = { + dailies = { + directory = "journals" + }, + }, +}) diff --git a/config/nvim/plugin/outline.lua b/config/nvim/plugin/outline.lua new file mode 100644 index 0000000..59d22fc --- /dev/null +++ b/config/nvim/plugin/outline.lua @@ -0,0 +1,9 @@ +require('outline').setup({ + symbol_folding = { + -- Unfold entire symbol tree by default with false, otherwise enter a + -- number starting from 1 + autofold_depth = false, + -- autofold_depth = 1, + }, +}) +vim.keymap.set('n', 'so', 'Outline', { desc = "Toggle outline" }) diff --git a/config/nvim/plugin/persistence.lua b/config/nvim/plugin/persistence.lua new file mode 100644 index 0000000..88b73ea --- /dev/null +++ b/config/nvim/plugin/persistence.lua @@ -0,0 +1,4 @@ +vim.keymap.set('n', "xr", function() require("persistence").load() end, { desc = "Restore Session" }) +vim.keymap.set('n', "xs", function() require("persistence").save() end, { desc = "Save Session" }) +vim.keymap.set('n', "xl", function() require("persistence").load({ last = true }) end, { desc = "Restore Last Session" }) +vim.keymap.set('n', "xd", function() require("persistence").stop() end, { desc = "Don't Save Current Session" }) diff --git a/config/nvim/plugin/quicker.lua b/config/nvim/plugin/quicker.lua new file mode 100644 index 0000000..5a7e761 --- /dev/null +++ b/config/nvim/plugin/quicker.lua @@ -0,0 +1 @@ +require('quicker').setup() diff --git a/config/nvim/plugin/render-markdown.lua b/config/nvim/plugin/render-markdown.lua new file mode 100644 index 0000000..f2bbe52 --- /dev/null +++ b/config/nvim/plugin/render-markdown.lua @@ -0,0 +1,33 @@ + +require('render-markdown').setup({ + completions = { lsp = { enabled = true } }, + -- render_modes = { 'n', 'v' }, + render_modes = true, + enabled = true, + anti_conceal = { + enabled = false, + }, + quote = { repeat_linebreak = true }, + checkbox = { + -- unchecked = { icon = '✘ ' }, + checked = { icon = '✔ ', scope_highlight = '@markup.strikethrough' }, + custom = { + todo = { raw = '[-]', rendered = '󰥔 ', highlight = 'RenderMarkdownTodo', scope_highlight = nil }, + important = { raw = '[~]', rendered = '󰓎 ', highlight = 'DiagnosticWarn', }, + }, + }, + latex = { + enabled = false, + converter = "latex2text", + }, + win_options = { + conceallevel = { + default = 0, + rendered = 2, -- Conceal level 2: hide LaTeX code fully + }, + concealcursor = { + default = "", + rendered = "n", -- Conceal only in normal mode + }, + } +}) diff --git a/config/nvim/plugin/snacks.lua b/config/nvim/plugin/snacks.lua new file mode 100644 index 0000000..eb5a19c --- /dev/null +++ b/config/nvim/plugin/snacks.lua @@ -0,0 +1,282 @@ +require('snacks').setup({ + animate = { + enabled = false, + duration = { step = 1, total = 1 }, + easing = "linear", + }, + bigfile = { enabled = true }, + dashboard = { enabled = false }, + explorer = { enabled = false }, + image = { + enabled = true, + inline = false, + scale = 3, -- nil | 1 (default) | 2 | 3 | ... + doc = { + inline = true, + enabled = true, + max_width = nil, + max_height = nil, + conceal = true, + }, + math = { + enabled = true, + } + }, + terminal = { + bo = { + filetype = "snacks_terminal", + }, + win = { style = "terminal" }, + wo = {}, + keys = { + q = "hide", + gf = function(self) + local f = vim.fn.findfile(vim.fn.expand(""), "**") + if f == "" then + Snacks.notify.warn("No file under cursor") + else + self:hide() + vim.schedule(function() + vim.cmd("e " .. f) + end) + end + end, + term_normal = { + "", + function(self) + self.esc_timer = self.esc_timer or (vim.uv or vim.loop).new_timer() + if self.esc_timer:is_active() then + self.esc_timer:stop() + vim.cmd("stopinsert") + else + self.esc_timer:start(250, 0, function() end) + return "" + end + end, + mode = "t", + expr = true, + desc = "Double escape to normal mode", + }, + }, + }, + indent = { enabled = false }, + notifier = { + enabled = true, + timeout = 1000, + }, + picker = { + enabled = true, + layout = { preset = "ivy", layout = { position = "bottom" } }, + frecency = true, + history_bonus = true, + projects = { + dev = { "~/Projects", }, + }, + actions = { + flash = function(picker) + require("flash").jump({ + pattern = "^", + label = { after = { 0, 0 } }, + search = { + mode = "search", + exclude = { + function(win) + return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "snacks_picker_list" + end, + }, + }, + action = function(match) + local idx = picker.list:row2idx(match.pos[1]) + picker.list:_move(idx, true, true) + end, + }) + end, + }, + win = { + input = { + keys = { + [''] = { 'layout_right', mode = { 'i', 'n' } }, + [""] = { "flash", mode = { "n", "i" } }, + ["s"] = { "flash" }, + }, + }, + }, + sources = { + files = { + -- add a custom action + actions = { + create_if_missing = function(picker, item) + -- When typing in the input, item may be nil. + -- We'll use the input text as the intended file path. + local input = picker.input and picker.input:get() or "" + if input == "" then return end + + -- Make it relative to picker cwd if it’s not absolute + local cwd = picker.opts.cwd or vim.loop.cwd() + local path = input + if not path:match("^/") and not path:match("^%a:[/\\]") then + path = cwd .. "/" .. path + end + + -- Normalize path (optional) + path = vim.fn.fnamemodify(path, ":p") + + -- If file exists, just open it + if vim.loop.fs_stat(path) then + picker:close() + vim.cmd.edit(path) + return + end + + -- Ensure parent dirs exist (optional but nice) + vim.fn.mkdir(vim.fn.fnamemodify(path, ":h"), "p") + + -- Open a new buffer at that path (creates buffer even if file missing) + picker:close() + vim.cmd.edit(path) + -- At this point buffer is new + unnamed-on-disk until you :w + end, + }, + + -- bind the action to a key in the picker UI + win = { + input = { + keys = { + [""] = { "create_if_missing", mode = { "i", "n" }, desc = "Create file from input" }, + }, + }, + list = { + keys = { + [""] = { "create_if_missing", mode = { "n" }, desc = "Create file from input" }, + }, + }, + }, + }, + }, + }, + scope = { enabled = false }, + scratch = { + ft = "markdown", + }, + statuscolumn = { enabled = true }, + styles = { + notification = { + -- wo = { wrap = true } -- Wrap notifications + } + } +}) + +vim.keymap.set('n', "o/", function() Snacks.picker.grep({dirs = { os.getenv("HOME") .. "/Documents/notes" }}) end, { desc = "Search Org Files" }) +vim.keymap.set('n', "", function() Snacks.picker.smart() end, { desc = "Smart Find Files" }) +vim.keymap.set('n', "j", function() Snacks.picker.files({args = { "--no-require-git" }}) end, { desc = "Find Files" }) +vim.keymap.set('n', ",", function() Snacks.picker.buffers() end, { desc = "Buffers" }) +vim.keymap.set('n', "/", function() Snacks.picker.grep() end, { desc = "Grep" }) +vim.keymap.set('n', ":", function() Snacks.picker.command_history() end, { desc = "Command History" }) +vim.keymap.set('n', "n", function() Snacks.picker.notifications() end, { desc = "Notification History" }) +vim.keymap.set('n', "i", function() Snacks.picker.lsp_symbols() end, { desc = "Symbols" }) +vim.keymap.set('n', "I", function() Snacks.picker.lsp_workspace_symbols() end, { desc = "LSP Workspace Symbols" }) +vim.keymap.set('n', "fb", function() Snacks.picker.buffers() end, { desc = "Buffers" }) +vim.keymap.set('n', "fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, { desc = "Find Config File" }) +vim.keymap.set('n', "ff", function() Snacks.picker.files() end, { desc = "Find Files" }) +vim.keymap.set('n', "fg", function() Snacks.picker.git_files() end, { desc = "Find Git Files" }) +vim.keymap.set('n', "fp", function() Snacks.picker.projects() end, { desc = "Projects" }) +vim.keymap.set('n', "fr", function() Snacks.picker.recent() end, { desc = "Recent" }) +vim.keymap.set('n', "gb", function() Snacks.picker.git_branches() end, { desc = "Git Branches" }) +vim.keymap.set('n', "gl", function() Snacks.picker.git_log() end, { desc = "Git Log" }) +vim.keymap.set('n', "gL", function() Snacks.picker.git_log_line() end, { desc = "Git Log Line" }) +vim.keymap.set('n', "gs", function() Snacks.picker.git_status() end, { desc = "Git Status" }) +vim.keymap.set('n', "gS", function() Snacks.picker.git_stash() end, { desc = "Git Stash" }) +vim.keymap.set('n', "gd", function() Snacks.picker.git_diff() end, { desc = "Git Diff (Hunks)" }) +vim.keymap.set('n', "gf", function() Snacks.picker.git_log_file() end, { desc = "Git Log File" }) +vim.keymap.set('n', "sb", function() Snacks.picker.lines() end, { desc = "Buffer Lines" }) +vim.keymap.set('n', "sB", function() Snacks.picker.grep_buffers() end, { desc = "Grep Open Buffers" }) +vim.keymap.set('n', "sg", function() Snacks.picker.grep() end, { desc = "Grep" }) +vim.keymap.set('n', 's"', function() Snacks.picker.registers() end, { desc = "Registers" }) +vim.keymap.set('n', 's/', function() Snacks.picker.search_history() end, { desc = "Search History" }) +vim.keymap.set('n', "sa", function() Snacks.picker.autocmds() end, { desc = "Autocmds" }) +vim.keymap.set('n', "sb", function() Snacks.picker.lines() end, { desc = "Buffer Lines" }) +vim.keymap.set('n', "sc", function() Snacks.picker.command_history() end, { desc = "Command History" }) +vim.keymap.set('n', "sC", function() Snacks.picker.commands() end, { desc = "Commands" }) +vim.keymap.set('n', "sd", function() Snacks.picker.diagnostics() end, { desc = "Diagnostics" }) +vim.keymap.set('n', "sD", function() Snacks.picker.diagnostics_buffer() end, { desc = "Buffer Diagnostics" }) +vim.keymap.set('n', "sh", function() Snacks.picker.help() end, { desc = "Help Pages" }) +vim.keymap.set('n', "sH", function() Snacks.picker.highlights() end, { desc = "Highlights" }) +vim.keymap.set('n', "si", function() Snacks.picker.icons() end, { desc = "Icons" }) +vim.keymap.set('n', "sj", function() Snacks.picker.jumps() end, { desc = "Jumps" }) +vim.keymap.set('n', "sk", function() Snacks.picker.keymaps() end, { desc = "Keymaps" }) +vim.keymap.set('n', "sl", function() Snacks.picker.loclist() end, { desc = "Location List" }) +vim.keymap.set('n', "sm", function() Snacks.picker.marks() end, { desc = "Marks" }) +vim.keymap.set('n', "sM", function() Snacks.picker.man() end, { desc = "Man Pages" }) +vim.keymap.set('n', "sp", function() Snacks.picker.lazy() end, { desc = "Search for Plugin Spec" }) +vim.keymap.set('n', "sq", function() Snacks.picker.qflist() end, { desc = "Quickfix List" }) +vim.keymap.set('n', "sR", function() Snacks.picker.resume() end, { desc = "Resume" }) +vim.keymap.set('n', "su", function() Snacks.picker.undo() end, { desc = "Undo History" }) +vim.keymap.set('n', "sz", function() Snacks.picker.zoxide() end, { desc = "Zoxide" }) +vim.keymap.set('n', "uC", function() Snacks.picker.colorschemes() end, { desc = "Colorschemes" }) +vim.keymap.set('n', "gd", function() Snacks.picker.lsp_definitions() end, { desc = "Goto Definition" }) +vim.keymap.set('n', "gD", function() Snacks.picker.lsp_declarations() end, { desc = "Goto Declaration" }) +vim.keymap.set('n', "gri", function() Snacks.picker.lsp_implementations() end, { desc = "Goto Implementation" }) +vim.keymap.set('n', "gy", function() Snacks.picker.lsp_type_definitions() end, { desc = "Goto T[y]pe Definition" }) +vim.keymap.set('n', "ss", function() Snacks.picker.lsp_symbols() end, { desc = "LSP Symbols" }) +vim.keymap.set('n', "sS", function() Snacks.picker.lsp_workspace_symbols() end, { desc = "LSP Workspace Symbols" }) +vim.keymap.set('n', "Z", function() Snacks.zen() end, { desc = "Toggle Zen Mode" }) +vim.keymap.set('n', "z", function() Snacks.zen.zoom() end, { desc = "Toggle Zoom" }) +vim.keymap.set('n', ".", function() Snacks.scratch() end, { desc = "Toggle Scratch Buffer" }) +vim.keymap.set('n', "S", function() Snacks.scratch.select() end, { desc = "Select Scratch Buffer" }) +vim.keymap.set('n', "bd", function() Snacks.bufdelete() end, { desc = "Delete Buffer" }) +vim.keymap.set('n', "bR", function() Snacks.rename.rename_file() end, { desc = "Rename File" }) +vim.keymap.set('n', "gg", function() Snacks.lazygit() end, { desc = "Lazygit" }) +vim.keymap.set('n', "un", function() Snacks.notifier.hide() end, { desc = "Dismiss All Notifications" }) +vim.keymap.set('n', "grr", function() Snacks.picker.lsp_references() end, { nowait = true, desc = "References" }) + +vim.keymap.set({ "n", "x" }, "sw", function() Snacks.picker.grep_word() end, { desc = "Visual selection or word" }) +vim.keymap.set({ "n", "v" }, "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse" }) +vim.keymap.set({ "n", "t" }, "", function() Snacks.terminal.toggle() end, { desc = "Toggle Terminal" }) +vim.keymap.set({ "n", "t" }, "]]", function() Snacks.words.jump(vim.v.count1) end, { desc = "Next Reference" }) +vim.keymap.set({ "n", "t" }, "[[", function() Snacks.words.jump(-vim.v.count1) end, { desc = "Prev Reference" }) + +vim.keymap.set('n', 'xN', +function() + Snacks.win({ + file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], + width = 0.6, + height = 0.6, + wo = { + spell = false, + wrap = false, + signcolumn = "yes", + statuscolumn = " ", + conceallevel = 3, + }, + }) +end, +{ desc = "Neovim News" }) + +vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + -- Setup some globals for debugging (lazy-loaded) + _G.dd = function(...) + Snacks.debug.inspect(...) + end + _G.bt = function() + Snacks.debug.backtrace() + end + vim.print = _G.dd -- Override print to use snacks for `:=` command + + -- Create some toggle mappings + Snacks.toggle.option("spell", { name = "Spelling" }):map("us") + Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") + Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") + Snacks.toggle.diagnostics():map("ud") + Snacks.toggle.line_number():map("ul") + Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("uc") + Snacks.toggle.treesitter():map("uT") + Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("ub") + Snacks.toggle.inlay_hints():map("uh") + Snacks.toggle.indent():map("ug") + Snacks.toggle.dim():map("uD") + end, +}) + + diff --git a/config/nvim/plugin/spectre.lua b/config/nvim/plugin/spectre.lua new file mode 100644 index 0000000..ed8a1ad --- /dev/null +++ b/config/nvim/plugin/spectre.lua @@ -0,0 +1,17 @@ + +vim.keymap.set({ 'n' }, "sr", function() require("spectre").open() end, { desc = "Replace in files (Spectre)" }) + +require('spectre').setup({ + open_cmd = "noswapfile vnew", + highlight = { + search = "SpectreSearch", + replace = "SpectreReplace", + }, + mapping = { + ["send_to_qf"] = { + map = "", + cmd = "lua require('spectre.actions').send_to_qf()", + desc = "send all items to quickfix", + }, + }, +}) diff --git a/config/nvim/plugin/theme.lua b/config/nvim/plugin/theme.lua new file mode 100644 index 0000000..1087412 --- /dev/null +++ b/config/nvim/plugin/theme.lua @@ -0,0 +1,8 @@ +vim.pack.add({{ src = 'https://github.com/ellisonleao/gruvbox.nvim' }}) + +require("gruvbox").setup({ + contrast = "hard", + transparent_mode = true, +}) + +vim.cmd("colorscheme gruvbox") diff --git a/config/nvim/plugin/todo-comments.lua b/config/nvim/plugin/todo-comments.lua new file mode 100644 index 0000000..bd307dc --- /dev/null +++ b/config/nvim/plugin/todo-comments.lua @@ -0,0 +1,3 @@ + +vim.keymap.set('n', 'st', function() Snacks.picker.todo_comments() end, { desc = 'Todo' }) +vim.keymap.set('n', 'sT', function() Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME", "NOTE" } }) end, { desc = "Todo/Fix/Fixme/Note" }) diff --git a/config/nvim/plugin/toggleterm.lua b/config/nvim/plugin/toggleterm.lua new file mode 100644 index 0000000..a975d06 --- /dev/null +++ b/config/nvim/plugin/toggleterm.lua @@ -0,0 +1,18 @@ +require("toggleterm").setup({ + -- highlights = require("rose-pine.plugins.toggleterm"), + size = 20, + open_mapping = [[]], + hide_numbers = true, + shade_terminals = true, + shading_factor = 2, + start_in_insert = true, + insert_mappings = true, + persiste_size = true, + direction = 'horizontal', + close_on_exit = true, + float_opts = { + border = "curved", + } +}) + +vim.keymap.set('t', "", "", { desc = "Escape input" }) diff --git a/config/nvim/plugin/tools.lua b/config/nvim/plugin/tools.lua new file mode 100644 index 0000000..6782cbc --- /dev/null +++ b/config/nvim/plugin/tools.lua @@ -0,0 +1,234 @@ +vim.keymap.set({'n'}, 'gn', 'Neogit kind=auto', { desc = 'Neogit' }) +vim.keymap.set({'n'}, 'gN', 'Neogit kind=floating', { desc = 'Neogit' }) +vim.keymap.set({'n'}, 'xm', 'Lazy reload mise.nvim', { desc = "Reload mise environment" }) +vim.keymap.set({'n'}, 'kp', 'PasteImage', { desc = "Paste image from system clipboard" }) +vim.keymap.set({ 'n' }, 'uu', vim.cmd.UndotreeToggle, { desc = 'Format buffer' }) + +require('kulala').setup() + +require("just").setup({ + fidget_message_limit = 32, -- limit for length of fidget progress message + open_qf_on_error = true, -- opens quickfix when task fails + open_qf_on_run = true, -- opens quickfix when running `run` task (`:JustRun`) + open_qf_on_any = false; -- opens quickfix when running any task (overrides other open_qf options) + autoscroll_qf = true, -- automatically scroll quickfix window on output + register_commands = true, -- if set to true then commands (:Just*) will be registered + notify = vim.notify, -- what to use to show messages/errors +}) +require('img-clip').setup() +require('sshfs').setup({ + mounts = { + base_dir = vim.fn.expand("$HOME") .. "/Public", -- where remote mounts are created + }, + -- Refer to the configuration section below + -- or leave empty for defaults +}) +require('mise').setup({ + unset_vars = true, + load_on_setup = true, + force_run = true, +}) + +require('neogit').setup({ + -- disable_context_highlighting = true, + disable_commit_confirmation = true, + disable_insert_on_commit = false, + disable_signs = true, + integrations = { diffview = true, fz_lua = false }, + auto_refresh = false, + console_timeout = 5000, + auto_show_console = false, + sections = { + stashes = { + folded = false, + }, + recent = { folded = false }, + }, +}) +require('zincoxide').setup({ + zincoxide_cmd = "zoxide", + complete = true, + behaviour = "tabs", +}) + + + +vim.keymap.set('n', "xo", "OverseerOpen", { desc = "Open Overseer" }) +vim.keymap.set('n', "to", "OverseerToggle", { desc = "Overseer Toggle" }) +vim.keymap.set('n', "", "OverseerRun", { desc = "Run Overseer" }) +vim.keymap.set('n', "", "OverseerToggle", { desc = "Overseer Toggle" }) + +require("overseer").setup({ + templates = { "builtin", "user" }, + component_aliases = { + default = { + { 'display_duration', detail_level = 2 }, + 'on_output_summarize', + 'on_exit_set_status', + 'on_result_diagnostics_quickfix', + 'on_complete_notify', + { "on_complete_dispose", require_view = { "SUCCESS", "FAILURE" } }, + }, + default_vscode = { + 'default', + 'on_result_diagnostics', + 'on_result_diagnostics_quickfix', + 'on_complete_notify', + }, + } +}) + +-- local pm = require("overseer.template.vscode.problem_matcher") +-- pm.register_problem_matcher("$rustc", { + -- fileLocation = { "autoDetect", "${cwd}" }, + -- pattern = { + -- --regexp = "^(.*?)-->\\s+(.*?):(\\d+):(\\d+)$", + -- -- vim_regexp = "\\v^(.*?)-->\\s+(.*?):(\\d+):(\\d+)$", + -- regexp = "^\\s+-->\\s*([^:]*):(\\d+):(\\d+)$", + -- vim_regexp = "\\v^\\s+-->\\s*([^:]*):(\\d+):(\\d+)$", + -- file = 1, + -- line = 2, + -- column = 3, + -- } + -- }) + +local osys = require("cmake-tools.osys") +require("cmake-tools").setup { + cmake_command = "cmake", -- this is used to specify cmake command path + ctest_command = "ctest", -- this is used to specify ctest command path + cmake_use_preset = true, + cmake_regenerate_on_save = true, -- auto generate when save CMakeLists.txt + cmake_generate_options = { "-DCMAKE_EXPORT_COMPILE_COMMANDS=1" }, -- this will be passed when invoke `CMakeGenerate` + cmake_build_options = {}, -- this will be passed when invoke `CMakeBuild` + -- support macro expansion: + -- ${kit} + -- ${kitGenerator} + -- ${variant:xx} + cmake_build_directory = function() + if osys.iswin32 then + return "out\\${variant:buildType}" + end + return "out/${variant:buildType}" + end, -- this is used to specify generate directory for cmake, allows macro expansion, can be a string or a function returning the string, relative to cwd. + cmake_soft_link_compile_commands = true, -- this will automatically make a soft link from compile commands file to project root dir + cmake_compile_commands_from_lsp = false, -- this will automatically set compile commands file location using lsp, to use it, please set `cmake_soft_link_compile_commands` to false + cmake_kits_path = nil, -- this is used to specify global cmake kits path, see CMakeKits for detailed usage + cmake_variants_message = { + short = { show = true }, -- whether to show short message + long = { show = true, max_length = 40 }, -- whether to show long message + }, + cmake_dap_configuration = { -- debug settings for cmake + name = "cpp", + type = "codelldb", + request = "launch", + stopOnEntry = false, + runInTerminal = true, + console = "integratedTerminal", + }, + cmake_executor = { -- executor to use + name = "quickfix", -- name of the executor + opts = {}, -- the options the executor will get, possible values depend on the executor type. See `default_opts` for possible values. + default_opts = { -- a list of default and possible values for executors + quickfix = { + show = "always", -- "always", "only_on_error" + position = "belowright", -- "vertical", "horizontal", "leftabove", "aboveleft", "rightbelow", "belowright", "topleft", "botright", use `:h vertical` for example to see help on them + size = 10, + encoding = "utf-8", -- if encoding is not "utf-8", it will be converted to "utf-8" using `vim.fn.iconv` + auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful. + }, + toggleterm = { + direction = "float", -- 'vertical' | 'horizontal' | 'tab' | 'float' + close_on_exit = false, -- whether close the terminal when exit + auto_scroll = true, -- whether auto scroll to the bottom + singleton = true, -- single instance, autocloses the opened one, if present + }, + overseer = { + new_task_opts = { + strategy = { + "toggleterm", + direction = "horizontal", + autos_croll = true, + quit_on_exit = "success" + } + }, -- options to pass into the `overseer.new_task` command + on_new_task = function(task) + require("overseer").open( + { enter = false, direction = "right" } + ) + end, -- a function that gets overseer.Task when it is created, before calling `task:start` + }, + terminal = { + name = "Main Terminal", + prefix_name = "[CMakeTools]: ", -- This must be included and must be unique, otherwise the terminals will not work. Do not use a simple spacebar " ", or any generic name + split_direction = "horizontal", -- "horizontal", "vertical" + split_size = 11, + + -- Window handling + single_terminal_per_instance = true, -- Single viewport, multiple windows + single_terminal_per_tab = true, -- Single viewport per tab + keep_terminal_static_location = true, -- Static location of the viewport if avialable + auto_resize = true, -- Resize the terminal if it already exists + + -- Running Tasks + start_insert = false, -- If you want to enter terminal with :startinsert upon using :CMakeRun + focus = false, -- Focus on terminal when cmake task is launched. + do_not_add_newline = false, -- Do not hit enter on the command inserted when using :CMakeRun, allowing a chance to review or modify the command before hitting enter. + }, -- terminal executor uses the values in cmake_terminal + }, + }, + cmake_runner = { -- runner to use + name = "terminal", -- name of the runner + opts = {}, -- the options the runner will get, possible values depend on the runner type. See `default_opts` for possible values. + default_opts = { -- a list of default and possible values for runners + quickfix = { + show = "always", -- "always", "only_on_error" + position = "belowright", -- "bottom", "top" + size = 10, + encoding = "utf-8", + auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful. + }, + toggleterm = { + direction = "float", -- 'vertical' | 'horizontal' | 'tab' | 'float' + close_on_exit = false, -- whether close the terminal when exit + auto_scroll = true, -- whether auto scroll to the bottom + singleton = true, -- single instance, autocloses the opened one, if present + }, + overseer = { + new_task_opts = { + strategy = { + "toggleterm", + direction = "horizontal", + autos_croll = true, + quit_on_exit = "success" + } + }, -- options to pass into the `overseer.new_task` command + on_new_task = function(task) + end, -- a function that gets overseer.Task when it is created, before calling `task:start` + }, + terminal = { + name = "Main Terminal", + prefix_name = "[CMakeTools]: ", -- This must be included and must be unique, otherwise the terminals will not work. Do not use a simple spacebar " ", or any generic name + split_direction = "horizontal", -- "horizontal", "vertical" + split_size = 11, + + -- Window handling + single_terminal_per_instance = true, -- Single viewport, multiple windows + single_terminal_per_tab = true, -- Single viewport per tab + keep_terminal_static_location = true, -- Static location of the viewport if avialable + auto_resize = true, -- Resize the terminal if it already exists + + -- Running Tasks + start_insert = false, -- If you want to enter terminal with :startinsert upon using :CMakeRun + focus = false, -- Focus on terminal when cmake task is launched. + do_not_add_newline = false, -- Do not hit enter on the command inserted when using :CMakeRun, allowing a chance to review or modify the command before hitting enter. + }, + }, + }, + cmake_notifications = { + runner = { enabled = true }, + executor = { enabled = true }, + spinner = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }, -- icons used for progress display + refresh_rate_ms = 100, -- how often to iterate icons + }, + cmake_virtual_text_support = true, -- Show the target related to current file using virtual text (at right corner) +} diff --git a/config/nvim/plugin/treesitter.lua b/config/nvim/plugin/treesitter.lua new file mode 100644 index 0000000..55374a0 --- /dev/null +++ b/config/nvim/plugin/treesitter.lua @@ -0,0 +1,65 @@ + + vim.g.no_plugin_maps = true + local ts_parsers = { + "bash", + "dockerfile", + "git_config", "git_rebase", "gitattributes", "gitcommit", "gitignore", + "go", "gomod", "gosum", + "json", "toml", "yaml", + "lua", + "make", + "markdown", + "python", + "terraform", + "vim", "vimdoc", + 'c', + "lua", + "markdown", + "markdown_inline", + "query", + "html", "xml", + "zig", + "typescript", "javascript", "svelte", + "regex", + "rust", + "http", + } + + local nts = require("nvim-treesitter") + nts.install(ts_parsers) + -- vim.api.nvim_create_autocmd('PackChanged', { + -- callback = function() + -- nts.update() + -- end + -- }) + + vim.api.nvim_create_autocmd("FileType", { -- enable treesitter highlighting and indents + callback = function(args) + local filetype = args.match + local lang = vim.treesitter.language.get_lang(filetype) + if vim.treesitter.language.add(lang) then + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + vim.treesitter.start() + end + end + }) + + -- vim.api.nvim_create_autocmd('FileType', { + -- pattern = ts_parsers, + -- callback = function() + -- vim.treesitter.start() + -- end, + -- }) + + -- require('ts-context-commentstring').setup({ + -- enable_autocmd = false + -- }) + + require("treesitter-context").setup({ + mode = "cursor", + max_lines = 3, + multiline_threshold = 1, + separator = '-', + min_window_height = 20, + line_numbers = true, + }) diff --git a/config/nvim/plugin/vim-tmux-navigator.lua b/config/nvim/plugin/vim-tmux-navigator.lua new file mode 100644 index 0000000..baead05 --- /dev/null +++ b/config/nvim/plugin/vim-tmux-navigator.lua @@ -0,0 +1,5 @@ +vim.keymap.set('n', "", "TmuxNavigateLeft" ) +vim.keymap.set('n', "", "TmuxNavigateDown" ) +vim.keymap.set('n', "", "TmuxNavigateUp" ) +vim.keymap.set('n', "", "TmuxNavigateRight" ) +-- vim.keymap.set('n', "", "TmuxNavigatePrevious") diff --git a/config/nvim/plugin/vimtex.lua b/config/nvim/plugin/vimtex.lua new file mode 100644 index 0000000..eafba38 --- /dev/null +++ b/config/nvim/plugin/vimtex.lua @@ -0,0 +1,5 @@ +vim.g.tex_flavor = "latex" +vim.g.vimtex_view_method = "zathura" -- Change to your preferred PDF viewer +vim.g.vimtex_quickfix_mode = 0 -- Disable quickfix window +-- vim.opt.conceallevel = 2 -- Enable concealment for nicer inline math display +vim.g.tex_conceal = "abdmg" -- Conceal accents, bold, delimiters, math, Greek diff --git a/config/nvim/plugin/which-key.lua b/config/nvim/plugin/which-key.lua new file mode 100644 index 0000000..0fc51f7 --- /dev/null +++ b/config/nvim/plugin/which-key.lua @@ -0,0 +1,58 @@ +require('which-key').setup({ + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, + }, + spec = { + { "g", group = "+goto" }, + { "]", group = "+next" }, + { "[", group = "+prev" }, + { "c", group = "+code", mode = { 'n', 'x' } }, + { "b", group = "+buffer" }, + { "f", group = "+find" }, + { "g", group = "+goto" }, + { "k", group = "+obsidian" }, + { "l", group = "+lsp" }, + { "m", group = "+bookmark" }, + { "o", group = "+notes" }, + { "r", group = "+ai" }, + { "s", group = "+search" }, + { "t", group = "+trouble" }, + { "v", group = "+vcs", mode = { 'n', 'v' } }, + { "w", group = "+workspace" }, + { "x", group = "+extra" }, + { "u", group = "+toggle" }, + }, +}) diff --git a/config/nvim/plugin/window-picker.lua b/config/nvim/plugin/window-picker.lua new file mode 100644 index 0000000..118c17c --- /dev/null +++ b/config/nvim/plugin/window-picker.lua @@ -0,0 +1,18 @@ + +require('window-picker').setup({ + -- Default keys to annotate, keys will be used in order. The default uses the + -- most accessible keys from the home row and then top row. + keys = 'alskdjfhgwoeiruty', + -- Swap windows by holding shift + letter + swap_shift = true, + -- Windows containing filetype to exclude + exclude = { qf = true, NvimTree = true, aerial = true }, + -- Flash the cursor line of the newly focused window for 300ms. + -- Set to 0 or false to disable. + flash_duration = 300, +}) + +vim.keymap.set('n', "a", "WindowPick", { desc = "Windows Pick" }) +vim.keymap.set('n', "a", "WindowPick", { desc = "Windows Pick" }) +vim.keymap.set('n', "D", "WindowZap", { desc = "Windows Delete" }) +vim.keymap.set('n', "S", "WindowSwap", { desc = "Windows Swap" }) diff --git a/installer/nvim.sh b/installer/nvim.sh index 91d4684..6e701bf 100755 --- a/installer/nvim.sh +++ b/installer/nvim.sh @@ -7,11 +7,11 @@ fi ${DOTFILES_DIR}/sync-config config/nvim # Set specific app links for current theme -PLUGINS_DIR="${HOME}/.config/nvim/lua/plugins" +PLUGINS_DIR="${HOME}/.config/nvim/plugin" THEMES_DIR="${HOME}/.local/share/themes" mkdir -p ${PLUGINS_DIR} -ln -snf ${THEMES_DIR}/current/theme/neovim.lua ${PLUGINS_DIR}/theme.lua +ln -snf ${THEMES_DIR}/current/theme/neovim-vimpack.lua ${PLUGINS_DIR}/theme.lua uv tool install vectorcode diff --git a/themes/catppuccin-latte/neovim-vimpack.lua b/themes/catppuccin-latte/neovim-vimpack.lua new file mode 100644 index 0000000..2b8ac61 --- /dev/null +++ b/themes/catppuccin-latte/neovim-vimpack.lua @@ -0,0 +1,2 @@ +vim.opt.background = 'light' +vim.cmd("colorscheme catppuccin") diff --git a/themes/catppuccin/neovim-vimpack.lua b/themes/catppuccin/neovim-vimpack.lua new file mode 100644 index 0000000..4437b44 --- /dev/null +++ b/themes/catppuccin/neovim-vimpack.lua @@ -0,0 +1,2 @@ +vim.opt.background = 'dark' +vim.cmd("colorscheme catppuccin") diff --git a/themes/everforest/neovim-vimpack.lua b/themes/everforest/neovim-vimpack.lua new file mode 100644 index 0000000..53b47e9 --- /dev/null +++ b/themes/everforest/neovim-vimpack.lua @@ -0,0 +1,2 @@ +vim.pack.add({{ src = 'https://github.com/neanias/everforest-nvim' }}) +vim.cmd('colorscheme everforest') diff --git a/themes/gruvbox/neovim-vimpack.lua b/themes/gruvbox/neovim-vimpack.lua new file mode 100644 index 0000000..1389bcf --- /dev/null +++ b/themes/gruvbox/neovim-vimpack.lua @@ -0,0 +1,9 @@ +vim.pack.add({{ src = 'https://github.com/ellisonleao/gruvbox.nvim' }}) + +require("gruvbox").setup({ + contrast = "hard", + transparent_mode = true, +}) + +vim.opt.background = 'dark' +vim.cmd("colorscheme gruvbox") diff --git a/themes/kanagawa/neovim-vimpack.lua b/themes/kanagawa/neovim-vimpack.lua new file mode 100644 index 0000000..6e9c459 --- /dev/null +++ b/themes/kanagawa/neovim-vimpack.lua @@ -0,0 +1,2 @@ +vim.pack.add({{ src = 'https://github.com/rebelot/kanagawa.nvim' }}) +vim.cmd('colorscheme kanagawa') diff --git a/themes/matte-black/neovim-vimpack.lua b/themes/matte-black/neovim-vimpack.lua new file mode 100644 index 0000000..745c56f --- /dev/null +++ b/themes/matte-black/neovim-vimpack.lua @@ -0,0 +1,2 @@ +vim.pack.add({{ src = 'https://github.com/tahayvr/matteblack.nvim'}}) +vim.cmd('colorscheme matteblack') diff --git a/themes/nord/neovim-vimpack.lua b/themes/nord/neovim-vimpack.lua new file mode 100644 index 0000000..83fae28 --- /dev/null +++ b/themes/nord/neovim-vimpack.lua @@ -0,0 +1,2 @@ +vim.pack.add({{ src = 'https://github.com/EdenEast/nightfox.nvim'}}) +vim.cmd("colorscheme nightfox") diff --git a/themes/osaka-jade/neovim-vimpack.lua b/themes/osaka-jade/neovim-vimpack.lua new file mode 100644 index 0000000..2d61a19 --- /dev/null +++ b/themes/osaka-jade/neovim-vimpack.lua @@ -0,0 +1,3 @@ +vim.pack.add({{ src = 'https://github.com/ribru17/bamboo.nvim'}}) +require('bamboo').setup({}) +vim.cmd('colorscheme bamboo') diff --git a/themes/ristretto/neovim-vimpack.lua b/themes/ristretto/neovim-vimpack.lua new file mode 100644 index 0000000..47978e8 --- /dev/null +++ b/themes/ristretto/neovim-vimpack.lua @@ -0,0 +1,20 @@ +vim.pack.add({{ src = 'https://github.com/gthelding/monokai-pro.nvim'}}) + +require("monokai-pro").setup({ + filter = "ristretto", + override = function() + return { + NonText = { fg = "#948a8b" }, + MiniIconsGrey = { fg = "#948a8b" }, + MiniIconsRed = { fg = "#fd6883" }, + MiniIconsBlue = { fg = "#85dacc" }, + MiniIconsGreen = { fg = "#adda78" }, + MiniIconsYellow = { fg = "#f9cc6c" }, + MiniIconsOrange = { fg = "#f38d70" }, + MiniIconsPurple = { fg = "#a8a9eb" }, + MiniIconsAzure = { fg = "#a8a9eb" }, + MiniIconsCyan = { fg = "#85dacc" }, -- same value as MiniIconsBlue for consistency + } + end, +}) +vim.cmd('colorscheme monokai-pro') diff --git a/themes/rose-pine/neovim-vimpack.lua b/themes/rose-pine/neovim-vimpack.lua new file mode 100644 index 0000000..b760778 --- /dev/null +++ b/themes/rose-pine/neovim-vimpack.lua @@ -0,0 +1,3 @@ +vim.opt.background = 'light' +vim.pack.add({{ src = 'https://github.com/rose-pine/neovim', name = 'rose-pine' }}) +vim.cmd("colorscheme rose-pine-dawn") diff --git a/themes/tokyo-night/neovim-vimpack.lua b/themes/tokyo-night/neovim-vimpack.lua new file mode 100644 index 0000000..8b1a426 --- /dev/null +++ b/themes/tokyo-night/neovim-vimpack.lua @@ -0,0 +1,12 @@ +vim.pack.add({{ src = 'https://github.com/folke/tokyonight.nvim' }}) +require("tokyonight").setup({ + style = "night", + transparent = true, + terminal_colors = true, + styles = { + sidebars = "transparent", + floats = "transparent", + }, +}) + +vim.cmd("colorscheme tokyonight")