Created
September 18, 2019 16:23
-
-
Save dpo/3f39255e33ad7aabad3169be543db0d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
file="$1" | |
line="$2" | |
[ "${file:0:1}" == "/" ] || file="${PWD}/$file" | |
exec osascript \ | |
-e "set ESC to ASCII character 27" \ | |
-e "tell application \"/Users/dpo/bin/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment