From Microsoft Visual Studio Code's Doc:
Setting VS Code as the default text editor
xdg-open
You can set the default text editor for text files (text/plain
) that
is used by xdg-open
with the following command:
bash xdg-mime default code.desktop text/plain
Debian alternatives system
Debian-based distributions allow setting a default editor using
the Debian alternatives
system, without concern
for the MIME type. You can set this by running the following and
selecting code:
bash sudo update-alternatives --set editor /usr/bin/code
If Visual Studio Code doesn't show up as an alternative to editor
,
you need to register it:
bash sudo update-alternatives --install /usr/bin/editor editor $(which code) 10
Additionally, there is this issue mentioning following:
Some need you to set the default for a mime type like:
~/.local/share/applications/defaults.list
[Default Applications]
text/plain=code-insiders.desktop
Which adds Open With Visual Studio Code - Insiders (Ctrl+O) to the
nautilus context menu.
/usr/share/applications
?