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

Respect comma first style #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 10 additions & 1 deletion indent/erlang.vim
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ function! s:BeginElementFound(stack, token, curr_vcol, stored_vcol, end_token, s
else
return [0, 0]
endif
elseif a:stack == ['first_comma']
return [1, a:curr_vcol]
else
return [1, s:UnexpectedToken(a:token, a:stack)]
endif
Expand Down Expand Up @@ -1024,7 +1026,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
let end_token = (token ==# '(' ? ')' :
\token ==# '{' ? '}' : 'error')

if empty(stack)
if empty(stack) || stack == ['first_comma']
" We found the opening paren whose block contains the LTI.
let mode = 'inside'
elseif stack[0] ==# end_token
Expand Down Expand Up @@ -1095,6 +1097,10 @@ function! s:ErlangCalcIndent2(lnum, stack)
call s:Log(' "' . token . '" token (whose closing token ' .
\'starts LTI) found -> return')
return curr_vcol
elseif stored_vcol ==# -1 && stack == ['first_comma']
call s:Log(' "' . token . '" token (which directly ' .
\'precedes LTI with first_comma) found -> return')
return curr_vcol
elseif stored_vcol ==# -1
" Examples: {{{
"
Expand Down Expand Up @@ -1438,6 +1444,9 @@ function! ErlangIndent()
let new_col = s:ErlangCalcIndent(v:lnum - 1,
\[ml[2], 'align_to_begin_element'])
endif
elseif currline =~# '^\s*,'
call s:Log(" Line type = 'first comma'")
let new_col = s:ErlangCalcIndent(v:lnum - 1, ['first_comma'])
else
call s:Log(" Line type = 'normal'")

Expand Down