How to open text with vim from thunar?

I open the text with the thunar “vim” command (file manager) just like an open image with the thunar “feh” command, and almost all applications are broken.

You do not need to open xterm, cd for this path and vi if you can simply double-click this file.

Is there a solution?

arch + openbox + thunar + xterm


There is a simpler solution: right click -> open with another application -> use a user command and type " xterm -e vim ".

This is from one of my QQ friends, actually looks like evnu. Thanks @evnu.

+4
source share
1 answer

You can do this with Xdg, as described in the ArchLinux Wiki . For GUI applications, the file type can be associated directly with the application using left-click -> Properties -> Open With . If you want to start xterm using a program, you can associate MimeType with a command to run as follows:

Go to ~/.local/share/applications . There, add a file that describes how to start the application, and save it as my-application.desktop or similar:

 [Desktop Entry] Encoding=UTF-8 Type=Application NoDisplay=true Name=vim Exec=/usr/bin/xterm -name vim -e /usr/bin/vim MimeType=text/plain 

Now you need to edit the defaults.list file. There, add the entry for MimeType that you want to associate with the new entry:

 [Default Applications] text/plain=`my-application.desktop` 

After a reboot, thunar should be able to run xterm with vim when you click regular text files.

+7
source

All Articles