Skip to content

Commit

Permalink
Add multi-line comments for Elm
Browse files Browse the repository at this point in the history
Technically the minimum necessary syntax for block comments requires
only a single hyphen (`-}`, `{-`), but I have found that using a double
hyphen plays a bit more nicely with the elmcast/elm-vim auto-formatting.
Further, uncommenting when using the single dashes leaves an extra level
of indentation (again, when using elmcast/elm-vim).
  • Loading branch information
zack committed Jan 19, 2017
1 parent 18cfe81 commit 17e3371
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugin/NERD_commenter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ let s:delimiterMap = {
\ 'eiffel': { 'left': '--' },
\ 'elf': { 'left': "'" },
\ 'elixir': { 'left': '#' },
\ 'elm': { 'left': '--' },
\ 'elm': { 'left': '--', 'leftAlt': '{--', 'rightAlt': '--}' },
\ 'elmfilt': { 'left': '#' },
\ 'ember-script': { 'left': '#' },
\ 'emblem': { 'left': '/' },
Expand Down Expand Up @@ -622,7 +622,7 @@ function s:AppendCommentToLine()

"stick the delimiters down at the end of the line. We have to format the
"comment with spaces as appropriate
execute ":normal! " . insOrApp . (isLineEmpty ? '' : ' ') . left . right
execute ":normal! " . insOrApp . (isLineEmpty ? '' : ' ') . left . right

" if there is a right delimiter then we gotta move the cursor left
" by the length of the right delimiter so we insert between the delimiters
Expand Down Expand Up @@ -1417,7 +1417,7 @@ function s:SetupStateBeforeLineComment(topLine, bottomLine)
let state = {'foldmethod' : &foldmethod,
\'ignorecase' : &ignorecase}

" Vim's foldmethods are evaluated every time we use 'setline', which can
" Vim's foldmethods are evaluated every time we use 'setline', which can
" make commenting wide ranges of lines VERY slow. We'll change it to
" manual, do the commenting stuff and recover it later. To avoid slowing
" down commenting few lines, we avoid doing this for ranges smaller than
Expand Down Expand Up @@ -1622,7 +1622,7 @@ function s:UncommentLinesSexy(topline, bottomline)
let theLine = s:SwapOuterPlaceHoldersForMultiPartDelims(theLine)
call setline(bottomline, theLine)
endif

" remove trailing whitespaces for first and last line
if g:NERDTrimTrailingWhitespace == 1
let theLine = getline(a:bottomline)
Expand Down

0 comments on commit 17e3371

Please sign in to comment.