Open Vim in Xfce4 Terminal from Thunar
Solution 1
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
.
Solution 2
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.
Related videos on Youtube
Comments
-
jbrock over 1 year
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.
-
muru about 7 yearsYou should probably suggest an edit to that post
-
jbrock about 7 yearsThis 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 about 7 yearsMy 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 about 7 yearsI 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/… -
Adrian Keister almost 4 yearsWhat if I wanted the opposite: to open up Vim in Xterm?