I am trying to automate the following in vim:
:r! sed -n 10p filename
Where the line number (10) is constantly changing. I was thinking something along the lines of
function! GetLine(line, filename)
:r! sed -n a:line,p a:filename
endfunction
which I have put in my .vimrc and properly sourced. But when I call with :call GetLine(10, "testfile.txt")
it doesn't work.
Now, while I have been using vim for quite a while, I am new to scripting it, so please bear with me if I am missing something obvious.