chore: run lint and fix errors

This commit is contained in:
2026-03-25 15:52:53 +05:00
parent 5ccf595db2
commit 4db280c102
10 changed files with 78 additions and 77 deletions

View File

@@ -57,7 +57,7 @@ for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
end end
-- add binaries installed by mason.nvim to path -- add binaries installed by mason.nvim to path
local is_windows = vim.fn.has("win32") ~= 0 local is_windows = vim.fn.has "win32" ~= 0
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
-------------------------------------- autocmds ------------------------------------------ -------------------------------------- autocmds ------------------------------------------
@@ -112,7 +112,7 @@ vim.api.nvim_create_autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("NvFilePost", { clear = true }), group = vim.api.nvim_create_augroup("NvFilePost", { clear = true }),
callback = function(args) callback = function(args)
local file = vim.api.nvim_buf_get_name(args.buf) local file = vim.api.nvim_buf_get_name(args.buf)
local buftype = vim.api.nvim_buf_get_option(args.buf, "buftype") local buftype = vim.bo[args.buf].buftype
if not vim.g.ui_entered and args.event == "UIEnter" then if not vim.g.ui_entered and args.event == "UIEnter" then
vim.g.ui_entered = true vim.g.ui_entered = true
@@ -123,12 +123,10 @@ vim.api.nvim_create_autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, {
vim.api.nvim_del_augroup_by_name "NvFilePost" vim.api.nvim_del_augroup_by_name "NvFilePost"
vim.schedule(function() vim.schedule(function()
vim.api.nvim_exec_autocmds("FileType", {})
if vim.g.editorconfig then if vim.g.editorconfig then
require("editorconfig").config(args.buf) require("editorconfig").config(args.buf)
end end
end, 0) end)
end end
end, end,
}) })

View File

@@ -202,14 +202,14 @@ M.lspconfig = {
["[d"] = { ["[d"] = {
function() function()
vim.diagnostic.goto_prev { float = { border = "rounded" } } vim.diagnostic.jump { count = -1, float = { border = "rounded" } }
end, end,
"Goto prev", "Goto prev",
}, },
["]d"] = { ["]d"] = {
function() function()
vim.diagnostic.goto_next { float = { border = "rounded" } } vim.diagnostic.jump { float = { border = "rounded" } }
end, end,
"Goto next", "Goto next",
}, },

View File

@@ -106,7 +106,7 @@ M.lazy_load = function(plugin)
if plugin == "nvim-lspconfig" then if plugin == "nvim-lspconfig" then
vim.cmd "silent! do FileType" vim.cmd "silent! do FileType"
end end
end, 0) end)
else else
require("lazy").load { plugins = plugin } require("lazy").load { plugins = plugin }
end end

View File

@@ -1,9 +1,9 @@
---@type ChadrcConfig ---@type ChadrcConfig
local M = {} local M = {}
M.ui = { theme = 'catppuccin' } M.ui = { theme = "catppuccin" }
M.mappings = require('custom.mappings') M.mappings = require "custom.mappings"
M.plugins = 'custom.plugins' M.plugins = "custom.plugins"
return M return M

View File

@@ -1,4 +1,4 @@
local dap = require("dap") local dap = require "dap"
dap.adapters["pwa-node"] = { dap.adapters["pwa-node"] = {
type = "server", type = "server",

View File

@@ -1,4 +1,4 @@
local config = require("plugins.configs.lspconfig") local config = require "plugins.configs.lspconfig"
local on_attach = config.on_attach local on_attach = config.on_attach
local capabilities = config.capabilities local capabilities = config.capabilities
@@ -11,7 +11,7 @@ local custom_on_attach = function(client, bufnr)
command = "_typescript.organizeImports", command = "_typescript.organizeImports",
arguments = { vim.api.nvim_buf_get_name(0) }, arguments = { vim.api.nvim_buf_get_name(0) },
} }
vim.lsp.buf.execute_command(params) client:request("workspace/executeCommand", params)
end, { desc = "Organize Imports" }) end, { desc = "Organize Imports" })
end end
end end
@@ -22,22 +22,22 @@ vim.lsp.config("ts_ls", {
init_options = { init_options = {
preferences = { preferences = {
disablesuggestions = true, disablesuggestions = true,
} },
}, },
}) })
vim.lsp.enable("ts_ls") vim.lsp.enable "ts_ls"
vim.lsp.config("terraformls", { vim.lsp.config("terraformls", {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
}) })
vim.lsp.enable("terraformls") vim.lsp.enable "terraformls"
vim.lsp.config("tflint", { vim.lsp.config("tflint", {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
}) })
vim.lsp.enable("tflint") vim.lsp.enable "tflint"
vim.lsp.config("gopls", { vim.lsp.config("gopls", {
on_attach = on_attach, on_attach = on_attach,
@@ -55,14 +55,14 @@ vim.lsp.config("gopls", {
}, },
}, },
}) })
vim.lsp.enable("gopls") vim.lsp.enable "gopls"
vim.lsp.config("pyright", { vim.lsp.config("pyright", {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
filetypes = { "python" }, filetypes = { "python" },
}) })
vim.lsp.enable("pyright") vim.lsp.enable "pyright"
vim.lsp.config("nil_ls", { vim.lsp.config("nil_ls", {
on_attach = on_attach, on_attach = on_attach,
@@ -70,7 +70,7 @@ vim.lsp.config("nil_ls", {
cmd = { "nil" }, cmd = { "nil" },
filetypes = { "nix" }, filetypes = { "nix" },
settings = { settings = {
['nil'] = { ["nil"] = {
testSetting = 42, testSetting = 42,
formatting = { formatting = {
command = { "nixfmt" }, command = { "nixfmt" },
@@ -78,4 +78,4 @@ vim.lsp.config("nil_ls", {
}, },
}, },
}) })
vim.lsp.enable("nil_ls") vim.lsp.enable "nil_ls"

View File

@@ -1,7 +1,12 @@
vim.g.maplocalleader = "," vim.g.maplocalleader = ","
vim.opt.colorcolumn = "80" vim.opt.colorcolumn = "80"
vim.g.copilot_no_tab_map = true vim.g.copilot_no_tab_map = true
vim.api.nvim_set_keymap("i", "<C-o>", 'copilot#Accept("<CR>")', { silent = true, expr = true, noremap = true, script = true }) vim.api.nvim_set_keymap(
"i",
"<C-o>",
'copilot#Accept("<CR>")',
{ silent = true, expr = true, noremap = true, script = true }
)
vim.wo.relativenumber = true vim.wo.relativenumber = true
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
@@ -12,7 +17,7 @@ vim.opt.autoread = true
vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter" }, { vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter" }, {
pattern = "*", pattern = "*",
callback = function() callback = function()
vim.cmd("checktime") vim.cmd "checktime"
end, end,
}) })

View File

@@ -8,16 +8,16 @@ M.disabled = {
}, },
} }
M['rust-tools'] = { M["rust-tools"] = {
n = { n = {
["<C-space>"] = { ["<C-space>"] = {
function () function()
require("rust-tools.hover_actions").hover_actions() require("rust-tools.hover_actions").hover_actions()
end, end,
"Rust hover actions", "Rust hover actions",
}, },
["<leader>a"] = { ["<leader>a"] = {
function () function()
require("rust-tools.code_action_group").code_action_group() require("rust-tools.code_action_group").code_action_group()
end, end,
"Rust code action group", "Rust code action group",
@@ -39,7 +39,7 @@ M.dap = {
"<cmd> DapTerminate <CR>", "<cmd> DapTerminate <CR>",
"Close Debugger", "Close Debugger",
}, },
} },
} }
M.dap_python = { M.dap_python = {
@@ -47,12 +47,12 @@ M.dap_python = {
n = { n = {
["<leader>dpr"] = { ["<leader>dpr"] = {
function () function()
require("dap-python").test_method() require("dap-python").test_method()
end, end,
"Debug test method", "Debug test method",
}, },
} },
} }
M.lazygit = { M.lazygit = {
@@ -83,7 +83,7 @@ M.noice = {
"<cmd> Noice last <CR>", "<cmd> Noice last <CR>",
"Show last message", "Show last message",
}, },
["<leader>nt"] ={ ["<leader>nt"] = {
"<cmd> Noice telescope <CR>", "<cmd> Noice telescope <CR>",
"Noice telescope mode", "Noice telescope mode",
}, },
@@ -101,15 +101,15 @@ M.noice = {
M.worktree = { M.worktree = {
n = { n = {
["<leader>gwv"] = { ["<leader>gwv"] = {
function () function()
local telescope = require("telescope") local telescope = require "telescope"
telescope.extensions.git_worktree.git_worktrees() telescope.extensions.git_worktree.git_worktrees()
end, end,
"View Git Worktrees", "View Git Worktrees",
}, },
["<leader>gwn"] = { ["<leader>gwn"] = {
function () function()
local telescope = require("telescope") local telescope = require "telescope"
telescope.extensions.git_worktree.create_git_worktree() telescope.extensions.git_worktree.create_git_worktree()
end, end,
"New Git Worktree", "New Git Worktree",
@@ -136,7 +136,7 @@ M.trouble = {
"<cmd> Trouble diagnostics toggle <CR>", "<cmd> Trouble diagnostics toggle <CR>",
"Diagnostics (Trouble)", "Diagnostics (Trouble)",
}, },
} },
} }
M.tabufline = { M.tabufline = {

View File

@@ -13,19 +13,19 @@ local plugins = {
"rcarriga/nvim-dap-ui", "rcarriga/nvim-dap-ui",
"nvim-neotest/nvim-nio", "nvim-neotest/nvim-nio",
}, },
config = function (_, _) config = function(_, _)
local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python" local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python"
require("dap-python").setup(path) require("dap-python").setup(path)
end end,
}, },
{ {
"rcarriga/nvim-dap-ui", "rcarriga/nvim-dap-ui",
dependencies = { dependencies = {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
}, },
config = function () config = function()
local dap = require("dap") local dap = require "dap"
local dapui = require("dapui") local dapui = require "dapui"
dapui.setup() dapui.setup()
dap.listeners.after.event_initialized["dapui_config"] = function() dap.listeners.after.event_initialized["dapui_config"] = function()
@@ -42,8 +42,8 @@ local plugins = {
{ "folke/neodev.nvim", opts = {} }, { "folke/neodev.nvim", opts = {} },
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
config = function () config = function()
require("telescope").load_extension("git_worktree") require("telescope").load_extension "git_worktree"
end, end,
}, },
{ {
@@ -77,7 +77,7 @@ local plugins = {
enabled = false, enabled = false,
}, },
}, },
config = function (_, opts) config = function(_, opts)
require("noice").setup(opts) require("noice").setup(opts)
end, end,
dependencies = { dependencies = {
@@ -139,9 +139,9 @@ local plugins = {
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
config = function () config = function()
require("plugins.configs.lspconfig") require "plugins.configs.lspconfig"
require("custom.configs.lspconfig") require "custom.configs.lspconfig"
end, end,
}, },
{ {
@@ -151,7 +151,7 @@ local plugins = {
{ {
"rust-lang/rust.vim", "rust-lang/rust.vim",
ft = "rust", ft = "rust",
init =function () init = function()
vim.g.rustfmt_autosave = 1 vim.g.rustfmt_autosave = 1
end, end,
}, },
@@ -159,8 +159,8 @@ local plugins = {
"simrat39/rust-tools.nvim", "simrat39/rust-tools.nvim",
ft = "rust", ft = "rust",
dependencies = { "neovim/nvim-lspconfig", "nvim-lua/plenary.nvim", "mfussenegger/nvim-dap" }, dependencies = { "neovim/nvim-lspconfig", "nvim-lua/plenary.nvim", "mfussenegger/nvim-dap" },
opts = function () opts = function()
local lspconfig = require("plugins.configs.lspconfig") local lspconfig = require "plugins.configs.lspconfig"
-- local extension_path = vim.env.HOME .. "/.local/share/nvim/mason/packages/codelldb/extension/" -- local extension_path = vim.env.HOME .. "/.local/share/nvim/mason/packages/codelldb/extension/"
-- local codelldb_path = extension_path .. 'adapter/codelldb' -- local codelldb_path = extension_path .. 'adapter/codelldb'
-- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so' -- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so'
@@ -193,7 +193,7 @@ local plugins = {
}, },
{ {
"crnvl96/lazydocker.nvim", "crnvl96/lazydocker.nvim",
opts = {}, -- automatically calls `require("lazydocker").setup()` opts = {}, -- automatically calls `require("lazydocker").setup()`
dependencies = { dependencies = {
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
}, },
@@ -202,13 +202,13 @@ local plugins = {
"saecki/crates.nvim", "saecki/crates.nvim",
event = { "BufRead Cargo.toml" }, event = { "BufRead Cargo.toml" },
config = function(_, opts) config = function(_, opts)
local crates = require("crates") local crates = require "crates"
crates.setup(opts) crates.setup(opts)
cmp.setup.buffer({ cmp.setup.buffer {
sources = { { name = "crates" }} sources = { { name = "crates" } },
}) }
crates.show() crates.show()
require("core.utils").load_mappings("crates") require("core.utils").load_mappings "crates"
end, end,
}, },
{ {
@@ -220,22 +220,22 @@ local plugins = {
behavior = cmp.ConfirmBehavior.Insert, behavior = cmp.ConfirmBehavior.Insert,
select = false, select = false,
} }
table.insert(M.sources, {name = "crates"}) table.insert(M.sources, { name = "crates" })
return M return M
end, end,
}, },
{ {
"mhartington/formatter.nvim", "mhartington/formatter.nvim",
event = "VeryLazy", event = "VeryLazy",
opts = function () opts = function()
return require("custom.configs.formatter") return require "custom.configs.formatter"
end end,
}, },
{ {
"laytan/cloak.nvim", "laytan/cloak.nvim",
lazy = false, lazy = false,
config = function () config = function()
require("cloak").setup({ require("cloak").setup {
enabled = true, enabled = true,
cloak_character = "*", cloak_character = "*",
-- The applied highlight group (colors) on the cloaking, see `:h highlight`. -- The applied highlight group (colors) on the cloaking, see `:h highlight`.
@@ -245,30 +245,28 @@ local plugins = {
-- Match any file starting with ".env". -- Match any file starting with ".env".
-- This can be a table to match multiple file patterns. -- This can be a table to match multiple file patterns.
file_pattern = { file_pattern = {
".env*", ".env*",
"wrangler.toml", "wrangler.toml",
".dev.vars", ".dev.vars",
}, },
-- Match an equals sign and any character after it. -- Match an equals sign and any character after it.
-- This can also be a table of patterns to cloak, -- This can also be a table of patterns to cloak,
-- example: cloak_pattern = { ":.+", "-.+" } for yaml files. -- example: cloak_pattern = { ":.+", "-.+" } for yaml files.
cloak_pattern = "=.+" cloak_pattern = "=.+",
}, },
}, },
}) }
end, end,
}, },
{ {
"yetone/avante.nvim", "yetone/avante.nvim",
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true` -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
-- ⚠️ must add this setting! ! ! -- ⚠️ must add this setting! ! !
build = vim.fn.has("win32") ~= 0 build = vim.fn.has "win32" ~= 0 and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false"
and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" or "make",
or "make",
event = "VeryLazy", event = "VeryLazy",
version = false, -- Never set this value to "*"! Never! version = false, -- Never set this value to "*"! Never!
---@module 'avante' ---@module 'avante'
---@type avante.Config
opts = { opts = {
-- add any opts here -- add any opts here
-- this file can contain specific instructions for your project -- this file can contain specific instructions for your project
@@ -280,10 +278,10 @@ local plugins = {
endpoint = "https://api.anthropic.com", endpoint = "https://api.anthropic.com",
model = "claude-sonnet-4-20250514", model = "claude-sonnet-4-20250514",
timeout = 30000, -- Timeout in milliseconds timeout = 30000, -- Timeout in milliseconds
extra_request_body = { extra_request_body = {
temperature = 0.75, temperature = 0.75,
max_tokens = 20480, max_tokens = 20480,
}, },
}, },
moonshot = { moonshot = {
endpoint = "https://api.moonshot.ai/v1", endpoint = "https://api.moonshot.ai/v1",
@@ -327,7 +325,7 @@ local plugins = {
}, },
{ {
-- Make sure to set this up properly if you have lazy=true -- Make sure to set this up properly if you have lazy=true
'MeanderingProgrammer/render-markdown.nvim', "MeanderingProgrammer/render-markdown.nvim",
opts = { opts = {
file_types = { "markdown", "Avante" }, file_types = { "markdown", "Avante" },
}, },

View File

@@ -62,6 +62,6 @@ vim.lsp.config("lua_ls", {
}, },
}, },
}) })
vim.lsp.enable("lua_ls") vim.lsp.enable "lua_ls"
return M return M