FreeTheBee
September 3rd, 2010, 08:45 PM
Hi, I was trying to add a mapping to my .vimrc file that would allow me to do some quick imports in python. I tried the following,
autocmd BufRead,BufNewFile *.py imap ,SNM import scipy as sci<cr>import matplotlib as mpl<cr>import matplotlib.pyplot as plt<cr><cr>
autocmd FileType imap ,SNM import scipy as...
and just the imap... into python.vim in my ftplugin folder.
In all cases the mapping does not work as long as I do not open a python file, as it should. However after opening a python file it becomes available in all other buffers as well. I expected the command to be exclusively available to the buffers that contain a python file. What am I missing here?
autocmd BufRead,BufNewFile *.py imap ,SNM import scipy as sci<cr>import matplotlib as mpl<cr>import matplotlib.pyplot as plt<cr><cr>
autocmd FileType imap ,SNM import scipy as...
and just the imap... into python.vim in my ftplugin folder.
In all cases the mapping does not work as long as I do not open a python file, as it should. However after opening a python file it becomes available in all other buffers as well. I expected the command to be exclusively available to the buffers that contain a python file. What am I missing here?