mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-20 17:43:42 -05:00
Created fzf with MacVim and iTerm2 (markdown)
30
fzf-with-MacVim-and-iTerm2.md
Normal file
30
fzf-with-MacVim-and-iTerm2.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
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, titled, for example, "In_a_new_term_function", and to let g:fzf_launcher = "In_a_new_term_function %s"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
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 "iTerm"
|
||||||
|
activate
|
||||||
|
set myterm to (make new terminal)
|
||||||
|
tell myterm
|
||||||
|
set mysession to (make new session at the end of sessions)
|
||||||
|
tell mysession
|
||||||
|
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
|
||||||
|
end tell
|
||||||
|
tell application old_frontmost
|
||||||
|
activate
|
||||||
|
end tell
|
||||||
|
end run' "$1" "$PWD"
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user