0

I find the vim-perl plugin here, but I can't enable it with:

filetype plugin indent on (I changed the order of "plugin" and "indent" after seeing that link)

I can't disable plugin support, so I tried an alternative way,

if &filetype == 'perl'
    filetype plugin on
else
    filetype plugin indent on
endif

But that doesn't work either! When I do filetype command in VIM, I see plugin, autodetection, indent are all ON

Any thoughts?

Community
  • 1
  • 1
daisy
  • 22,498
  • 29
  • 129
  • 265
  • 2
    How to "can't enable" and "doesn't work" actually manifest themselves?! What is missing / wrong? – Ingo Karkat Jan 20 '13 at 10:17
  • @IngoKarkat “Doesn’t work” means that without `filetype on` filetype is not detected and thus `&filetype` is not equal to `perl` and `:if` condition is always false. “Can’t enable” is much more interesting. – ZyX Jan 20 '13 at 10:27

1 Answers1

1

But that doesn't work either! When I do filetype command in VIM, I see plugin, autodetection, indent are all ON

Of course, it would not. :filetype also enables filetype detection, thus there is no way you can automatically have &filetype equal to perl until you have run :filetype on.

You can try something like

function s:DisablePerlIndent()
    augroup DisablePerlIndent
        if &ft is# 'perl'
            autocmd! BufEnter <buffer> filetype indent off
        else
            autocmd! BufEnter <buffer>
        endif
    augroup END
endfunction
augorup DisablePerlIndent
    autocmd! FileType * call s:DisablePerlIndent()
augroup END

, but I doubt this will actually work. It would be much better if you follow @IngoKarkat advice and say what does “can’t enable” mean.

ZyX
  • 52,536
  • 7
  • 114
  • 135