tags:

views:

214

answers:

2

I installed perl-support.vim into ~/.vim (unzipped). When I create a new .pl file it shows me the default template, which means my installation is successful (I guess). I have already added filetype plugin on in ~/.vimrc & /etc/vimrc.

How do I enter a perl-support command? The write up recommends typing \isu in normal mode for creating a new sub, but the moment I hit i vim changes into insert mode and nothing intended happens.

What am I doing wrong?

+2  A: 

Make sure you've enabled ftplugins with the filetype plugin on command in .vimrc, and of course make sure that the file you're editing is recognized as a Perl file (usually, by having a known extension, but you can force the matter by issuing the command set filetype=perl. If filetype plugins aren't enabled, or if the filetype isn't recognized, then the rest of perl-support won't get loaded at all.

hobbs
Thanks. I have already added "filetype plugin on" in ~/.vimrc t seem to help
Akeshi
Update : set filetype=perl works . Thanks :)
Akeshi
If you're starting work on a new perl file, go ahead and do `vim whatever.pl` instead of waiting until you save to give it a name. Then the filetype will be detected from the beginning.
hobbs
A: 

Thanks Brian. set filetype=perl works.

However, I wanted to do this everytime I open a .t test file - which my vim does not recognize as perl files because the interpreter statement is also custom.

I checked out :help syntax in vim and saw this.

mkdir ~/.vim/ftdetect

cd ~/.vim/ftdetect

vi t.vim

which contains

au BufRead,BufNewFile *.t set filetype=perl

which says - if file extension .t set filetype = perl.

This can be useful for any custom extensions also.

Saurabh Hirani