feat: more stuf

This commit is contained in:
Barrett Ruth 2026-02-16 21:27:03 -05:00
parent 24b6fdb455
commit 828352781f
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
14 changed files with 84 additions and 39 deletions

View file

@ -27,7 +27,13 @@ vim.lsp.config('*', {
flags = { debounce_text_changes = 0 }, flags = { debounce_text_changes = 0 },
}) })
map({ { 'n', 'x' }, 'gF', lsp.format }) map({
{ 'n', 'x' },
'gF',
function()
vim.lsp.buf.format({ async = true })
end,
})
for _, server in ipairs({ for _, server in ipairs({
'bashls', 'bashls',

View file

@ -5,6 +5,6 @@ vim.filetype.add({
}, },
filename = { filename = {
['requirements.txt'] = 'config', ['requirements.txt'] = 'config',
dunstrc = 'dosini' dunstrc = 'dosini',
}, },
}) })

View file

@ -42,15 +42,22 @@ for _, plugin in ipairs(disabled_plugins) do
vim.g['loaded_' .. plugin] = 1 vim.g['loaded_' .. plugin] = 1
end end
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git" local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) local out = vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'--branch=stable',
lazyrepo,
lazypath,
})
if vim.v.shell_error ~= 0 then if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({ vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" }, { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
{ out, "WarningMsg" }, { out, 'WarningMsg' },
{ "\nPress any key to exit..." }, { '\nPress any key to exit...' },
}, true, {}) }, true, {})
vim.fn.getchar() vim.fn.getchar()
os.exit(1) os.exit(1)

View file

@ -128,7 +128,6 @@ function M.foldexpr()
return tostring(max_level) return tostring(max_level)
end end
function M.setup() function M.setup()
vim.opt.fillchars:append({ vim.opt.fillchars:append({
fold = ' ', fold = ' ',

View file

@ -1,6 +1,7 @@
return { return {
setup = function() setup = function()
vim.o.statusline = '%!v:lua.require("config.lines.statusline").statusline()' vim.o.statusline =
'%!v:lua.require("config.lines.statusline").statusline()'
vim.o.statuscolumn = vim.o.statuscolumn =
'%!v:lua.require("config.lines.statuscolumn").statuscolumn()' '%!v:lua.require("config.lines.statuscolumn").statuscolumn()'
end, end,

View file

@ -9,7 +9,13 @@ return {
local relnum = vim.v.relnum local relnum = vim.v.relnum
local hl = relnum == 0 and 'CursorLineNr' or 'LineNr' local hl = relnum == 0 and 'CursorLineNr' or 'LineNr'
local marks = vim.api.nvim_buf_get_extmarks(0, -1, { lnum - 1, 0 }, { lnum - 1, 0 }, { details = true }) local marks = vim.api.nvim_buf_get_extmarks(
0,
-1,
{ lnum - 1, 0 },
{ lnum - 1, 0 },
{ details = true }
)
for _, mark in ipairs(marks) do for _, mark in ipairs(marks) do
if mark[4] and mark[4].number_hl_group then if mark[4] and mark[4].number_hl_group then
hl = mark[4].number_hl_group hl = mark[4].number_hl_group

View file

@ -79,16 +79,12 @@ function M.on_attach(client, bufnr)
end end
end end
function M.format(opts) function M.format()
local ok, ft_handler = pcall(require, 'guard.filetype') if pcall(require, 'guard.filetype') then
if ok then vim.cmd.Guard('fmt')
local conf = ft_handler[vim.bo.filetype] else
if conf and conf.formatter and #conf.formatter > 0 then vim.lsp.buf.format({ async = true })
require('guard').fmt()
return
end
end end
vim.lsp.buf.format(opts or { async = true })
end end
return M return M

View file

@ -73,7 +73,8 @@ local cpp_single = cpp_base .. [[ solve();
return 0; return 0;
} // }}}]] } // }}}]]
local cpp_multi = cpp_base .. [[ u32 tc = 1; local cpp_multi = cpp_base
.. [[ u32 tc = 1;
std::cin >> tc; std::cin >> tc;
for (u32 t = 0; t < tc; ++t) { for (u32 t = 0; t < tc; ++t) {
solve(); solve();
@ -211,10 +212,10 @@ return {
require('cp.helpers').clearcol(buf) require('cp.helpers').clearcol(buf)
end, end,
before_run = function(_) before_run = function(_)
require('config.lsp').format({ async = true }) require('config.lsp').format()
end, end,
before_debug = function(_) before_debug = function(_)
require('config.lsp').format({ async = true }) require('config.lsp').format()
end, end,
setup_code = function(state) setup_code = function(state)
vim.opt_local.winbar = '' vim.opt_local.winbar = ''
@ -234,9 +235,13 @@ return {
local platform = state.get_platform() local platform = state.get_platform()
insert_template(buf, lang, platform) insert_template(buf, lang, platform)
local clang_format_path = vim.fn.getcwd() .. '/.clang-format' local clang_format_path = vim.fn.getcwd()
.. '/.clang-format'
if vim.fn.filereadable(clang_format_path) == 0 then if vim.fn.filereadable(clang_format_path) == 0 then
vim.fn.writefile(vim.split(clang_format, '\n'), clang_format_path) vim.fn.writefile(
vim.split(clang_format, '\n'),
clang_format_path
)
end end
end, end,
}, },

View file

@ -185,7 +185,8 @@ return {
{ {
'<leader>go', '<leader>go',
with_forge(function(forge) with_forge(function(forge)
local branch = vim.trim(vim.fn.system('git branch --show-current')) local branch =
vim.trim(vim.fn.system('git branch --show-current'))
forge.browse(file_loc(), branch) forge.browse(file_loc(), branch)
end), end),
mode = { 'n', 'v' }, mode = { 'n', 'v' },

View file

@ -10,18 +10,26 @@ return {
lsp_as_default_formatter = true, lsp_as_default_formatter = true,
} }
end, end,
keys = {
{ 'gF', '<cmd>Guard fmt<CR>', mode = { 'n', 'x' } },
},
config = function() config = function()
local ft = require('guard.filetype') local ft = require('guard.filetype')
ft('python'):fmt({ ft('python')
cmd = 'isort', :fmt({
args = { '--profile', 'black', '-' }, cmd = 'isort',
stdin = true, args = { '--profile', 'black', '-' },
}):append('black'):lint('mypy') stdin = true,
})
:append('black')
:lint('mypy')
ft('lua'):fmt('stylua'):lint('selene') ft('lua'):fmt('stylua'):lint('selene')
ft('javascript,javascriptreact,typescript,typescriptreact'):fmt('prettierd'):lint('eslint_d') ft('javascript,javascriptreact,typescript,typescriptreact')
:fmt('prettierd')
:lint('eslint_d')
ft('css,graphql,html,json,jsonc,mdx,yaml'):fmt('prettierd') ft('css,graphql,html,json,jsonc,mdx,yaml'):fmt('prettierd')
ft('sh,bash,zsh'):fmt({ ft('sh,bash,zsh'):fmt({

View file

@ -1,6 +1,7 @@
return { return {
{ {
'barrettruth/midnight.nvim', 'barrettruth/midnight.nvim',
dir = '~/dev/midnight.nvim',
enabled = true, enabled = true,
config = function() config = function()
vim.cmd.colorscheme('midnight') vim.cmd.colorscheme('midnight')
@ -305,15 +306,15 @@ return {
}, },
}, },
{ 'tpope/vim-abolish', event = 'VeryLazy' }, { 'tpope/vim-abolish', event = 'VeryLazy' },
{ 'tpope/vim-sleuth', event = 'BufReadPost' }, { 'tpope/vim-sleuth', event = 'BufReadPost' },
{ {
'kylechui/nvim-surround', 'kylechui/nvim-surround',
config = true, config = true,
keys = { keys = {
{ 'cs', mode = 'n' }, { 'cs', mode = 'n' },
{ 'ds', mode = 'n' }, { 'ds', mode = 'n' },
{ 'ys', mode = 'n' }, { 'ys', mode = 'n' },
{ 'yS', mode = 'n' }, { 'yS', mode = 'n' },
{ 'yss', mode = 'n' }, { 'yss', mode = 'n' },
{ 'ySs', mode = 'n' }, { 'ySs', mode = 'n' },
}, },

View file

@ -15,7 +15,13 @@ for _, key in ipairs({ 'u', '<C-r>', 'U' }) do
if not api.nvim_buf_is_valid(buf) then if not api.nvim_buf_is_valid(buf) then
return return
end end
vim.hl.range(buf, ns, 'HighlightUndo', { sr, sc }, { er, ec }) vim.hl.range(
buf,
ns,
'HighlightUndo',
{ sr, sc },
{ er, ec }
)
vim.defer_fn(function() vim.defer_fn(function()
if api.nvim_buf_is_valid(buf) then if api.nvim_buf_is_valid(buf) then
api.nvim_buf_clear_namespace(buf, ns, 0, -1) api.nvim_buf_clear_namespace(buf, ns, 0, -1)

View file

@ -44,7 +44,7 @@ in
luarocks luarocks
tree-sitter tree-sitter
nixfmt-tree nixfmt-tree
(texlive.combine { inherit (texlive) scheme-small latexindent latexmk; }) (texlive.combine { inherit (texlive) scheme-small latexindent latexmk lastpage pgf collection-fontsrecommended; })
]; ];
programs.neovim = { programs.neovim = {
@ -58,4 +58,9 @@ in
xdg.configFile."nvim".source = xdg.configFile."nvim".source =
config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/config/nvim"; config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/config/nvim";
xdg.configFile."latexmk/latexmkrc".text = ''
$out_dir = "build";
$pdf_mode = 1;
'';
} }

View file

@ -116,6 +116,10 @@
"github.com" = { "github.com" = {
identityFile = "~/.ssh/id_ed25519"; identityFile = "~/.ssh/id_ed25519";
}; };
"jetson-nano" = {
hostname = "100.95.16.119";
user = "charlie";
}
"lightsail" = { "lightsail" = {
hostname = "52.87.124.139"; hostname = "52.87.124.139";
user = "ec2-user"; user = "ec2-user";