elixir-editors / vim-elixir

Vim configuration files for Elixir
http://elixir-lang.org/
Other
1.31k stars 156 forks source link

% and Tag Highlighting are not working for HEEX as they are working for EElixir format #567

Open collegeimprovements opened 1 year ago

collegeimprovements commented 1 year ago

Filing a bug? Have you already tried updating vim-elixir? For indentation/highlighting bugs, please use the following template:

Actual EElixir filetype for same format

Screen Shot 2023-03-04 at 1 54 06 AM

Actual HEEX filetype for same format

Screen Shot 2023-03-04 at 1 56 01 AM

Also, % is not working as it doesn't take us to closing tag.

mbramson commented 8 months ago

Also encountering this. Using Neovim if that's useful.

ghost commented 8 months ago

@mbramson , @collegeimprovements:

There was a commit on both vim & neovim runtime (vimscripts distributed along vim) to include support for matchit:

Take a look at https://github.com/vim/vim/commit/8967f6c4b9e2071dea9a63dbbbb93f6b9119ae99 & https://github.com/neovim/neovim/pull/24626/commits/9b2f251761052ce3b900196bed056513a6a9505a

Some distributions (like MacOS) don't allow modifying system files, but you can try including the patch in an after-directory, the exact location depends on your runtimepath setting.

For example, in my configuration, the patch sits on ~/.config/vim/after/ftplugin/heex.vim (it looks like this):

" See: https://github.com/vim/vim/blob/master/runtime/ftplugin/heex.vim

" 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:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words"
endif

That would be only a work-around but that's what I can offer you right now since I'm not sure how vim-elixir should play along with $VIMRUNTIME 😅.

Hope it helps on the meantime 🙂.

ghost commented 8 months ago

Forgot to mention that such patch only addresses the problem with matchit.

A work-around for syntax highlighting would be to include set syntax=eelixir on after/ftpulgin/heex.vim.

sodapopcan commented 1 week ago

Sorry, I linked the wrong issue. My PR does not affect this one.