How do I get perl-support.vim to recognize Perl files?

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

to ~ / .vimrc and / etc / vimrc.

How do I enter the command perl-support

? The entry recommends typing \isuin normal mode to create a new unit, but the moment I click i, vim goes into insert mode and nothing happens.

What am I doing wrong?

+2


source to share


3 answers


Make sure you enable ftplugins with the command filetype plugin on

in .vimrc

and of course make sure that the file you are editing is recognized as a Perl file (usually having a known extension, but you can force the object by running the command set filetype=perl

. If file type plugins are not enabled or if the file type is not recognized, the rest of the perl support is not loaded at all.



+3


source


As recommended by hobbs , it set filetype=perl

works.

However, I wanted to do this every time I open a test file .t

that my vim does not recognize as perl files, since interpreter instructions are also common.

I checked :help syntax

in vim and saw this:

mkdir ~/.vim/ftdetect
cd ~/.vim/ftdetect
vim t.vim

      



which contains

au BufRead,BufNewFile *.t set filetype=perl

      

which means: if file extension .t

then execute set filetype=perl

.

This can be useful for any other custom extension.

+2


source


I found that I had to install Perl::Tags

in front of most things (especially \

). Installation Perl::Tags

threw an error message reset with filetype plugin on

.

cpan> install Perl::Tags # make sure you say yes to any offer to install dependancies

      

+1


source







All Articles