mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-11 21:13:50 -05:00
Update
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
let s:SKIP_SYNTAX = '\%(Comment\|String\)$'
|
||||
let s:BLOCK_SKIP = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:SKIP_SYNTAX."'"
|
||||
|
||||
function! elixir#util#is_indentable_at(line, col)
|
||||
if a:col == -1 " skip synID lookup for not found match
|
||||
@@ -20,31 +19,24 @@ function! elixir#util#is_indentable_at(line, col)
|
||||
\ !~ s:SKIP_SYNTAX
|
||||
endfunction
|
||||
|
||||
function! elixir#util#is_indentable_match(line, pattern)
|
||||
return elixir#util#is_indentable_at(a:line.num, match(a:line.text, a:pattern))
|
||||
endfunction
|
||||
|
||||
function! elixir#util#count_indentable_symbol_diff(line, open, close)
|
||||
if elixir#util#is_indentable_match(a:line, a:open)
|
||||
\ && elixir#util#is_indentable_match(a:line, a:close)
|
||||
return
|
||||
\ s:match_count(a:line.text, a:open)
|
||||
\ - s:match_count(a:line.text, a:close)
|
||||
else
|
||||
return 0
|
||||
end
|
||||
return
|
||||
\ s:match_count(a:line, a:open)
|
||||
\ - s:match_count(a:line, a:close)
|
||||
endfunction
|
||||
|
||||
function! s:match_count(string, pattern)
|
||||
let size = strlen(a:string)
|
||||
function! s:match_count(line, pattern)
|
||||
let size = strlen(a:line.text)
|
||||
let index = 0
|
||||
let counter = 0
|
||||
|
||||
while index < size
|
||||
let index = match(a:string, a:pattern, index)
|
||||
let index = match(a:line.text, a:pattern, index)
|
||||
if index >= 0
|
||||
let index += 1
|
||||
let counter +=1
|
||||
if elixir#util#is_indentable_at(a:line.num, index)
|
||||
let counter +=1
|
||||
end
|
||||
else
|
||||
break
|
||||
end
|
||||
@@ -53,4 +45,8 @@ function! s:match_count(string, pattern)
|
||||
return counter
|
||||
endfunction
|
||||
|
||||
function elixir#util#is_blank(string)
|
||||
return a:string =~ '^\s*$'
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user