Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file called .aliases for bash and zsh, I put this line

# vim: set filetype=bash: 

but if I make

: echo &ft

I get conf

share|improve this question
add comment

4 Answers

That should work. I tried that line myself and it worked. I could be that your 'modeline' option got set to 'nomodeline'. Try executing this and see what you get.

:verbose set modeline?

That will tell you the value of the 'modeline' option and if not the default, where it was last set.

Some Linux distributions set 'nomodeline' in /etc/vimrc or /usr/share/vim/vimrc as a security measure, even though the security problems with 'modeline' have long been fixed.

share|improve this answer
    
modeline Last set from ~/.vimrc –  juanpablo Aug 16 '11 at 5:06
    
for security, I change the modeline to add this to my ~/.vimrc au BufNewFile,BufRead .*aliases set filetype=sh –  juanpablo Aug 16 '11 at 5:24
add comment

set modelines=1 (or any non-0 value) in my ~/.vimrc got it working for me.

share|improve this answer
3  
This has no effect if modeline is not also set (which it is by default in Vim unless you're root) –  kynan Sep 5 '13 at 12:10
    
Gentoo has a system-wide set nomodeline in /etc/vimrc due to all the vulnerabilities with modelines handling in vim. –  MattBianco May 23 at 13:43
add comment

in ~/.vimrc you need to set following:

set nocompatible 
filetype plugin on
set modeline 
share|improve this answer
add comment

Adding just the following to my ~/.vimrc worked for me on my Funtoo Linux box:

set modeline
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.