在xubuntu17.10中,为什么我用右键点文件选择vim打开,所用的终端会不一样?
发表于 : 2018-01-09 2:28
请教各路大神!
下图是正常开启vim的效果. 下图是右键点文件选择用vim打开.就直接用xterm打开了!!! 请问怎么改呀?我想右键打开也用第一张图的样子!
谢谢~
下图是正常开启vim的效果. 下图是右键点文件选择用vim打开.就直接用xterm打开了!!! 请问怎么改呀?我想右键打开也用第一张图的样子!
谢谢~
vickycq 写了:右键点文件选择用 vim 打开时,使用的是 /usr/share/applications/vim.desktop
在 /usr/share/applications/vim.desktop 中,有键值 Terminal=true,即使用终端打开
由于历史原因,这里选择终端的机制不清楚,与桌面环境和文件管理器有关
大部分桌面环境和文件管理器会尝试使用 xdg-open 打开 vim.desktop
而 xdg-open 又会根据目前桌面环境,使用不同的方法打开 vim.desktop。
xdg-open 遇到含有 Terminal=true 的 desktop 文件时,选择终端的机制似乎是根据预先硬编码的列表强行匹配,其行为无法自定义。
因此,您可能需要自己创建一个 desktop 文件,在 Exec= 中硬编码打算使用的终端。您可以将 /usr/share/applications/vim.desktop 复制一份,改个名字(文件名和 Name=),改为 Terminal=false,在 Exec= 中使用 xfce4-terminal -e vim %F
您也可以直接修改 vim.desktop,不过这样软件包升级时可能会被覆盖
你怎么改的?我只是说个大致方法reejoo 写了:Cry 这样改后,闪退!
代码: 全选
[Desktop Entry]
Name=Vim
GenericName=Text Editor
Comment=Edit text files
Comment[zh_CN]=编辑文本文件
TryExec=vim
Exec=xfce4-terminal -e "vim %F"
Terminal=false
Type=Application
Keywords=Text;editor;
Icon=gvim
Categories=Utility;TextEditor;
StartupNotify=false
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
vickycq 写了:用这个试试代码: 全选
[Desktop Entry] Name=Vim GenericName=Text Editor Comment=Edit text files Comment[zh_CN]=编辑文本文件 TryExec=vim Exec=xfce4-terminal -e "vim %F" Terminal=false Type=Application Keywords=Text;editor; Icon=gvim Categories=Utility;TextEditor; StartupNotify=false MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;