feat(nvim): final simplication;

This commit is contained in:
Barrett Ruth 2026-03-01 12:55:32 -05:00
parent 6f664a27bd
commit 060cb3d7a8
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
19 changed files with 46 additions and 163 deletions

View file

@ -1,2 +1 @@
vim.o.shiftwidth = 2
vim.o.makeprg = 'node %'

View file

@ -1 +0,0 @@
vim.o.makeprg = 'python %'

View file

@ -1 +0,0 @@
vim.o.makeprg = 'cargo run'

View file

@ -1 +0,0 @@
vim.o.makeprg = 'sh %'

View file

@ -1,3 +1,4 @@
-- TODO: move to barrettruth/render.nvim
vim.keymap.set('n', '<leader>t', function()
if vim.fn.executable('sioyek') ~= 1 then
return vim.notify('sioyek not found', vim.log.levels.ERROR)

View file

@ -18,7 +18,6 @@ vim.diagnostic.config({
vim.lsp.config('*', {
on_attach = lsp.on_attach,
flags = { debounce_text_changes = 0 },
})
for _, server in ipairs({

View file

@ -2,7 +2,7 @@ vim.g.mapleader = ' '
vim.g.lz_n = {
load = function(name)
vim.cmd('packadd! ' .. (name:match('[^/]+$') or name))
vim.cmd.packadd((name:match('[^/]+$') or name))
end,
}

View file

@ -4,7 +4,7 @@ local Methods = vim.lsp.protocol.Methods
function M.on_attach(client, bufnr)
if client:supports_method(Methods.textDocument_hover) then
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = 0 })
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = bufnr })
end
local ok, _ = pcall(require, 'fzf-lua')
@ -67,7 +67,7 @@ function M.on_attach(client, bufnr)
for _, m in ipairs(mappings) do
local method, key, cmd = unpack(m)
if client:supports_method(method) then
vim.keymap.set('n', key, cmd, { buffer = 0 })
vim.keymap.set('n', key, cmd, { buffer = bufnr })
end
end
end

View file

@ -1,101 +0,0 @@
local M = {}
local projects = {
{
name = 'bmath',
paths = { vim.env.HOME .. '/dev/bmath' },
cmd = 'cmake -B build -DCMAKE_BUILD_TYPE=Debug && cmake --build build && ctest --test-dir build --output-on-failure',
},
{
name = 'neovim',
paths = { vim.env.HOME .. '/dev/neovim' },
cmd = 'make',
},
{
name = 'barrettruth.com',
paths = { vim.env.HOME .. '/dev/barrettruth.com' },
cmd = 'pnpm dev',
},
{
name = 'philipmruth.com',
paths = { vim.env.HOME .. '/dev/philipmruth.com' },
cmd = 'pnpm dev',
},
}
---@type overseer.Task|nil
local current_task = nil
local actions = {
nvim = function()
local ok, oil = pcall(require, 'oil')
if not ok then
return
end
oil.open()
end,
git = function()
vim.cmd.Git()
vim.cmd.only()
end,
run = function()
local ok, overseer = pcall(require, 'overseer')
if not ok then
return
end
local cwd = vim.fn.getcwd()
local match = nil
for _, p in ipairs(projects) do
if vim.tbl_contains(p.paths, cwd) then
match = p
break
end
end
if not match then
vim.notify_once(
'No task defined for this project',
vim.log.levels.WARN
)
vim.cmd('q!')
return
end
if
current_task
and (current_task.cwd ~= cwd or current_task.name ~= match.name)
then
if current_task:is_running() then
current_task:stop()
end
current_task:dispose(true)
current_task = nil
end
if not current_task or not current_task:is_running() then
current_task = overseer.new_task({
name = match.name,
cmd = match.cmd,
cwd = cwd,
env = match.env,
})
current_task:start()
end
current_task:open_output()
end,
}
function M.run(subcmd)
if not subcmd then
error('No subcommand provided')
end
if not vim.tbl_contains(vim.tbl_keys(actions), subcmd) then
error('Invalid subcommand: ' .. subcmd)
end
actions[subcmd]()
end
return M

View file

@ -1,9 +0,0 @@
return {
on_attach = function(_, bufnr)
require('config.lsp').on_attach(_, bufnr)
local bufname = vim.api.nvim_buf_get_name(bufnr)
if string.match(bufname, '%.env') then
vim.diagnostic.enable(false, { bufnr = bufnr })
end
end,
}

View file

@ -1,18 +1,3 @@
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and client.name == 'clangd' then
vim.keymap.set(
'n',
'gh',
vim.cmd.ClangdSwitchSourceHeader,
{ buffer = args.buf }
)
end
end,
group = vim.api.nvim_create_augroup('AClangdKeymap', { clear = true }),
})
return {
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
cmd = {

View file

@ -1,11 +1,11 @@
vim.pack.add({
{ src = 'https://github.com/saghen/blink.cmp', load = false },
{ src = 'https://github.com/Kaiser-Yang/blink-cmp-git', load = false },
{ src = 'https://github.com/bydlw98/blink-cmp-env', load = false },
{ src = 'https://github.com/barrettruth/blink-cmp-ssh', load = false },
{ src = 'https://github.com/barrettruth/blink-cmp-tmux', load = false },
{ src = 'https://github.com/barrettruth/blink-cmp-ghostty', load = false },
})
'https://github.com/saghen/blink.cmp',
'https://github.com/Kaiser-Yang/blink-cmp-git',
'https://github.com/bydlw98/blink-cmp-env',
'https://github.com/barrettruth/blink-cmp-ssh',
'https://github.com/barrettruth/blink-cmp-tmux',
'https://github.com/barrettruth/blink-cmp-ghostty',
}, { load = function() end })
local pack_dir = vim.fn.stdpath('data') .. '/site/pack/core/opt'
local blink_dir = pack_dir .. '/blink.cmp'
@ -35,6 +35,13 @@ return {
'saghen/blink.cmp',
event = { 'InsertEnter', 'LspAttach' },
keys = { { '<c-n>', mode = 'i' } },
before = function()
vim.cmd.packadd('blink-cmp-git')
vim.cmd.packadd('blink-cmp-env')
vim.cmd.packadd('blink-cmp-ssh')
vim.cmd.packadd('blink-cmp-tmux')
vim.cmd.packadd('blink-cmp-ghostty')
end,
after = function()
---@module 'blink.cmp'
---@type blink.cmp.Config

View file

@ -1,6 +1,6 @@
vim.pack.add({
{ src = 'https://github.com/ibhagwan/fzf-lua', load = false },
})
'https://github.com/ibhagwan/fzf-lua',
}, { load = function() end })
return {
'ibhagwan/fzf-lua',

View file

@ -1,7 +1,7 @@
vim.pack.add({
{ src = 'https://github.com/tpope/vim-fugitive', load = false },
{ src = 'https://github.com/lewis6991/gitsigns.nvim', load = false },
})
'https://github.com/tpope/vim-fugitive',
'https://github.com/lewis6991/gitsigns.nvim',
}, { load = function() end })
---@return string
local function file_loc()

View file

@ -1,7 +1,7 @@
vim.pack.add({
{ src = 'https://github.com/nvimdev/guard.nvim', load = false },
{ src = 'https://github.com/nvimdev/guard-collection', load = false },
})
'https://github.com/nvimdev/guard.nvim',
'https://github.com/nvimdev/guard-collection',
}, { load = function() end })
return {
'nvimdev/guard.nvim',

View file

@ -1,9 +1,12 @@
vim.pack.add({
'https://github.com/neovim/nvim-lspconfig',
{ src = 'https://github.com/folke/lazydev.nvim', load = false },
{ src = 'https://github.com/saecki/live-rename.nvim', load = false },
})
vim.pack.add({
'https://github.com/folke/lazydev.nvim',
'https://github.com/saecki/live-rename.nvim',
}, { load = function() end })
return {
{
'neovim/nvim-lspconfig',

View file

@ -1,15 +1,15 @@
vim.pack.add({
{ src = 'https://github.com/echasnovski/mini.ai', load = false },
{ src = 'https://github.com/monaqa/dial.nvim', load = false },
{ src = 'https://github.com/catgoose/nvim-colorizer.lua', load = false },
{ src = 'https://github.com/echasnovski/mini.pairs', load = false },
{ src = 'https://github.com/echasnovski/mini.misc', load = false },
{ src = 'https://github.com/nvim-mini/mini.bufremove', load = false },
{ src = 'https://github.com/tpope/vim-abolish', load = false },
{ src = 'https://github.com/tpope/vim-sleuth', load = false },
{ src = 'https://github.com/kylechui/nvim-surround', load = false },
{ src = 'https://github.com/lervag/vimtex', load = false },
})
'https://github.com/echasnovski/mini.ai',
'https://github.com/monaqa/dial.nvim',
'https://github.com/catgoose/nvim-colorizer.lua',
'https://github.com/echasnovski/mini.pairs',
'https://github.com/echasnovski/mini.misc',
'https://github.com/nvim-mini/mini.bufremove',
'https://github.com/tpope/vim-abolish',
'https://github.com/tpope/vim-sleuth',
'https://github.com/kylechui/nvim-surround',
'https://github.com/lervag/vimtex',
}, { load = function() end })
return {
{

View file

@ -1,9 +1,12 @@
vim.pack.add({
'https://github.com/nvim-treesitter/nvim-treesitter',
'https://github.com/nvim-treesitter/nvim-treesitter-textobjects',
{ src = 'https://github.com/Wansmer/treesj', load = false },
})
vim.pack.add({
'https://github.com/Wansmer/treesj',
}, { load = function() end })
vim.api.nvim_create_autocmd('PackChanged', {
callback = function(ev)
local name, kind = ev.data.spec.name, ev.data.kind