Skip to content

Commit 8e84c3a

Browse files
committed
chore(lint): fixed stylua and linted nvim configs
1 parent acd2f7f commit 8e84c3a

15 files changed

+188
-136
lines changed

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,8 @@ repos:
5151
rev: 39.63.1
5252
hooks:
5353
- id: renovate-config-validator
54+
55+
- repo: https://github.com/JohnnyMorganz/StyLua
56+
rev: v2.0.2
57+
hooks:
58+
- id: stylua # or stylua-system / stylua-github

config/nvim/init.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if not vim.loop.fs_stat(lazypath) then
1818
if vim.v.shell_error ~= 0 then
1919
vim.api.nvim_echo({
2020
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
21-
{ out, 'WarningMsg' },
21+
{ out, 'WarningMsg' },
2222
{ '\nPress any key to exit...' },
2323
}, true, {})
2424
vim.fn.getchar()
@@ -38,7 +38,7 @@ require 'autogroups'
3838

3939
-- ── Load plugins ────────────────────────────────────────────────────
4040
require('lazy').setup(
41-
-- Automatically load plugins from lua/plugins
41+
-- Automatically load plugins from lua/plugins
4242
'plugins',
4343
-- Lazy Configuration
4444
{

config/nvim/lua/autogroups.lua

+17-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ autocmd('TextYankPost', {
1717
--
1818
-- This fixes the issue where the line numbers jump
1919
-- around when moving between lines relative line numbers enabled.
20-
autocmd({ "BufEnter", "BufWinEnter", "TabEnter" }, {
20+
autocmd({ 'BufEnter', 'BufWinEnter', 'TabEnter' }, {
2121
callback = function()
22-
local max_line_count = vim.fn.line("$")
22+
local max_line_count = vim.fn.line '$'
2323
-- Only adjust if the file is large enough to matter
2424
if max_line_count > 99 then
2525
vim.opt.numberwidth = #tostring(max_line_count) + 1
@@ -68,7 +68,16 @@ autocmd('FileType', {
6868
-- wrap and check for spell in text filetypes
6969
autocmd('FileType', {
7070
group = augroup('wrap_spell', { clear = true }),
71-
pattern = { 'text', 'plaintex', 'typst', 'gitcommit', 'markdown', 'asciidoc', 'rst', 'tex' },
71+
pattern = {
72+
'text',
73+
'plaintex',
74+
'typst',
75+
'gitcommit',
76+
'markdown',
77+
'asciidoc',
78+
'rst',
79+
'tex',
80+
},
7281
callback = function()
7382
vim.opt_local.wrap = true
7483
vim.opt_local.spell = true
@@ -87,7 +96,11 @@ autocmd({ 'FileType' }, {
8796
-- .dotfiles/ssh/config.d/*, .ssh/config.local, .ssh/config.work
8897
autocmd({ 'BufRead', 'BufNewFile' }, {
8998
desc = 'Set filetype for SSH config directory',
90-
pattern = { '*/?.ssh/{config|shared}.d/*', '*/?.ssh/config.local', '*/?.ssh/config.work' },
99+
pattern = {
100+
'*/?.ssh/{config|shared}.d/*',
101+
'*/?.ssh/config.local',
102+
'*/?.ssh/config.work',
103+
},
91104
command = 'set filetype=sshconfig',
92105
})
93106

config/nvim/lua/keymaps.lua

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- vim: set ft=lua ts=2 sw=2 tw=0 et cc=120 :
22

3-
require('utils')
3+
require 'utils'
44

55
-- ╭─────────────────────────────────────────────────────────╮
66
-- │ Keymaps │
@@ -78,7 +78,6 @@ K.nl('cbl', '<Cmd>CBline<CR>', 'CB: Simple Line')
7878
K.nl('cbm', '<Cmd>CBllbox14<CR>', 'CB: Marked')
7979
K.nl('cbt', '<Cmd>CBllline<CR>', 'CB: Titled Line')
8080

81-
8281
-- ── Telescope operations ────────────────────────────────────────────
8382
-- Mappings for Telescope operations like finding files, buffers, etc.
8483
-- Convention: All mappings start with 's' followed by the operation
@@ -127,14 +126,14 @@ K.nl('tn', ':Noice dismiss<cr>', 'Noice: Dismiss Notification')
127126
-- Convention is 'q' followed by the operation
128127
K.nl('qf', ':q<CR>', 'Quicker close split')
129128
K.nl('qq', function()
130-
if vim.fn.confirm("Force save and quit?", "&Yes\n&No", 2) == 1 then
131-
vim.cmd('wq!')
129+
if vim.fn.confirm('Force save and quit?', '&Yes\n&No', 2) == 1 then
130+
vim.cmd 'wq!'
132131
end
133132
end, 'Quit with force saving')
134133
K.nl('qw', ':wq<CR>', 'Write and quit')
135134
K.nl('qQ', function()
136-
if vim.fn.confirm("Force quit without saving?", "&Yes\n&No", 2) == 1 then
137-
vim.cmd('q!')
135+
if vim.fn.confirm('Force quit without saving?', '&Yes\n&No', 2) == 1 then
136+
vim.cmd 'q!'
138137
end
139138
end, 'Force quit without saving')
140139

config/nvim/lua/nvm-default/init.lua

+25-26
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,17 @@ M.version = '0.1.0' -- x-release-please-version
2525
---@return string? Return the result of the command
2626
local function run_command(cmd)
2727
local result = vim.fn.system(cmd)
28-
return vim.v.shell_error == 0 and result:gsub("%s+$", "") or nil
28+
return vim.v.shell_error == 0 and result:gsub('%s+$', '') or nil
2929
end
3030

31-
3231
-- Helper function to show a notification
3332
---@param msg string Show a message
3433
---@param level number|"info"|"warn"|"error"|"trace" Notification level
3534
local function n(msg, level)
36-
if msg == nil then
37-
msg = M.name .. ": No message provided"
38-
end
39-
if level == nil then
40-
level = "trace"
41-
end
35+
if msg == nil then msg = M.name .. ': No message provided' end
36+
if level == nil then level = 'trace' end
4237

43-
vim.notify(M.name .. ": " .. msg, level)
38+
vim.notify(M.name .. ': ' .. msg, level)
4439
end
4540

4641
---@class NvmDefaultOptions
@@ -52,59 +47,63 @@ end
5247
---@type NvmDefaultOptions
5348
M.defaults = {
5449
add_to_path = vim.g.nvm_default_add_to_path or true,
55-
nvm_path = vim.fn.expand(os.getenv("NVM_DIR") or "~/.nvm"),
56-
notify_level = vim.g.nvm_default_notify_level or "info",
50+
nvm_path = vim.fn.expand(os.getenv 'NVM_DIR' or '~/.nvm'),
51+
notify_level = vim.g.nvm_default_notify_level or 'info',
5752
}
5853

5954
-- Fetch the NVM default version or fallback to node version
6055
---@param opts? NvmDefaultOptions Plugin options
6156
function M.setup(opts)
62-
local options = vim.tbl_deep_extend("force", M.defaults, opts or {})
57+
local options = vim.tbl_deep_extend('force', M.defaults, opts or {})
6358

6459
local nvm_path = options.nvm_path
65-
local node_version =
66-
run_command(string.format(". %s/nvm.sh && nvm version default", nvm_path)) or
67-
run_command(string.format(". %s/nvm.sh && nvm version node", nvm_path))
60+
local node_version = run_command(
61+
string.format('. %s/nvm.sh && nvm version default', nvm_path)
62+
) or run_command(string.format('. %s/nvm.sh && nvm version node', nvm_path))
6863

69-
if node_version and node_version:match("^v") then
64+
if node_version and node_version:match '^v' then
7065
-- Set vim.g.node_host_prog and vim.g.copilot_node_command
71-
local current_nvm_version_path = string.format("%s/versions/node/%s", nvm_path, node_version)
72-
local current_nvm_node_bin_path = string.format("%s/bin", current_nvm_version_path)
73-
local current_nvm_node_bin = string.format("%s/node", current_nvm_node_bin_path)
74-
local neovim_node_host_bin_path = string.format("%s/neovim-node-host", current_nvm_node_bin_path)
66+
local current_nvm_version_path =
67+
string.format('%s/versions/node/%s', nvm_path, node_version)
68+
local current_nvm_node_bin_path =
69+
string.format('%s/bin', current_nvm_version_path)
70+
local current_nvm_node_bin =
71+
string.format('%s/node', current_nvm_node_bin_path)
72+
local neovim_node_host_bin_path =
73+
string.format('%s/neovim-node-host', current_nvm_node_bin_path)
7574

7675
-- Collect missing files and directories errors for error output
7776
local missing = {}
7877

7978
-- If node_dir isn't there, stop and show error
8079
if not vim.fn.isdirectory(current_nvm_version_path) then
81-
table.insert(missing, "Node.js directory: " .. current_nvm_version_path)
80+
table.insert(missing, 'Node.js directory: ' .. current_nvm_version_path)
8281
end
8382

8483
-- If node_bin isn't there, stop and show error
8584
if not vim.fn.filereadable(current_nvm_node_bin) then
86-
table.insert(missing, "Node.js binary: " .. current_nvm_node_bin)
85+
table.insert(missing, 'Node.js binary: ' .. current_nvm_node_bin)
8786
end
8887

8988
if not vim.fn.filereadable(neovim_node_host_bin_path) then
90-
table.insert(missing, "Neovim host binary: " .. neovim_node_host_bin_path)
89+
table.insert(missing, 'Neovim host binary: ' .. neovim_node_host_bin_path)
9190
end
9291

9392
if #missing > 0 then
94-
n("Missing required files:\n- " .. table.concat(missing, "\n- "), "error")
93+
n('Missing required files:\n- ' .. table.concat(missing, '\n- '), 'error')
9594
return
9695
end
9796

9897
-- Add to PATH if requested. Can be turned off by setting if it messes with
9998
-- other tools.
10099
if options.add_to_path then
101-
vim.env.PATH = current_nvm_node_bin_path .. ":" .. vim.env.PATH
100+
vim.env.PATH = current_nvm_node_bin_path .. ':' .. vim.env.PATH
102101
end
103102

104103
vim.g.node_host_prog = neovim_node_host_bin_path
105104
vim.g.copilot_node_command = current_nvm_node_bin
106105
else
107-
n("Unable to determine the Node.js version from nvm.", "error")
106+
n('Unable to determine the Node.js version from nvm.', 'error')
108107
end
109108
end
110109

config/nvim/lua/options.lua

+31-30
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,47 @@
55
-- `:help vim.g`
66
-- For more options, you can see `:help option-list`
77

8-
local g = vim.g -- A table to store global variables
9-
local o = vim.opt -- A table to store global options
8+
local g = vim.g -- A table to store global variables
9+
local o = vim.opt -- A table to store global options
1010

1111
vim.loader.enable() -- Enable the plugin loader
1212

1313
-- vim.global
14-
g.mapleader = ' ' -- Space as the leader key
15-
g.maplocalleader = ' ' -- Space as the local leader key
14+
g.mapleader = ' ' -- Space as the leader key
15+
g.maplocalleader = ' ' -- Space as the local leader key
1616

17-
g.colors_theme = 'tokyonight' -- Set the colorscheme
18-
g.colors_variant_light = 'tokyonight-day' -- Set the light variant
17+
g.colors_theme = 'tokyonight' -- Set the colorscheme
18+
g.colors_variant_light = 'tokyonight-day' -- Set the light variant
1919
g.colors_variant_dark = 'tokyonight-storm' -- Set the dark variant
2020

21-
g.editorconfig = true -- Make sure editorconfig support is enabled
22-
g.loaded_perl_provider = 0 -- Disable perl provider
23-
g.loaded_ruby_provider = 0 -- Disable ruby provider
21+
g.editorconfig = true -- Make sure editorconfig support is enabled
22+
g.loaded_perl_provider = 0 -- Disable perl provider
23+
g.loaded_ruby_provider = 0 -- Disable ruby provider
24+
g.loaded_java_provider = 0 -- Disable java provider
2425

2526
-- vim.options
26-
o.breakindent = true -- Enable break indent
27+
o.breakindent = true -- Enable break indent
2728
o.completeopt = 'menuone,noselect' -- Popup menu when typing
28-
o.cursorline = true -- Show which line your cursor is on
29-
o.inccommand = 'split' -- Preview substitutions live, as you type!
30-
o.mouse = 'a' -- Enable mouse support
31-
o.number = true -- Show line numbers
32-
o.numberwidth = 3 -- Set the width of the number column
33-
o.relativenumber = true -- Show relative line numbers
34-
o.scrolloff = 15 -- Show context around cursor
35-
o.showmode = false -- Don't show mode
36-
o.signcolumn = 'yes:3' -- Keep signcolumn on by default
37-
o.smartindent = true -- Insert indents automatically
38-
o.spell = true -- Enable spell checking
39-
o.spelllang = 'en_us' -- Set the spell checking language
40-
o.splitbelow = true -- split to the bottom
41-
o.splitright = true -- vsplit to the right
42-
o.termguicolors = true -- Fixes Notify opacity issues
43-
o.timeoutlen = 250 -- Decrease mapped sequence wait time
44-
o.undofile = true -- Save undo history
45-
o.updatetime = 250 -- 250 ms = 2,5 seconds
46-
o.ignorecase = true -- Ignore case in search patterns
47-
o.smartcase = true -- Override 'ignorecase' if pattern contains upper case chars
29+
o.cursorline = true -- Show which line your cursor is on
30+
o.inccommand = 'split' -- Preview substitutions live, as you type!
31+
o.mouse = 'a' -- Enable mouse support
32+
o.number = true -- Show line numbers
33+
o.numberwidth = 3 -- Set the width of the number column
34+
o.relativenumber = true -- Show relative line numbers
35+
o.scrolloff = 15 -- Show context around cursor
36+
o.showmode = false -- Don't show mode
37+
o.signcolumn = 'yes:3' -- Keep signcolumn on by default
38+
o.smartindent = true -- Insert indents automatically
39+
o.spell = true -- Enable spell checking
40+
o.spelllang = 'en_us' -- Set the spell checking language
41+
o.splitbelow = true -- split to the bottom
42+
o.splitright = true -- vsplit to the right
43+
o.termguicolors = true -- Fixes Notify opacity issues
44+
o.timeoutlen = 250 -- Decrease mapped sequence wait time
45+
o.undofile = true -- Save undo history
46+
o.updatetime = 250 -- 250 ms = 2,5 seconds
47+
o.ignorecase = true -- Ignore case in search patterns
48+
o.smartcase = true -- Override 'ignorecase' if pattern contains upper case chars
4849

4950
-- List options
5051
o.list = true -- Show some invisible characters

config/nvim/lua/plugins/blink.lua

+7-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ return {
1212
'saghen/blink.compat',
1313
version = '*',
1414
-- lazy.nvim will automatically load the plugin when it's required by blink.cmp
15-
lazy = true,
1615
opts = {
1716
-- make sure to set opts so that lazy.nvim calls blink.compat's setup
1817
impersonate_nvim_cmp = true,
@@ -26,7 +25,7 @@ return {
2625
-- Lua plugin to turn github copilot into a cmp source
2726
-- https://github.com/giuxtaposition/blink-cmp-copilot
2827
{
29-
"giuxtaposition/blink-cmp-copilot",
28+
'giuxtaposition/blink-cmp-copilot',
3029
dependencies = {
3130
-- Fully featured & enhanced replacement for copilot.vim complete
3231
-- with API for interacting with Github Copilot
@@ -76,13 +75,13 @@ return {
7675
menu = {
7776
draw = {
7877
columns = {
79-
{ "label", "label_description", gap = 1 },
80-
{ "kind_icon", "kind", gap = 1 }
78+
{ 'label', 'label_description', gap = 1 },
79+
{ 'kind_icon', 'kind', gap = 1 },
8180
},
8281
},
8382
},
8483
documentation = {
85-
auto_show = true
84+
auto_show = true,
8685
},
8786
ghost_text = {
8887
enabled = false,
@@ -95,7 +94,7 @@ return {
9594
providers = {
9695
copilot = {
9796
name = 'copilot',
98-
module = 'blink-cmp-copilot'
97+
module = 'blink-cmp-copilot',
9998
},
10099
},
101100
completion = {
@@ -113,10 +112,10 @@ return {
113112
-- completion = { accept = { auto_brackets = { enabled = true } } }
114113

115114
-- experimental signature help support
116-
signature = { enabled = true }
115+
signature = { enabled = true },
117116
},
118117
-- allows extending the enabled_providers array elsewhere in your config
119118
-- without having to redefine it
120-
opts_extend = { "sources.completion.enabled_providers" },
119+
opts_extend = { 'sources.completion.enabled_providers' },
121120
},
122121
}

config/nvim/lua/plugins/folke.lua

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ return {
22
-- A collection of small QoL plugins for Neovim
33
-- https://github.com/folke/snacks.nvim
44
{
5-
"folke/snacks.nvim",
5+
'folke/snacks.nvim',
66
priority = 1000,
77
lazy = false,
88
---@type snacks.Config
@@ -17,24 +17,24 @@ return {
1717
quickfile = { enabled = true },
1818
statuscolumn = {
1919
enabled = true,
20-
left = { "mark", "sign" }, -- priority of signs on the left (high to low)
21-
right = { "fold", "git" }, -- priority of signs on the right (high to low)
20+
left = { 'mark', 'sign' }, -- priority of signs on the left (high to low)
21+
right = { 'fold', 'git' }, -- priority of signs on the right (high to low)
2222
folds = {
23-
open = true, -- show open fold icons
24-
git_hl = false, -- use Git Signs hl for fold icons
23+
open = true, -- show open fold icons
24+
git_hl = false, -- use Git Signs hl for fold icons
2525
},
2626
git = {
2727
-- patterns to match Git signs
28-
patterns = { "GitSign", "MiniDiffSign" },
28+
patterns = { 'GitSign', 'MiniDiffSign' },
2929
},
3030
refresh = 50, -- refresh at most every 50ms
3131
},
3232
words = { enabled = true },
3333
styles = {
3434
notification = {
35-
wo = { wrap = true } -- Wrap notifications
36-
}
37-
}
35+
wo = { wrap = true }, -- Wrap notifications
36+
},
37+
},
3838
},
3939
},
4040
-- A pretty diagnostics, references, telescope results,

0 commit comments

Comments
 (0)