- But actually VS Codium
- Multiple Windows
- Cursors, navigating, selection
- Important keyboard shortcuts
- Misc needful extensions
- Visualize weird stuff
- Various config one needs
- Bonus gotchas
A code editor.
VS Code is a soemthign more structured than a text editor, and less heavy duty than a code IDE. A code editor, that is. It is Microsoft’s in-house competitor to Atom, with a similar technology stack, but somewhat cleaner and faster, last I checked.
I am not clear on its relationship to 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 cask install 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.
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
emoji and unicode
Insert Unicode is a handy tool for inserting arbitrary unicode by searching in various elaborate ways, including full emoji support. Alternatively, Unicode Latex converts from LaTeX character macros to unicode.
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?
See VS Code for prose.
There are two options to keep your fancy and elaborate VS Code customisations shared across all your comptuers
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.
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?
That can be toned down by language for e.g. markdown.
How about bracket closing? (brrrrr) If you are like me and you are offended by every implementation of bracket closing you have yet seen, you want, in your config:
Aaaaahhhh that’s better.
Alternatively, you might want to use AI-assisted IntelliSense.
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.
Command line not working
You want it to work from 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