- But actually VS Codium
- Multiple Windows
- Cursors, navigating, selection
- Important keyboard shortcuts
- Misc needful extensions
- Networked VS Code
- Remote collaborative editing
- Editing prose
- Visualize weird stuff
- Various config one needs
- Bonus gotchas
A code editor.
VS Code is a something more powerful than a text editor, and less heavy than a code IDE. It is Microsoft’s in-house competitor to the code editor Atom, with a similar technology stack, but somewhat cleaner and faster, last I checked. Also Atom might have been famous in this niche but now that Microsoft owns Atom and VS Code it is likely that Atom will gradually bitrot.
I am not clear on the relationship between VS Code the flabby Visual Studio. Some shared branding without any particular shared code? I don’t care enough to ever find out.1
Anyway, VS Code is OK, it turns out.
But actually VS Codium
VS Codium is the pure community distribution of VS Code. Despite the editor being mostly open, Microsoft inserts some creepy code into the packaged version which VS Codium excludes. Why and how you should migrate from Visual Studio Code to VSCodium.
# Ubuntu-esque wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg \ | sudo apt-key add - echo 'deb https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/repos/debs/ vscodium main' \ | sudo tee --append /etc/apt/sources.list.d/vscodium.list sudo apt update && sudo apt install codium # Windows choco install vscodium # Mac brew install --cask vscodium
This should work more or less identically to Microsoft’s version, except that Microsoft will know less stuff about you.
Almost obvious but to get maximum value you have to learn a couple of extra things.
Multiline search expressions
require you to type
That’s for vanilla string matching. For regex matching if you want to match
multiline search you need to explicitly add newline characters to your character
To replace regex groups you do the usual thing -
$1 is the first group etc and
$$ is a dollar sign.
Putting this together, if you wished to replace latex equation bracket syntax with latex
dollar syntax, you would replace
\\\[ *([\s\S\r]+?) *\\\]
interact with search usefully.
General multiple cursors are made by
There are many keyboard shortcuts to use them to automate menial chores.
- https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance). (source) Pylance is an extension that works alongside Python in Visual Studio Code to provide performant language support. Under the hood, Pylance is powered by Pyright, Microsoft’s static type checking tool. Using Pyright, Pylance has the ability to supercharge your Python IntelliSense experience with rich type information, helping you write better code faster.
- Notebooks are getting revamped! | Python
Important keyboard shortcuts
Tab switching is not obvious.
There are a lot of tweaks you could do, but short story:
Ctrl PageDown (Windows/Linux) or
⌘ ⌥ → (Mac).
See VS Code for LaTeX.
ext install ms-python.python ext install ms-python.vscode-pylance
Misc needful extensions
Networked VS Code
Here be tips for using VS Code as a collaborative cloud-friendly editor.
Remote edits code in particular environments - including spinning up containers or SSH sessions, so that your editor and execution environments can be different. The remotes in the former case can be local “remotes”. This is a smooth networked edit workflow, although the remote vs_code can be lacking some needful extensions. I should work out how that works.
Slightly weirder, code-server runs a server process that makes vs code accessible to you in a browser. The companion app ssh automates that. I am not sure when you would do it this way. Some kind of devops scenario that I am not cool enough to know about, or when working from a thin client?
Remote collaborative editing
There are two options to keep your fancy and elaborate VS Code customisations shared across various computers.
OG settings sync
If don’t want to sync everything, I can use sync pragmas, which look like this:
// @sync os=linux host=work-pc // @sync os=mac host=home-pc
VS Code built-in settings sync
Now Microsoft itself supporst a built in settings sync which looks fine also.
See VS Code for prose.
Visualize weird stuff
vs code data preview is a tabular data visualiser/analyser for vs code.
Various config one needs
You config is in a JSON file, which is quaintly retro but does mean that 3rd party config is at least not purely abysmal. The location is the following:
But you can coordinate across OSes by using settings sync.
Hover/tooltip/hint/autocompletion things are too intrusive
There are a lot of features which huddle under the opaque umbrella of intellisense, because they let someone in marketing get too near the product. But they all need tweaking, so you have to work out which is which. First, which is hover, which is hints etc?
The thing that appears when you mouse over a character is
It probably does something useful in statically-typed languages, but often ends up
To clam it for all languages, perhaps
so it activates after 3 seconds instead of RIGHT NOW LOOK AT ME OH SORRY WERE YOU TRYING TO READ SOMETHING ON THE SCREEN.
The hints are probably also being annoying, right? because instead of letting you finish a line it wants to to insert some wacky argument? disable that.
"editor.acceptSuggestionOnEnter": false, "editor.acceptSuggestionOnCommitCharacter": false,
That can be toned down by language for e.g. markdown.
How about bracket closing? (brrrrr) I am offended by every implementation of bracket closing I have yet seen, so I put this in my config:
Alternatively, I might want to use AI-assisted IntelliSense which is possibly less needy? :
Outline view in python is mostly imports
"symbolOutline.topLevel": [ "Class", "Module", "Constructor", "Function", "Method" ]
AFAICT the built-in one doesn’t do this.
Which language is that file?
You can use VS Code as an alternative client to talk to jupyter kernels.
Launching VS code from command line
You want to launch the command line for fish shell on macOS?
set -U fish_user_paths \ "/Applications/Visual Studio Code.app/Contents/Resources/app/bin" \ $fish_user_paths