feat: add new plugins, refactor options, and improve blink.cmp detection
- Add focusline.nvim for scroll-aware cursor centering - Add kitty-scrollback.nvim for Kitty terminal scrollback integration - Add qalc.nvim for inline calculator support - Add blink.lib as explicit dependency for blink.cmp - Fix blink.cmp binary detection to check v2 install path first - Add PackChanged autocmd to auto-rebuild blink.cmp after updates - Expand inc-rename.nvim config with all available options documented - Add luv library path to lazydev for vim.uv completions - Consolidate leader key setup into options.lua (remove duplicate in init.lua) - Add autoread + FocusGained/CursorHold triggers for external file changes - Add BufReadPost autocmd to restore last cursor position on file open - Reorganize options.lua with section headers and logical grouping - Update plugin lockfile revisions (blink.cmp, conform, gitsigns, lualine, etc.) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+75
-36
@@ -4,10 +4,6 @@
|
||||
└────────────────────────────────────────────────────────────────┘
|
||||
--]]
|
||||
|
||||
-- Set leader keys before any other configuration
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- Copyright (C) 2026 rootiest
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
@@ -23,6 +19,32 @@ vim.g.maplocalleader = "\\"
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ Basic Options │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
-- Set leader keys before any other configuration
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- Indentation
|
||||
vim.opt.tabstop = 2 -- Tab width in spaces
|
||||
vim.opt.shiftwidth = 2 -- Indent width for >> and auto-indent
|
||||
vim.opt.expandtab = true -- Use spaces instead of tabs
|
||||
|
||||
-- Performance and UI defaults
|
||||
vim.opt.updatetime = 200 -- Faster completion and CursorHold events
|
||||
vim.opt.autowrite = true -- Enable auto write
|
||||
vim.opt.number = true -- Show line numbers
|
||||
vim.opt.relativenumber = true -- Relative line numbers
|
||||
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ Sessions and Saving │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
-- Persistent undo across sessions
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Autowrite/Autosave
|
||||
-- This ensures changes are saved on every buffer change or when leaving insert mode.
|
||||
vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, {
|
||||
@@ -36,29 +58,26 @@ vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, {
|
||||
end,
|
||||
})
|
||||
|
||||
-- Performance and UI defaults
|
||||
vim.opt.updatetime = 200 -- Faster completion and CursorHold events
|
||||
vim.opt.autowrite = true -- Enable auto write
|
||||
vim.opt.number = true -- Show line numbers
|
||||
vim.opt.relativenumber = true -- Relative line numbers
|
||||
-- Automatically reload files changed outside of Neovim
|
||||
vim.opt.autoread = true
|
||||
|
||||
-- Persistent undo across sessions
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Indentation
|
||||
vim.opt.tabstop = 2 -- Tab width in spaces
|
||||
vim.opt.shiftwidth = 2 -- Indent width for >> and auto-indent
|
||||
vim.opt.expandtab = true -- Use spaces instead of tabs
|
||||
|
||||
-- FormatOnSave
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
-- Auto-reload Triggers
|
||||
-- Reload when focus is gained or when the cursor is idle
|
||||
vim.api.nvim_create_autocmd({ "FocusGained", "CursorHold" }, {
|
||||
group = vim.api.nvim_create_augroup("autoread_on_focus", { clear = true }),
|
||||
pattern = "*",
|
||||
callback = function(args)
|
||||
require("conform").format({ bufnr = args.buf })
|
||||
callback = function()
|
||||
-- Only if the buffer is not modified, to avoid losing unsaved changes
|
||||
if vim.bo.modified == false then
|
||||
vim.cmd("checktime")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Execute Format
|
||||
-- Format Function
|
||||
-- Formats the entire buffer by default,
|
||||
-- but if a range is provided (e.g., via visual selection),
|
||||
-- it formats only that range.
|
||||
vim.api.nvim_create_user_command("Format", function(args)
|
||||
local range = nil
|
||||
if args.count ~= -1 then
|
||||
@@ -71,17 +90,38 @@ vim.api.nvim_create_user_command("Format", function(args)
|
||||
require("conform").format({ async = true, lsp_format = "fallback", range = range })
|
||||
end, { range = true })
|
||||
|
||||
--[[
|
||||
┌────────────────────────────────────────────────────────────────┐
|
||||
│ Root Management │
|
||||
└────────────────────────────────────────────────────────────────┘
|
||||
--]]
|
||||
-- FormatOnSave
|
||||
-- Formats the buffer before saving.
|
||||
-- This is a common practice to ensure code is consistently formatted.
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
-- Call Format function
|
||||
vim.api.nvim_command("Format")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Return to last-known cursor position when reopening files
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
desc = "Jump to last known cursor position on open",
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
local last_pos = vim.fn.line("'\"")
|
||||
if last_pos > 1 and last_pos <= vim.fn.line("$") then
|
||||
vim.cmd('normal! g`\"')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ Root Management │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
-- Automatically change the working directory to the project root.
|
||||
-- This ensures that plugins like Snacks.picker and GrugFar work
|
||||
-- relative to the file or project you are currently editing.
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("rootiest_auto_cd", { clear = true }),
|
||||
group = vim.api.nvim_create_augroup("buffer_auto_cd", { clear = true }),
|
||||
callback = function()
|
||||
local path = vim.api.nvim_buf_get_name(0)
|
||||
if path == "" then
|
||||
@@ -115,17 +155,18 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
--[[
|
||||
┌────────────────────────────────────────────────────────────────┐
|
||||
│ Shell Interaction │
|
||||
└────────────────────────────────────────────────────────────────┘
|
||||
--]]
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ Shell Interaction │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
-- Detect terminal environment
|
||||
local is_kitty = os.getenv("KITTY_PID") ~= nil
|
||||
local current_shell = os.getenv("SHELL") or "/bin/sh"
|
||||
local shell_name = current_shell:match("([^/]+)$") or "sh"
|
||||
|
||||
-- Terminal Title Management
|
||||
local title_group = vim.api.nvim_create_augroup("TerminalTitle", { clear = true })
|
||||
|
||||
-- Helper function to update the terminal title
|
||||
local function set_terminal_title(title)
|
||||
-- If in Kitty, we use the direct escape sequence as it's reliable
|
||||
@@ -139,9 +180,7 @@ local function set_terminal_title(title)
|
||||
end
|
||||
end
|
||||
|
||||
-- Create the Autocommand Group
|
||||
local title_group = vim.api.nvim_create_augroup("TerminalTitle", { clear = true })
|
||||
|
||||
-- Terminal title updates on buffer enter and window enter
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
group = title_group,
|
||||
callback = function()
|
||||
|
||||
Reference in New Issue
Block a user