Microsoft Visual Studio Code is a really nice editor and I would like to make it my default normal (not terminal) text-editor over Gedit, Emacs, or Vim. (I know, I'm so evil.)
There's no way for me to add it via a GUI option and I've looked at several online suggestions, but all of them are fairly out of date or unhelpful.
Do any of you have any suggestions? I'll take a terminal solution, but if you guys have a GUI one, that'll do too.
52 Answers
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 byxdg-openwith the following command:bash xdg-mime default code.desktop text/plainDebian 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/codeIf 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:
1Some need you to set the default for a mime type like:
~/.local/share/applications/defaults.list[Default Applications] text/plain=code-insiders.desktopWhich adds Open With Visual Studio Code - Insiders (Ctrl+O) to the nautilus context menu.
These two worked for me:
- Using xdg-utils:
xdg-mime default code.desktop text/plain- In this file:
/usr/share/applications/defaults.listreplace this line:
text/plain=gedit.desktopwith:
text/plain=code.desktopNote: update-alternatives affects non-graphical environment (terminal) only
1