First of, I am sure there are plugins that will do what I am trying to achieve but I am using this as an exercise to learn vim as I am still quite new so I am not really interested in plugin suggestions.
I am trying to build a command that will pope the current line of my buffer through Pandoc and replace the line with the output. This would allow me to, for example, have the line:
# Title
turn into
<h1>Title</h1>
in an html document. In time I would like it to output different text based on the buffer's file type but for now I am focusing on html. This is what I have so far:
exe "read !echo " . getline('.') " | pandoc -t html"
I am aware that at the moment this won't replace the current line but that is intentional whilst I'm debugging
With my cursor on the line #test
, I got the following added to the line below it:
<p>exetest</p>
It appears to me that the #
is being converted to exe
before it is piped into pandoc. Could you please tell me why this is and how to fix it.
Thanks in advance