Editors & IDEs
Debian Development Machine Setup
Chapter 8 ยท Editors & IDEs on the Desktop
The languages are installed, so now you need somewhere to write code. This chapter is about setting up
editors on devserver, not about learning them: VS Code Essentials, Learning Vim and Text Editors
& IDEs Survey already teach how to use the tools. Here we deal with the Debian-specific parts: where to
get VS Code from, how to keep it updated, how to choose a default editor for the whole system, and how to
record your extensions so a rebuild is painless.
What You Already Have
A Debian desktop already has nano, and you installed vim in Chapter 2. The last
command shows where Debian's editor command currently points. That is the system's default
terminal editor, which programs like Git and sudoedit call when they need you to type something.
apt policy code will show nothing yet: VS Code is not in Debian's own repositories.
| Editor | Type | On Debian 13 | Good for |
|---|---|---|---|
| nano | Terminal | Included | Quick edits to config files; the easy one to learn. |
| Vim | Terminal | Version 9.1 in Debian's repositories (vim) | Fast editing anywhere, including over SSH on debserver. |
| Neovim | Terminal | Version 0.10.4 in Debian's repositories (neovim) | A modern, extensible take on Vim. |
| VS Code | Graphical IDE | Not in Debian; from Microsoft's repository | Larger projects, debugging, extensions, integrated terminal and Git. |
You do not have to choose one. A common pattern is VS Code for projects and a terminal editor for quick edits and for work over SSH. The rest of this chapter sets up that combination.
Installing VS Code from Microsoft's Repository
VS Code is Microsoft's program, not part of Debian, so you install it from Microsoft's own apt repository. That is a third-party repository: you are choosing to trust a company outside Debian to supply software that will run with your user's permissions, and to keep it updated. Linux Package Managers 3 explains what that trust involves, and Chapter 4 already showed you the same idea for the NVIDIA driver, though that one came from Debian. Do it deliberately, in three steps.
Step 1: Get Microsoft's signing key
This downloads Microsoft's public key and converts it into the binary format apt uses. Piping a downloaded
key into gpg is not the same risk as piping a downloaded script into
bash, because gpg --dearmor only converts data and does not run it. Still, apply
the habit from Chapter 1 and look at what you have:
This prints the key's owner and fingerprint. Compare the fingerprint with the one published by Microsoft before you rely on it; a key you obtained over HTTPS from Microsoft's own site is reasonable to trust, but the check costs a minute.
Step 2: Add the repository
Create /etc/apt/sources.list.d/vscode.sources in the same deb822 format you met in Chapter 2:
Read the Signed-By line carefully. It tells apt that packages from this repository must
be signed by this key, and that this key is trusted for this repository only. That keeps Microsoft's
key from vouching for anything else.
Step 3: Install
Then check it with the Chapter 3 tools:
.deb file to download. Installing it offers to add the repository and key
for you. That is convenient, but it does the repository setup on your behalf without showing you the steps.
This course uses the manual method so that you can see what you have trusted, and it leaves a file
(vscode.sources) that Chapter 10 can put in the rebuild script.
sudo apt update && sudo apt full-upgrade
updates it along with everything else, and Chapter 2's routine covers it. Microsoft notes the repository can
lag behind a release by up to three hours, so a brand-new version may take a little while to appear. The
trade-off of a third-party repository is that you have added one more source of code to your machine, so keep
it to the ones you actually need.
Extensions and Settings
VS Code is only as useful as its extensions. You can install them from the command line, which is what makes them recordable:
| Extension | Why |
|---|---|
Python (ms-python.python) | Runs and debugs Python, and finds your project's virtual environment from Chapter 5. |
PHP Intelephense (bmewburn.vscode-intelephense-client) | Code completion and error hints for PHP. |
| ESLint and Prettier | Checks and formats JavaScript, the tools you would install per project with npm from Chapter 6. |
Remote - SSH (ms-vscode-remote.remote-ssh) | Opens a folder on another machine, such as debserver, over the SSH connection from Chapter 2. |
Confirm each identifier in the extension marketplace before installing, because publishers rename things and this list is a starting point, not a guarantee. If a command reports that an extension was not found, search for it in VS Code's Extensions panel and copy the identifier from there.
"telemetry.telemetryLevel": "off" in
your settings file, or search “telemetry” in the Settings screen.
Recording the list
Save the list now, and you can rebuild this part of the machine with one command later:
Choosing a Default Editor
Several programs, Git among them, open “the editor” when they need input from you. If that is not the editor you want, you will meet an unfamiliar interface at an awkward moment. Set it once. Debian keeps a system-wide choice, and you can override it for yourself:
Choose the editor you are most comfortable with in a terminal. If that is nano, use nano; the point is that
it is a decision you made, not one that surprised you. Check it with
git config --global --get core.editor and echo $EDITOR. If you would rather use
VS Code for Git messages, git config --global core.editor "code --wait" works; the
--wait makes Git pause until you close the file.
Which Tool for Which Job
| You want to… | Use |
|---|---|
| Work on a project | VS Code, with a few well-chosen extensions |
| Edit a config file, or work over SSH | Vim, Neovim or nano |
Edit files on debserver from VS Code | Remote - SSH |
| Keep VS Code updated | apt full-upgrade |
| Rebuild your editor setup | vscode.sources and vscode-extensions.txt |
Hands-On Exercises
Add Microsoft's repository and install VS Code by the manual method. Before installing, inspect the key you downloaded. After installing, use the Chapter 3 tools to prove where the package came from. Explain what the Signed-By line does and what you have trusted.
Set your default editor at every level (system, user, shell and Git), then prove each setting took effect. Trigger Git's editor with a test commit and confirm the right editor opens.
๐ View solutionInstall three VS Code extensions from the command line, save the list, remove one extension, and restore it from the saved file. Then describe how you would use Remote - SSH to edit a file on debserver, and one risk of doing so.
Chapter 8 Quick Reference
- Debian 13 has Vim 9.1, Neovim 0.10.4 and nano; VS Code is not in Debian and comes from Microsoft's repository
- Key:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft.gpg; inspect withgpg --show-keys - Repository file
/etc/apt/sources.list.d/vscode.sourceswithSigned-By: /usr/share/keyrings/microsoft.gpg sudo apt update && sudo apt install code; afterwardsapt full-upgradekeeps it current (repository can lag up to three hours)- A third-party repository means trusting that publisher; keep them to the ones you need
- Extensions:
code --install-extension ID,code --list-extensions; verify IDs in the marketplace - Save and restore:
code --list-extensions > file;xargs -L1 code --install-extension < file - Default editor:
sudo update-alternatives --config editor,select-editor,EDITOR,git config --global core.editor - Remote - SSH edits files on another machine over SSH; be careful when the machine is
debserver