# Neovim Auto-Sync Rule When the user asks you to "open these files", "show me what you're working on in nvim", or after a large refactor where visual verification is needed, you MUST push the relevant files to the user's active Neovim buffer. ## Execution Paths ### 1. Neovim RPC (Preferred when outside Tmux) If the `$NVIM` environment variable is available (e.g., you are running inside a Neovim terminal like toggleterm), or if you can locate the Neovim server socket in `/tmp/nvim.*/0`, use the remote feature: ```bash nvim --server /tmp/nvim.sock --remote file1.py file2.py ``` *(Tip: You may need to run `lsof -c nvim | grep "tmp"` or search `/tmp/` to dynamically find the exact socket path if `$NVIM` is not exported to your current shell session).* ### 2. Tmux Injection (Fallback when inside Tmux) If Neovim is running inside Tmux (and not easily reachable via RPC), use `tmux send-keys` to inject the files into the Neovim args list: ```bash tmux send-keys -t 0:1 Escape ":args file1.py file2.py" C-m Escape ":argdo e" C-m ``` *(Tip: Adjust the tmux target `-t 0:1` if the user's nvim pane is elsewhere, e.g., `-t 0:1.2`).* This ensures the user does not have to manually open files you have just modified, regardless of whether they are using Tmux or not.