example:
fun! s:MyScript(startline,endline)
python3 << endpython
import vim
startline = vim.eval("a:startline")
endline = vim.eval("a:endline")
for n in range(startline, endline + 1):
line = vim.current.buffer[n - 1]
#===========================
# start input lines
if re.search(...,line):
do this or that
# end input lines
#===========================
vim.current.buffer[n - 1] = line
endpython
endfun
I want to insert python code dynamically between start and end input lines in above script.
I know that I can use Vim's input field (Let question = ....) to do certain things with "line" p.e. line = eval(myinputlline) but how can I insert python code like if re.search(....) and more lines at once?
py3file.vim) file.python3 << endpythonyou runpy3file file.py. To change filenames at the execution time useexecute::execute 'py3file ' . filename.