summaryrefslogtreecommitdiff
path: root/vim/.config/nvim/lua
diff options
context:
space:
mode:
authorGrace Yoder <grace_yoder@outlook.com>2026-03-23 19:19:54 -0400
committerGrace Yoder <grace_yoder@outlook.com>2026-03-23 19:19:54 -0400
commit70a1581228f838b03545a4295aa6adf67b67c2a8 (patch)
tree7a9ba8ffc9a109c0fcc6571e9df939950f05b50d /vim/.config/nvim/lua
parenta34e41df2ef5208843b67f67da8d61fbba12f0fd (diff)
nvim overhaul
Diffstat (limited to 'vim/.config/nvim/lua')
-rw-r--r--vim/.config/nvim/lua/native-lsp.lua4
-rw-r--r--vim/.config/nvim/lua/packed.lua127
-rw-r--r--vim/.config/nvim/lua/plugins.lua (renamed from vim/.config/nvim/lua/plugins/init.lua)163
-rw-r--r--vim/.config/nvim/lua/plugins/blink_config.lua11
-rw-r--r--vim/.config/nvim/lua/plugins/lualine-config.lua4
-rw-r--r--vim/.config/nvim/lua/plugins/marks-config.lua36
-rw-r--r--vim/.config/nvim/lua/plugins/rust-config.lua34
-rw-r--r--vim/.config/nvim/lua/plugins/ts.lua41
-rw-r--r--vim/.config/nvim/lua/remap.lua57
-rw-r--r--vim/.config/nvim/lua/westwood-lint.lua9
10 files changed, 194 insertions, 292 deletions
diff --git a/vim/.config/nvim/lua/native-lsp.lua b/vim/.config/nvim/lua/native-lsp.lua
index 33c9c01..ee97f80 100644
--- a/vim/.config/nvim/lua/native-lsp.lua
+++ b/vim/.config/nvim/lua/native-lsp.lua
@@ -88,6 +88,10 @@ vim.lsp.enable("fish-lsp")
+vim.diagnostic.config({
+ virtual_text = { priority = 100 },
+})
+
-- https://lsp-zero.netlify.app/blog/lsp-client-features.html
vim.opt.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' }
diff --git a/vim/.config/nvim/lua/packed.lua b/vim/.config/nvim/lua/packed.lua
new file mode 100644
index 0000000..28a21cc
--- /dev/null
+++ b/vim/.config/nvim/lua/packed.lua
@@ -0,0 +1,127 @@
+--
+-- Packed: a single file, somewhat compatible Packer replacement
+-- Written by grace
+--
+
+local function resolve_src(s)
+ if s:match("^https?://") then
+ return s
+ end
+ if s:match("^[%w%-]+/[%w%-_.]+$") then
+ return "https://github.com/" .. s
+ end
+ return s
+end
+
+local function normalize_plugin(p)
+ if type(p) == "string" then
+ return {
+ src = resolve_src(p),
+ name = p:match(".*/(.*)"),
+ }
+ end
+
+ if type(p[1]) == "string" then
+ p.src = resolve_src(p[1])
+ p[1] = nil
+ end
+
+ if p.src then
+ p.src = resolve_src(p.src)
+ end
+
+ if not p.name and p.as then
+ p.name = p.as
+ end
+
+ if not p.version then
+ if p.commit then
+ p.version = p.commit
+ elseif p.tag then
+ p.version = p.tag
+ elseif p.branch then
+ p.version = p.branch
+ end
+ end
+
+
+
+ local unsupported = {
+ 'disable', 'installer', 'updater', 'after', 'rtp',
+ 'opt', 'bufread', 'lock', 'run', 'requires', 'rocks', 'setup'
+ }
+
+ for _, field in ipairs(unsupported) do
+ if p[field] then
+ vim.notify("Packed does not support `" .. field .. "`: " .. (p.name or p.src), vim.log.levels.WARN)
+ vim.api.nvim_echo({ { "Press Enter to continue...", "MoreMsg" } }, false, {})
+ vim.fn.getchar()
+ end
+ end
+
+ if p.cmd or p.ft or p.keys or p.event or p.fn or p.cond or p.module or p.module_pattern then
+ vim.notify("Packed does not support lazy loading: " .. (p.name or p.src), vim.log.levels.WARN)
+ vim.api.nvim_echo({ { "Press Enter to continue...", "MoreMsg" } }, false, {})
+ vim.fn.getchar()
+ end
+
+
+
+ return p
+end
+
+local function setup_plugins(plugs)
+ local plugins = {}
+
+ if type(plugs) == "function" then
+ local function use(p)
+ table.insert(plugins, p)
+ end
+
+ plugs(use)
+ else
+ plugins = plugs
+ end
+ local specs = {}
+
+ for _, p in ipairs(plugins) do
+ p = normalize_plugin(p)
+
+ local spec = vim.deepcopy(p)
+ spec.config = nil
+
+ table.insert(specs, spec)
+ end
+
+ vim.pack.add(specs, { confirm = true, load = true })
+
+
+ for _, p in ipairs(plugins) do
+ if type(p) ~= "string" and p.config then
+ local ok = pcall(p.config)
+ if not ok then
+ vim.notify("Config failed: " .. (p.name or p.src), vim.log.levels.ERROR)
+ vim.api.nvim_echo({ { "Press Enter to continue...", "MoreMsg" } }, false, {})
+ vim.fn.getchar()
+ end
+ end
+ end
+
+
+ local unused = vim.iter(vim.pack.get())
+ :filter(function(p)
+ return not p.active
+ end)
+ :map(function(p)
+ return p.spec.name
+ end)
+ :totable()
+
+ vim.pack.del(unused)
+end
+
+
+local r = {}
+r.setup = setup_plugins
+
+return r
diff --git a/vim/.config/nvim/lua/plugins/init.lua b/vim/.config/nvim/lua/plugins.lua
index 574aaf0..dcdf5df 100644
--- a/vim/.config/nvim/lua/plugins/init.lua
+++ b/vim/.config/nvim/lua/plugins.lua
@@ -1,39 +1,9 @@
-vim.cmd [[packadd packer.nvim]]
+-- vim.pack.update(nil, { target = 'lockfile' })
-local ensure_packer = function()
- local fn = vim.fn
- local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
- if fn.empty(fn.glob(install_path)) > 0 then
- fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
- vim.cmd [[packadd packer.nvim]]
- return true
- end
- return false
-end
-
-local packer_bootstrap = ensure_packer()
-
-return require('packer').startup(function(use)
- use 'wbthomason/packer.nvim'
-
- -- use "neovim/nvim-lspconfig"
-
- use {
- 'maxmx03/solarized.nvim',
- config = function()
- vim.o.background = 'dark'
- ---@type solarized
- local solarized = require('solarized')
- vim.o.termguicolors = true
- vim.o.background = 'dark'
- solarized.setup({})
- -- vim.cmd.colorscheme 'solarized'
- end
- }
+return require("packed").setup(function(use)
+ use 'nvim-lua/plenary.nvim'
use {
'nvim-telescope/telescope.nvim',
- requires = { { 'nvim-lua/plenary.nvim' } },
- run = ":TSUpdate",
config = function()
require('telescope').setup({
defaults = {
@@ -58,7 +28,6 @@ return require('packer').startup(function(use)
use {
'nvim-treesitter/nvim-treesitter',
branch = 'main',
- run = ':TSUpdate',
config = function()
require('nvim-treesitter').setup()
@@ -83,41 +52,38 @@ return require('packer').startup(function(use)
use 'mbbill/undotree'
+ use 'nvim-tree/nvim-web-devicons'
use 'mfussenegger/nvim-lint'
use {
'nvim-lualine/lualine.nvim',
- requires = { 'nvim-tree/nvim-web-devicons', opt = true },
- config = function() require('plugins/lualine-config') end
+ config = function()
+ require('lualine').setup {
+ options = { theme = "rose-pine" }
+ }
+ end
}
- -- use {
- -- 'm4xshen/autoclose.nvim',
- -- config = function() require("autoclose").setup() end
- -- }
- --
+
+ -- grrr why does neovim not have this?
use {
"windwp/nvim-autopairs",
- event = "InsertEnter",
config = function()
require("nvim-autopairs").setup {}
end
}
- use {
- 'CRAG666/betterTerm.nvim',
- config = function() require('betterTerm').setup() end
- }
-
+ use { "akinsho/toggleterm.nvim", config = function()
+ require("toggleterm").setup {
+ size = 30
+ }
+ vim.keymap.set({ "n", "t", "v" }, "<leader>tt", require("toggleterm").toggle, { desc = "Toggle terminal" })
+ end }
+ use { 'nvim-telescope/telescope.nvim' }
use {
'anurag3301/nvim-platformio.lua',
- requires = {
- { 'akinsho/nvim-toggleterm.lua' },
- { 'nvim-telescope/telescope.nvim' },
- { 'nvim-lua/plenary.nvim' },
- },
config = function()
if not vim.g.is_purdue then
require('platformio').setup({
- lsp = "clangd" --default: ccls, other option: clangd
+ lsp = "ccls" --default: ccls, other option: clangd
-- If you pick clangd, it also creates compile_commands.json
})
end
@@ -126,30 +92,26 @@ return require('packer').startup(function(use)
use {
"chentoast/marks.nvim",
- config = function() require('plugins/marks-config') end
- }
-
- use {
- "nvim-neo-tree/neo-tree.nvim",
- branch = "v3.x",
- requires = {
- "nvim-lua/plenary.nvim",
- "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
- "MunifTanjim/nui.nvim",
- -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
- }
+ config = function() require('marks').setup() end
}
-
- use { "nvim-tree/nvim-web-devicons" }
- use { "MunifTanjim/nui.nvim" }
+ -- use { "MunifTanjim/nui.nvim" }
use { 'rafamadriz/friendly-snippets' }
use {
'saghen/blink.cmp',
- run = 'cargo build --release',
+ version = 'v1.10.1',
config = function()
- require("plugins/blink_config")
+ require("blink.cmp").setup({
+ fuzzy = {
+ implementation = "prefer_rust_with_warning",
+ prebuilt_binaries = {
+ download = true,
+ force_version = "v1.*"
+ },
+ },
+ keymap = { preset = "enter" },
+ })
end
}
@@ -162,17 +124,6 @@ return require('packer').startup(function(use)
end
}
- -- use {
- -- 'mrcjkb/rustaceanvim',
- -- config = function() require('plugins/rust-config') end
- -- }
-
- use {
- "NeogitOrg/neogit",
- config = function()
- require("neogit").setup {}
- end
- }
use {
"mfussenegger/nvim-dap",
@@ -180,12 +131,12 @@ return require('packer').startup(function(use)
config = function()
local dap = require("dap")
- require('dap.ext.vscode').load_launchjs(nil, {
- node = { 'javascript', 'typescript' },
- python = { 'python' },
- go = { 'go' },
- codelldb = { 'c', 'cpp', 'rust' }
- })
+ -- require('dap.ext.vscode').load_launchjs(nil, {
+ -- node = { 'javascript', 'typescript' },
+ -- python = { 'python' },
+ -- go = { 'go' },
+ -- codelldb = { 'c', 'cpp', 'rust' }
+ -- })
vim.keymap.set('n', '<M-u>', function() dap.continue() end, { desc = 'DAP: Continue' })
vim.keymap.set('n', '<M-i>', function() dap.step_into() end, { desc = 'DAP: Step Into' })
@@ -224,9 +175,9 @@ return require('packer').startup(function(use)
config = function() require('overseer').setup() end
}
use 'theHamsta/nvim-dap-virtual-text'
+ use "nvim-neotest/nvim-nio"
use {
"rcarriga/nvim-dap-ui",
- requires = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
config = function()
local dap, dapui = require("dap"), require("dapui")
dapui.setup()
@@ -247,10 +198,6 @@ return require('packer').startup(function(use)
use { "geigerzaehler/tree-sitter-jinja2" }
- use "echasnovski/mini.base16"
-
- use 'rktjmp/lush.nvim'
-
use {
"rose-pine/neovim",
as = "rose-pine",
@@ -264,56 +211,32 @@ return require('packer').startup(function(use)
use {
'chomosuke/typst-preview.nvim',
- tag = 'v1.*',
config = function()
require 'typst-preview'.setup {}
end,
}
- -- use "folke/which-key.nvim"
use({
- "andrewferrier/wrapping.nvim",
+ "iamcco/markdown-preview.nvim",
config = function()
- require("wrapping").setup()
+ vim.api.nvim_create_user_command("MDPreviewInstall", function()
+ vim.vim.fn["mkdp#util#install"]()
+ end, {})
end,
})
- use({
- "iamcco/markdown-preview.nvim",
- run = function() vim.fn["mkdp#util#install"]() end,
- })
-
-
- -- use {
- -- 'preservim/vim-pencil',
- -- config = function()
- -- vim.cmd([[
- -- augroup PencilSetup
- -- autocmd!
- -- autocmd FileType markdown,text,tex,gitcommit setlocal formatoptions+=t
- -- autocmd FileType markdown,text,tex,gitcommit PencilHard
- -- augroup END augroup END
- -- ]])
- -- end
- -- }
use {
'LukasPietzschmann/telescope-tabs',
- requires = { 'nvim-telescope/telescope.nvim' },
config = function()
require 'telescope-tabs'.setup {
-- Your custom config :^)
}
end
}
-
use "HiPhish/rainbow-delimiters.nvim"
------------------------
-
- if packer_bootstrap then
- require('packer').sync()
- end
end)
diff --git a/vim/.config/nvim/lua/plugins/blink_config.lua b/vim/.config/nvim/lua/plugins/blink_config.lua
deleted file mode 100644
index 00d5a59..0000000
--- a/vim/.config/nvim/lua/plugins/blink_config.lua
+++ /dev/null
@@ -1,11 +0,0 @@
-require("blink.cmp").setup({
- fuzzy = {
- implementation = "lua",
- prebuilt_binaries = {
- download = true,
- force_version = 'v1.2.0',
- },
- },
- keymap = { preset = "enter" },
-})
-
diff --git a/vim/.config/nvim/lua/plugins/lualine-config.lua b/vim/.config/nvim/lua/plugins/lualine-config.lua
deleted file mode 100644
index fe47e43..0000000
--- a/vim/.config/nvim/lua/plugins/lualine-config.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-require('lualine').setup {
- options = { theme = "rose-pine" }
-}
-
diff --git a/vim/.config/nvim/lua/plugins/marks-config.lua b/vim/.config/nvim/lua/plugins/marks-config.lua
deleted file mode 100644
index d1b4c82..0000000
--- a/vim/.config/nvim/lua/plugins/marks-config.lua
+++ /dev/null
@@ -1,36 +0,0 @@
-require'marks'.setup {
- -- whether to map keybinds or not. default true
- default_mappings = true,
- -- which builtin marks to show. default {}
- builtin_marks = { ".", "<", ">", "^" },
- -- whether movements cycle back to the beginning/end of buffer. default true
- cyclic = true,
- -- whether the shada file is updated after modifying uppercase marks. default false
- force_write_shada = false,
- -- how often (in ms) to redraw signs/recompute mark positions.
- -- higher values will have better performance but may cause visual lag,
- -- while lower values may cause performance penalties. default 150.
- refresh_interval = 250,
- -- sign priorities for each type of mark - builtin marks, uppercase marks, lowercase
- -- marks, and bookmarks.
- -- can be either a table with all/none of the keys, or a single number, in which case
- -- the priority applies to all marks.
- -- default 10.
- sign_priority = { lower=10, upper=15, builtin=8, bookmark=20 },
- -- disables mark tracking for specific filetypes. default {}
- excluded_filetypes = {},
- -- disables mark tracking for specific buftypes. default {}
- excluded_buftypes = {},
- -- marks.nvim allows you to configure up to 10 bookmark groups, each with its own
- -- sign/virttext. Bookmarks can be used to group together positions and quickly move
- -- across multiple buffers. default sign is '!@#$%^&*()' (from 0 to 9), and
- -- default virt_text is "".
- bookmark_0 = {
- sign = "⚑",
- virt_text = "hello world",
- -- explicitly prompt for a virtual line annotation when setting a bookmark from this group.
- -- defaults to false.
- annotate = false,
- },
- mappings = {}
-}
diff --git a/vim/.config/nvim/lua/plugins/rust-config.lua b/vim/.config/nvim/lua/plugins/rust-config.lua
deleted file mode 100644
index c52d382..0000000
--- a/vim/.config/nvim/lua/plugins/rust-config.lua
+++ /dev/null
@@ -1,34 +0,0 @@
-local bufnr = vim.api.nvim_get_current_buf()
-vim.keymap.set(
- "n",
- "<leader>a",
- function()
- vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping
- -- or vim.lsp.buf.codeAction() if you don't want grouping.
- end,
- { silent = true, buffer = bufnr }
-)
-vim.keymap.set(
- "n",
- "K",
- function()
- if vim.bo.filetype == "rust" then
- vim.cmd.RustLsp({'hover', 'actions'})
- else
- vim.lsp.buf.hover()
- end
- end,
- { silent = true, buffer = bufnr }
-)
-
-vim.g.rustaceanvim = {
- server = {
- settings = {
- ["rust-analyzer"] = {
- checkOnSave = {
- command = "clippy",
- },
- },
- },
- },
-}
diff --git a/vim/.config/nvim/lua/plugins/ts.lua b/vim/.config/nvim/lua/plugins/ts.lua
deleted file mode 100644
index 5f1b8b0..0000000
--- a/vim/.config/nvim/lua/plugins/ts.lua
+++ /dev/null
@@ -1,41 +0,0 @@
-require'nvim-treesitter.configs'.setup {
- -- A list of parser names, or "all" (the listed parsers MUST always be installed)
- ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" },
-
- -- Install parsers synchronously (only applied to `ensure_installed`)
- sync_install = false,
-
- -- Automatically install missing parsers when entering buffer
- -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
- auto_install = true,
-
- -- List of parsers to ignore installing (or "all")
- -- ignore_install = { "javascript" },
-
- ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
- -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
-
- highlight = {
- enable = true,
-
- -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
- -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
- -- the name of the parser)
- -- list of language that will be disabled
- -- disable = { "c", "rust" },
- -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
- disable = function(lang, buf)
- local max_filesize = 100 * 1024 -- 100 KB
- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
- if ok and stats and stats.size > max_filesize then
- return true
- end
- end,
-
- -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
- -- Using this option may slow down your editor, and you may see some duplicate highlights.
- -- Instead of true it can also be a list of languages
- additional_vim_regex_highlighting = false,
- },
-}
diff --git a/vim/.config/nvim/lua/remap.lua b/vim/.config/nvim/lua/remap.lua
index 1f8964e..0128949 100644
--- a/vim/.config/nvim/lua/remap.lua
+++ b/vim/.config/nvim/lua/remap.lua
@@ -57,45 +57,18 @@ vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)
-- Better Term
-local betterTerm = require('betterTerm')
--- toggle firts term
-vim.keymap.set({ "n", "t" }, "<leader>tt", betterTerm.open, { desc = "Open terminal" })
--- Select term focus
--- vim.keymap.set({"n"}, "<leader>tf", betterTerm.select, { desc = "Select terminal"})
--- Create new term
-local current = 2
-vim.keymap.set(
- { "n" }, "<leader>tn",
- function()
- betterTerm.open(current)
- current = current + 1
- end,
- { desc = "New terminal" }
-)
-
--- Neotree
-
-local ntc = require('neo-tree.command')
-vim.keymap.set('n', '<C-b>', function()
- local reveal_file = vim.fn.expand('%:p')
- if (reveal_file == '') then
- reveal_file = vim.fn.getcwd()
- else
- local f = io.open(reveal_file, "r")
- if (f) then
- f.close(f)
- else
- reveal_file = vim.fn.getcwd()
- end
- end
- ntc.execute({
- action = "focus", -- OPTIONAL, this is the default value
- source = "filesystem", -- OPTIONAL, this is the default value
- position = "right", -- OPTIONAL, this is the default value
- reveal_file = reveal_file, -- path to file or folder to reveal
- reveal_force_cwd = true, -- change cwd without asking if needed
- toggle = true,
- })
- end,
- { desc = "Show Sidebar" }
-)
+-- local betterTerm = require('betterTerm')
+-- -- toggle firts term
+-- vim.keymap.set({ "n", "t" }, "<leader>tt", betterTerm.open, { desc = "Open terminal" })
+-- -- Select term focus
+-- -- vim.keymap.set({"n"}, "<leader>tf", betterTerm.select, { desc = "Select terminal"})
+-- -- Create new term
+-- local current = 2
+-- vim.keymap.set(
+-- { "n" }, "<leader>tn",
+-- function()
+-- betterTerm.open(current)
+-- current = current + 1
+-- end,
+-- { desc = "New terminal" }
+-- )
diff --git a/vim/.config/nvim/lua/westwood-lint.lua b/vim/.config/nvim/lua/westwood-lint.lua
index 0ffc8d8..04501b2 100644
--- a/vim/.config/nvim/lua/westwood-lint.lua
+++ b/vim/.config/nvim/lua/westwood-lint.lua
@@ -1,18 +1,19 @@
local lint = require("lint")
-local errorformat = "%WWARNING: %m,%Z%\\s%\\s%\\s%\\s%\\s%\\s%\\s%\\s%\\sat (stdin) from line %l column %c to line %e column %k"
+local errorformat =
+"%WWARNING: %m,%Z%\\s%\\s%\\s%\\s%\\s%\\s%\\s%\\s%\\sat (stdin) from line %l column %c to line %e column %k"
lint.linters.westwood = {
cmd = '/homes/kkasad/share/westwood',
stdin = true,
- args = {'-f', 'machine', '-'},
+ args = { '-f', 'machine', '-' },
stream = both,
ignore_exitcode = false,
env = nil,
parser = require('lint.parser').from_errorformat(errorformat)
}
-lint.linters_by_ft.c = {"westwood", "clangtidy"}
-lint.linters_by_ft.cpp = {"westwood"}
+lint.linters_by_ft.c = { "westwood", "clangtidy" }
+lint.linters_by_ft.cpp = { "westwood" }
vim.list_extend(lint.linters_by_ft.c, { "westwood", "clangtidy" })
vim.list_extend(lint.linters_by_ft.cpp, { "westwood" })