How do I allow the cursor to sit one position past the end of the line in normal mode?
Answer
:set virtualedit=onemore
Explanation
By default, Vim's cursor cannot go past the last character of a line in normal mode — pressing $ lands on the final character, not after it. Setting virtualedit=onemore lifts that restriction by allowing the cursor to occupy one virtual position beyond the line's last character, without inserting whitespace.
This is the conservative alternative to virtualedit=all, which lets the cursor wander anywhere into empty space. onemore gives just enough extra freedom for operators and plugins that need to select a range ending after the last character.
How it works
virtualedit=onemore— normal mode cursor can go one character past EOLvirtualedit=block— past-EOL movement in Visual block mode only (common separate use)virtualedit=all— unrestricted virtual cursor placement everywhere- Values can be combined:
:set virtualedit=block,onemore
The virtual position is real for cursor placement and motion purposes, but no whitespace is added to the file unless you actually type text there.
Example
With a line containing hello (5 chars):
hello
^
cursor can now land here (column 6)
Normally $ stops at column 5 (o). With onemore, you can reach column 6 and then use i to insert at that position without needing A (append).
Tips
- Some plugins (e.g., mini.nvim operators, vim-surround variations) require or work better with
onemore - Useful when writing mappings that need to select to the end of a line inclusively
- The
<End>key in normal mode will also respectonemoreand position past the last character - Does not affect Insert or Visual modes — use
virtualedit=insertorvirtualedit=allfor those