Ubuntu: Open Vim in Xfce4 Terminal from Thunar


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.


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.


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.


It worked for me.


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

xfce4-terminal -e "vim"  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »