Here is an example I'm working with. It is intended to add a template to a file, and then comment out these lines that are simply read using the vCom BlockComment plugin function. The goal is to mark the line number before I read from the file and after I finish reading from the file so that I can comment on the range of lines just inserted. However, I have time to figure out which syntax should point to this range. The commented line below is my attempt to call a function with a given range using variables. The commented part has a syntax error if I provide a range of hard code, as shown below, the script works below. How then do we put our range in a variable?
function! AddBoilerPlate() let s:beginLine = line(".") r /Users/danieljbrieckjr/myBolierPlate.txt exe "normal! joDate Created: " . strftime("%B %d, %Y") exe "normal! oLast Modified: " . strftime("%B %d, %Y") let s:endLine = line(".") "-------------------------------------------------- " s:beginLine, s:endLine call Comment() "-------------------------------------------------- 1,3 call Comment() endfunction
source share