|
Create a vimrc file in the user's home directory, and then add in the following:
function HeaderPython ()
call setline (1, "#! / usr / bin / env python")
call append (1, "# - * - coding: utf8 - * -")
normal G
normal o
normal o
endf
autocmd bufnewfile * .py call HeaderPython ()
Save out
For example, I use the root user, so I created as follows:
vim ~ / .vimrc
function HeaderPython ()
call setline (1, "#! / usr / bin / env python")
call append (1, "# - * - coding: utf8 - * -")
normal G
normal o
normal o
endf
autocmd bufnewfile * .py call HeaderPython ()
Save and exit
Then directly vim file name in any directory |
|
|
|