Start Neovim with a named socket:
nvim --listen /tmp/nvim.sockWhen I reference "current code", "what I'm looking at", "this function", "my cursor":
- Get location:
nvim --server /tmp/nvim.sock --remote-expr "expand('%:p') . ':' . line('.')"
# → /path/to/file.py:42- Get context efficiently — don't dump blindly. Use the file:line to target what's needed:
- Quick look: sed -n '32,52p' file.py
- Find function bounds: ast-grep --lang python -p 'def
$NAME($ $$): $$$' - Find usages: rg 'symbol' --type py
- Read file with offset if large
- Current line only (when useful):
nvim --server /tmp/nvim.sock --remote-expr "getline('.')"