search

Home  >  Q&A  >  body text

Some configurations of macvim are invalid

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, is used to add execution permissions to the python file, where the 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, also fails and there is no response. .

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).

过去多啦不再A梦过去多啦不再A梦2756 days ago888

reply all(1)I'll reply

  • 某草草

    某草草2017-05-16 16:44:07

    It’s my configuration file that conflicts, it’s nothing to do with macvim

    reply
    0
  • Cancelreply