Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the new .heex extension #553

Merged
merged 1 commit into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Features:

* Syntax highlighting for Elixir and EEx files
* Filetype detection for `.ex`, `.exs`, `.eex`, `.leex`, and `.sface` files
* Filetype detection for `.ex`, `.exs`, `.eex`, `.heex`, `.leex`, and `.sface` files
* Automatic indentation
* Integration between Ecto projects and [vim-dadbod][] for running SQL queries
on defined Ecto repositories
Expand Down
2 changes: 1 addition & 1 deletion doc/elixir.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ INTRODUCTION *elixir-introduction*
*elixir* provides Vim configuration files for Elixir http://elixir-lang.org/

* Syntax highlighting for Elixir and EEx files
* Filetype detection for `.ex`, `.exs`, `.eex`, `.leex`, and `.sface` files
* Filetype detection for `.ex`, `.exs`, `.eex`, `.heex`, `.leex`, and `.sface` files
* Automatic indentation
* Integration between Ecto projects and |vim-dadbod| for running SQL queries
on defined Ecto repositories
Expand Down
2 changes: 1 addition & 1 deletion ftdetect/elixir.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
au BufRead,BufNewFile *.eex,*.heex,*.leex,*.sface set filetype=eelixir
au BufRead,BufNewFile mix.lock set filetype=elixir
au BufRead,BufNewFile * call s:DetectElixir()

Expand Down
5 changes: 4 additions & 1 deletion ftplugin/eelixir.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ if !exists("b:eelixir_subtype")
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(&filetype,'^eex\.\zs\w\+')
endif
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(&filetype,'^heex\.\zs\w\+')
endif
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(&filetype,'^leex\.\zs\w\+')
endif
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(&filetype,'^sface\.\zs\w\+')
endif
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.eex\|\.sface\|\.leex\|\.eelixir\)\+$','',''),'\.\zs\w\+$')
let b:eelixir_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.eex\|\.heex\|\.leex\|\.sface\|\.eelixir\)\+$','',''),'\.\zs\w\+$')
endif
if b:eelixir_subtype == 'ex'
let b:eelixir_subtype = 'elixir'
Expand Down
2 changes: 1 addition & 1 deletion ftplugin/elixir.vim
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let &l:path =
\ &g:path
\ ], ',')
setlocal includeexpr=elixir#util#get_filename(v:fname)
setlocal suffixesadd=.ex,.exs,.eex,.leex,.sface,.erl,.xrl,.yrl,.hrl
setlocal suffixesadd=.ex,.exs,.eex,.heex,.leex,.sface,.erl,.xrl,.yrl,.hrl

let &l:define = 'def\(macro\|guard\|delegate\)\=p\='

Expand Down
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ def self.new
end
end

module HeexBuffer
def self.new
Buffer.new(VIM, :heex)
end
end

module LeexBuffer
def self.new
Buffer.new(VIM, :leex)
Expand Down Expand Up @@ -162,6 +168,7 @@ def self.new
{
be_elixir_indentation: :ex,
be_eelixir_indentation: :eex,
be_heelixir_indentation: :heex,
be_leelixir_indentation: :leex,
be_surface_indentation: :sface
}.each do |matcher, type|
Expand Down Expand Up @@ -191,6 +198,7 @@ def self.new
{
include_elixir_syntax: :ex,
include_eelixir_syntax: :eex,
include_heelixir_syntax: :heex,
include_leelixir_syntax: :leex,
include_surface_syntax: :sface
}.each do |matcher, type|
Expand Down
5 changes: 4 additions & 1 deletion syntax/eelixir.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ if !exists("b:eelixir_subtype")
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(&filetype,'^eex\.\zs\w\+')
endif
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(&filetype,'^heex\.\zs\w\+')
endif
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(&filetype,'^leex\.\zs\w\+')
endif
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(&filetype,'^sface\.\zs\w\+')
endif
if b:eelixir_subtype == ''
let b:eelixir_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.eex\|\.sface\|\.leex\|\.eelixir\)\+$','',''),'\.\zs\w\+$')
let b:eelixir_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.eex\|\.heex\|\.leex\|\.sface\|\.eelixir\)\+$','',''),'\.\zs\w\+$')
endif
if b:eelixir_subtype == 'ex'
let b:eelixir_subtype = 'elixir'
Expand Down