mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 17:13:42 -05:00
Updated fzf with MacVim and iTerm2 (markdown)
@@ -1,38 +1,38 @@
|
|||||||
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"
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
osascript -e \
|
osascript -e \
|
||||||
'on run argv
|
'on run argv
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
set old_frontmost to item 1 of (get name of processes whose frontmost is true)
|
set old_frontmost to item 1 of (get name of processes whose frontmost is true)
|
||||||
end tell
|
end tell
|
||||||
tell application "iTerm"
|
tell application "iTerm"
|
||||||
activate
|
activate
|
||||||
set myterm to (make new terminal)
|
set myterm to (make new terminal)
|
||||||
tell myterm
|
tell myterm
|
||||||
set mysession to (make new session at the end of sessions)
|
set mysession to (make new session at the end of sessions)
|
||||||
tell mysession
|
tell mysession
|
||||||
exec command "bash"
|
exec command "bash"
|
||||||
write text "cd " & quoted form of (item 2 of argv)
|
write text "cd " & quoted form of (item 2 of argv)
|
||||||
write text (item 1 of argv) & " && exit"
|
write text (item 1 of argv) & " && exit"
|
||||||
end tell
|
end tell
|
||||||
repeat while (exists myterm)
|
repeat while (exists myterm)
|
||||||
delay 0.1
|
delay 0.1
|
||||||
end repeat
|
end repeat
|
||||||
end tell
|
end tell
|
||||||
end tell
|
end tell
|
||||||
tell application old_frontmost
|
tell application old_frontmost
|
||||||
activate
|
activate
|
||||||
end tell
|
end tell
|
||||||
end run' "$1" "$PWD"
|
end run' "$1" "$PWD"
|
||||||
```
|
```
|
||||||
|
|
||||||
to control the size of the generated iTerm window you just need to insert the lines
|
to control the size of the generated iTerm window you just need to insert the lines
|
||||||
|
|
||||||
```applescript
|
```applescript
|
||||||
set number of columns of myterm to C
|
set number of columns of myterm to C
|
||||||
set number of rows of myterm to R
|
set number of rows of myterm to R
|
||||||
```
|
```
|
||||||
for some numbers C,R after `set myterm to (make new terminal)`
|
for some numbers C,R after `set myterm to (make new terminal)`
|
||||||
Reference in New Issue
Block a user