Skip to content

Commit e9f568c

Browse files
committed
Merge pull request #15 from hcs42/records
(#14) Jump to record/marco after '#' or '?'
2 parents 315bf2a + 0551a69 commit e9f568c

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

bin/vim-erlang-tags.erl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,14 @@ add_func_tags(Tags, File, ModName, FuncName) ->
317317
% File contains a macro or record called Name; add this information to Tags.
318318
add_record_or_macro_tag(Tags, File, Attribute, Name) ->
319319

320-
Kind =
320+
{Kind, Prefix} =
321321
case Attribute of
322322
<<"record">> ->
323323
log("Record found: ~s~n", [Name]),
324-
$r;
324+
{$r, $#};
325325
<<"define">> ->
326326
log("Macro found: ~s~n", [Name]),
327-
$d
327+
{$d, $?}
328328
end,
329329

330330
Scope =
@@ -337,9 +337,17 @@ add_record_or_macro_tag(Tags, File, Attribute, Name) ->
337337

338338
% myrec ./mymod.erl /^-record\.\*\<myrec\>/;" r file:
339339
% myrec ./myhrl.hrl /^-record\.\*\<myrec\>/;" r
340-
% myrec ./mymod.erl /^-define\.\*\<mymac\>/;" m file:
341-
% myrec ./myhrl.hrl /^-define\.\*\<mymac\>/;" m
340+
% mymac ./mymod.erl /^-define\.\*\<mymac\>/;" m file:
341+
% mymac ./myhrl.hrl /^-define\.\*\<mymac\>/;" m
342342
add_tag(Tags, Name, File,
343+
["/^-\\s\\*", Attribute, "\\s\\*(\\s\\*", Name, "\\>/"],
344+
Scope, Kind),
345+
346+
% #myrec ./mymod.erl /^-record\.\*\<myrec\>/;" r file:
347+
% #myrec ./myhrl.hrl /^-record\.\*\<myrec\>/;" r
348+
% ?mymac ./mymod.erl /^-define\.\*\<mymac\>/;" m file:
349+
% ?mymac ./myhrl.hrl /^-define\.\*\<mymac\>/;" m
350+
add_tag(Tags, [Prefix|Name], File,
343351
["/^-\\s\\*", Attribute, "\\s\\*(\\s\\*", Name, "\\>/"],
344352
Scope, Kind).
345353

plugin/vim-erlang-tags.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ command! ErlangTags call VimErlangTags()
4343
function! VimErlangTagsSelect()
4444
let orig_isk = &isk
4545
set isk+=:
46-
normal "_vaw
46+
normal "_vawo
47+
if getline('.')[col('.') - 2] =~# '[#?]'
48+
normal h
49+
endif
4750
let &isk = orig_isk
4851
endfunction
4952

0 commit comments

Comments
 (0)