Skip to content

Conversation

@NelsonVides
Copy link
Contributor

@NelsonVides NelsonVides commented Oct 22, 2019

This is very useful in case you like having tags to OTP libs at hand, in many projects, and building tags for each project with the otp tags seems redundant. Like this, you can have one global otptags for all your projects.

@NelsonVides
Copy link
Contributor Author

@hcs42 What do you think of this functionality? I have a very similar thing on my .vimrc at the moment, only that I'm extracting the path with asdf where erlang, which is faster, but anyway I felt like generating the otp tags for every project I run was just very very redundant. Any idea on how to improve the user experience for this functionality or you like it like that?

folder, it will build a tags file called `otptags`. The next thing you need, is
to make vim aware of this. That's where the next function comes in place:

call GetOtpTagsPath()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use echo instead of call? call won't print anything.

endfunction

function! AsyncBuildOtpTags()
let cmd = '(OTPPATH=`' . s:otppath_cmd . '` && ' . s:exec_script . ' -i $OTPPATH -o $OTPPATH/otptags)'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vim cannot necessarily write "$OTPPATH/otptags". For me erl -noinput -eval 'io:format("~ts", [code:lib_dir()]), init:stop().' returns /usr/lib/erlang/lib, which causes AsyncBuildOtpTags to silently fail.

Three suggestions:

  • Some error handling to report this situation.
  • Maybe use the ":terminal" command instead of system + &? (It was added in Vim 8.1.)
  • Maybe make it configurable to put the tags file somewhere else.

@hcs42
Copy link
Member

hcs42 commented Oct 25, 2019

Any idea on how to improve the user experience for this functionality or you like it like that?

I posted my ideas in the review.

I also generate a separate tagfile for OTP tags, so I understand the motivation. On the other hand, I generate my tags from bash (calling vim_erlang_tags.erl of course), so I'm not sure if I can judge which Vim commands are wanted by the users for generating tags. Feel free to come up with your own vision regarding that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants