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 selectionstdin 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
Post a Comment