Using Vim for pipeline filtering

6 views
Skip to first unread message

Miles Cranmer

unread,
Jun 16, 2020, 5:34:23 AM6/16/20
to vim...@vim.org
Dear all,

I made a 40-line script that lets you call Vim commands for Unix pipeline filtering, like sed or awk: https://github.com/MilesCranmer/vim-stream.

As an example,

> cat file.txt | vims -l 'f|d$'

will filter the output of "cat file.txt" by running the Vim command ‘f|d$’ on each line to delete everything after "|". The repo gives the other options.

I’m eager to hear: are you potentially interested in integrating these modes into Vim itself? The code looks tiny but pulls a lot of weight; I use "vim-stream" for batch text processing in nearly every script I write. I no longer spend time hunting for awk/sed commands, since Vim is ingrained in my fingers.

I'm interested to hear your thoughts.
Cheers,
Miles Cranmer

--
-------------------------------------------------------------------------------------------
twitter.com/MilesCranmer
-------------------------------------------------------------------------------------------
Reply all
Reply to author
Forward
0 new messages