Skim wikiから、このスクリプトを実行しようとしています。
#!/bin/bash
file="$1"
line="$2"
[ "${file:0:1}" == "/" ] || file="${PWD}/$file"
exec osascript \
-e "set ESC to ASCII character 27" \
-e "tell application \"Vim\" to activate" \
-e "tell application \"System Events\"" \
-e " tell process \"Vim\"" \
-e " keystroke ESC & \":set hidden\" & return " \
-e " keystroke \":if bufexists('$file')\" & return " \
-e " keystroke \":exe \\\":buffer \\\" . bufnr('$file')\" & return " \
-e " keystroke \":else \" & return " \
-e " keystroke \": edit ${file// /\\\\ }\" & return " \
-e " keystroke \":endif\" & return " \
-e " keystroke \":$line\" & return " \
-e " keystroke \"zO\" " \
-e " end tell" \
-e "end tell"
コマンドラインから実行しようとすると、次のようになります。
# Go to line 20 of some_file
$ ./that_script "some_file" 20
次のエラーが発生します。
56:64: execution error: File Vim wasn’t found. (-43)
試み
私はあらゆる種類を試しました:
tell application \"vim\" to activate <-- File vim wasn't found
tell application \"/usr/bin/vim\" to activate <-- this raises a 10810 error
tell application \"/path/to/my/own/compiled/vim\" <-- this raises a 10810 error
目的
GUIではなくターミナルから実行されているVimインスタンスと「通信」しようとしています。