fix nvim ownership: remove mappings.lua from setup_env, clarify architecture in CLAUDE.md
mappings.lua belongs in the nvchad repo — putting it in dotfiles/nvim/ conflicts with the nvchad git-tracked copy on every sync. Feature modules (rename_term, telescope_tasks) stay in setup_env as intended. Also removes the misplaced symlink block in install_nvchad.sh that ran before backup/clone. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e9027cf92f
commit
2b2b2f18b3
@ -59,7 +59,6 @@ Symlink-based deployment. Editing `~/.<file>` directly edits the repo file. `git
|
|||||||
- `dotfiles/.bashrc` — main shell config
|
- `dotfiles/.bashrc` — main shell config
|
||||||
- `dotfiles/.vimrc`, `.gitconfig`, `.tmux.conf`, `.psqlrc`, `.pspgconf`
|
- `dotfiles/.vimrc`, `.gitconfig`, `.tmux.conf`, `.psqlrc`, `.pspgconf`
|
||||||
- `dotfiles/bin/td` — time-tracking CLI
|
- `dotfiles/bin/td` — time-tracking CLI
|
||||||
- `dotfiles/nvim/mappings.lua` — all nvim keybindings
|
|
||||||
- `dotfiles/nvim/td.lua`, `td_mappings.lua` — nvim time-tracking integration
|
- `dotfiles/nvim/td.lua`, `td_mappings.lua` — nvim time-tracking integration
|
||||||
- `dotfiles/nvim/rename_term.lua` — vault-wide find-and-replace with confirmation popup (`<leader>rn`)
|
- `dotfiles/nvim/rename_term.lua` — vault-wide find-and-replace with confirmation popup (`<leader>rn`)
|
||||||
- `dotfiles/nvim/telescope_tasks.lua` — vault-wide task pickers (`<leader>tl` open tasks, `<leader>tL` priority tasks)
|
- `dotfiles/nvim/telescope_tasks.lua` — vault-wide task pickers (`<leader>tl` open tasks, `<leader>tL` priority tasks)
|
||||||
@ -72,7 +71,11 @@ Symlink-based deployment. Editing `~/.<file>` directly edits the repo file. `git
|
|||||||
|
|
||||||
The nvim config lives in a separate repo at `git@gitea.hptrow.me:pt/nvchad.git` (`customize` branch), deployed to `~/.config/nvim`. `install_nvchad.sh` manages it.
|
The nvim config lives in a separate repo at `git@gitea.hptrow.me:pt/nvchad.git` (`customize` branch), deployed to `~/.config/nvim`. `install_nvchad.sh` manages it.
|
||||||
|
|
||||||
`dotfiles/nvim/td.lua` and `td_mappings.lua` are deployed as symlinks into `~/.config/nvim/lua/` by `deploy_nvim`. The nvim repo's `mappings.lua` loads them via `require "td_mappings"`. The nvim repo does not track these files — setup_env owns them.
|
**Ownership boundary — important:**
|
||||||
|
- **nvchad repo owns `mappings.lua`** — this is the keymap entry point. It lives in `~/.config/nvim/lua/mappings.lua` and is tracked by the nvchad git repo. Edit it there, push from `~/.config/nvim`.
|
||||||
|
- **setup_env owns feature modules** — `td.lua`, `td_mappings.lua`, `rename_term.lua`, `telescope_tasks.lua`. These are deployed as symlinks into `~/.config/nvim/lua/` by `deploy_nvim`. The nvchad repo does NOT track them. `mappings.lua` loads them via `require`.
|
||||||
|
|
||||||
|
Do NOT put `mappings.lua` in `dotfiles/nvim/`. It will conflict with the nvchad repo's tracked copy on every `git pull` during sync, producing `.backup` files on all machines.
|
||||||
|
|
||||||
**Dependency**: `deploy_nvim` must run after `install_nvchad.sh` has created `~/.config/nvim/lua/`. On a fresh machine this is handled automatically by `setup_env.sh` ordering. On existing machines `sync.sh` handles it.
|
**Dependency**: `deploy_nvim` must run after `install_nvchad.sh` has created `~/.config/nvim/lua/`. On a fresh machine this is handled automatically by `setup_env.sh` ordering. On existing machines `sync.sh` handles it.
|
||||||
|
|
||||||
|
|||||||
@ -1,78 +0,0 @@
|
|||||||
require "nvchad.mappings"
|
|
||||||
|
|
||||||
-- add yours here
|
|
||||||
|
|
||||||
local map = vim.keymap.set
|
|
||||||
|
|
||||||
map("n", ";", ":", { desc = "CMD enter command mode" })
|
|
||||||
map("i", "jk", "<ESC>")
|
|
||||||
|
|
||||||
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
|
|
||||||
|
|
||||||
-- open tasks / priority tasks vault-wide (telescope_tasks.lua)
|
|
||||||
map('n', '<leader>tl', function() require('telescope_tasks').open_tasks() end, { desc = "telescope: open tasks" })
|
|
||||||
map('n', '<leader>tL', function() require('telescope_tasks').priority_tasks() end, { desc = "telescope: priority tasks" })
|
|
||||||
-- Add a keybinding for calling ObsidianTag
|
|
||||||
vim.api.nvim_set_keymap('n', '<leader>tt', ':ObsidianTag<CR>', { noremap = true, silent = true })
|
|
||||||
-- Add a keybinding for calling ObsidianBacklinks
|
|
||||||
vim.api.nvim_set_keymap('n', '<leader>lb', ':ObsidianBacklinks<CR>', { noremap = true, silent = true })
|
|
||||||
-- Add a keybinding for calling ObsidianLink
|
|
||||||
vim.api.nvim_set_keymap('v', '<leader>fl', ':ObsidianLink<CR>', { noremap = true, silent = true })
|
|
||||||
-- priority task
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>p1", "A 🔼<Esc>", { noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>p2", "A ⏫<Esc>", { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- Live grep all files (including gitignored and hidden files)
|
|
||||||
vim.keymap.set("n", "<leader>fW", function()
|
|
||||||
require('telescope.builtin').live_grep({
|
|
||||||
additional_args = function()
|
|
||||||
return { "--hidden", "--no-ignore" }
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end, { desc = "telescope live grep all files" })
|
|
||||||
|
|
||||||
-- make leader-e toggle the tree view as opposed to just setting focus
|
|
||||||
vim.api.nvim_set_keymap('n', '<leader>e', ':NvimTreeToggle<CR>', {noremap = true, silent = true})
|
|
||||||
|
|
||||||
-- move the whole page without moving the cursor
|
|
||||||
vim.api.nvim_set_keymap('n', 'J', '<C-e>', { noremap = true })
|
|
||||||
vim.keymap.set('n', '<leader>j', 'J', { remap = false, desc = "Join lines" })
|
|
||||||
vim.api.nvim_set_keymap('n', 'K', '<C-y>', { noremap = true })
|
|
||||||
|
|
||||||
-- Resize windows
|
|
||||||
vim.api.nvim_set_keymap('n', '<Up>', '5<C-w>+', { silent = true })
|
|
||||||
vim.api.nvim_set_keymap('n', '<Down>', '5<C-w>-', { silent = true })
|
|
||||||
vim.api.nvim_set_keymap('n', '<Right>', '10<C-w>>', { silent = true })
|
|
||||||
vim.api.nvim_set_keymap('n', '<Left>', '10<C-w><', { silent = true })
|
|
||||||
|
|
||||||
-- wrap selected text in single quotes
|
|
||||||
vim.keymap.set('x', "<leader>'", function()
|
|
||||||
local text = vim.fn.getreg('"') -- Get the visually selected text
|
|
||||||
vim.cmd("normal! c'" .. text .. "'")
|
|
||||||
end, { desc = "Wrap selected text in single quotes" })
|
|
||||||
|
|
||||||
-- wrap selected text in double quotes
|
|
||||||
vim.keymap.set('x', '<leader>"', function()
|
|
||||||
local text = vim.fn.getreg('"') -- Get the visually selected text
|
|
||||||
vim.cmd('normal! c"' .. text .. '"')
|
|
||||||
end, { desc = "Wrap selected text in double quotes" })
|
|
||||||
|
|
||||||
-- Gitsigns blame current line
|
|
||||||
vim.keymap.set("n", "<leader>gb", ":Gitsigns blame_line<CR>", { noremap = true, silent = true, desc = "Git blame line" })
|
|
||||||
|
|
||||||
-- Format current buffer (uses conform; for markdown this snaps tables via mdformat-gfm)
|
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>fm", function()
|
|
||||||
require("conform").format({ async = true, lsp_fallback = true })
|
|
||||||
end, { desc = "Format buffer / selection" })
|
|
||||||
|
|
||||||
-- Disable alt+h and alt+v terminal toggles
|
|
||||||
vim.keymap.del({ "n", "t" }, "<A-h>")
|
|
||||||
vim.keymap.del({ "n", "t" }, "<A-v>")
|
|
||||||
|
|
||||||
-- Vault-wide find-and-replace with confirmation popup
|
|
||||||
vim.keymap.set("n", "<leader>rn", function()
|
|
||||||
require("rename_term").run()
|
|
||||||
end, { desc = "Rename term across vault (find → replace)" })
|
|
||||||
|
|
||||||
-- td: time-track markdown todos — all in ~/setup_env/dotfiles/nvim/{td,td_mappings}.lua
|
|
||||||
require("td_mappings")
|
|
||||||
@ -82,20 +82,6 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Overlay personal lua modules from setup_env (symlinks override cloned files)
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
||||||
NVIM_DOTFILES="$SCRIPT_DIR/dotfiles/nvim"
|
|
||||||
if [ -d "$NVIM_DOTFILES" ]; then
|
|
||||||
echo "Symlinking personal nvim modules from $NVIM_DOTFILES ..."
|
|
||||||
for mod in "$NVIM_DOTFILES"/*.lua; do
|
|
||||||
[ -f "$mod" ] || continue
|
|
||||||
target="$HOME/.config/nvim/lua/$(basename "$mod")"
|
|
||||||
[ -L "$target" ] && rm "$target"
|
|
||||||
ln -s "$mod" "$target"
|
|
||||||
echo " linked: $(basename "$mod")"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Starting installation..."
|
echo "Starting installation..."
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user