There’s two ways to do this, the canonical way, and the hack. First:
The Canonical Way
- Window > Preferences… Fold out General > Editors > File Associations.
- Choose the file type you want to edit
- Click the “Add” button beside the “Associated editors” box.
- Click “External programs” and “Browse…”, then find gvim, or enter /usr/bin/gvim, or generally make it go to gvim.
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.
The Hack
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.
- Run > External Tools > External Tools Configuration…
- Select “Program” on the left and click the “New” icon.
- Enter “Send to vim” for the Name
- Enter “/usr/bin/gvim” (or whatever your path is) for the Location
- Under “Working Directory” enter
${project_loc}(this is a variable representing your project’s top directory) - Under arguments enter
${resource_loc}(this represents your current resource’s path) - On the “Build” tab, un-check “Build before Launch” (unless you really want that)
- On the Common tab, check “External Tools” under the “Display in favorites menu”
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