I've used fzf for some time and it has worked fine in macvim gui mode -- popping up an xterm window. It also works in both vim and neovim's command-line interface.
But in the past couple of weeks it's stopped working at all in macvim gui. No xterm window ever pops up and it appears that macvim simply hangs until I hit ctrl-C.
It still works fine in nvim and vim command lines.
Did you upgrade to El Capitan? Check if the commands like xcalc works.
I did upgrade.
xcalc does work.
I also tried working around this using applescript and iterm2, which would be fine, except for:
1) iterm's applescript interface has changed significantly in recent versions (2.9+ see https://iterm2.com/applescript.html)
2) I tried fixing the applescript, but I don't know applescript really and it doesn't quite work. here's what I tried:
#!/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 (create window with default profile command "bash")
select first window
tell current session of first window
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"
This pops up an iterm window with fzf in it, but:
1) this window loses focus and the old macvim window reacitvates
2) even if i switch focus back to this window and then select a file, the file doesn't open and macvim never seems to be told about this selection.
I'm currently on a macbook that's still running yosemite, and xterm works just fine. I'll see if it works in el capitan later.
I'm also not really familiar with applescript, the code snippet was originally provided by @gleachkr
Works for me on El Capitan. Not sure what went wrong in your case. Does :!xterm -e bash -ci fzf on macvim work?
When I try to start xterm from a terminal, it seems to start, but I think it's displaying offscreen somewhere. Perhaps this is because I have multiple monitors? So I think everything is actually working, but the xterm is just offscreen.
I'll just use Ctrl-P for now in the macvim gui until xterm is fixed. Oh well.
I'm quite confused about this. I am migrating myself from "vim" on the console to "mac_vim", but amazingly the "fzf" does work in the console but refuses to work in "mac_vim".
I have tried :!xterm -e bash -ci fzf but it simply returns:
`/bin/bash: xterm: command not found
shell returned 127
Press ENTER or type command to continue
`
No matter if it's "vim" in the console or macvim. However if I press "ctrl+p" which is mapped to this:
map <C-p> :FZF<CR>
and in the console works perfectly however when I press ctrl + p in the macvim I get this error:
Error running xterm -T "[fzf]" -bg "\#1c1b1a" -fg "\#f8f6f2" -geometry 156x22+0+23 -e bash -ic '/Users/felix/.fzf/bin/fzf --expect=ctrl-v,ctrl-x,ctrl-m,ctrl
-t > /var/folders/bv/y3h3jym557gccm9v1p2hnk2r0000gn/T/vr06YuC/52'&& osascript -e "tell application \"MacVim\" to activate"
If you want to take a peek into my just follow this link .vimrc
Any help will be really appreciated. Thanks!
@felixcuello
/bin/bash: xterm: command not found
meaning that you have to install xterm.
But you can use another terminal emulator instead; e.g. iterm2.
Having said that, I'm not sure if you'll like the experience of fzf on macvim. fzf is a command-line program that requires a terminal emulator and macvim isn't one, so we can run it inside macvim window.
MacVim now has built-in terminal with :terminal command. Is there any possibility to implement this for fzf?
I have no idea, I don't use GVim. Pull requests are welcome if you're interested in contributing.
@kutsan Looks like the Terminal feature in MacVim is in early stage of development. I tried the latest snapshot of MacVim and it seems pretty unstable. I am really looking into this, because lack of proper fzf support breaks all my workflows. I would love to switch to MacVim, as it feels light years more faster/smoother and any other combination I've tried. As soon as the feature get a bit more usable I'll definitely help with integrating fzf with MacVim.
Most helpful comment
I'm quite confused about this. I am migrating myself from "vim" on the console to "mac_vim", but amazingly the "fzf" does work in the console but refuses to work in "mac_vim".
I have tried
:!xterm -e bash -ci fzfbut it simply returns:`/bin/bash: xterm: command not found
shell returned 127
Press ENTER or type command to continue
`
No matter if it's "vim" in the console or macvim. However if I press "ctrl+p" which is mapped to this:
map <C-p> :FZF<CR>and in the console works perfectly however when I press
ctrl + pin the macvim I get this error:Error running xterm -T "[fzf]" -bg "\#1c1b1a" -fg "\#f8f6f2" -geometry 156x22+0+23 -e bash -ic '/Users/felix/.fzf/bin/fzf --expect=ctrl-v,ctrl-x,ctrl-m,ctrl -t > /var/folders/bv/y3h3jym557gccm9v1p2hnk2r0000gn/T/vr06YuC/52'&& osascript -e "tell application \"MacVim\" to activate"If you want to take a peek into my just follow this link .vimrc
Any help will be really appreciated. Thanks!