Ubuntu – How to assign a Vim as the default program for a file type and run it in maximized terminal

11.10default-programsgnomegnome-terminal

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.

Best Answer

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]
Encoding=UTF-8
Name=Vim Text Editor (Console)
Comment=Edit text files in a console using Vim
Exec=gnome-terminal --full-screen --execute bash -c "vim %u"
Terminal=true
Type=Application
Icon=/usr/share/pixmaps/vim.svg
Categories=Application;Utility;TextEditor;
StartupNotify=true
MimeType=text/plain;
NoDisplay=true

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.

Related Question