I really can not figure how to do this.
I am trying to create a snippet that will read a file (the name I will get it by selecting it so it will be in the ${VISUAL}
) and then using grep extract a line from it.
What I tried is something like
!v cat ${VISUAL} | grep "some text"
but of course that in shell ${VISUAL}
has a different value.
I tried something in python, but I am lost. All I could get was
!p snip.rv=snip.v.text
that will give me the value for ${VISUAL}
Thank you for your help.
Maybe for your specific case you could use the vim builtin :read function ?