Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Easier with Vi, and particularly Vim.

Hit V to enter visual mode, visually select the lines of text, then :w !<command> to write the lines to a command. (Note space between w and !).

Alterantive: Hit V to enter visual mode, then ! to pipe, and type command. This will replace the text with the output of that command, so you've captured any informative messages or diagnostics of that program right in the buffer.

If it went wrong, just u to undo (remove the program's output and replace by your original text) and try again.

Any program can be swapped out; you can't trust that just because you're entering something into an editor, it's not written to a storage device. (Unless you've configured your system not to have any swap space.)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: