Skip to content
Merged
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
18 changes: 13 additions & 5 deletions bin/vim-erlang-tags.erl
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,14 @@ add_func_tags(Tags, File, ModName, FuncName) ->
% File contains a macro or record called Name; add this information to Tags.
add_record_or_macro_tag(Tags, File, Attribute, Name) ->

Kind =
{Kind, Prefix} =
case Attribute of
<<"record">> ->
log("Record found: ~s~n", [Name]),
$r;
{$r, $#};
<<"define">> ->
log("Macro found: ~s~n", [Name]),
$d
{$d, $?}
end,

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

% myrec ./mymod.erl /^-record\.\*\<myrec\>/;" r file:
% myrec ./myhrl.hrl /^-record\.\*\<myrec\>/;" r
% myrec ./mymod.erl /^-define\.\*\<mymac\>/;" m file:
% myrec ./myhrl.hrl /^-define\.\*\<mymac\>/;" m
% mymac ./mymod.erl /^-define\.\*\<mymac\>/;" m file:
% mymac ./myhrl.hrl /^-define\.\*\<mymac\>/;" m
add_tag(Tags, Name, File,
["/^-\\s\\*", Attribute, "\\s\\*(\\s\\*", Name, "\\>/"],
Scope, Kind),

% #myrec ./mymod.erl /^-record\.\*\<myrec\>/;" r file:
% #myrec ./myhrl.hrl /^-record\.\*\<myrec\>/;" r
% ?mymac ./mymod.erl /^-define\.\*\<mymac\>/;" m file:
% ?mymac ./myhrl.hrl /^-define\.\*\<mymac\>/;" m
add_tag(Tags, [Prefix|Name], File,
["/^-\\s\\*", Attribute, "\\s\\*(\\s\\*", Name, "\\>/"],
Scope, Kind).

Expand Down
5 changes: 4 additions & 1 deletion plugin/vim-erlang-tags.vim
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ command! ErlangTags call VimErlangTags()
function! VimErlangTagsSelect()
let orig_isk = &isk
set isk+=:
normal "_vaw
normal "_vawo
if getline('.')[col('.') - 2] =~# '[#?]'
normal h
endif
let &isk = orig_isk
endfunction

Expand Down