如何用thunar打开带有vim的文本?(How to open text with vim from thunar? [closed])

编程入门 行业动态 更新时间:2024-10-26 10:40:13
如何用thunar打开带有vim的文本?(How to open text with vim from thunar? [closed])

我从thunar(文件管理器)用命令“vim”打开文本,就像从thunar命令“feh”打开图片一样,几乎所有应用程序都被破坏了。

不想打开xterm,cd到那个路径,如果只需双击就可以vi那个文件。

有解决方案吗?

arch + openbox + thunar + xterm


有一个更简单的解决方案: 右键单击 - >使用其他应用程序打开 - >使用自定义命令并输入“ xterm -e vim ”。

这来自我的一个QQ好友,实际上与evnu的相似。 谢谢@evnu。

I open text with command "vim" from thunar(A file manager) just as open picture with command "feh" from thunar, and almost all applications broken.

Don't want open xterm, cd to that path and vi that file if can just double-click.

Is there a solution?

arch + openbox + thunar + xterm


There is a simpler solution: right click -> open with other application -> use a custom command and input "xterm -e vim".

This from one of my QQ friends, actually similar with evnu's. Thanks @evnu.

最满意答案

你可以使用ArchLinux Wiki中描述的Xdg来做到这一点。 对于GUI应用程序,可以使用left-click -> Properties -> Open With将文件类型直接与应用程序关联。 如果要使用程序运行xterm,可以将MimeType与命令关联,如下所示:

转到~/.local/share/applications 。 在那里,添加一个文件,描述如何启动应用程序并将其另存为my-application.desktop或类似文件:

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

现在您必须编辑defaults.list文件。 在那里,添加要与新条目关联的MimeType的条目:

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

重启后,当您单击纯文本文件时,thunar应该能够使用vim启动xterm。

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

Go to ~/.local/share/applications. There, add a file describing how to start your 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 have to edit the file defaults.list. There, add an entry for the MimeType you want to associate with your new entry:

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

After a restart, thunar should be able to start xterm with vim when you click plain textfiles.

更多推荐

本文发布于:2023-04-29 10:25:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336419.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何用   文本   thunar   closed   vim

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!