@@ -50,25 +50,29 @@ endfunction
5050
5151command ! ErlangTags call VimErlangTags ()
5252
53- function ! VimErlangTagsSelect (split )
54- if a: split
55- split
56- endif
53+ " Execute the given tag lookup for current word, where 'iskeyword' is
54+ " temporarily set such that modules, records, and macros are included.
55+ function ! s: GoToErlangTag (cmd)
5756 let orig_isk = &isk
58- set isk += :
59- normal " _vawo
60- if getline (' .' )[col (' .' ) - 2 ] = ~# ' [#?]'
61- normal h
62- endif
57+ set isk += :,#,?
58+ let ident = expand (' <cword>' )
6359 let &isk = orig_isk
60+
61+ execute a: cmd ident
6462endfunction
6563
6664function ! VimErlangTagsDefineMappings ()
67- nnoremap <buffer> <c-]> :call VimErlangTagsSelect(0)<cr><c-]>
68- nnoremap <buffer> g<LeftMouse> :call VimErlangTagsSelect(0)<cr><c-]>
69- nnoremap <buffer> <c-LeftMouse> :call VimErlangTagsSelect(0)<cr><c-]>
70- nnoremap <buffer> g] :call VimErlangTagsSelect(0)<cr> g]
71- nnoremap <buffer> g<c-]> :call VimErlangTagsSelect(0)<cr> g<c-]>
72- nnoremap <buffer> <c-w><c-]> :call VimErlangTagsSelect(1)<cr><c-]>
73- nnoremap <buffer> <c-w> ] :call VimErlangTagsSelect(1)<cr><c-]>
65+ nnoremap <buffer> <c-]> :<C-U> call <SID> GoToErlangTag('tag')<cr>
66+ nnoremap <buffer> g<LeftMouse> :<C-U> call <SID> GoToErlangTag('tag')<cr>
67+ nnoremap <buffer> <c-LeftMouse> :<C-U> call <SID> GoToErlangTag('tag')<cr>
68+ nnoremap <buffer> g] :<C-U> call <SID> GoToErlangTag('tselect')<cr>
69+ nnoremap <buffer> g<c-]> :<C-U> call <SID> GoToErlangTag('tjump')<cr>
70+ nnoremap <buffer> <c-w><c-]> :<C-U> call <SID> GoToErlangTag('stag')<cr>
71+ nnoremap <buffer> <c-w> ] :<C-U> call <SID> GoToErlangTag('stag')<cr>
72+ nnoremap <buffer> <c-w> g] :<C-U> call <SID> GoToErlangTag('stselect')<cr>
73+ nnoremap <buffer> <c-w> g<c-]> :<C-U> call <SID> GoToErlangTag('stjump')<cr>
74+ nnoremap <buffer> <c-w> } :<C-U> call <SID> GoToErlangTag('ptag')<cr>
75+ nnoremap <buffer> <c-w> g} :<C-U> call <SID> GoToErlangTag('ptjump')<cr>
7476endfunction
77+
78+ " vim:set expandtab sw = 4 ts = 4 :
0 commit comments