Files
dotfiles-public/private_dot_config/nvim/lua/config/keymaps.lua
T
bcherb2 0aaaf51421 feat: nvim config tracks the live tree
Port the live ~/.config/nvim working tree (bcherb2/nvim master plus its
uncommitted git.lua and minimap.lua edits): adds claudecode, eslint, lsp,
typescript, meow-yarn and refactoring-fix specs, drops the files the live
repo deleted, and takes live for everything else.

Kept from public: lazy.lua with luarocks disabled, the ai_assist cond
guard (nvim-ai-assist is not anonymously clonable, so a fresh box only
gets it from the private clone list), and the scrubbed endpoint comment
in place of live's LAN address.
2026-11-18 01:32:57 -05:00

40 lines
1.9 KiB
Lua

-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
--
-- -- Copy relative path
vim.keymap.set("n", "<leader>cy", function()
vim.fn.setreg("+", vim.fn.expand("%"))
print("Copied relative path: " .. vim.fn.expand("%"))
end, { desc = "Copy relative path" })
-- Copy absolute path
vim.keymap.set("n", "<leader>cY", function()
vim.fn.setreg("+", vim.fn.expand("%:p"))
print("Copied absolute path: " .. vim.fn.expand("%:p"))
end, { desc = "Copy absolute path" })
-- Select mode (Shift+arrows) replaces the selection with what you type, so `y`
-- types a "y". Conventional copy/cut instead (<C-g> switches to Visual first).
-- The `y`/`d` is fed remappable so buffer maps still apply (md-render's render
-- view copies markdown source); `"+` is fed noremap so which-key's `"` trigger
-- stays out. Both go to the front of typeahead, in this order.
local function clipboard_op(prefix, op)
return function()
vim.api.nvim_feedkeys(op, "mi", false)
vim.api.nvim_feedkeys(vim.keycode(prefix) .. '"+', "ni", false)
end
end
vim.keymap.set("s", "<C-c>", clipboard_op("<C-g>", "y"), { desc = "Copy selection to clipboard" })
vim.keymap.set("s", "<C-x>", clipboard_op("<C-g>", "d"), { desc = "Cut selection to clipboard" })
vim.keymap.set("x", "<C-c>", clipboard_op("", "y"), { desc = "Copy selection to clipboard" })
-- VS Code's terminal toggle (Ctrl+`, the ~ key), mirroring LazyVim's <C-/>.
-- Only reaches nvim when the terminal sends CSI u / kitty keys; the legacy
-- encoding of Ctrl+` is NUL, which is <C-Space> (flash) and is left alone.
local function toggle_terminal()
Snacks.terminal.focus(nil, { cwd = LazyVim.root() })
end
vim.keymap.set({ "n", "t" }, "<C-`>", toggle_terminal, { desc = "Terminal (Root Dir)" })
vim.keymap.set({ "n", "t" }, "<C-~>", toggle_terminal, { desc = "which_key_ignore" })