File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,27 @@ Or within Vim by executing the following command:
6262Note that for the latter command, the current working directory will be used
6363(` :help pwd ` to find out more).
6464
65+ ### Generate OTP tags
66+
67+ Often, you might be curious about the implementation of that function from the
68+ OTP libraries, but ` CTRL-t ` is not taking you there. We have a solution for
69+ this:
70+
71+ call AsyncBuildOtpTags()
72+
73+ This command will find the path to your otp installation, and inside its ` lib/ `
74+ folder, it will build a tags file called ` otptags ` . The next thing you need, is
75+ to make vim aware of this. That's where the next function comes in place:
76+
77+ call GetOtpTagsPath()
78+
79+ This will return the path to the generated ` otptags ` file, wherever this file
80+ lives. Extract it, and add it to your tags by doing
81+
82+ let &tags.="," . otptags_path
83+
84+ Where otptags\_ path is the expanded path returned previously.
85+
6586### Options
6687
6788#### ` g:erlang_tags_ignore `
Original file line number Diff line number Diff line change 2222autocmd FileType erlang call VimErlangTagsDefineMappings ()
2323
2424let s: exec_script = expand (' <sfile>:p:h' ) . " /../bin/vim_erlang_tags.erl"
25+ let s: otppath_cmd = ' erl -noinput -eval '' io:format("~ts", [code:lib_dir()]), init:stop().'' '
2526
2627function ! s: GetExecuteCmd ()
2728 let script_opts = " "
@@ -42,6 +43,17 @@ function! s:GetExecuteCmd()
4243 return s: exec_script . script_opts
4344endfunction
4445
46+ function ! GetOtpTagsPath ()
47+ let otppath = system (s: otppath_cmd )
48+ let otptags = otppath . " /otptags"
49+ return otptags
50+ endfunction
51+
52+ function ! AsyncBuildOtpTags ()
53+ let cmd = ' (OTPPATH=`' . s: otppath_cmd . ' ` && ' . s: exec_script . ' -i $OTPPATH -o $OTPPATH/otptags)'
54+ call system (cmd . " &" )
55+ endfunction
56+
4557function ! VimErlangTags (... )
4658 let param = join (a: 000 , " " )
4759 let exec_cmd = s: GetExecuteCmd ()
@@ -104,7 +116,7 @@ if !exists("s:os")
104116endif
105117
106118" https://vim.fandom.com/wiki/Autocmd_to_update_ctags_file
107- function ! DelTagOfFile (file )
119+ function ! s: DelTagOfFile (file )
108120 let fullpath = a: file
109121 let cwd = getcwd ()
110122 let tagfilename = cwd . " /tags"
You can’t perform that action at this time.
0 commit comments