How do I open the current Ex command in the command-line window for full-screen editing?
Answer
:<C-f>
Explanation
Long Ex commands are easy to mistype when you edit inline on a single command line. Vim lets you promote the current command to the command-line window, where you can use full Normal-mode editing, history navigation, and text objects before executing. This is a high-leverage workflow when building complex substitutions, global commands, or pipelines joined with |.
How it works
:<C-f>
:starts Ex command-line entry<C-f>opens the command-line window (q:) with the current command loaded- Inside that window, you can edit like a normal buffer (motions, operators, search, macros)
- Press
<CR>on a line to execute that command
Example
Suppose you are drafting a complex command such as:
:%s/\\v<(foo|bar)>/\\=toupper(submatch(1))/g | update
Instead of fixing mistakes in cramped inline mode, press :<C-f>, refine it in the command-line window, then hit <CR> to run it cleanly.
Tips
- Use
q:to open command history directly, even when not actively entering: - You can edit previous commands and rerun them from the same window
- Treat it as your "scratchpad" for risky one-off commands before execution