-- ── Bootstrap lazy.nvim ─────────────────────────────────────────────────────── local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath, }) end vim.opt.rtp:prepend(lazypath) -- ── Plugins ─────────────────────────────────────────────────────────────────── require("lazy").setup({ { dir = vim.fn.expand("~/Dotfiles/nvim/theme/cyberqueer.nvim") }, "rktjmp/lush.nvim", "tpope/vim-sensible", "junegunn/goyo.vim", "arecarn/vim-crunch", "preservim/nerdtree", "ryanoasis/vim-devicons", { "junegunn/fzf", build = function() vim.fn["fzf#install"]() end }, "junegunn/fzf.vim", "vim-airline/vim-airline", "vim-airline/vim-airline-themes", "voldikss/vim-floaterm", "rust-lang/rust.vim", "norcalli/nvim-colorizer.lua", { "neoclide/coc.nvim", branch = "release" }, { "mg979/vim-visual-multi", branch = "master" }, "SirVer/ultisnips", "honza/vim-snippets", "mfussenegger/nvim-dap", "elihunter173/dirbuf.nvim", "tpope/vim-dadbod", "kristijanhusak/vim-dadbod-ui", "kristijanhusak/vim-dadbod-completion", "nvim-mini/mini.icons", "tadmccorkle/markdown.nvim", { "ellisonleao/glow.nvim", config = true }, "itchyny/calendar.vim", { "greggh/claude-code.nvim", dependencies = { "nvim-lua/plenary.nvim" }, config = function() require("claude-code").setup() end, }, }, { -- keep lazy's own UI out of the way on first install install = { colorscheme = { "habamax" } }, }) -- ── Colorscheme & UI ────────────────────────────────────────────────────────── vim.cmd("colorscheme cyberqueer") vim.g.airline_powerline_fonts = 1 vim.g.airline_theme = "cyberqueer" local ipaddr = vim.trim(vim.fn.system("hostname -i")) local hostname = vim.trim(vim.fn.system("hostname -s")) vim.g.airline_section_x = "IP:" .. ipaddr .. " DNS:" .. hostname -- ── Providers ───────────────────────────────────────────────────────────────── vim.g.loaded_ruby_provider = 0 vim.g.loaded_perl_provider = 0 -- ── Editor options ──────────────────────────────────────────────────────────── vim.cmd("filetype plugin indent on") vim.cmd("syntax enable") vim.opt.number = true vim.opt.relativenumber = true vim.opt.cursorline = true vim.opt.cursorcolumn = true vim.opt.showmode = false vim.opt.shiftwidth = 4 vim.opt.scrolloff = 5 vim.opt.wrap = false vim.opt.incsearch = true vim.opt.ignorecase = true vim.opt.smartcase = true vim.opt.showcmd = true vim.opt.showmatch = true vim.opt.hlsearch = true vim.opt.history = 1000 vim.opt.wildmenu = true vim.opt.wildmode = "list:longest" -- ── Keymaps ─────────────────────────────────────────────────────────────────── -- window navigation (normal mode) vim.keymap.set("n", "", "w") vim.keymap.set("n", "", "h") vim.keymap.set("n", "", "j") vim.keymap.set("n", "", "k") -- window navigation from terminal-insert mode (exit insert, then move) vim.keymap.set("t", "", "h", { silent = true }) vim.keymap.set("t", "", "j", { silent = true }) vim.keymap.set("t", "", "k", { silent = true }) vim.keymap.set("t", "", "w", { silent = true }) -- auto-enter insert mode when focusing a terminal buffer (skip floaterm) vim.api.nvim_create_autocmd("BufEnter", { pattern = "term://*", callback = function() if vim.bo.filetype ~= "floaterm" then vim.cmd("startinsert") end end, }) -- calendar.vim steals for month nav; restore window movement vim.api.nvim_create_autocmd("FileType", { pattern = "calendar", callback = function() local o = { buffer = true, silent = true } vim.keymap.set("n", "", "w", o) vim.keymap.set("n", "", "h", o) vim.keymap.set("n", "", "j", o) vim.keymap.set("n", "", "k", o) end, }) -- quick actions vim.keymap.set("n", "t", ":FloatermNew", { silent = true }) vim.keymap.set("n", "e", ":NERDTreeTogglel", { silent = true }) vim.keymap.set("n", "s", ":DBUIToggle", { silent = true }) vim.keymap.set("n", "q", function() local ok = pcall(vim.cmd, "wq") if not ok then vim.cmd("q") end end, { silent = true }) -- insert mode completion vim.keymap.set("i", "", "") vim.keymap.set("i", "", "") -- sudo save vim.cmd("ca w!! w !sudo tee '%'") -- visual block shorthand vim.cmd("command! Vb normal! ") -- ── UltiSnips ───────────────────────────────────────────────────────────────── vim.g.UltiSnipsExpandTrigger = "" vim.g.UltiSnipsJumpForwardTrigger = "" vim.g.UltiSnipsJumpBackwardTrigger = "" vim.g.UltiSnipsEditSplit = "vertical" -- ── CoC ─────────────────────────────────────────────────────────────────────── vim.g.coc_global_extensions = { "coc-snippets", "coc-powershell", "coc-sh", "coc-omnisharp", "coc-clangd", "coc-json", "coc-css", "coc-git", "coc-pyright", "coc-sql", } vim.g.coc_snippet_next = "" vim.g.coc_snippet_prev = "" vim.keymap.set("i", "", "(coc-snippets-expand)", { remap = true }) vim.keymap.set("v", "", "(coc-snippets-select)", { remap = true }) vim.keymap.set("i", "", "(coc-snippets-expand-jump)", { remap = true }) vim.keymap.set("x", "x", "(coc-convert-snippet)", { remap = true }) -- tab/s-tab navigate CoC pum, else fall through vim.keymap.set("i", "", function() return vim.fn["coc#pum#visible"]() == 1 and vim.fn["coc#pum#next"](1) or "" end, { expr = true, silent = true }) vim.keymap.set("i", "", function() return vim.fn["coc#pum#visible"]() == 1 and vim.fn["coc#pum#prev"](1) or "" end, { expr = true, silent = true }) -- CR confirms CoC selection vim.keymap.set("i", "", function() return vim.fn["coc#pum#visible"]() == 1 and vim.fn["coc#pum#confirm"]() or "" end, { expr = true, silent = true }) -- ── PIM floating windows (sideward T: left column overlay) ─────────────────── local function _pim_scratch(label, err) vim.cmd("enew") vim.bo.buftype = "nofile" vim.bo.buflisted = false vim.api.nvim_buf_set_lines(0, 0, -1, false, { "[" .. label .. " unavailable]", "", err or "" }) end local function _pim_close_win(win) if not vim.api.nvim_win_is_valid(win) then return end local buf = vim.api.nvim_win_get_buf(win) vim.api.nvim_win_close(win, true) if vim.api.nvim_buf_is_valid(buf) and vim.bo[buf].buftype == "terminal" then pcall(vim.api.nvim_buf_delete, buf, { force = true }) end end local function _pim_float(row, col, height, width, border) local buf = vim.api.nvim_create_buf(false, true) local win = vim.api.nvim_open_win(buf, true, { relative = "editor", row = row, col = col, height = math.max(1, height), width = math.max(1, width), style = "minimal", border = border or "none", zindex = 50, }) vim.api.nvim_set_option_value("winhighlight", "Normal:Normal,NormalNC:Normal", { win = win }) return win end -- n/g/f: individual centered floating windows local _solo = {} local function toggle_solo(key, cmd, label) local win = _solo[key] if win and vim.api.nvim_win_is_valid(win) then _pim_close_win(win) _solo[key] = nil return end local H = vim.o.lines - 2 local W = vim.o.columns local h = math.max(1, math.floor(H * 0.85)) local w = math.max(1, math.floor(W * 0.85)) -- centre accounting for the 1-cell rounded border on each side local r = math.max(0, math.floor((H - h - 2) / 2)) local c = math.max(0, math.floor((W - w - 2) / 2)) local win_id = _pim_float(r, c, h, w, "rounded") local ok, err = pcall(vim.cmd, cmd) if not ok then _pim_scratch(label, err) end _solo[key] = win_id end vim.keymap.set("n", "n", function() toggle_solo("n", "terminal alot", "alot") end, { silent = true }) vim.keymap.set("n", "g", function() toggle_solo("g", "Calendar -position=here", "calendar.vim") end, { silent = true }) vim.keymap.set("n", "f", function() toggle_solo("f", "terminal abook", "abook") end, { silent = true }) -- r: sideward-T overlay — left column (bar of the T) with three stacked panes, -- document remains visible to the right (the stem of the T) local _pim_wins = {} local function toggle_pim() if #_pim_wins > 0 and vim.api.nvim_win_is_valid(_pim_wins[1]) then for _, w in ipairs(_pim_wins) do _pim_close_win(w) end _pim_wins = {} return end -- full-screen: alot left, abook top-right, calendar bottom-right local H = vim.o.lines - 2 local W = vim.o.columns local right_w = math.max(80, math.floor(W * 0.45)) local left_w = math.max(1, W - right_w) local top_h = math.max(1, math.floor(H / 2)) local bot_h = math.max(1, H - top_h) local w1 = _pim_float(0, 0, H, left_w) local ok, err = pcall(vim.cmd, "terminal alot") if not ok then _pim_scratch("alot", err) end local w2 = _pim_float(0, left_w, top_h, right_w) ok, err = pcall(vim.cmd, "terminal abook") if not ok then _pim_scratch("abook", err) end local w3 = _pim_float(top_h, left_w, bot_h, right_w) ok, err = pcall(vim.cmd, "Calendar -position=here") if not ok then _pim_scratch("calendar.vim", err) end _pim_wins = { w1, w2, w3 } vim.api.nvim_set_current_win(w1) end vim.keymap.set("n", "x", toggle_pim, { silent = true })