Perl用辞書ファイルの作成
Perlで全ての関数を補完してくれるように辞書ファイルを作成する方法のメモ。
mkdir ~/.vim/dict
perlの全関数の辞書ファイル作成
perldic.pl
#!/usr/bin/perl while(<DATA>){ chomp; my $command = (split)[0]; print $command."\n" if $command =~ /^\w\w+$/; } print join("\n", qw/for while until foreach if elsif else unless/) . "\n";
それから
http://search.cpan.org/src/NWCLARK/perl-5.8.8/lib/Pod/Functions.pm:title
の__DATA__ 以下を、perldic.plの最後にコピペし保存する。
※__DATA__という文字列も含む。
以下のシェルを実行する。
perl preldic.pl | sort > ~/.vim/dict/perl_function.dict
.vimrcに追記
perl_functions.dictを設定
"ファイルタイプ別辞書ファイル autocmd FileType perl :set dictionary+=~/.vim/dict/perl_functions.dict "辞書ファイルを使用する設定に変更 set complete+=k