Vim Filters

Tue, Apr 26, 2022 One-minute read

Vim Filters

Today I learnt about (and showed some vim-hater colleagues) vim filters.

I am still at the point of consciously thinking about them. So, I’ve already noticed a few spots where I could of used a filter but instead dropped back to what I know.

A few contrived and simple examples.

Get the first zet with a #golang tag

:r !ds zet t golang | awk '{print $1} | head -n 1
# 20220424000235

Get unix time

:r !ds uniq second
# 1650971184

Line count for this document

:r !wc -l #
# 16 zet/20220426105644/README.md

These are so basic its not funny but gaining an awareness is the start. Conscious thought when writing leads to the mental leaps which turn things like this into muscle memory.

Tags:

#vim