Execute shell command without filtering from Vim

Select your block of text, then type these keys :w !sh

The whole thing should look like:

:'<,'>w !sh

That’s it. Only took me 8 years to learn that one : )

note: typing : after selecting text produces :'<,’> a range indicating selection start and end.

Update 2016: This is really just one use of the generic:

'<,'>w !cli_command

Which basically lets you “send” arbitrary parts of your file to external commands and see the results in a temporary vi window without altering your buffer. Other useful examples would be:

'<,'>w !wc
'<,'>w !to_file my_file

I honestly find it more useful to alter the current buffer. This variety is simply:

'<,'>!wc
'<,'>!to_file my_file

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)