به Nostr بپیوندید
2026-02-12 16:27:23 CET

npub185…t8tc6 on Nostr: #TIL you can use vim/nvim as a pager directly, like some_command |vim Even better ...

#TIL you can use vim/nvim as a pager directly, like

some_command |vim


Even better than that, you can redirect a file into vim like

vim < some_file.txt


The advantages of this over view/vim -R are twofold: one, it is literally impossible to overwrite the file, unless you manually type :w exact_filename within vim. Second, you can safely edit the buffer without getting any warnings of being in read-only mode, because you're editing an ephemeral buffer, not the file.

Disclaimers: I did not actually learn this today, but within the last 12 months. Also, this doesn't work in vanilla vi/nvi.