diff --git a/ftplugin/elm/sections.vim b/ftplugin/elm/sections.vim new file mode 100644 index 0000000..419fdee --- /dev/null +++ b/ftplugin/elm/sections.vim @@ -0,0 +1,30 @@ +" http://learnvimscriptthehardway.stevelosh.com/chapters/51.html + + +function! s:NextSection(type, backwards) + if a:type == 1 + let pattern = '\v^((port )\?module|type alias Model|type Msg|update :|view :|main :)' + elseif a:type == 2 + let pattern = '\v\n\n^\S' + endif + + if a:backwards + let dir = '?' + else + let dir = '/' + endif + + execute 'silent normal! ' . dir . pattern . "\r" +endfunction + +noremap