Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to assign a terminal based program as a default program in Gnome Shell 3.2. I am running Ubuntu 11.10.

More specifically, I want my .txt files to open in vim with maximized Gnome Terminal.

The 'Open with other application' menu does not provide for this.

Thanks in advance for help.

share|improve this question
up vote 3 down vote accepted

For files handling in gnome you will have to use the graphical version of vim called gvim, to install it type sudo apt-get install vim-gnome.

Has an option you can create a .desktop file that will be listed on 'Open with other application' tab:

  • Navigate to ~/.local/share/applications
  • Create a file called vim-console.desktop with these contents:
[Desktop Entry]
Name=Vim Text Editor (Console)
Comment=Edit text files in a console using Vim
Exec=gnome-terminal --full-screen --execute bash -c "vim %u"

After this you will see Vim Text Editor (Console) in your Open with other application tab, select it and when you double click the file you will be able to open it using vim terminal editor.

share|improve this answer

I found another solution as above solution didn't work for me (I don't know why).

Create a file mvim in /usr/bin/ by:

sudo vim /usr/bin/mvim

And paste the following two lines:

/usr/bin/gnome-terminal -e "/usr/bin/vim $1"

Press :wq and Enter to save.

Now give executable permissions to this your command by:

sudo chmod +x /usr/bin/mvim

To test if it's gonna work or not, you can type:

mvim anyfile

It should open a new terminal with anyfile opened in vim.

Now open your file manager (mine is SpaceFM) and right click a text file and click Properties. If there is an option of open with command then type in the path to your command i.e. /usr/bin/mvim.

And yay! meanwhile you created your own command!

share|improve this answer
+1 for the right answer – cat Dec 25 '15 at 15:21
Thanks. Glad it helped. – Mandeep Singh Dec 26 '15 at 12:39
You'll run into trouble with filenames with spaces. Use /usr/bin/gnome-terminal -e "/usr/bin/vim '$1'", or /usr/bin/gnome-terminal -x /usr/bin/vim "$1". Better yet, use -x and $@: /usr/bin/gnome-terminal -x /usr/bin/vim "$@", in case you want to pass options to Vim, or open multiple files. – muru Dec 26 '15 at 12:47
Thanks for the information, muru. I am using lxterminal as of now. Is there any alternative for -x flag or something to make multiple files thing work for me. – Mandeep Singh Dec 26 '15 at 13:03
Thanks @josifoski :) – Mandeep Singh Jun 26 at 14:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.