I am learning Vim and I have successfully set up my .vimrc file such that whenever I make a new python .py file, the appropriate shebang and header are auto-generated. Yay me!
However, when building terminal pipelines I don't always like to include the .py extension for the programs I pipe to. Hence, the shebang won't auto-generate. Sad!
Without repeating what I wrote for the autocmd (which took much trial and error to write because that is how I learn), can I map a string like "pyhead" while in INSERT mode, or create a macro tied to the autocmd to easily implement my shebangbang when I choose not to use the .py extension? I feel as though a simple map to a command that already exists should prevent a cluttered .vimrc. I have placed my autocmd in an augroup as follows:
augroup Shebang
autocmd BufNewFile *.py 0put =\"#!/usr/bin/env python\<nl>...
...# -*-coding: utf-8 -*-\
...<nl>\<nl>\"
...|put ='#'.expand('%:t')
...|put =\"#<My_NAME>\"
...|put ='#LAST UPDATED: '.strftime('%m-%d-%Y')\|$
augroup end
For clarity, the autocmd is all on one line, but I included three dots to indicate continuation (so that you wouldn't need to scroll). If this is a silly request, and there is an easy answer please reprimand. Thanks!