Vim / Neovim CLI Startup, Diff, and Recovery

Launch editors with flags, compare files, recover swap data, and use terminal-friendly startup patterns.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Startup commands

Launch Vim or Neovim with practical flags for real workflows.

Open a file from shell

Start the editor on a file path.

bashANYvimnvimcli
bash
vim file.txt
nvim file.txt
Notes

The standard entry point for everyday editing from the terminal.

Open file at a specific line

Jump directly to a target line on startup.

bashANYvimnvimcli
bash
vim +42 app.ts
nvim +42 app.ts
Notes

Useful from grep results, stack traces, or bug reports.

Open read-only

Prevent accidental writes while reviewing.

bashANYvimreadonlycli
bash
vim -R file.txt
nvim -R file.txt
Notes

Handy for logs, generated files, and audits.

Start without user config

Launch a clean environment for config debugging.

bashANYvimtroubleshootingconfig
bash
vim -u NONE -U NONE
nvim --clean
Notes

Excellent for isolating plugin or configuration problems.

Diff mode

Compare files directly in the editor and navigate hunks.

Start in diff mode

Open two files side by side for comparison.

bashANYvimdiffreview
bash
vimdiff old.txt new.txt
nvim -d old.txt new.txt
Notes

Ideal for merge reviews, code comparisons, and refactors.

Jump between diff hunks

Move to the next or previous change region.

vimANYvimdiffnavigation
vim
]c  [c
Notes

These motions make diff review much faster.

Pull or push changes across diff panes

Take changes from one side or send them to the other.

vimANYvimdiffmerge
vim
:diffget  :diffput
Notes

Helpful during manual merges and conflict resolution.

Recovery and swap workflows

Recover work after crashes and inspect swap-based recovery options.

Recover from a swap file

Open recovery mode for a specific file.

bashANYvimrecoveryswap
bash
vim -r file.txt
nvim -r file.txt
Notes

Useful after crashes or interrupted sessions.

List recoverable swap files

Show swap files that can be recovered.

bashANYvimrecoveryswap
bash
vim -r
nvim -r
Notes

Useful when you remember the editor but not the original file path.

Write recovered contents elsewhere

Save a recovered buffer to a safe path first.

vimANYvimrecoverysafety
vim
:write recovered-file.txt
Notes

A smart first step before cleaning up stale swap files.

Recommended next

No recommendations yet.