stylua added rule

This commit is contained in:
2026-06-20 03:44:26 +02:00
parent 907b234eb7
commit 6fb33b02cd
13 changed files with 154 additions and 145 deletions
+6 -4
View File
@@ -6,12 +6,14 @@ local neoformat_group = augroup("NeoformatOnSave", { clear = true })
autocmd("BufWritePost", {
group = neoformat_group,
callback = function()
if vim.bo.buftype ~= "" or vim.bo.modifiable == false or vim.bo.readonly then
return
end
if vim.fn.exists ":Neoformat" ~= 2 then
if
vim.bo.buftype ~= ""
or vim.bo.modifiable == false
or vim.bo.readonly
then
return
end
if vim.fn.exists ":Neoformat" ~= 2 then return end
vim.cmd "silent! Neoformat"
end,
})
+9 -5
View File
@@ -1,10 +1,16 @@
require("bufferline").setup {
options = {
diagnostics = "coc",
diagnostics_indicator = function(count, level, diagnostics_dict, context)
diagnostics_indicator = function(
count,
level,
diagnostics_dict,
context
)
local s = " "
for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and "" or (e == "warning" and "" or "")
local sym = e == "error" and ""
or (e == "warning" and "" or "")
s = s .. n .. sym
end
return s
@@ -16,9 +22,7 @@ require("bufferline").setup {
},
vim.api.nvim_create_autocmd({ "BufAdd", "BufDelete" }, {
callback = function()
vim.schedule(function()
pcall(nvim_bufferline)
end)
vim.schedule(function() pcall(nvim_bufferline) end)
end,
}),
},
+7 -5
View File
@@ -3,8 +3,12 @@ local cmp_lsp = require "cmp_nvim_lsp"
local M = {}
M.capabilities =
vim.tbl_deep_extend("force", {}, vim.lsp.protocol.make_client_capabilities(), cmp_lsp.default_capabilities())
M.capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
cmp_lsp.default_capabilities()
)
local cmp_kinds = {
Text = "",
@@ -47,9 +51,7 @@ cmp.setup {
},
completion = { completeopt = "menu,menuone" },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
expand = function(args) require("luasnip").lsp_expand(args.body) end,
},
mapping = { -- change later zach is ????
["<C-d>"] = cmp.mapping.scroll_docs(-4),
+9 -2
View File
@@ -7,7 +7,10 @@ dap.adapters.python = function(cb, config)
local host = (config.connect or config).host or "127.0.0.1"
cb {
type = "server",
port = assert(port, "`connect.port` is required for a python `attach` configuration"),
port = assert(
port,
"`connect.port` is required for a python `attach` configuration"
),
host = host,
options = { source_filetype = "python" },
}
@@ -59,7 +62,11 @@ dap.configurations.cpp = {
type = "lldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
return vim.fn.input(
"Path to executable: ",
vim.fn.getcwd() .. "/",
"file"
)
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
+5 -15
View File
@@ -6,22 +6,14 @@ local function on_attach(bufnr)
end
map("n", "]g", function()
if vim.wo.diff then
return "]g"
end
vim.schedule(function()
gs.next_hunk()
end)
if vim.wo.diff then return "]g" end
vim.schedule(function() gs.next_hunk() end)
return "<Ignore>"
end, "Next hunk")
map("n", "[g", function()
if vim.wo.diff then
return "[g"
end
vim.schedule(function()
gs.prev_hunk()
end)
if vim.wo.diff then return "[g" end
vim.schedule(function() gs.prev_hunk() end)
return "<Ignore>"
end, "Prev hunk")
@@ -30,9 +22,7 @@ local function on_attach(bufnr)
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
map("n", "<leader>hb", gs.blame_line, "Blame line")
map("n", "<leader>hd", gs.diffthis, "Diff this")
map("n", "<leader>hD", function()
gs.diffthis "~"
end, "Diff against ~")
map("n", "<leader>hD", function() gs.diffthis "~" end, "Diff against ~")
map("n", "<leader>htb", gs.toggle_current_line_blame, "Toggle line blame")
map("n", "<leader>htd", gs.toggle_deleted, "Toggle deleted")
end
+8 -2
View File
@@ -21,6 +21,12 @@ hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
end)
vim.g.rainbow_delimiters = { highlight = highlight }
require("ibl").setup { indent = { char = "" }, scope = { highlight = highlight } }
require("ibl").setup {
indent = { char = "" },
scope = { highlight = highlight },
}
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
hooks.register(
hooks.type.SCOPE_HIGHLIGHT,
hooks.builtin.scope_highlight_from_extmark
)
+15 -16
View File
@@ -1,7 +1,9 @@
local fn = vim.fn
local function get_coc_lsp_client()
local clients = vim.g.coc_service_initialized and vim.fn["CocAction"] "services" or {}
local clients = vim.g.coc_service_initialized
and vim.fn["CocAction"] "services"
or {}
for _, client in pairs(clients) do
if client["state"] == "running" then
local client_name = client["id"]
@@ -14,9 +16,7 @@ local function get_coc_lsp_client()
end
local function spell()
if vim.o.spell then
return string.format "[SPELL]"
end
if vim.o.spell then return string.format "[SPELL]" end
return ""
end
@@ -24,11 +24,10 @@ end
--- show indicator for Chinese IME
local function ime_state()
if vim.g.is_mac then
local layout = fn.libcall(vim.g.XkbSwitchLib, "Xkb_Switch_getXkbLayout", "")
local layout =
fn.libcall(vim.g.XkbSwitchLib, "Xkb_Switch_getXkbLayout", "")
local res = fn.match(layout, [[\v(Squirrel\.Rime|SCIM.ITABC)]])
if res ~= -1 then
return "[CN]"
end
if res ~= -1 then return "[CN]" end
end
return ""
@@ -36,24 +35,21 @@ end
local diff = function()
local git_status = vim.b.gitsigns_status_dict
if git_status == nil then
return
end
if git_status == nil then return end
local modify_num = git_status.changed
local remove_num = git_status.removed
local add_num = git_status.added
local info = { added = add_num, modified = modify_num, removed = remove_num }
local info =
{ added = add_num, modified = modify_num, removed = remove_num }
-- vim.print(info)
return info
end
local virtual_env = function()
-- only show virtual env for Python
if vim.bo.filetype ~= "python" then
return ""
end
if vim.bo.filetype ~= "python" then return "" end
local conda_env = os.getenv "CONDA_DEFAULT_ENV"
local venv_path = os.getenv "VIRTUAL_ENV"
@@ -116,7 +112,10 @@ require("lualine").setup {
},
lualine_y = {
{ "encoding", fmt = string.upper },
{ "fileformat", symbols = { unix = "", dos = "", mac = "" } },
{
"fileformat",
symbols = { unix = "", dos = "", mac = "" },
},
"filetype",
},
lualine_z = { "progress" },
+55 -33
View File
@@ -26,9 +26,7 @@ require("notify").setup {
local client_notifs = {}
local function get_notif_data(client_id, token)
if not client_notifs[client_id] then
client_notifs[client_id] = {}
end
if not client_notifs[client_id] then client_notifs[client_id] = {} end
if not client_notifs[client_id][token] then
client_notifs[client_id][token] = {}
@@ -37,7 +35,8 @@ local function get_notif_data(client_id, token)
return client_notifs[client_id][token]
end
local spinner_frames = { "", "", "", "", "", "", "", "" }
local spinner_frames =
{ "", "", "", "", "", "", "", "" }
local function update_spinner(client_id, token)
local notif_data = get_notif_data(client_id, token)
@@ -52,9 +51,7 @@ local function update_spinner(client_id, token)
replace = notif_data.notification,
})
vim.defer_fn(function()
update_spinner(client_id, token)
end, 100)
vim.defer_fn(function() update_spinner(client_id, token) end, 100)
end
end
@@ -74,9 +71,7 @@ vim.lsp.handlers["$/progress"] = function(_, result, ctx)
local val = result.value
if not val.kind then
return
end
if not val.kind then return end
local notif_data = get_notif_data(client_id, result.token)
@@ -84,7 +79,10 @@ vim.lsp.handlers["$/progress"] = function(_, result, ctx)
local message = format_message(val.message, val.percentage)
notif_data.notification = vim.notify(message, "info", {
title = format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
title = format_title(
val.title,
vim.lsp.get_client_by_id(client_id).name
),
icon = spinner_frames[1],
timeout = false,
hide_from_history = false,
@@ -93,16 +91,21 @@ vim.lsp.handlers["$/progress"] = function(_, result, ctx)
notif_data.spinner = 1
update_spinner(client_id, result.token)
elseif val.kind == "report" and notif_data then
notif_data.notification = vim.notify(format_message(val.message, val.percentage), "info", {
replace = notif_data.notification,
hide_from_history = false,
})
notif_data.notification =
vim.notify(format_message(val.message, val.percentage), "info", {
replace = notif_data.notification,
hide_from_history = false,
})
elseif val.kind == "end" and notif_data then
notif_data.notification = vim.notify(val.message and format_message(val.message) or "Complete", "info", {
icon = "",
replace = notif_data.notification,
timeout = 6000,
})
notif_data.notification = vim.notify(
val.message and format_message(val.message) or "Complete",
"info",
{
icon = "",
replace = notif_data.notification,
timeout = 6000,
}
)
notif_data.spinner = nil
end
@@ -111,14 +114,22 @@ end
-- table from lsp severity to vim severity.
local severity = { "error", "warn", "info" }
vim.lsp.handlers["window/showMessage"] = function(err, method, params, client_id)
vim.lsp.handlers["window/showMessage"] = function(
err,
method,
params,
client_id
)
vim.notify(method.message, severity[params.type])
end
-- DAP integration
-- Make sure to also have the snippet with the common helper functions in your config!
dap.listeners.before["event_progressStart"]["progress-notifications"] = function(session, body)
dap.listeners.before["event_progressStart"]["progress-notifications"] = function(
session,
body
)
local notif_data = get_notif_data("dap", body.progressId)
local message = format_message(body.message, body.percentage)
@@ -132,20 +143,31 @@ dap.listeners.before["event_progressStart"]["progress-notifications"] = function
notif_data.notification.spinner = 1, update_spinner("dap", body.progressId)
end
dap.listeners.before["event_progressUpdate"]["progress-notifications"] = function(session, body)
dap.listeners.before["event_progressUpdate"]["progress-notifications"] = function(
session,
body
)
local notif_data = get_notif_data("dap", body.progressId)
notif_data.notification = vim.notify(format_message(body.message, body.percentage), "info", {
replace = notif_data.notification,
hide_from_history = false,
})
notif_data.notification =
vim.notify(format_message(body.message, body.percentage), "info", {
replace = notif_data.notification,
hide_from_history = false,
})
end
dap.listeners.before["event_progressEnd"]["progress-notifications"] = function(session, body)
dap.listeners.before["event_progressEnd"]["progress-notifications"] = function(
session,
body
)
local notif_data = client_notifs["dap"][body.progressId]
notif_data.notification = vim.notify(body.message and format_message(body.message) or "Complete", "info", {
icon = "",
replace = notif_data.notification,
timeout = 6000,
})
notif_data.notification = vim.notify(
body.message and format_message(body.message) or "Complete",
"info",
{
icon = "",
replace = notif_data.notification,
timeout = 6000,
}
)
notif_data.spinner = nil
end
+2 -6
View File
@@ -1,12 +1,8 @@
if not vim.F then
vim.F = {}
end
if not vim.F then vim.F = {} end
if not vim.F.if_nil and not vim.nonnil then
vim.F.if_nil = function(value, default)
if value == nil then
return default
end
if value == nil then return default end
return value
end
end
+8 -7
View File
@@ -1,9 +1,7 @@
local map = vim.keymap.set
local default_opts = { noremap = true }
map("n", "<leader>n", function()
Snacks.notifier.show_history()
end)
map("n", "<leader>n", function() Snacks.notifier.show_history() end)
map(
"n",
@@ -34,7 +32,12 @@ map("n", "<A-k>", "<C-w>k", { desc = "Move to top split" })
map("n", "<A-l>", "<C-w>l", { desc = "Move to right split" })
map("n", "<leader>e", vim.cmd.NvimTreeToggle)
map("n", "<leader>u", require("undotree").toggle, { noremap = true, silent = true })
map(
"n",
"<leader>u",
require("undotree").toggle,
{ noremap = true, silent = true }
)
map("n", "<A-->", ":bdelete<CR>")
-- map("n", "<SA-->", ":BufferRestore<CR>")
@@ -67,6 +70,4 @@ map("i", "<C-c>", "<Esc>")
map("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>")
map("n", "<leader><leader>", function()
vim.cmd "so"
end)
map("n", "<leader><leader>", function() vim.cmd "so" end)
+6 -5
View File
@@ -22,7 +22,8 @@ vim.opt.updatetime = 50
vim.opt.textwidth = 0
vim.opt.colorcolumn = "100"
vim.opt.formatoptions = "rqnj"
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
vim.o.sessionoptions =
"blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
vim.o.laststatus = 0
vim.o.clipboard = "unnamedplus"
vim.o.cursorline = true
@@ -47,8 +48,8 @@ vim.g.loaded_ruby_provider = 0
local is_windows = vim.fn.has "win32" ~= 0
local sep = is_windows and "\\" or "/"
local delim = is_windows and ";" or ":"
vim.env.PATH = table.concat({ vim.fn.stdpath "data", "mason", "bin" }, sep) .. delim .. vim.env.PATH
vim.env.PATH = table.concat({ vim.fn.stdpath "data", "mason", "bin" }, sep)
.. delim
.. vim.env.PATH
vim.api.nvim_create_user_command("Nf", function()
vim.cmd "Neoformat"
end, {})
vim.api.nvim_create_user_command("Nf", function() vim.cmd "Neoformat" end, {})
+22 -44
View File
@@ -4,21 +4,23 @@ return {
},
{
"lewis6991/gitsigns.nvim",
config = function()
require "config.gitsigns"
end,
config = function() require "config.gitsigns" end,
},
{
"vimpostor/vim-tpipeline",
},
{ "vimpostor/vim-tpipeline" },
{
"aznhe21/actions-preview.nvim",
config = function()
require "config.actions-preview"
end,
config = function() require "config.actions-preview" end,
},
{
"sbdchd/neoformat",
init = function()
vim.cmd("source" .. vim.fn.stdpath "config" .. "/lua/config/neoformat.vim")
vim.cmd(
"source"
.. vim.fn.stdpath "config"
.. "/lua/config/neoformat.vim"
)
end,
},
{
@@ -62,90 +64,66 @@ return {
"saadparwaiz1/cmp_luasnip",
"j-hui/fidget.nvim",
},
config = function()
require "config.lspconfig"
end,
config = function() require "config.lspconfig" end,
},
{
"https://gitlab.com/itaranto/plantuml.nvim",
version = "*",
config = function()
require("plantuml").setup()
end,
config = function() require("plantuml").setup() end,
},
{
"nvim-treesitter/nvim-treesitter",
lazy = false,
branch = "main",
build = ":TSUpdate",
config = function()
require "config.treesitter"
end,
config = function() require "config.treesitter" end,
},
{
"rmagatti/auto-session",
config = function()
require "config.autosession"
end,
config = function() require "config.autosession" end,
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require "config.telescope"
end,
config = function() require "config.telescope" end,
},
{ "lambdalisue/vim-suda" },
{ "nvim-tree/nvim-web-devicons" },
{
"nvim-tree/nvim-tree.lua",
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
config = function()
require "config.nvimtree"
end,
config = function() require "config.nvimtree" end,
},
{
"akinsho/bufferline.nvim",
event = "VeryLazy",
config = function()
require "config.barbar"
end,
config = function() require "config.barbar" end,
},
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
config = function()
require "config.lualine"
end,
config = function() require "config.lualine" end,
},
{
"jiaoshijie/undotree",
config = function()
require "config.undotree"
end,
config = function() require "config.undotree" end,
},
{ "hiphish/rainbow-delimiters.nvim" },
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
require "config.autopairs"
end,
config = function() require "config.autopairs" end,
},
{ "tpope/vim-fugitive" },
{
"catgoose/nvim-colorizer.lua",
config = function()
require "config.colorizer"
end,
config = function() require "config.colorizer" end,
},
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
{ "ellisonleao/gruvbox.nvim", priority = 1000, config = true, opts = ... },
{
"mfussenegger/nvim-dap",
config = function()
require "config.dap"
end,
config = function() require "config.dap" end,
},
{
"MeanderingProgrammer/render-markdown.nvim",