3

I am using Xubuntu 16.04. I have set the default application to Vim for plain text files in Thunar. By default Vim opens in XTerm and not in Xfce Terminal. I would like for it to default to Xfce4 Terminal.

In Thunar the Open Terminal Here context menu item opens Xfce4 Terminal, and Xfce4 Terminal is set to default in Preferred Applications. Whisker Menu and the other menus open Vim in Xfce4 Terminal. I have tried creating a .desktop file, and this did not work. I have tried the option "Use a custom command:" under "Open With" > "Other Application" in Thunar. I have also tried uninstalling Xterm, and Thunar just shows an error.

2

I initially tried editing /usr/share/applications/vim.desktop. I commented out #Exec=vim %F and added Exec=xfce4-terminal -e 'vim %F'. This worked for a while and then it started opening both Xterm and Xfce4 Terminal.

Instead in Thunar I right clicked on a txt file. I went to Properties > Open With: > Other Application > Use a custom command. I added xfce4-terminal -e 'vim %F'. This now works perfect.

To access the .desktop file you just created you can go to ~/.local/share/applications/. In the file you will see Exec=xfce4-terminal -e 'vim %F' %f. You can remove the %f if you'd like. Mine initially used a folder icon in Thunar. I changed it to use the Xfce4 Terminal icon instead by adding the line Icon=utilities-terminal.

1

I edited /usr/share/applications/vim.desktop and changed the value for 'Exec' adding

Exec=xfce4-terminal -e "vim %F"

just as jbrock said. Then I changed the value for 'Terminal' to false.

Terminal=false

It worked for me.

  • 3
    You should probably suggest an edit to that post – muru Feb 9 '17 at 9:50
  • This works as well. Instead of Vim settings, it does use my Xfce terminal settings, such as background color. My main issue is that it does not use my custom Vim color scheme called Moriarty. Instead it uses the default color scheme. Does it use your color scheme? This does not matter much to me anyways (even though I posted about it). I don't really ever open a plain text file from Thunar. – jbrock Feb 9 '17 at 19:10
  • My answer above of creating a custom .desktop file does the same thing as your answer (at least for me). The only downside to editing the /usr/share/applications/vim.desktop file is that it may be overwritten when Vim has an update. The desktop entry can be copied to ~/.local/share/applications so it is not overwritten. – jbrock Feb 9 '17 at 19:10
  • I just tested it by changing the /usr/share/applications/vim.desktop entry back to default. It works. Feel free to add the instructions here, and I can mark as correct or upvote. askubuntu.com/questions/610474/… – jbrock Feb 9 '17 at 19:10
0

You can work around this problem by setting the menu exec or .desktop file exec to:

xfce4-terminal -e "vim"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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