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 },
})
map({ { 'n', 'x' }, 'gF', lsp.format })
map({
{ 'n', 'x' },
'gF',
function()
vim.lsp.buf.format({ async = true })
end,
})
for _, server in ipairs({
'bashls',

View file

@ -5,6 +5,6 @@ vim.filetype.add({
},
filename = {
['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
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
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'--branch=stable',
lazyrepo,
lazypath,
})
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
{ out, 'WarningMsg' },
{ '\nPress any key to exit...' },
}, true, {})
vim.fn.getchar()
os.exit(1)

View file

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

View file

@ -1,6 +1,7 @@
return {
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 =
'%!v:lua.require("config.lines.statuscolumn").statuscolumn()'
end,

View file

@ -9,7 +9,13 @@ return {
local relnum = vim.v.relnum
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
if mark[4] and mark[4].number_hl_group then
hl = mark[4].number_hl_group

View file

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

View file

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

View file

@ -185,7 +185,8 @@ return {
{
'<leader>go',
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)
end),
mode = { 'n', 'v' },

View file

@ -10,18 +10,26 @@ return {
lsp_as_default_formatter = true,
}
end,
keys = {
{ 'gF', '<cmd>Guard fmt<CR>', mode = { 'n', 'x' } },
},
config = function()
local ft = require('guard.filetype')
ft('python'):fmt({
cmd = 'isort',
args = { '--profile', 'black', '-' },
stdin = true,
}):append('black'):lint('mypy')
ft('python')
:fmt({
cmd = 'isort',
args = { '--profile', 'black', '-' },
stdin = true,
})
:append('black')
:lint('mypy')
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('sh,bash,zsh'):fmt({

View file

@ -1,6 +1,7 @@
return {
{
'barrettruth/midnight.nvim',
dir = '~/dev/midnight.nvim',
enabled = true,
config = function()
vim.cmd.colorscheme('midnight')
@ -305,15 +306,15 @@ return {
},
},
{ 'tpope/vim-abolish', event = 'VeryLazy' },
{ 'tpope/vim-sleuth', event = 'BufReadPost' },
{ 'tpope/vim-sleuth', event = 'BufReadPost' },
{
'kylechui/nvim-surround',
config = true,
keys = {
{ 'cs', mode = 'n' },
{ 'ds', mode = 'n' },
{ 'ys', mode = 'n' },
{ 'yS', mode = 'n' },
{ 'cs', mode = 'n' },
{ 'ds', mode = 'n' },
{ 'ys', mode = 'n' },
{ 'yS', 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
return
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()
if api.nvim_buf_is_valid(buf) then
api.nvim_buf_clear_namespace(buf, ns, 0, -1)

View file

@ -44,7 +44,7 @@ in
luarocks
tree-sitter
nixfmt-tree
(texlive.combine { inherit (texlive) scheme-small latexindent latexmk; })
(texlive.combine { inherit (texlive) scheme-small latexindent latexmk lastpage pgf collection-fontsrecommended; })
];
programs.neovim = {
@ -58,4 +58,9 @@ in
xdg.configFile."nvim".source =
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" = {
identityFile = "~/.ssh/id_ed25519";
};
"jetson-nano" = {
hostname = "100.95.16.119";
user = "charlie";
}
"lightsail" = {
hostname = "52.87.124.139";
user = "ec2-user";