3

I want to set vim (not gvim, not vi) as standard text editor. In the net there are the following suggestions to associate programs with file types.

  1. use sudo update-alternatives --config editor link
  2. doing something with .desktop files link
  3. use mimeopen -d vim link

I am using Ubuntu 14.04 and nemo as file manager. When I tried update-alternatives I got the following prompt:

 Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/vim.gnome   60        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
* 3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.gnome   60        manual mode
  5            /usr/bin/vim.tiny    10        manual mode

Press enter to keep the current choice[*], or type selection number:

Unfortunately nothing changed after I selected option 3. Then I tried the second method with the desktop-files. It works great for txt-files, but not for .tex files. Then I tried to associate .tex files via

mimeopen -d *.tex

Please choose a default application for files of type text/x-tex

1) vim  (vim-usercreated-1)
2) Texmaker  (texmaker)
3) SecureDownloadManager  (wine-extension-sdx)
4) notepad  (wine-extension-txt)
5) LibreOffice Writer  (libreoffice-writer)
6) gedit  (gedit)
7) Geany  (geany)
8) GVim  (gvim)
9) Other...

The prompt I answered simple with "vim" as you can see in the first item of the list. Since then everytime a .swp file is created after opening the .tex-file in nemo, without showing me anything of the vim terminal. So it is kind of running but it does not show up on screen. When I open the tex file with a command like xdg-open I get a warning "Vim: Warning: Input is not from a terminal".

On the net I could not find any more options to accomplish this file association. Please help me :)

1 Answer 1

3

Nemo is not able to directly open a command line programme in the foreground. Therefore, the trick is to instruct Nemo to open a new terminal window and pass vim as an argument.

Open a Nemo window and right click on a .tex file. Then select Open With... and Other Application...; in the window that shows up type the following in the Enter a custom command... box:

gnome-terminal -x vim

And click Add to list. It should then look like this:

enter image description here

Then click OK. Now double click on the .tex file, a new terminal should pop up running vim editing the file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .