feat: improve inverse search cmd

This commit is contained in:
Barrett Ruth 2026-03-12 15:42:20 -04:00
parent aea9d07ae9
commit f1cc5ca1ba
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
6 changed files with 42 additions and 28 deletions

12
scripts/nvim-inverse-search Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
file="$1"
line="$2"
for sock in /run/user/$(id -u)/nvim.*.0; do
[ -S "$sock" ] || continue
result=$(nvim --server "$sock" --remote-expr "bufnr('$file')" 2>/dev/null)
if [ "$result" != "-1" ] && [ -n "$result" ]; then
nvim --server "$sock" --remote-expr "execute('b +$line $file | normal! zz')"
exit 0
fi
done