Files
dotfiles/common/nvim/init.lua
T
connor e6644d0616 Rebuild dotfiles as one branch with per-host layers
Replaces the previous repo, which had split into two histories that never
met (mainframe on a dead GitLab remote, the laptops on Gitea) with 146
dirty files across three machines and the NAS never enrolled at all.

Branch-per-machine is gone. One main, with host differences expressed as
small files under hosts/<hostname>/ rather than as branches, so there is
nothing to merge. The reconciled zsh layer reduces 15-33 line forks to
1-7 effective lines per host; distro differences (oh-my-zsh prefix,
syntax-highlighting path, fd vs fdfind) are probed in common/ instead.

Fresh history: the old one carried six plaintext credentials, 45 MB of
mail caches, browser caches and vendored binaries. 5,096 tracked files
and 144 MB become 462 files and 2.6 MB. The .gitignore is now an
allowlist, which is what keeps that true.

Root cause of the rot: ~/.local/bin was a symlink to scripts/ with GOPATH
inside it, so every go install wrote into version control (2.2 GB on the
work laptop). PATH now points at the repo instead of the reverse.

Also: Hyprland replaces sway and is sourced in two halves so $browser is
defined before use; singleton automations carry ConditionHost= alongside
host-layer-only placement; ddns moves from cron to a guarded timer;
package manifests and pkg-snapshot/pkg-restore replace the X11-era
install_scripts/; networkmanager-dmenu added to system76 (the binding
always existed, the package never did).
2026-09-14 14:24:37 -04:00

150 lines
7.0 KiB
Lua
Executable File

-- .d8888b. 888888 888 888
-- d88P Y88b "88b 888 888
-- 888 888 888 888 888
-- 888 .d88b. 88888b. 88888b. .d88b. 888d888 888 .d88b. 88888b. 88888b. .d8888b 888888 .d88b. 88888b. .d88b.
-- 888 d88''88b 888 '88b 888 '88b d88''88b 888P" 888 d88''88b 888 '88b 888 '88b 88K 888 d88''88b 888 '88b d8P Y8b
-- 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 'Y8888b. 888 888 888 888 888 88888888
-- Y88b d88P Y88..88P 888 888 888 888 Y88..88P 888 88P Y88..88P 888 888 888 888 X88 Y88b. Y88..88P 888 888 Y8b.
-- 'Y8888P" 'Y88P' 888 888 888 888 'Y88P' 888 888 'Y88P' 888 888 888 888 88888P' 'Y888 'Y88P' 888 888 'Y8888
-- .d88P
-- .d88P"
-- 888P"
--
-- ------------------------------------------------------------------------------
-- General Settings
-- ------------------------------------------------------------------------------
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.scrolloff = 5
vim.opt.sidescrolloff = 5
-- vim.opt.cmdheight = 2
vim.opt.diffopt = "vertical,closeoff,context:6"
vim.opt.clipboard = "unnamedplus"
vim.opt.mouse = "nv"
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.spell = false
vim.opt.list = true
vim.opt.joinspaces = false
vim.opt.breakindent = true
vim.opt.undofile = true
vim.opt.completeopt = "menuone,noselect"
vim.opt.termguicolors = true
vim.opt.guifont = "RobotoMono Nerd Font:h11"
vim.opt.signcolumn = "yes"
vim.opt.winborder = "rounded"
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.g.leader = " "
-- ------------------------------------------------------------------------------
-- PlugIns
-- ------------------------------------------------------------------------------
vim.pack.add({
{ src = "https://github.com/vague2k/vague.nvim" },
{ src = "https://github.com/mason-org/mason.nvim" },
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/stevearc/oil.nvim" },
{ src = "https://github.com/nvim-telescope/telescope.nvim" },
{ src = "https://github.com/nvim-lua/plenary.nvim" },
-- { src = "https://github.com/github/copilot.vim" },
{ src = "https://github.com/kdheepak/lazygit.nvim" },
{ src = "https://github.com/tpope/vim-surround" },
{ src = "https://github.com/tpope/vim-repeat" },
{ src = "https://github.com/tommcdo/vim-lion" },
{ src = "https://github.com/andythigpen/nvim-coverage" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter" },
})
require("mason").setup()
require("oil").setup()
require("telescope").setup({ pickers = { colorscheme = { enable_preview = true } } })
require("coverage").setup({
auto_reload = true,
signs = {
covered = { text = "█", texthl = "CoverageCovered" },
uncovered = { text = "█", texthl = "CoverageUncovered" },
partial = { text = "█", texthl = "CoveragePartial" },
},
})
require("nvim-treesitter").setup( {
ensure_installed = { "lua", "python", "rust", "markdown", "markdown_inline", "julia" },
highlight = { enable = true },
})
vim.lsp.enable({ "lua_ls", "rust_analyzer", "julials", "pylsp", "black", "marksman", "ruff", "clangd" })
vim.lsp.config("rust_analyzer", {
settings = {
["rust-analyzer"] = {
cargo = { features = "all" },
}
}
})
vim.cmd("colorscheme vague")
-- KEYMAPS
-- -------------------------------------------------------------------------------
local builtin = require('telescope.builtin')
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format, { desc = "[f]ormat the current file" })
vim.keymap.set("n", "<leader>sr", builtin.oldfiles, { desc = "[s]earch [r]ecent files" })
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[s]earch files" })
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[s]earch [w]ord with grep" })
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[s]earch with [g]rep" })
vim.keymap.set('n', "<leader>sh", builtin.help_tags, { desc = "[s]earch [h]elp" })
vim.keymap.set('n', "<leader>sc", builtin.colorscheme, { desc = "[s]earch [c]olorschemes" })
vim.keymap.set('i', "jk", "<Esc>", { desc = "Escape, as in [j]ust [k]idding" })
vim.keymap.set('n', "<leader>o", ":Oil<CR>", { desc = "Run [O]il" })
vim.keymap.set('n', "<leader> ", ":nohlsearch<CR>", { desc = "Run [O]il" })
vim.keymap.set('n', "n", "nzz", { desc = "Move next search result to center of screen" })
vim.keymap.set('n', "N", "Nzz", { desc = "Move prev search result to center of screen" })
vim.keymap.set('n', "<leader>e", vim.diagnostic.open_float, { desc = "Open up the [e]rror" })
vim.keymap.set('n', "<leader>lg", ":LazyGitCurrentFile<CR>", { desc = "Open up [l]azy [g]it" })
vim.keymap.set('n', "<leader>ml", "0dwI<BS> <Esc>", { desc = "[M]erge lines" })
vim.keymap.set('n', "j", "gj", { desc = "Down visually" })
vim.keymap.set('n', "k", "gk", { desc = "Up visually" })
-- LSP KEYMAPS/CONFIG
-------------------------------------------------------------------------------
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gr', builtin.lsp_references, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', '<leader>k', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<space>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,
})