formatted + added project formatter that respects .gitignore

This commit is contained in:
foxora 2026-03-03 04:50:29 +00:00
parent 3e14220569
commit 2c69e1f116
4 changed files with 24 additions and 10 deletions

View file

@ -14,7 +14,8 @@
"hyprland/workspaces" = { "hyprland/workspaces" = {
format = "{id}"; format = "{id}";
}; };
"ext/workspaces" = { # not enabled yet, hyprland and mango need two different configs ;-; "ext/workspaces" = {
# not enabled yet, hyprland and mango need two different configs ;-;
format = "{id}"; format = "{id}";
ignore-hidden = true; ignore-hidden = true;
on-click = "activate"; on-click = "activate";

View file

@ -8,10 +8,18 @@ vim.opt.colorcolumn = "80"
require("plugins") require("plugins")
require("lsp") require("lsp")
vim.keymap.set('n', '<A-h>', function() vim.cmd('wincmd h') end) vim.keymap.set("n", "<A-h>", function()
vim.keymap.set('n', '<A-j>', function() vim.cmd('wincmd j') end) vim.cmd("wincmd h")
vim.keymap.set('n', '<A-k>', function() vim.cmd('wincmd k') end) end)
vim.keymap.set('n', '<A-l>', function() vim.cmd('wincmd l') end) vim.keymap.set("n", "<A-j>", function()
vim.cmd("wincmd j")
end)
vim.keymap.set("n", "<A-k>", function()
vim.cmd("wincmd k")
end)
vim.keymap.set("n", "<A-l>", function()
vim.cmd("wincmd l")
end)
local uv = vim.loop local uv = vim.loop
local colorscheme_filepath = "/home/aurora/.cache/nvim/neovim-colors" local colorscheme_filepath = "/home/aurora/.cache/nvim/neovim-colors"

View file

@ -1,10 +1,13 @@
vim.keymap.set("n", "<leader>P", "<cmd>ConformProject<cr>", { noremap = true, silent = true }) vim.keymap.set("n", "<leader>P", function()
vim.api.nvim_exec_autocmds("User", { pattern = "ConformProject" })
vim.cmd("ConformProject")
end, { noremap = true, silent = true })
vim.api.nvim_create_user_command("ConformProject", function() vim.api.nvim_create_user_command("ConformProject", function()
local conform = require("conform") local conform = require("conform")
local root = vim.fn.getcwd() local root = vim.fn.getcwd()
-- Use git to get files (respects .gitignore) -- respects .gitignore
local handle = io.popen(string.format("cd %s && git ls-files --cached --others --exclude-standard", root)) local handle = io.popen(string.format("cd %s && git ls-files --cached --others --exclude-standard", root))
if not handle then if not handle then
@ -18,7 +21,9 @@ vim.api.nvim_create_user_command("ConformProject", function()
end end
handle:close() handle:close()
-- Format each file -- format each file
-- TODO: maybe run each formatter on the directory instead as it may be faster
-- although that would actually mean we can't count what files were formatted so i don't know
local formatted_count = 0 local formatted_count = 0
for _, filepath in ipairs(files) do for _, filepath in ipairs(files) do
local bufnr = vim.fn.bufadd(filepath) local bufnr = vim.fn.bufadd(filepath)
@ -42,6 +47,7 @@ return {
{ {
"conform.nvim", "conform.nvim",
enabled = nixCats("format") or false, enabled = nixCats("format") or false,
event = "User ConformProject", -- also will load when we format the entire project yayayayy :333
keys = { keys = {
{ "<leader>p", desc = "Format File (pretty :3)" }, { "<leader>p", desc = "Format File (pretty :3)" },
}, },

View file

@ -1,5 +1,4 @@
{ ... }: {...}: {
{
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
package = null; package = null;