stdout - How to use an external command in Vim to modify the selection -



stdout - How to use an external command in Vim to modify the selection -

something i've found useful in other editors ability to:

take selected text run external command , pass selection stdin take external commands stdout , replace current selection it.

this way can write useful text tools operate on selection using language can basic io.

how can done vim?

(directly in command line, or via key binding?)

:'<,'>!command

'<,'> represents (linewise) visual selection , automatically inserted when nail : , have selected.

example:

if select line containing:

print("hello!")

and run vim command:

:'<,'>!python

the text replaced hello!.

if want set key-binding (f5 evaluate example)

vnoremap <f5> :!python<cr>

vim stdout stdin

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -