c_CTRL‑O.vim
One-shot normal mode for command-line mode 2025-11-04
Project Readme • Project Files • GitHub Repo
In Vim I use command-line CTRL‑G and CTRL‑T extensively: they let you peek at occurrences of a pattern without clobbering the last search or cluttering up the jumplist. This plugin’s main feature is a command-line CTRL‑O binding that functions like insert-mode CTRL‑O and complements this workflow well. See the readme for more information.
The plugin also defines a command-line CTRL‑R CTRL‑O {motion} that inserts {motion} text from the buffer into the command-line. For example, CTRL‑R CTRL‑O a" inserts the string literal under the cursor. This binding was included because, with command-line CTRL‑O working, its implementation is trivial: feed CTRL‑O y, wait for user input, then feed CTRL‑R ".
In writing this plugin I ended up reading through parts of Vim’s source code to help answer questions the documentation couldn’t (see the comments in c_CTRL-O.vim) and that was a great learning experience.