I'm not looking for an "Vim Plugin" for Eclipse. Instead, I'd just want a keyboard-shortcut to open the current Eclipse file within a new Vim instance.
Is there a quick and easy way to do that?
There's two ways to do this, the canonical way, and the hack. First:
Now, files of that type should show up in an external vim instance. Awesome, right? But that doesn't solve your problem of pushing the current buffer out to vim.
Instead, we're going to set vim as a "build tool", and have eclipse send it the current file as arguments. This may have some unaffected side-effects, based on your project settings, but look into them carefully if you experience things like unexpected re-building of your files.
${project_loc}
(this is a variable representing your project's top directory)${resource_loc}
(this represents your current resource's path)You should be all set! Now you can send your file to vim by using the menu
Run > External Tools > Send to vim
If you want to get fancy, you can even add a button to your toolbar.
Be advised, I've used gvim in the examples. If you'd like to use terminal vim, you'll have to call it appropriately based on the terminal you're using. For xterm, this would be /usr/bin/xterm -e /usr/bin/vim
, instead of /usr/bin/gvim
You can also create a small shell script that simply opens whatever options are passed to it in named vim instance. For example, the shell script I use is simply:
#!/bin/bash
gvim --servername eclipse --remote-tab-silent "$@"
Then make the script executable and follow the canonical method described by sleepynate, using your script as the external editor.
I'm aware there is a highly upvoted answer but I should say that what I found most convienent on OSX was to use QuickCursor to let me open any text in macVim.