vim creating alias for frequently used command

python, vim, waf, wsh

Solution

If I have understood correctly your question, the following added to your `.vimrc` shoud work

autocmd BufRead,BufNewFile *.waf set filetype=python

If it is a particular filename like `wscript`, this works too:

autocmd BufRead,BufNewFile wscript set filetype=python

If you can't rely on an extension or filename you can add a modeline at the top or bottom of your file

# vim: set filetype=python :

See `:help modeline` for more information.

But it is kinda ugly because you have to modify the file, and if your are working in a team, it can be problematic.

Problem

Possible Duplicate: Aliasing a command in vim So I have to edit waf wscript files a lot . Everytime I execute this command to set the filetype ``` set filetype=python ``` is there a way to set up an small alias for the above command ? SO that I can just go in EX mode and type "py" which does the same thing.

Original source

Related problems