How could VIM (script?) insert ^L (page break) and /r on an empty line, automatically after every 30 Lines OR 1800 characters while writing? Any ideas?
Your idea might not work how you want it to, because if you go back and earlier parts of your file, your page breaks are going to end up in the wrong places.
I think a better idea would be to set up an autocommand that resets the page breaks whenever you save the file.
Here's a quick one that sets them every 30 lines whenever you save a file with a
.txt extension. If you also want it to work for every 1800 characters you're going to need to write a more iterative function that steps through the file keeping track of characters and and newlines and places the page breaks in the appropriate places.
function! ResetPageBreaks() abort " Remove existing page breaks execute "g/^\<C-L>$/d" " Add a page break every 30 lines %s/^/\= !(line('.') % 30) ? "\<C-L>\r" : '' endfunction augroup PageBreaks autocmd! autocmd BufWritePre *.txt call ResetPageBreaks() augroup END