@@ -6,112 +6,3 @@ let s:path = fnamemodify(resolve(expand('<sfile>:p')), ':h:h')
66let s: bundle_path = s: path ." /bundle"
77
88
9- " " for now load by placing this in .vimrc
10- " " find a way to do it from inside module while being loaded
11- " " runtime bundle/vim-pathogen/autoload/pathogen.vim
12- " " execute pathogen#infect("bundle/{}", "bundle/vim-ide-elixir/bundle/{}")
13- "
14- " "let s:modules = ["vim-desert-programming", "vim-elixir"]
15- "
16- " " we have pathogen as plugin manager
17- " "if exists("g:loaded_pathogen")
18- " " execute pathogen#infect(s:bundle_path."/{}")
19- " " "runtime(s:bundle_path."/vim-desert-programming")
20- " "endif
21- "
22- "
23- " function! Tag_transform(tags)
24- " " remove OTP callbacks from ordinary function list
25- " call filter(a:tags, ' !(v:val.fields.kind == "f" && v:val.name =~ "\\v(handle_call|handle_info|handle_cast|init|terminate)") ')
26- "
27- " function! Arity_extract(idx, tag)
28- " if a:tag.fields.kind == 'f' || a:tag.fields.kind == 'g'
29- " let args_string = substitute(a:tag.pattern, "^.*defp\\?[ \t]*".a:tag.name."[ \t]*", "", "")
30- " let args_string = substitute(args_string, "do[ \t]*\\\\[$]$", "", "") " multiline
31- " " TODO: remove
32- " " if a:tag.pattern =~ "defp reply"
33- " " debug echo("asd")
34- " " endif
35- " let args_string = substitute(args_string, ")\\([ \t]*when.*\\)\\?,[ \t]*do.*\\\\[$]$", ")", "")
36- " let args_string = substitute(args_string, "[ \t]*", "", "g")
37- "
38- " let args_len = len(args_string)
39- "
40- " if args_len == 0
41- " let a:tag.name = a:tag.name."/0"
42- " else
43- " let old_args_len = -10000
44- " while args_len != old_args_len
45- " let args_string = substitute(args_string, "{[^}]*}", "", "g")
46- " let args_string = substitute(args_string, "\\[[^]]*\\]", "", "g")
47- " let old_args_len = args_len
48- " let args_len = len(args_string)
49- " endwhile
50- "
51- " let comma_count = len(substitute(args_string, "[^,]", "", "g"))
52- " let a:tag.name = a:tag.name . "/" . (comma_count + 1)
53- " endif
54- "
55- " return a:tag
56- " else
57- " return a:tag
58- " endif
59- " endfunction
60- "
61- " " replaces function names with function_name/arity notation
62- " call map(a:tags, function('Arity_extract'))
63- "
64- " let seen_list = map(copy(a:tags), '[v:val.fields.kind, v:val.name, v:val.fields.line]')
65- "
66- " let seen_fnames = {}
67- " for [kind, fname, line] in seen_list
68- " if ! has_key(seen_fnames, kind.fname)
69- " let seen_fnames[kind.fname] = line
70- " endif
71- " endfor
72- "
73- " " leaves only first definition of function with same arity
74- " function! Filter_fun(seen_hash, idx, tag)
75- " let key = a:tag.fields.kind . a:tag.name
76- " let line = a:tag.fields.line
77- "
78- " return a:seen_hash[key] == line
79- " endfunction
80- "
81- " call filter(a:tags, function('Filter_fun', [seen_fnames]))
82- "
83- " return a:tags
84- " endfunction
85- "
86- " let g:tagbar_type_elixir = {
87- " \ 'ctagstype' : 'elixir',
88- " \ 'deffile' : s:path . '/extras/elixir-ctags/.ctags',
89- " \ 'transform': function("Tag_transform"),
90- " \ 'kinds' : [
91- " \ 'm:modules:1',
92- " \ 'O:OTP callbacks',
93- " \ 't:tests',
94- " \ 'f:functions (public)',
95- " \ 'g:functions (private)',
96- " \ 'c:callbacks',
97- " \ 'd:delegates',
98- " \ 'e:exceptions',
99- " \ 'i:implementations',
100- " \ 'a:macros',
101- " \ 'o:operators',
102- " \ 's:structs',
103- " \ 'p:protocols',
104- " \ 'r:records',
105- " \ 'T:types',
106- " \ 'z:foo'
107- " \ ]
108- " \ }
109- "
110- " set updatetime=500
111- "
112- " " keyboard shortcuts
113- " nmap <F4> :TagbarToggle<CR>
114- " nmap <C-@> :CtrlPTagbar<CR>
115- " nmap <Leader>l :CtrlPLine<CR>
116-
117-
0 commit comments