From e91471432f7b7e3e5cb6cdb245819998d6653b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 8 Jul 2025 13:39:02 +0200 Subject: [PATCH] nvim: run stylua --- .config/nvim/after/plugin/cmp.lua | 11 ++++++++--- .config/nvim/after/plugin/lsp.lua | 4 +++- .config/nvim/after/plugin/telescope.lua | 2 +- .config/nvim/after/plugin/treesitter.lua | 4 +++- .config/nvim/lua/cmds.lua | 12 +++++++++--- .config/nvim/lua/maps.lua | 4 +++- .stylua.toml | 2 +- 7 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.config/nvim/after/plugin/cmp.lua b/.config/nvim/after/plugin/cmp.lua index e3734045..5f15e3cf 100644 --- a/.config/nvim/after/plugin/cmp.lua +++ b/.config/nvim/after/plugin/cmp.lua @@ -47,7 +47,8 @@ ls.add_snippets("typst", { t("#entry("), f(show_date_typst_entry), t { ")[", "" }, - t(" "), i(0), + t(" "), + i(0), t { "", "]" }, }), s("lang", { @@ -62,7 +63,9 @@ local function get_cms() assert(vim.bo.commentstring ~= "", "comment string is not set") local left = vim.bo.commentstring:gsub("%s*%%s.*", "") local right = vim.bo.commentstring:gsub(".*%%s%s*", "") - if right == "" then right = left end + if right == "" then + right = left + end return { left = left, right = right } end local function horizon(args) @@ -122,7 +125,9 @@ ls.add_snippets("go", { local of_filetype = function(fts) local ft = vim.bo.filetype for _, v in ipairs(fts) do - if v == ft then return true end + if v == ft then + return true + end end return false end diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua index 44796a73..6736b371 100644 --- a/.config/nvim/after/plugin/lsp.lua +++ b/.config/nvim/after/plugin/lsp.lua @@ -175,7 +175,9 @@ require("lspconfig")["ltex_plus"].setup { local ltex_dict = {} if vim.uv.fs_stat(ltex_dict_path) then for line in io.lines(ltex_dict_path) do - if not string.startswith(line, "#") and line ~= "" then table.insert(ltex_dict, line) end + if not string.startswith(line, "#") and line ~= "" then + table.insert(ltex_dict, line) + end end end client.config.settings.ltex.dictionary = { diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/after/plugin/telescope.lua index bb501ddf..948c0b5d 100644 --- a/.config/nvim/after/plugin/telescope.lua +++ b/.config/nvim/after/plugin/telescope.lua @@ -9,7 +9,7 @@ local state = require("telescope.state") local vimgrep_arguments = { unpack(config.values.vimgrep_arguments) } table.insert(vimgrep_arguments, "--hidden") -- search hidden -table.insert(vimgrep_arguments, "--glob") -- ignore git +table.insert(vimgrep_arguments, "--glob") -- ignore git table.insert(vimgrep_arguments, "!**/.git/*") telescope.setup { diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua index c1f391f4..c6610e50 100644 --- a/.config/nvim/after/plugin/treesitter.lua +++ b/.config/nvim/after/plugin/treesitter.lua @@ -22,7 +22,9 @@ require("nvim-treesitter.configs").setup { disable = function(lang, buf) local max_filesize = 100 * 1024 -- 100 KB local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf)) - if ok and stats and stats.size > max_filesize then return true end + if ok and stats and stats.size > max_filesize then + return true + end end, indent = true, diff --git a/.config/nvim/lua/cmds.lua b/.config/nvim/lua/cmds.lua index ca6f05f5..c0fcd104 100644 --- a/.config/nvim/lua/cmds.lua +++ b/.config/nvim/lua/cmds.lua @@ -120,11 +120,17 @@ vim.api.nvim_create_autocmd("OptionSet", { }) vim.api.nvim_create_user_command("Retab", function(opts) - if #opts.fargs ~= 2 then return print("should have exactly two argument: [src] and [dst]") end + if #opts.fargs ~= 2 then + return print("should have exactly two argument: [src] and [dst]") + end local src = tonumber(opts.fargs[1]) local dst = tonumber(opts.fargs[2]) - if src == nil then print("first argument [src] is not a valid number") end - if dst == nil then print("second argument [dst] is not a valid number") end + if src == nil then + print("first argument [src] is not a valid number") + end + if dst == nil then + print("second argument [dst] is not a valid number") + end vim.bo.shiftwidth = src vim.bo.tabstop = src diff --git a/.config/nvim/lua/maps.lua b/.config/nvim/lua/maps.lua index 1c1037e1..d9823e08 100644 --- a/.config/nvim/lua/maps.lua +++ b/.config/nvim/lua/maps.lua @@ -64,7 +64,9 @@ vim.api.nvim_create_autocmd("WinClosed", { group = vim.api.nvim_create_augroup("conf_fugitive_prevwin", {}), callback = function(args) local win = tonumber(args.match) - if win == vim.api.nvim_get_current_win() and vim.bo.filetype == "fugitive" then vim.cmd.wincmd("p") end + if win == vim.api.nvim_get_current_win() and vim.bo.filetype == "fugitive" then + vim.cmd.wincmd("p") + end end, }) diff --git a/.stylua.toml b/.stylua.toml index ef03137d..5f0d7dad 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -4,7 +4,7 @@ indent_type = "Spaces" indent_width = 4 quote_style = "AutoPreferDouble" call_parentheses = "NoSingleTable" -collapse_simple_statement = "Always" +collapse_simple_statement = "FunctionOnly" [sort_requires] enabled = false