Love vi? Prefer emacs? Want the power of the 80’s added to Oracle SQL Developer? You can do that via our External Tools feature. And you can even have SQL Developer throw over your open file into vi, edit it, save it, and refresh the buffer in the worksheet to reflect the file changes.

Here’s how.

Install vi

I went and grabbed vim, Windows 7 x64 to be exact.

Then in SQL Developer I accessed the External Tools.

External Tools Setup in SQL Developer
External Tools Setup in SQL Developer

Select ‘External Tools’ from the menu and add a new entry to vi, or in my case, gvim.

Where is the exe?
Where is the exe?

Note that I used the ‘Arguments’ input in the form to create the ‘command line’ call to gvim.exe. Consult the docs to see what your program requires to accept an ‘open file’ command. For help on referencing the special syntax for referencing open file names, paths, etc. – just use the ‘Insert…’ button.


Now we tell SQL Developer what icon, if any, to show, and what text to show in the External Tools menu.

Save file before, reload file after?
Save file before, reload file after?

Pay careful attention to the ‘After the tool exits’ option. I’m using this visual vi tool to edit the file. When it closes, I want SQL Developer to reload the file in the worksheet. There’s also an option to auto-save the buffer BEFORE I launch vi, but I prefer to control that behavior and will leave it ‘off’ in my install.

You may also want to disable the ‘Log Output to Messages Log’ option. Using this feature ‘a lot’ will fill up your log panel with a bunch of new log panels for gvim. You can of course always close or hide the panel instead.

Now Let’s See it Work Already!

sqldev_vi

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

9 Comments

  1. When I set up vim instead of gvim it does not show, the process started but no vim window opened? Gvim seems to work but vim doesn’t.

  2. I set up emacs using the steps above: all OK, so thanks for that. The only problem is that the ‘Terminate EMACS’ button does not work.

    Any advice on that?

  3. Shawn Wilkoff Reply

    I’ve used the External Tools to successfully set up interfaces to other products. Is there a way to export those settings to hand to our entire developer team rather than have each person set them all up manually?

    • There’s nothing in the GUI to do this for you. You might be able to find where the External Tools settings are stored and bundle those files as part of your standard ‘install,’ but you might have to build an actual installation script if those files are stored in the Windows User Docs & Settings folders…

  4. Sanjeev Sapre Reply

    It does not take the content from editor rather opens the file, so if I am just writing few SQLs in worksheet that I have not saved to file, this trick wont work. It will be relly useful if it works like in SQL-Plus where the buffer is put into afiedt file.

  5. The argument variables do not seem to resolve on Linux. I have the arguments defined as “gvim -f /${file.dir}/${file.name}” (without the quotes) and the logging shows the following.

    /home/baucumd>
    gnome-terminal -e //

    gvim just loads the / directory.

    • I see that I misunderstood what this would do. I thought it would enable the user to edit stored procedures in an external tool. After some more messing around with it I see you can only use it to edit code already stored on the local filesystem.

Write A Comment