Skip to content

Commit

Permalink
use foldmethod=syntax by default w/ escape hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jbodah committed Apr 10, 2021
1 parent dab61ea commit 5a1811c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions doc/elixir.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ SETTINGS *elixir-settings*
*g:elixir_indent_max_lookbehind*
TODO

*g:elixir_fold*
TODO

*g:elixir_use_markdown_for_docs*
TODO

Expand Down
3 changes: 1 addition & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ def syntax(content, pattern)

def fold_and_replace(content, fold_on_line)
with_file content do
cmd = ":set foldmethod=syntax<CR>"
cmd += "zO"
cmd = "zO"
cmd += "#{fold_on_line}G"
cmd += "zc"
cmd += "cc#{FOLD_PLACEHOLDER}<Esc>"
Expand Down
5 changes: 5 additions & 0 deletions syntax/elixir.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ endif
let s:cpo_save = &cpo
set cpo&vim

" Default to enable folding; allow users to explicitly opt out
if has("folding") && !(exists("g:elixir_fold") && !g:elixir_fold)
setlocal foldmethod=syntax
endif

syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@elixirDeclaration,elixirTodo,elixirArguments,elixirBlockDefinition,elixirUnusedVariable,elixirStructDelimiter,elixirListDelimiter
syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation
syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass
Expand Down

0 comments on commit 5a1811c

Please sign in to comment.