vim creating alias for frequently used command

0 votes
I want edit waf wscript files. I am executing the following command to set the filetype:

set filetype=python
 

Is there any other way to set up a small alias for the above command so that I can just go in EX mode and type "py" which does the same thing? Can anyone tell me the solution?
May 14 in Python by ana1504.k
• 6,630 points
10 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
You can add the following to your .vimrc and try:

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 such as:

# vim: set filetype=python :
answered May 14 by SDeb
• 10,700 points

Related Questions In Python

0 votes
2 answers

What is the python keyword “with” used for?

Please visit this site to know abt ...READ MORE

answered Aug 31, 2018 in Python by Somesh
30 views
0 votes
1 answer

What is set() function used for?

Sets are unordered, as you say. Even ...READ MORE

answered Oct 17, 2018 in Python by Priyaj
• 56,140 points
10 views
0 votes
1 answer
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
54 views
0 votes
1 answer

Which IDE can be used for Python on Mac OS X

Have tried many different (Kate, Eclipse, Scite, ...READ MORE

answered Oct 15, 2018 in Python by SDeb
• 10,700 points
39 views
0 votes
1 answer

Return a list inside a for loop while iterating over the elements of another list

The print() is getting called multiple times ...READ MORE

answered Sep 21, 2018 in Python by SDeb
• 10,700 points
30 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.