chore: format all lua files

This commit is contained in:
2025-09-06 01:29:17 +02:00
parent cc8164aef9
commit 44dfa47f41
13 changed files with 225 additions and 205 deletions
+2 -2
View File
@@ -63,7 +63,7 @@ vim.api.nvim_create_autocmd("FileType", {
vim.api.nvim_create_autocmd("TermLeave", {
desc = "Reload buffers when leaving terminal",
pattern = "*",
callback = function ()
callback = function()
vim.cmd.checktime()
end
end,
})
+6 -6
View File
@@ -2,15 +2,15 @@ vim.g.mapleader = " "
vim.g.vimsyn_embed = "lpP"
vim.g.netrw_banner = 0
vim.g.netrw_liststyle = 1
vim.g.netrw_list_hide = '\\.venv/,\\.git/'
vim.g.netrw_list_hide = "\\.venv/,\\.git/"
vim.g.netrw_maxfilenamelen = 47
vim.g.netrw_mousemaps = 0
vim.g.netrw_sizestyle = 'H'
vim.g.netrw_sort_by = 'name'
vim.g.netrw_sort_options = 'i'
vim.g.netrw_sort_sequence = '[\\/]\\s*,*'
vim.g.netrw_sizestyle = "H"
vim.g.netrw_sort_by = "name"
vim.g.netrw_sort_options = "i"
vim.g.netrw_sort_sequence = "[\\/]\\s*,*"
vim.g.netrw_special_syntax = 1
vim.g.netrw_timefmt = '%d-%m-%Y %H:%M'
vim.g.netrw_timefmt = "%d-%m-%Y %H:%M"
vim.g.c_syntax_for_h = 1
vim.g.python_indent = {
open_paren = "shiftwidth()",
+39 -39
View File
@@ -3,18 +3,18 @@ vim.keymap.set("n", "tn", vim.cmd.tabnew)
vim.keymap.set("n", "tq", vim.cmd.tabclose)
-- Clipboard
if vim.env.TMUX and vim.fn.executable('tmux') then
if vim.env.TMUX and vim.fn.executable("tmux") then
vim.keymap.set(
{ "n", "x" },
"<leader>y",
"\"+y:call system('tmux load-buffer -w -', @+)<CR>"
)
else
vim.keymap.set({ "n", "x", }, "<leader>y", '"+y')
vim.keymap.set({ "n", "x" }, "<leader>y", '"+y')
end
vim.keymap.set({ "n", "x", }, "<leader>p", '"+p')
vim.keymap.set({ "n", "x", }, "<leader>P", '"+P')
vim.keymap.set({ "n", "x", }, "<leader>+", ":call setreg('+', @\")<CR>")
vim.keymap.set({ "n", "x" }, "<leader>p", '"+p')
vim.keymap.set({ "n", "x" }, "<leader>P", '"+P')
vim.keymap.set({ "n", "x" }, "<leader>+", ":call setreg('+', @\")<CR>")
-- Allow exiting insert mode in terminal by hitting <ESC>
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
@@ -29,8 +29,8 @@ vim.keymap.set("t", "<C-\\>", function()
end)
-- Use :diffput/get instead of normal one to allow staging visual selection
vim.keymap.set({"n", "x"}, "<leader>dp", ":diffput<CR>")
vim.keymap.set({"n", "x"}, "<leader>do", ":diffget<CR>")
vim.keymap.set({ "n", "x" }, "<leader>dp", ":diffput<CR>")
vim.keymap.set({ "n", "x" }, "<leader>do", ":diffget<CR>")
local close_pum = function()
if vim.fn.pumvisible() ~= 0 then
@@ -51,52 +51,52 @@ end, { expr = true })
vim.keymap.set("n", "<C-w>q", ":bp | bd#<CR>")
-- Allow (de)indenting without deselecting
vim.keymap.set({"x"}, "<", "<gv")
vim.keymap.set({"x"}, ">", ">gv")
vim.keymap.set({ "x" }, "<", "<gv")
vim.keymap.set({ "x" }, ">", ">gv")
-- Remove default mappings
vim.keymap.set("", "<C-LeftMouse>", "")
vim.keymap.set('n', 'K', function()
if vim.bo.filetype == 'vim' or vim.bo.filetype == 'help' then
vim.cmd('help ' .. vim.fn.expand('<cword>'))
vim.keymap.set("n", "K", function()
if vim.bo.filetype == "vim" or vim.bo.filetype == "help" then
vim.cmd("help " .. vim.fn.expand("<cword>"))
else
vim.cmd('Man ' .. vim.fn.expand('<cword>'))
vim.cmd("Man " .. vim.fn.expand("<cword>"))
end
end)
-- Remove right-click menu items
vim.cmd.aunmenu({ "PopUp.-1-", })
vim.cmd.aunmenu({ "PopUp.How-to\\ disable\\ mouse", })
vim.cmd.aunmenu({ "PopUp.-1-" })
vim.cmd.aunmenu({ "PopUp.How-to\\ disable\\ mouse" })
-- Insert-mode Emacs bindings
vim.keymap.set('i', '<C-f>', '<Right>')
vim.keymap.set('i', '<C-b>', '<Left>')
vim.keymap.set('i', '<C-a>', '<C-o>^')
vim.keymap.set('i', '<C-e>', '<C-o>$')
vim.keymap.set("i", "<C-f>", "<Right>")
vim.keymap.set("i", "<C-b>", "<Left>")
vim.keymap.set("i", "<C-a>", "<C-o>^")
vim.keymap.set("i", "<C-e>", "<C-o>$")
-- vim.keymap.set('i', '<C-d>', '<C-o>x') -- Overrides de-indent
vim.keymap.set('i', '<M-f>', '<C-o>w')
vim.keymap.set('i', '<M-b>', '<C-o>b')
vim.keymap.set('i', '<M-d>', '<C-o>dw')
vim.keymap.set('i', '<M-BS>', '<C-o>db')
vim.keymap.set("i", "<M-f>", "<C-o>w")
vim.keymap.set("i", "<M-b>", "<C-o>b")
vim.keymap.set("i", "<M-d>", "<C-o>dw")
vim.keymap.set("i", "<M-BS>", "<C-o>db")
-- Command-mode Emacs bindings
vim.keymap.set('c', '<C-f>', '<Right>')
vim.keymap.set('c', '<C-b>', '<Left>')
vim.keymap.set('c', '<C-a>', '<Home>')
vim.keymap.set('c', '<C-e>', '<End>')
vim.keymap.set('c', '<C-d>', '<Delete>')
vim.keymap.set('c', '<C-n>', '<Down>')
vim.keymap.set('c', '<C-p>', '<Up>')
vim.keymap.set('c', '<M-f>', '<C-Right>')
vim.keymap.set('c', '<M-b>', '<C-Left>')
vim.keymap.set('c', '<M-d>', '<C-Right><C-w>')
vim.keymap.set('c', '<M-BS>', '<C-w>')
vim.keymap.set("c", "<C-f>", "<Right>")
vim.keymap.set("c", "<C-b>", "<Left>")
vim.keymap.set("c", "<C-a>", "<Home>")
vim.keymap.set("c", "<C-e>", "<End>")
vim.keymap.set("c", "<C-d>", "<Delete>")
vim.keymap.set("c", "<C-n>", "<Down>")
vim.keymap.set("c", "<C-p>", "<Up>")
vim.keymap.set("c", "<M-f>", "<C-Right>")
vim.keymap.set("c", "<M-b>", "<C-Left>")
vim.keymap.set("c", "<M-d>", "<C-Right><C-w>")
vim.keymap.set("c", "<M-BS>", "<C-w>")
vim.keymap.set('n', '<leader>ve', function()
if vim.o.virtualedit == 'all' then
vim.o.virtualedit = 'block'
vim.keymap.set("n", "<leader>ve", function()
if vim.o.virtualedit == "all" then
vim.o.virtualedit = "block"
else
vim.o.virtualedit = 'all'
vim.o.virtualedit = "all"
end
end)
@@ -110,7 +110,7 @@ vim.keymap.set("n", "<Leader>r", function()
end)
-- Removed bindings
vim.keymap.set('n', 'gr', '<Nop>')
vim.keymap.set("n", "gr", "<Nop>")
-- Default bindings that are good to know:
-- insert mode:
+22 -13
View File
@@ -34,7 +34,7 @@ vim.opt.completeopt:append({
"noselect",
})
-- set nowrap
vim.opt.matchpairs:append({ "<:>", })
vim.opt.matchpairs:append({ "<:>" })
-- Only relevant with wrap enabled (default)
vim.opt.linebreak = true
vim.opt.breakindent = true
@@ -65,7 +65,7 @@ vim.opt.diffopt:append("closeoff")
vim.opt.diffopt:append("internal")
-- These make diffs easier to read, please see the following:
-- https://vimways.org/2018/the-power-of-diff/
vim.opt.diffopt:append({ "indent-heuristic", "algorithm:histogram", })
vim.opt.diffopt:append({ "indent-heuristic", "algorithm:histogram" })
vim.opt.diffopt:append("linematch:40")
vim.opt.hlsearch = true
vim.opt.laststatus = 2
@@ -75,7 +75,7 @@ vim.opt.shortmess:append("a")
vim.opt.autoread = true
-- vim.opt.cmdheight = 0 -- To hide cmdline when not used. Disabled due to
-- causing "Press ENTER to continue" messages for small messages.
vim.opt.jumpoptions = {'stack', 'view', 'clean'}
vim.opt.jumpoptions = { "stack", "view", "clean" }
vim.opt.updatetime = 100
vim.opt.guicursor:append("a:Cursor")
@@ -83,7 +83,7 @@ function _G._status_line_git()
local status = vim.b.gitsigns_status_dict
if not status then
return ''
return ""
end
local added = status.added or 0
@@ -93,15 +93,24 @@ function _G._status_line_git()
local parts = {}
if added > 0 then
table.insert(parts, string.format("%%#GitSignsAdd#+%d%%*", status.added))
table.insert(
parts,
string.format("%%#GitSignsAdd#+%d%%*", status.added)
)
end
if changed > 0 then
table.insert(parts, string.format('%%#GitSignsChange#~%d%%*', status.changed))
table.insert(
parts,
string.format("%%#GitSignsChange#~%d%%*", status.changed)
)
end
if removed > 0 then
table.insert(parts, string.format('%%#GitSignsDelete#-%d%%*', status.removed))
table.insert(
parts,
string.format("%%#GitSignsDelete#-%d%%*", status.removed)
)
end
return table.concat(parts, " ")
@@ -120,24 +129,24 @@ function _G._status_line_diagnostics()
end
if warn > 0 then
table.insert(parts, string.format('%%#DiagnosticWarn#W%d%%*', warn))
table.insert(parts, string.format("%%#DiagnosticWarn#W%d%%*", warn))
end
if hint > 0 then
table.insert(parts, string.format('%%#DiagnosticHint#H%d%%*', hint))
table.insert(parts, string.format("%%#DiagnosticHint#H%d%%*", hint))
end
if info > 0 then
table.insert(parts, string.format('%%#DiagnosticInfo#I%d%%*', info))
table.insert(parts, string.format("%%#DiagnosticInfo#I%d%%*", info))
end
return table.concat(parts, " ")
end
vim.opt.statusline = " %{expand('%:.')}%4( %m%) %{%v:lua._status_line_git()%} %="
.. " %{%v:lua._status_line_diagnostics()%} "
.. " %{&filetype} %-6.6{&fileencoding}"
.. " %-4.4{&fileformat} %4.4(%p%%%)%6.6l:%-3.3v"
.. " %{%v:lua._status_line_diagnostics()%} "
.. " %{&filetype} %-6.6{&fileencoding}"
.. " %-4.4{&fileformat} %4.4(%p%%%)%6.6l:%-3.3v"
vim.cmd("syntax on")
vim.cmd("filetype plugin indent on")