fix: namespace all local packages and modules

This commit is contained in:
2025-04-16 23:16:58 +02:00
parent 0c327701a1
commit 16ccb1d107
45 changed files with 43 additions and 32 deletions
-75
View File
@@ -1,75 +0,0 @@
vim.api.nvim_create_autocmd("FileType", {
pattern = "help",
callback = function()
vim.wo.number = true
vim.wo.relativenumber = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
desc = "Use tabs for indents in Go files",
pattern = "go",
callback = function()
vim.bo.expandtab = false
end,
})
vim.api.nvim_create_autocmd("FileType", {
desc = "Fix parsing compile errors into quickfixlist",
pattern = "zig",
callback = function()
vim.bo.errorformat = "%f:%l:%c: %t%.%#: %m,%-G%.%#"
end,
})
vim.api.nvim_create_autocmd({ "BufReadPost" }, {
desc = "Return cursor to last position when re-opening a buffer",
pattern = "*",
command = 'silent! normal! g`"zv',
})
vim.api.nvim_create_autocmd("FileType", {
desc = "Use two space indent for C++ files",
pattern = { "cpp" },
callback = function()
vim.bo.tabstop = 2
vim.bo.softtabstop = 2
vim.bo.shiftwidth = 2
vim.bo.cinoptions = "g0"
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "netrw" },
callback = function()
vim.keymap.set("n", "<C-h>", "-", { buffer = true, remap = true })
vim.keymap.set("n", "<C-l>", "<CR>", { buffer = true, remap = true })
end,
})
vim.api.nvim_create_autocmd("VimEnter", {
pattern = "*",
command = ":clearjumps",
})
vim.api.nvim_create_autocmd("FileType", {
desc = "Make markdown files a bit prettier",
pattern = { "markdown" },
callback = function()
vim.wo.conceallevel = 2
vim.wo.concealcursor = "n"
end,
})
vim.api.nvim_create_autocmd("FileType", {
desc = "Customize python indentation",
pattern = { "python" },
callback = function()
vim.g.python_indent = {
open_paren = 'shiftwidth()',
continue = 'shiftwidth()',
closed_paren_align_last_line = false,
}
end,
})
-18
View File
@@ -1,18 +0,0 @@
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_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_special_syntax = 1
vim.g.netrw_timefmt = '%d-%m-%Y %H:%M'
vim.g.c_syntax_for_h = 1
local termfeatures = vim.g.termfeatures or {}
termfeatures.osc52 = false
vim.g.termfeatures = termfeatures
-146
View File
@@ -1,146 +0,0 @@
-- Tab mappings ---
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
vim.keymap.set(
{ "n", "x" },
"<leader>y",
"\"+y:call system('tmux load-buffer -w -', @+)<CR>"
)
else
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>")
-- Allow exiting insert mode in terminal by hitting <ESC>
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
-- 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>")
local close_pum = function()
if vim.fn.pumvisible() ~= 0 then
return "<cmd>pclose<cr>"
end
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
if vim.api.nvim_win_get_config(winid).relative ~= "" then
return "<cmd>fclose<cr>"
end
end
end
vim.keymap.set({ "n", "i" }, "<C-c>", function()
return close_pum()
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")
-- 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>'))
else
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", })
-- 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-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')
-- 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('n', '<leader>ve', function()
if vim.o.virtualedit == 'all' then
vim.o.virtualedit = 'block'
else
vim.o.virtualedit = 'all'
end
end)
-- Removed bindings
vim.keymap.set('n', 'gr', '<Nop>')
-- Default bindings that are good to know:
-- insert mode:
-- <C-T> - indent, see :h i_CTRL-T
-- <C-D> - un-indent, see :h i_CTRL-D
-- normal mode:
-- H/M/L - Jump to highest/middle/lowest line in window.
-- <count?><C-E> - scroll window down <count> lines, see :h CTRL-E
-- <count?><C-Y> - scroll window up <count> lines, see :h CTRL-Y
-- <C-A> - Increment
-- <C-X> - Decrement
-- <C-w>H - Move window to the left
-- <C-w>J - Move window down
-- <C-w>K - Move window up
-- <C-w>L - Move window to the right
-- gq{motion} - format word-wrap of the line that {motion} moves over
-- {Visual}gq - format word-wrap of the visually selected area
-- gqq - format word-wrap of the current line
-- commands:
-- :make - execute makeprg with given args, and put the output in
-- quickfix list
-- :grep - execute grepprg with given args, and put the results in
-- quickfix list
-- :cex {expr} - Create a quickfix list using the result of {expr} and
-- jump to the first error. For example:
-- :cex system('make')
-- :cgete {expr} - same as :cex but don't jump to the first error
-- :copen - open quickfix list
-- :cdo {cmd} - execute {cmd} in each valid entry in the quickfix list.
-- works like this:
-- :cfirst
-- :{cmd}
-- :cnext
-- :{cmd}
-- etc.
-- :cfdo {cmd} - same as :cdo but on each file in quickfix list
-- :cn - go to the next error in quickfix list that includes a file name
-- :cp - go to the previous error in quickfix list that includes a file name
-- :cc [num] - go to the specified error in quickfix list
-- @: - repeat last command
-- :s/foo/bar/ - substitute the first match of foo with bar in the current line
-- :s/foo/bar/g - same as above but for all matches in the current line
-- :%s/foo/bar/g - same as above, but for all lines in buffer
-- :%s/foo/bar/gc - same as above but asking for confirmation on each match
-- :lua << EOF - run a lua snippet using lua-heredoc syntax
-- local tbl = {1, 2, 3}
-- for k, v in ipairs(tbl) do
-- print(v)
-- end
-- EOF
-- :diffsplit <other-file> - open diff split
-142
View File
@@ -1,142 +0,0 @@
vim.opt.cursorline = true
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.mouse = "a"
vim.opt.mousemodel = "popup"
vim.opt.fillchars = {
diff = " ",
horiz = "",
horizup = "",
horizdown = "",
vert = "",
vertleft = "",
vertright = "",
verthoriz = "",
}
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = true
vim.opt.shiftwidth = 4
vim.opt.smarttab = false
-- Folds are configured in nvim-treesitter, so this is only for fallback
vim.opt.foldenable = false
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99
vim.opt.foldmethod = "indent"
vim.opt.foldignore = ""
vim.opt.completeopt:append({
"menu",
"menuone",
"preview",
"noinsert",
"noselect",
})
-- set nowrap
vim.opt.matchpairs:append({ "<:>", })
-- Only relevant with wrap enabled (default)
vim.opt.linebreak = true
vim.opt.breakindent = true
vim.opt.showbreak = ""
-- Minimum amount of lines to show offset +/- to cursorline
vim.opt.scrolloff = 3
vim.opt.visualbell = true
vim.opt.errorbells = false
-- Persistent undo even after you close a file and re-open it
vim.opt.undofile = true
-- Align indent to next multiple value of shiftwidth.
-- E.g., only insert as many spaces necessary for reaching the next shiftwidth
vim.opt.shiftround = true
-- Allow virtualedit (editing on empty spaces) in visual block mode (Ctrl+V)
vim.opt.virtualedit = "block"
-- True color support. Avoid if terminal does not support it.
vim.opt.termguicolors = true
vim.opt.signcolumn = "yes:2"
-- Diff options
vim.opt.diffopt = {}
-- Use vertical split by default
vim.opt.diffopt:append("vertical")
-- Insert filler lines
vim.opt.diffopt:append("filler")
-- Execute :diffoff when only one diff window remain
vim.opt.diffopt:append("closeoff")
-- Use internal diff library
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("linematch:40")
vim.opt.hlsearch = true
vim.opt.laststatus = 2
vim.opt.textwidth = 0
vim.opt.colorcolumn = "81"
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.updatetime = 100
function _G._status_line_git()
local status = vim.b.gitsigns_status_dict
if not status then
return ''
end
local added = status.added or 0
local changed = status.changed or 0
local removed = status.removed or 0
local parts = {}
if added > 0 then
table.insert(parts, string.format("%%#GitSignsAdd#+%d%%*", status.added))
end
if changed > 0 then
table.insert(parts, string.format('%%#GitSignsChange#~%d%%*', status.changed))
end
if removed > 0 then
table.insert(parts, string.format('%%#GitSignsDelete#-%d%%*', status.removed))
end
return table.concat(parts, " ")
end
function _G._status_line_diagnostics()
local diag = vim.diagnostic.count(0)
local err = diag[vim.diagnostic.severity.ERROR] or 0
local warn = diag[vim.diagnostic.severity.WARN] or 0
local hint = diag[vim.diagnostic.severity.HINT] or 0
local info = diag[vim.diagnostic.severity.INFO] or 0
local parts = {}
if err > 0 then
table.insert(parts, string.format("%%#DiagnosticError#E%d%%*", err))
end
if warn > 0 then
table.insert(parts, string.format('%%#DiagnosticWarn#W%d%%*', warn))
end
if hint > 0 then
table.insert(parts, string.format('%%#DiagnosticHint#H%d%%*', hint))
end
if info > 0 then
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"
vim.cmd("syntax on")
vim.cmd("filetype plugin indent on")