Pergunta

Ref: Perforce changing the default editor

The above question refers to the p4 command line utility, so setting EDITOR seems to work. However, the graphical p4v implementation seems to use some obscure rules for selecting the default editor. On my last distro, it was using the default editor under /etc/alternatives. But on CentOS, it doesn't seem to be using that at all, since there is no default editor.

Without running strace on this thing and getting something sensible from that, does anybody know how to set the "default" editor for p4v, without having to specify file extensions individually in the "File Editors" settings section?

Foi útil?

Solução

I traced p4v.bin in the end. It looks like you can create a file in your home directory at: ~/.local/share/applications/defaults.list. But this is read before the global version and thus settings are overridden by what is in the global version. I'd say this is a bug, but that's for another time. Instead, you need to edit the global one in /usr/share/applications/defaults.list. You just need to add the following entry and any others you see fit, not forgetting to comment out the existing entry:

#text/plain=gedit.desktop
text/plain=gvim.desktop

Then create a file called gvim.desktop in ~/.local/share/applications/ with the following content:

Name=gvim
GenericName=Text Editor
Comment=Edit Text Files
Exec=gvim --server %U
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain
Icon=gvim
Categories=GNOME;GTK;Utility;TextEditor;

No need to restart perforce, it doesn't cache the mime-type queries, so it will read the defaults.list file again and find your modified entry.

Update: It is all documented here: https://wiki.archlinux.org/index.php/Default_Applications

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top