File tree 2 files changed +34
-1
lines changed
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:
62
62
Note that for the latter command, the current working directory will be used
63
63
(` :help pwd ` to find out more).
64
64
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
+
65
86
### Options
66
87
67
88
#### ` g:erlang_tags_ignore `
Original file line number Diff line number Diff line change 22
22
autocmd FileType erlang call VimErlangTagsDefineMappings ()
23
23
24
24
let 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().'' '
25
26
26
27
function ! s: GetExecuteCmd ()
27
28
let script_opts = " "
@@ -42,6 +43,17 @@ function! s:GetExecuteCmd()
42
43
return s: exec_script . script_opts
43
44
endfunction
44
45
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
+
45
57
function ! VimErlangTags (... )
46
58
let param = join (a: 000 , " " )
47
59
let exec_cmd = s: GetExecuteCmd ()
@@ -104,7 +116,7 @@ if !exists("s:os")
104
116
endif
105
117
106
118
" https://vim.fandom.com/wiki/Autocmd_to_update_ctags_file
107
- function ! DelTagOfFile (file )
119
+ function ! s: DelTagOfFile (file )
108
120
let fullpath = a: file
109
121
let cwd = getcwd ()
110
122
let tagfilename = cwd . " /tags"
You can’t perform that action at this time.
0 commit comments