Right-click a file and choose to launch in vim.

Gvim is a good application.  Right-click on a file (e.g. *.html) will give me the option to launch it in gvim.  But gvim has a big problem.  It uses a built-in terminal with limited functionality.  For example, I am used to pressing Shift-k to view the man page for the function where my cursor is.  If I do this is gvim, I’ll get WARNING: terminal is not fully functional, and the man page is filled with “codes” (for creating bold effect I guess) that makes it hard to read the content.

There seems to have no way to workaround this gvim issue, so I decided to stick with vim.  In order to have “right-click then launch in vim in a gnome-terminal”:

1. Right-click on the file with the said extension (e.g. *html).
2. Click on Properties.
3. Choose Open With tab.
4. Click on the Add button.
5. Click on the Use a custom command.
6. Write the command gnome-terminal -x vim
7. Click the Close button.

Now, right-click on the file gives you an option to Open with “gnome-terminal”.  Choose that and you have your file open in vim.

All is good except the name of the option Open with “gnome-terminal” which is wrong.  I want it to be Open with “gnome-terminal-vim”.  So, I write a one line shell script called gnome-terminal-vim with the content:

gnome-terminal -x vim "$1"

Make the script executable and place it somewhere in $PATH.

Lastly, change the command in step 6 to gnome-terminal-vim

That’s it.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: