A collection of things I’ve learned that I think others might like to know, but aren’t big enough to fill a whole page all their own.
#include_next — search for an include file that isn’t the current one. Allows you to extend system headers (e.g. to provide compatibility shims).
printf("%*s", 32, "foo") — use one argument as padding width for another.
printf("%.10s", ...) — print up to 10 bytes from the given string (allows printing w/o null terminator).
printf("%.*s", (int)len, buf) — print a non-null-terminated string.
paste - - will join pairs of lines from stdin.
OSC-7 escape code (”\x1b]7;file://$(hostname)$(uriencode ”$(pwd)”)\n”) to inform terminal emulator of your CWD.
C-s — Suspend the running terminal.
C-q — Resume the same.
The usual size of a cache line is 64 bytes.
You can double click to select a full word in most GUI applications — but it turns out if you keep the mouse held after the second click, and drag, you can make a larger selection that still only contains full words.
wsconsctl -dw font=Boldface in the console to get a smaller font.
C-Enter — open command palette
C-Mouse1 — eyedropper
C-M-Mouse1 — eyedropper (current layer without effects)
F3 — open command palette
S-v — slide vertex along edge (GG also works)
i — inset face
-Sres:1080 URL to download the best quality video no larger than the given vertical resolution.
--term-title can do ternary operators, not just individual properties (e.g. ${?pause==yes:⏸ }${?pause==no:♫} ${media-title}).
g<C-a> — in visual mode, increment the first number on each line of the selection, with the amount added increasing by one each time.
C-x s — switch to a mode where individual keys do commands (s to step, c to continue, etc.)
In Firefox, you can right click the URL bar for many websites to add their search page. This can then be set as the default, or given a custom shortcut under Settings > Search > Search Shortcuts, so that by typing @foobar<Tab> in the navigation bar you can search that website. For example, I have search shortcuts for the following:
For sites this doesn’t work on, there’s an extension:
C-b — Open bookmarks side panel.
C-d — Bookmark current page.
C-d M-r — Delete bookmark (if current page is bookmarked).
M-[0-8] — Switch to the Nth tab.
M-9 — Switch to the last tab.
Firefox Multi-Account Containers — C-S-[1234] will open a new tab in the indicated container.
browser.tabs.insertAfterCurrent — New tabs (even opened with C-t) will appear next to the active tab. Handy if you use vertical tabs.