diff --git a/CLAUDE.md b/CLAUDE.md index a08a093..f9912bd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -59,7 +59,6 @@ Symlink-based deployment. Editing `~/.` directly edits the repo file. `git - `dotfiles/.bashrc` — main shell config - `dotfiles/.vimrc`, `.gitconfig`, `.tmux.conf`, `.psqlrc`, `.pspgconf` - `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/rename_term.lua` — vault-wide find-and-replace with confirmation popup (`rn`) - `dotfiles/nvim/telescope_tasks.lua` — vault-wide task pickers (`tl` open tasks, `tL` priority tasks) @@ -72,7 +71,11 @@ Symlink-based deployment. Editing `~/.` 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. -`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. diff --git a/dotfiles/nvim/mappings.lua b/dotfiles/nvim/mappings.lua deleted file mode 100644 index c063bb3..0000000 --- a/dotfiles/nvim/mappings.lua +++ /dev/null @@ -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", "") - --- map({ "n", "i", "v" }, "", " w ") - --- open tasks / priority tasks vault-wide (telescope_tasks.lua) -map('n', 'tl', function() require('telescope_tasks').open_tasks() end, { desc = "telescope: open tasks" }) -map('n', 'tL', function() require('telescope_tasks').priority_tasks() end, { desc = "telescope: priority tasks" }) --- Add a keybinding for calling ObsidianTag -vim.api.nvim_set_keymap('n', 'tt', ':ObsidianTag', { noremap = true, silent = true }) --- Add a keybinding for calling ObsidianBacklinks -vim.api.nvim_set_keymap('n', 'lb', ':ObsidianBacklinks', { noremap = true, silent = true }) --- Add a keybinding for calling ObsidianLink -vim.api.nvim_set_keymap('v', 'fl', ':ObsidianLink', { noremap = true, silent = true }) --- priority task -vim.api.nvim_set_keymap("n", "p1", "A 🔼", { noremap = true, silent = true }) -vim.api.nvim_set_keymap("n", "p2", "A ⏫", { noremap = true, silent = true }) - --- Live grep all files (including gitignored and hidden files) -vim.keymap.set("n", "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', 'e', ':NvimTreeToggle', {noremap = true, silent = true}) - --- move the whole page without moving the cursor -vim.api.nvim_set_keymap('n', 'J', '', { noremap = true }) -vim.keymap.set('n', 'j', 'J', { remap = false, desc = "Join lines" }) -vim.api.nvim_set_keymap('n', 'K', '', { noremap = true }) - --- Resize windows -vim.api.nvim_set_keymap('n', '', '5+', { silent = true }) -vim.api.nvim_set_keymap('n', '', '5-', { silent = true }) -vim.api.nvim_set_keymap('n', '', '10>', { silent = true }) -vim.api.nvim_set_keymap('n', '', '10<', { silent = true }) - --- wrap selected text in single quotes -vim.keymap.set('x', "'", 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', '"', 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", "gb", ":Gitsigns blame_line", { 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" }, "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" }, "") -vim.keymap.del({ "n", "t" }, "") - --- Vault-wide find-and-replace with confirmation popup -vim.keymap.set("n", "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") diff --git a/install_nvchad.sh b/install_nvchad.sh index 3675c93..7c80d5d 100755 --- a/install_nvchad.sh +++ b/install_nvchad.sh @@ -82,20 +82,6 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 0 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 "Starting installation..." echo ""