Before, under ubuntu, there were the following two sentences in the vim configuration file:
autocmd BufNewFile *.py 0r ~/.vim/templates/header.py autocmd BufNewFile,BufRead *.py nmap
:!chmod +x % " change mode
is used to automatically add some fixed content to the file header when creating a new python file. In addition, header.py
file content is
#! /usr/bin/env python
# -*- coding: utf-8 -*-
But after migrating to macvim, every time a file is opened, the file content of header.py will be added at the beginning. In this way, after n times of opening, there will be 2n lines of comments at the beginning of the file. In addition,
It is speculated that the compilation options of macvim may be different from those of vim under ubuntu, but after looking at :h template
, it seems that BufNewFile *.py 0r does not require any compilation options. I don’t know why. ?
How can I achieve my purpose under macvim (when creating a new python file, automatically add some fixed content to the file header, and use <F7>
to add execution permissions to the python file)?
A big difference between macvim and linux vim that I have discovered so far is: macvim does not have a + sign register. I don’t know what other differences there are? Why isn't macvim exactly the same as vim under Linux? (Is it possible to make macvim the same as vim-gnome used under ubuntu by compiling some options).
某草草2017-05-16 16:44:07
It’s my configuration file that conflicts, it’s nothing to do with macvim