Just like the topic says; is it possible to add a certain text string in the beginning of a file if I create a certain file type?For example, if I create a random Python file with vim random.py. Can I configure my vim to automatically add #!/usr/bin/python at line 1?I have a standard vim installation without any plugins or anything, I didn't even have a .vimrc in my /home so I manually created it. As you might have imagined by now, I am very new to using vim so my apologies if this is a dumb question.I found How do I add skeleton text to new vim files? but I am not sure if that is what I am looking for, or how to do it. If it turns out that this question is a duplicate of the question linked, I will try to look it up furthermore once I get home from work.Thanks in advance!EDITThanks for all the answers and I am sorry that this question indeed was a duplicate.
Is it possible to add a specific text string in the beginning of creating a certain file type?
vimrc;filetype;filetype python
You can accomplish it by placingautocmd BufNewFile *.py norm i#!/usr/bin/pythonin your .vimrc file.  This should insert the text at the beginning of the first file, whenever you open a non-existing file with the file extension py.The part norm i#!/usr/bin/python is simply commands which are executed when the file is opened.  As it is a new file, the cursor vil automatically be on the first line, which is empty.  Then norm treats the rest of the commands as you where in normal mode, which means that i takes you to insert mode and, when in insert mode #!/usr/bin/python simply types these characters.