Enable Markdown Syntax Highlighting in Fenced Code Blocks

I use Vim for presenting technical talks in markdown. But code blocks in markdown don’t get syntax highlighting in Vim. Let’s change that! Set this: :let g:markdown_fenced_languages = ['typescript'] Now, when I create a TypeScript fenced code block (three backticks + typescript), the type-safe code inside get highlighted, right inside my markdown. See help syntax for more.

September 21, 2026

Open Vim Readonly

We can open Vim in read-only mode in two ways: vim -R <file> Or: view <file> A use case could be a file on a server with credentials that we want to read but be sure not to change. See man vim for more information.

August 23, 2026

Vim view all your maps

For each way you can map something in Vim, you can inspect those mappings. Check out this table of commands: COMMANDS MODES :map :noremap :unmap Normal, Visual, Select, Operator-pending :nmap :nnoremap :nunmap Normal :vmap :vnoremap :vunmap Visual and Select :smap :snoremap :sunmap Select :xmap :xnoremap :xunmap Visual :omap :onoremap :ounmap Operator-pending :map! :noremap! :unmap! Insert and Command-line :imap :inoremap :iunmap Insert :lmap :lnoremap :lunmap Insert, Command-line, Lang-Arg :cmap :cnoremap :cunmap Command-line :tmap :tnoremap :tunmap Terminal-Job To take a very practical one, :nmap will show you all of your normal mode mappings. Find a new command to try; you are not using them all (neither am I). ...

August 8, 2026

Vim Scriptout and Scriptin

Today I discovered these two Vim flags: vim -w log.txt file vim -s log.txt file The -w flag sends all keystrokes in your session to log.txt. The -s loads Vim and replays all the keystroke back onto that file. So I open file, type lll and :wq, and then my log.txt should have some representation of that saved. When I open file again with log.txt as my script, those same keystrokes will replay after the file opens. The arguments are scriptout and scriptin, respectively. ...

June 30, 2026

Vim :Tutor Command

Longtime Vim users know the vimtutor program, which teaches you Vim in Vim. Vim 9.2 shipped with a new :Tutor command that improves on this. :Tutor The original vimtutor is entered like this: $ vimtutor Digging into this script on my machine, we see: $VIM -f -u NONE -c "set nocp showcmd" "$TUTORCOPY" The flag -u NONE opens the tutor without any configurations applied. This can be useful but is also harsh, especially for experienced users or those coming from an IDE. ...

April 29, 2026

Installing Vim on a Remote Server

Vim-tiny is a great choice for remote server work. When I’m working on a remote server with Vim (common use case: stripped-down Docker containers), I need a text editor to manipulate configuration files. vim-tiny is my current package of choice. apt-get update apt-get install vim-tiny It’s a basic version of Vim, no GUI, fewer features. Feels like a good call for servers without Vim, that we want to keep light and fast, that I may never return to. ...

February 13, 2026

Vim Mappings Verbose

I have a Vim normal mode mapping, and I don’t know where it comes from. My Vim config, a plugin, somewhere else? nmap shows me the mapping: :nmap gsp n gsp * 1z= And verbose nmap shows me where it comes from: :verbose nmap gsp n gsp * 1z= Last set from ~/.vimrc line 111 The setting is coming from inside the .vimrc!

July 22, 2025

Vim Jump to Previous Occurrence

In Vim Normal mode, * searches forward for the next occurrence of word. But what goes back? It’s #! This TIL illustrates how we get set in our ways with our tools. I found a way to use Vim for over a decade without knowing how to do this. Today, I learned. See :help # for more details.

May 20, 2025

Vim Scratchpad Part 2

Today, I’d like to dive deeper into a part of my practice: using a persisted text file for jotting things down. In this post, I’ll explain the ‘why’ behind this technique, and provide an updated version of it. You can read the post I’m following up on here. Why Use a Scratchpad? Why use this technique? Here are a few reasons. I’m a note-taker. The military trains soldiers to always have “something to write on, and something to write with.” When I see somebody in a meeting not taking notes, I wonder if they’re paying attention and how they’re going to remember key details. ...

October 26, 2022

Vim Scratchpad

Today I’d like to share a small part of my practice: using a persisted scratchpad text file for jotting things down. When coding, often I’ll need to save a piece of data or type something out. This could be the identifier of a record, or a list of steps my pair and I think we need to take to fix a problem. Instead of creating a new file each time, I keep a scratchpad in my root directory, named ~/buffer. I’ve mapped Vim to open it from normal mode with <leader> g: ...

August 25, 2022