Skip to content

Commit 2082dd4

Browse files
committed
fix: skip stylua in CI and format existing Lua files
- Skip stylua hook in CI environments to prevent SQLite conflicts - Format all existing Neovim Lua configuration files with stylua - Maintain stylua formatting for local development - Prevent CI failures while ensuring code consistency
1 parent 16486d5 commit 2082dd4

File tree

15 files changed

+1147
-1141
lines changed

15 files changed

+1147
-1141
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ repos:
5656
name: stylua
5757
description: Format Lua code with StyLua
5858
entry: bash
59-
args: [-c, 'if command -v nix >/dev/null 2>&1; then nix shell nixpkgs#stylua -c stylua "$@"; else echo "Skipping stylua (Nix not available)"; fi', --]
59+
args: [-c, 'if [ "$CI" = "true" ]; then echo "Skipping stylua in CI"; exit 0; elif command -v nix >/dev/null 2>&1; then nix shell nixpkgs#stylua -c stylua "$@"; else echo "Skipping stylua (Nix not available)"; fi', --]
6060
language: system
6161
files: \.lua$

common/neovim/init.lua

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,54 +8,54 @@ vim.g.maplocalleader = "\\"
88
-- Bootstrap lazy.nvim
99
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
1010
if not (vim.uv or vim.loop).fs_stat(lazypath) then
11-
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
12-
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
13-
if vim.v.shell_error ~= 0 then
14-
vim.api.nvim_echo({
15-
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
16-
{ out, "WarningMsg" },
17-
{ "\nPress any key to exit..." },
18-
}, true, {})
19-
vim.fn.getchar()
20-
os.exit(1)
21-
end
11+
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
12+
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
13+
if vim.v.shell_error ~= 0 then
14+
vim.api.nvim_echo({
15+
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
16+
{ out, "WarningMsg" },
17+
{ "\nPress any key to exit..." },
18+
}, true, {})
19+
vim.fn.getchar()
20+
os.exit(1)
21+
end
2222
end
2323
vim.opt.rtp:prepend(lazypath)
2424

2525
-- Make sure to setup `mapleader` and `maplocalleader` before loading lazy.nvim
2626
-- so that mappings are correct. This is also a good place to setup other settings.
2727
require("lazy").setup({
28-
spec = {
29-
-- Add LazyVim and import its plugins
30-
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
31-
-- Import any extras modules here
32-
-- { import = "lazyvim.plugins.extras.lang.typescript" },
33-
-- { import = "lazyvim.plugins.extras.lang.json" },
34-
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
35-
-- Import your custom plugins
36-
{ import = "plugins" },
37-
},
38-
defaults = {
39-
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
40-
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
41-
lazy = false,
42-
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
43-
-- have outdated releases, which may break your Neovim install.
44-
version = false, -- always use the latest git commit
45-
-- version = "*", -- try installing the latest stable version for plugins that support semver
46-
},
47-
install = { colorscheme = { "catppuccin" } },
48-
checker = { enabled = true }, -- automatically check for plugin updates
49-
performance = {
50-
rtp = {
51-
-- disable some rtp plugins
52-
disabled_plugins = {
53-
"gzip",
54-
"tarPlugin",
55-
"tohtml",
56-
"tutor",
57-
"zipPlugin",
58-
},
59-
},
60-
},
28+
spec = {
29+
-- Add LazyVim and import its plugins
30+
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
31+
-- Import any extras modules here
32+
-- { import = "lazyvim.plugins.extras.lang.typescript" },
33+
-- { import = "lazyvim.plugins.extras.lang.json" },
34+
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
35+
-- Import your custom plugins
36+
{ import = "plugins" },
37+
},
38+
defaults = {
39+
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
40+
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
41+
lazy = false,
42+
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
43+
-- have outdated releases, which may break your Neovim install.
44+
version = false, -- always use the latest git commit
45+
-- version = "*", -- try installing the latest stable version for plugins that support semver
46+
},
47+
install = { colorscheme = { "catppuccin" } },
48+
checker = { enabled = true }, -- automatically check for plugin updates
49+
performance = {
50+
rtp = {
51+
-- disable some rtp plugins
52+
disabled_plugins = {
53+
"gzip",
54+
"tarPlugin",
55+
"tohtml",
56+
"tutor",
57+
"zipPlugin",
58+
},
59+
},
60+
},
6161
})
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
local function augroup(name)
2-
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
2+
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
33
end
44
vim.api.nvim_create_autocmd("TextYankPost", {
5-
group = augroup("highlight_yank"),
6-
callback = function()
7-
vim.highlight.on_yank()
8-
end,
5+
group = augroup("highlight_yank"),
6+
callback = function()
7+
vim.highlight.on_yank()
8+
end,
99
})
1010

1111
vim.api.nvim_create_autocmd("FileType", {
12-
group = augroup("close_with_q"),
13-
pattern = {
14-
"PlenaryTestPopup",
15-
"help",
16-
"lspinfo",
17-
"man",
18-
"notify",
19-
"qf",
20-
"spectre_panel",
21-
"startuptime",
22-
"tsplayground",
23-
"neotest-output",
24-
"checkhealth",
25-
"neotest-summary",
26-
"neotest-output-panel",
27-
},
28-
callback = function(event)
29-
vim.bo[event.buf].buflisted = false
30-
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
31-
end,
12+
group = augroup("close_with_q"),
13+
pattern = {
14+
"PlenaryTestPopup",
15+
"help",
16+
"lspinfo",
17+
"man",
18+
"notify",
19+
"qf",
20+
"spectre_panel",
21+
"startuptime",
22+
"tsplayground",
23+
"neotest-output",
24+
"checkhealth",
25+
"neotest-summary",
26+
"neotest-output-panel",
27+
},
28+
callback = function(event)
29+
vim.bo[event.buf].buflisted = false
30+
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
31+
end,
3232
})
3333

3434
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
35-
group = augroup("auto_create_dir"),
36-
callback = function(event)
37-
if event.match:match("^%w%w+://") then
38-
return
39-
end
40-
local file = vim.loop.fs_realpath(event.match) or event.match
41-
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
42-
end,
35+
group = augroup("auto_create_dir"),
36+
callback = function(event)
37+
if event.match:match("^%w%w+://") then
38+
return
39+
end
40+
local file = vim.loop.fs_realpath(event.match) or event.match
41+
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
42+
end,
4343
})
4444

4545
vim.api.nvim_create_autocmd({ "VimEnter", "VimResized" }, {
46-
group = augroup("terminal_resize"),
47-
callback = function()
48-
vim.cmd("redraw!")
49-
end,
46+
group = augroup("terminal_resize"),
47+
callback = function()
48+
vim.cmd("redraw!")
49+
end,
5050
})
5151

5252
-- Disable spell checking for all file types (overrides LazyVim defaults)
5353
vim.api.nvim_create_autocmd("FileType", {
54-
group = augroup("disable_spell"),
55-
pattern = { "text", "plaintex", "typst", "gitcommit", "markdown" },
56-
callback = function()
57-
vim.opt_local.spell = false
58-
end,
54+
group = augroup("disable_spell"),
55+
pattern = { "text", "plaintex", "typst", "gitcommit", "markdown" },
56+
callback = function()
57+
vim.opt_local.spell = false
58+
end,
5959
})

common/neovim/lua/config/keymaps.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keymap("n", "<leader>w", "<cmd>w<cr>", { desc = "Save file" })
1212
keymap("n", "<leader>q", "<cmd>q<cr>", { desc = "Quit" })
1313
-- Use LazyVim's Snacks.bufdelete() for proper buffer management
1414
keymap("n", "<leader>x", function()
15-
require("snacks").bufdelete()
15+
require("snacks").bufdelete()
1616
end, { desc = "Close buffer" })
1717

1818
keymap("n", "<C-h>", "<C-w>h", { desc = "Go to left window" })

common/neovim/lua/config/lazy.lua

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,75 @@
22
-- This file is automatically loaded by LazyVim
33

44
return {
5-
-- Set the colorscheme (use base name, not variant)
6-
colorscheme = "catppuccin",
5+
-- Set the colorscheme (use base name, not variant)
6+
colorscheme = "catppuccin",
77

8-
-- Configure icons (if you want to customize them)
9-
icons = {
10-
misc = {
11-
dots = "󰇘",
12-
},
13-
ft = {
14-
octo = "",
15-
},
16-
dap = {
17-
Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" },
18-
Breakpoint = " ",
19-
BreakpointCondition = " ",
20-
BreakpointRejected = { " ", "DiagnosticError" },
21-
LogPoint = ".>",
22-
},
23-
diagnostics = {
24-
Error = " ",
25-
Warn = " ",
26-
Hint = " ",
27-
Info = " ",
28-
},
29-
git = {
30-
added = " ",
31-
modified = " ",
32-
removed = " ",
33-
},
34-
kinds = {
35-
Array = " ",
36-
Boolean = "󰨙 ",
37-
Class = " ",
38-
Codeium = "󰘦 ",
39-
Color = " ",
40-
Control = " ",
41-
Collapsed = " ",
42-
Constant = "󰏿 ",
43-
Constructor = " ",
44-
Copilot = " ",
45-
Enum = " ",
46-
EnumMember = " ",
47-
Event = " ",
48-
Field = " ",
49-
File = " ",
50-
Folder = " ",
51-
Function = "󰊕 ",
52-
Interface = " ",
53-
Key = " ",
54-
Keyword = " ",
55-
Method = "󰊕 ",
56-
Module = " ",
57-
Namespace = "󰦮 ",
58-
Null = " ",
59-
Number = "󰎠 ",
60-
Object = " ",
61-
Operator = " ",
62-
Package = " ",
63-
Property = " ",
64-
Reference = " ",
65-
Snippet = " ",
66-
String = " ",
67-
Struct = "󰆼 ",
68-
TabNine = "󰏚 ",
69-
Text = " ",
70-
TypeParameter = " ",
71-
Unit = " ",
72-
Value = " ",
73-
Variable = "󰀫 ",
74-
},
75-
},
8+
-- Configure icons (if you want to customize them)
9+
icons = {
10+
misc = {
11+
dots = "󰇘",
12+
},
13+
ft = {
14+
octo = "",
15+
},
16+
dap = {
17+
Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" },
18+
Breakpoint = " ",
19+
BreakpointCondition = " ",
20+
BreakpointRejected = { " ", "DiagnosticError" },
21+
LogPoint = ".>",
22+
},
23+
diagnostics = {
24+
Error = " ",
25+
Warn = " ",
26+
Hint = " ",
27+
Info = " ",
28+
},
29+
git = {
30+
added = " ",
31+
modified = " ",
32+
removed = " ",
33+
},
34+
kinds = {
35+
Array = " ",
36+
Boolean = "󰨙 ",
37+
Class = " ",
38+
Codeium = "󰘦 ",
39+
Color = " ",
40+
Control = " ",
41+
Collapsed = " ",
42+
Constant = "󰏿 ",
43+
Constructor = " ",
44+
Copilot = " ",
45+
Enum = " ",
46+
EnumMember = " ",
47+
Event = " ",
48+
Field = " ",
49+
File = " ",
50+
Folder = " ",
51+
Function = "󰊕 ",
52+
Interface = " ",
53+
Key = " ",
54+
Keyword = " ",
55+
Method = "󰊕 ",
56+
Module = " ",
57+
Namespace = "󰦮 ",
58+
Null = " ",
59+
Number = "󰎠 ",
60+
Object = " ",
61+
Operator = " ",
62+
Package = " ",
63+
Property = " ",
64+
Reference = " ",
65+
Snippet = " ",
66+
String = " ",
67+
Struct = "󰆼 ",
68+
TabNine = "󰏚 ",
69+
Text = " ",
70+
TypeParameter = " ",
71+
Unit = " ",
72+
Value = " ",
73+
Variable = "󰀫 ",
74+
},
75+
},
7676
}

common/neovim/lua/config/options.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ opt.spell = false
3838

3939
-- Cursor configuration - pink blinking cursor
4040
opt.guicursor = {
41-
"n-v-c:block-Cursor/lCursor-blinkwait1000-blinkon500-blinkoff500",
42-
"i-ci:ver25-Cursor/lCursor-blinkwait1000-blinkon500-blinkoff500",
43-
"r-cr:hor20-Cursor/lCursor-blinkwait1000-blinkon500-blinkoff500",
41+
"n-v-c:block-Cursor/lCursor-blinkwait1000-blinkon500-blinkoff500",
42+
"i-ci:ver25-Cursor/lCursor-blinkwait1000-blinkon500-blinkoff500",
43+
"r-cr:hor20-Cursor/lCursor-blinkwait1000-blinkon500-blinkoff500",
4444
}
4545

4646
-- Cursor color is set in colorscheme.lua after theme loads

0 commit comments

Comments
 (0)