Monday, August 12, 2024

Re: How to get matchit to work with heredocs in Perl files

Good morning,

you could try adding

" /usr/local/share/vim/vim91/ftplugin/html.vim (lines 33-43)
" HTML: thanks to Johannes Zellner and Benji Fisher.
if exists("loaded_matchit") && !exists("b:match_words")
  let b:match_ignorecase = 1
  let b:match_words = '<!--:-->,' ..
\       '<:>,' ..
\       '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' ..
\       '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' ..
\       '<\@<=\([^/!][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
  let b:html_set_match_words = 1
  let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words b:html_set_match_words"
endif

to your ~/.vim/ftplugin/perl.vim file (respectively %USERPROFILE%\vimfiles instead of ~/.vim on 
Microsoft Windows).

   Enno
Le samedi 10 août 2024 à 00:21:22 UTC+2, DwigtArmyOfChampions a écrit :
I have matchit loaded and I create a PHP file hello.php that contains the following text:

<?php

$html = <<<"HTML"
<table>
  <tr>
    <td>I AM THE TABLE.</td>
  </tr>
</table>
HTML;

print "$html\n";

exit();


If I put my cursor on the HTMLtags in the heredoc if I hit the percent key(%) I can toggle between the opening and closing tags for table, tr, and td. Cool!

So, if I create a Perl file hello.pl that contains the following text:

#!/usr/bin/perl

use strict;
use warnings;

print "Hello world!\n";

my $html = <<"HTML";
<table>
  <tr>
    <td>I AM THE TABLE.</td>
  </tr>
</table>
HTML

exit();

If I try to toggle the HTML tags similar to what I did in the PHP file, it does NOT work. How do I get the heredo toggling to work with Perl files?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/cef2f237-8f3f-40ad-9a87-190655e0d303n%40googlegroups.com.

No comments: