mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 15:23:48 -05:00
Added iTerm2 version 3.0-compatible Applescript block
@@ -1,3 +1,5 @@
|
|||||||
|
# For iTerm2 version 2.x
|
||||||
|
|
||||||
(Originally posted by @gleachkr)
|
(Originally posted by @gleachkr)
|
||||||
|
|
||||||
To open fzf from MacVim in a new iTerm2 window, it should work to make the following script executable somewhere in your Vim's PATH (with the title, for example, "In_a_new_term_function") and to let g:fzf_launcher = "In_a_new_term_function %s"
|
To open fzf from MacVim in a new iTerm2 window, it should work to make the following script executable somewhere in your Vim's PATH (with the title, for example, "In_a_new_term_function") and to let g:fzf_launcher = "In_a_new_term_function %s"
|
||||||
@@ -74,4 +76,34 @@ end run' $1 $PWD
|
|||||||
|
|
||||||
And put it in PATH (I've put it in `/usr/local/bin`)
|
And put it in PATH (I've put it in `/usr/local/bin`)
|
||||||
|
|
||||||
Note: it doesn't work very well if you've got an instance of iTerm2 running in full screen
|
Note: it doesn't work very well if you've got an instance of iTerm2 running in full screen
|
||||||
|
|
||||||
|
# For iTerm2 version 3.0 and higher
|
||||||
|
|
||||||
|
(Added by @amacdougall)
|
||||||
|
|
||||||
|
The Applescript API for iTerm2 has changed with version 3.0. This updated script works for me:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# update for iterm2 3.0+
|
||||||
|
osascript -e \
|
||||||
|
'on run argv
|
||||||
|
tell application "System Events"
|
||||||
|
set old_frontmost to item 1 of (get name of processes whose frontmost is true)
|
||||||
|
end tell
|
||||||
|
tell application "iTerm2"
|
||||||
|
set myterm to (create window with default profile)
|
||||||
|
tell current session of first window
|
||||||
|
-- exec command "bash"
|
||||||
|
write text "cd " & quoted form of (item 2 of argv)
|
||||||
|
write text (item 1 of argv) & " && exit"
|
||||||
|
end tell
|
||||||
|
repeat while (exists myterm)
|
||||||
|
delay 0.1
|
||||||
|
end repeat
|
||||||
|
end tell
|
||||||
|
tell application old_frontmost
|
||||||
|
activate
|
||||||
|
end tell
|
||||||
|
end run' "$1" "$PWD"
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user