Skip to content
Open
Show file tree
Hide file tree
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: 11 additions & 0 deletions ftplugin/elm/ctags/elm.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--langdef=Elm
--langmap=Elm:.elm
--regex-Elm=/^ *([a-z][a-zA-Z0-9_-]+)[ \t ]*:[^:].*->(.*)/\1/f,function,functions type declarations,S:String s/
--regex-Elm=/^ *([a-z][a-zA-Z0-9_-]+)[ \t ]*:([^:][^-]+)$/\1/c,constant,constants/
--regex-Elm=/^port *([a-z][a-zA-Z0-9_-]+)[ \t ]*:[^:]/\1/p,port,ports/
--regex-Elm=/^type *([A-Z][a-zA-Z0-9_-]*)/\1/t,type/
--regex-Elm=/^type alias *([A-Z][a-zA-Z0-9_-]*)/\1/t,type,Declared types/
--regex-Elm=/[ \r\n\t][\|=][ \r\n\t]*([A-Z][a-zA-Z0-9_-]*)(.*)/\1/C,constructor,constructors created by types/
--regex-Elm=/^module *([A-Z][.a-zA-Z0-9_-]*)/\1/m,module,module definitions/
--regex-Elm=/^import *([A-Z][.a-zA-Z0-9_-]*)(.*as *([A-Z][.a-zA-Z0-9_-]*))?.*(\(.*\))*/\1 (\2)/i,import,imported modules/

23 changes: 23 additions & 0 deletions ftplugin/elm/tagbar.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,34 @@ elseif globpath(&rtp, 'plugin/tagbar.vim') == ""
finish
endif

if !exists("g:elm_ctags_config")
let g:elm_ctags_config = expand('<sfile>:p:h:h') . '/elm/ctags/elm.cnf'
endif

if !exists("g:elm_ctags_target_dirs")
let g:elm_ctags_target_dirs = './elm-stuff ./src'
endif

if !exists("g:elm_ctags_exe")
let g:elm_ctags_exe = 'ctags-exuberant'
endif

function! GenerateElmTags()
exec system(g:elm_ctags_exe . ' -R --fields=+l --options=' . g:elm_ctags_config . ' ' . g:elm_ctags_target_dirs)
endfunction
command! ElmGenerateTags call GenerateElmTags()

let g:Plugin_install_dir = expand('<sfile>:p:h:h')
function! s:SetTagbar()
if !exists("g:tagbar_type_elm")
let g:tagbar_type_elm = {
\ 'ctagstype' : 'elm',
\ 'deffile' : g:elm_ctags_config,
\ 'kinds' : [
\ 'm:module',
\ 'i:imports',
\ 't:types',
\ 'C:constructors',
\ 'c:constants',
\ 'f:functions',
\ 'p:ports'
Expand Down