Hi
I use Vim editor for programming and here's the problem that I am facing.
I am using multiple tabs to edit C++ and Python files simultaneously and I have added the following in my .vimrc file
filetype plugin indent on
au filetype python set mp=python3\ %
au filetype cpp set mp=g++\ -Werror\ -Wextra\ -Wall\ -ansi\ -pedantic-errors\ -g\ %
i.e all I want is that when I switch to a tab with a Python file and run :make, it should run :!python3 %, and when I switch to a tab with a C++ file and run :make it should run :!g++ -Werror -Wextra -Wall -ansi -pedantic-errors -g %
However it's not working, and everytime I switch the tab and run :make, it tries to execute !g++ -Werror -Wextra -Wall -ansi -pedantic-errors -g % and when I run :set ft? on the 2 files(i.e Python and C++) to check whether the filetypes have been correctyl identified or not, I get the correct result i.e python and cpp.
Then why is this autocommand not working? Am I missing something? Thanks for your patience