I have set my .vimrc to automatically add a shebang line, as below:
autocmd BufNewFile * execute 'silent! 1s/.*/#!\/usr\/bin\/env ' . (empty(&filetype) ? '' : ' '.&filetype)
However, I would like it to also add two lines below it and go into insert mode. When I simply add $i to the end of the command, as below, I get an error. Ideas?
autocmd BufNewFile * execute 'silent! 1s/.*/#!\/usr\/bin\/env ' . (empty(&filetype) ? '' : ' '.&filetype) $<CR><CR>i