如何将 Vim 指定为文件类型的默认程序并在最大化终端中运行它?

des*_*ukh 5 gnome gnome-terminal 11.10 default-programs

我想在 Gnome Shell 3.2 中指定一个基于终端的程序作为默认程序。我正在运行 Ubuntu 11.10。

更具体地说,我希望我的 .txt 文件在 vim 中使用最大化的 Gnome 终端打开。

“用其他应用程序打开”菜单不提供此功能。

预先感谢您的帮助。

Bru*_*ira 3

对于 gnome 中的文件处理,您必须使用vim名为的图形版本gvim来安装它,键入sudo apt-get install vim-gnome.

有一个选项可以创建一个.desktop文件,该文件将在“使用其他应用程序打开”选项卡上列出:

  • 导航~/.local/share/applications
  • 创建一个包含以下内容的文件vim-console.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Vim Text Editor (Console)
Comment=Edit text files in a console using Vim
Exec=gnome-terminal --full-screen --execute bash -c "vim %u"
Terminal=true
Type=Application
Icon=/usr/share/pixmaps/vim.svg
Categories=Application;Utility;TextEditor;
StartupNotify=true
MimeType=text/plain;
NoDisplay=true
Run Code Online (Sandbox Code Playgroud)

之后,您将在“使用其他应用程序打开”选项卡中看到Vim 文本编辑器(控制台),选择它,当您双击该文件时,您将能够使用 vim 终端编辑器打开它。