Subject: | Included Vim example doesn't clean up tempfiles. |
The Vim example included in the perldoc doesn't clean up after itself;
the attached patch utilizes the Vim function tempname(). This function
will both protect the tagsfile as well as cleanup after it when Vim exits.
Subject: | perl-tags-vim.patch |
--- perl-tags.vim-orig Mon Apr 30 13:26:21 2007
+++ perl-tags.vim Mon Apr 30 13:28:06 2007
@@ -9,6 +9,8 @@
EOF
endfunction
+ " Let vim do the tempfile cleanup and protection
+ let s:tagsfile = tempname()
function s:do_tags(filename)
perl <<EOF
my $filename = VIM::Eval('a:filename');
@@ -17,7 +19,7 @@
# we'll now do a global (for this PID) tags file which will get updated as you source dive.
- my $tagsfile="/tmp/tags_$$";
+ my $tagsfile= VIM::Eval('s:tagsfile');
VIM::SetOption("tags+=$tagsfile");
# of course, it may not even output, for example, if there's nothing new to process