@@ -50,25 +50,27 @@ endfunction
50
50
51
51
command ! ErlangTags call VimErlangTags ()
52
52
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)
57
56
let orig_isk = &isk
58
- set isk += :
59
- normal " _vawo
60
- if getline (' .' )[col (' .' ) - 2 ] = ~# ' [#?]'
61
- normal h
62
- endif
57
+ set isk += :,#,?
58
+ execute a: cmd expand (' <cword>' )
63
59
let &isk = orig_isk
64
60
endfunction
65
61
66
62
function ! 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-]>
63
+ nnoremap <buffer> <c-]> :<C-U> call <SID> GoToErlangTag('tag')<cr>
64
+ nnoremap <buffer> g<LeftMouse> :<C-U> call <SID> GoToErlangTag('tag')<cr>
65
+ nnoremap <buffer> <c-LeftMouse> :<C-U> call <SID> GoToErlangTag('tag')<cr>
66
+ nnoremap <buffer> g] :<C-U> call <SID> GoToErlangTag('tselect')<cr>
67
+ nnoremap <buffer> g<c-]> :<C-U> call <SID> GoToErlangTag('tjump')<cr>
68
+ nnoremap <buffer> <c-w><c-]> :<C-U> call <SID> GoToErlangTag('stag')<cr>
69
+ nnoremap <buffer> <c-w> ] :<C-U> call <SID> GoToErlangTag('stag')<cr>
70
+ nnoremap <buffer> <c-w> g] :<C-U> call <SID> GoToErlangTag('stselect')<cr>
71
+ nnoremap <buffer> <c-w> g<c-]> :<C-U> call <SID> GoToErlangTag('stjump')<cr>
72
+ nnoremap <buffer> <c-w> } :<C-U> call <SID> GoToErlangTag('ptag')<cr>
73
+ nnoremap <buffer> <c-w> g} :<C-U> call <SID> GoToErlangTag('ptjump')<cr>
74
74
endfunction
75
+
76
+ " vim:set expandtab sw = 4 ts = 4 :
0 commit comments