Multiline editing
In Neovim, multiline editing in Visual Mode is usually done with Visual Block Mode or Visual Line Mode. These let you edit multiple lines simultaneously.
1. Visual Block Mode (Column Editing)
Best for editing the same column across many lines.
Steps
- Move the cursor to the start column.
- Press:
Ctrl + v
- Use
j/k(or arrow keys) to select multiple lines. - Then use one of these commands:
Insert text at start of block
Shift + i
Type the text → press Esc.
Neovim inserts it on all selected lines.
Example:
Before:
apple
banana
orange
Block select first column → Shift+i → type -
After:
- apple
- banana
- orange
Append text at end of block
Shift + a
Example: add ; to end of lines.
Replace characters
Press:
r
Then type the replacement character.
Delete a column
Press:
d
2. Visual Line Mode (Whole Line Edits)
Select full lines:
Shift + v
Move up/down to select lines.
Now you can:
Indent
>
Unindent
<
Comment (if using plugin like Comment.nvim)
gc
3. Insert on Multiple Lines Without Column Alignment
Example: add // to several lines.
- Select lines:
Shift + v
- Run a normal command on them:
:normal I//
I inserts at the beginning of every selected line.
4. Useful Multiline Patterns
Add text at line end
:'<,'>normal A;
Remove first character of lines
Ctrl+v → select column → d
5. Example Workflow (Very Common)
Add console.log() before multiple JS variables.
Ctrl+v
select lines
Shift+i
console.log(
Esc
✅ Key Idea
| Mode | Shortcut | Use case |
|---|---|---|
| Visual Block | Ctrl+v | Column editing |
| Visual Line | Shift+v | Whole line editing |
| Visual | v | Character selection |
💡 Pro Tip: Multiline editing becomes extremely powerful when combined with Neovim plugins like vim-surround or Comment.nvim.