vim-tags 0.1.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/plugin/vim-tags.vim +25 -0
- data/plugins.rb +44 -15
- data/vim-tags.gemspec +3 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54f07d46762d5b46e167a109c7db802774447fbd29ceb7647688b66318ab0555
|
4
|
+
data.tar.gz: bc1a66bf2898f280248e1201504b0081ba9b7be71929d9150aadc941fe714a23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adeed160156225ac249e50e37846ebb0fdfd54d78704fa866ac883784ea7f4146504535ae3cff08d4ab642d6d3dadb6409818400bf746444ba9cd2bb4863271b
|
7
|
+
data.tar.gz: 53725474a7183209df6ce8ccb0f4ecb7d5ba84bbe052e86cbb38f904478c057718055e08c85bab5238aa02b9eb42d448f6795feb280aaea5c84c866117291d34
|
data/plugin/vim-tags.vim
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
function! LoadRubyTags()
|
2
|
+
let l:project_directory = finddir('.git/..', expand('%:p:h').';')
|
3
|
+
|
4
|
+
if !empty(l:project_directory)
|
5
|
+
let l:gem_tag_files_path = l:project_directory . '/.bundle/.gem_tag_files'
|
6
|
+
|
7
|
+
if !filereadable(l:gem_tag_files_path)
|
8
|
+
let l:install_response = system('bundler plugin install vim-tags')
|
9
|
+
let l:command_response = system('bundler vim-tags')
|
10
|
+
endif
|
11
|
+
|
12
|
+
let l:gems = json_decode(readfile(l:gem_tag_files_path))
|
13
|
+
let l:ruby = json_decode(readfile(l:project_directory . '/.bundle/.ruby_tag_files'))
|
14
|
+
|
15
|
+
let &l:tags = &tags . ',' . l:gems['tags'] . ',' . l:ruby['tags']
|
16
|
+
let &l:path = &path . ',' . l:gems['paths'] . ',' . l:ruby['paths']
|
17
|
+
endif
|
18
|
+
endfunction
|
19
|
+
|
20
|
+
augroup rubypath
|
21
|
+
autocmd!
|
22
|
+
autocmd FileType ruby setlocal suffixesadd+=.rb
|
23
|
+
|
24
|
+
autocmd FileType ruby :call LoadRubyTags()
|
25
|
+
augroup END
|
data/plugins.rb
CHANGED
@@ -1,35 +1,64 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler"
|
4
|
+
require "json"
|
4
5
|
|
5
6
|
class VimTagsCommand < Bundler::Plugin::API
|
6
7
|
command "vim-tags"
|
7
8
|
|
8
9
|
def exec(*)
|
9
|
-
|
10
|
+
write_gem_file
|
11
|
+
write_ruby_file
|
12
|
+
end
|
10
13
|
|
11
|
-
|
14
|
+
private
|
12
15
|
|
13
|
-
|
14
|
-
|
16
|
+
def write_gem_file
|
17
|
+
write_to_file(
|
18
|
+
File.join(Bundler.app_config_path, ".gem_tag_files"),
|
19
|
+
"\nWriting gem file tag cache",
|
20
|
+
{ tags: gem_tags, paths: gem_paths }
|
21
|
+
)
|
22
|
+
end
|
15
23
|
|
16
|
-
|
17
|
-
|
24
|
+
def write_ruby_file
|
25
|
+
write_to_file(
|
26
|
+
File.join(Bundler.app_config_path, ".ruby_tag_files"),
|
27
|
+
"Writing ruby tag cache to",
|
28
|
+
{ tags: ruby_tags, paths: $:.join(",") }
|
29
|
+
)
|
18
30
|
end
|
19
31
|
|
20
|
-
def
|
21
|
-
|
22
|
-
|
32
|
+
def ruby_tags
|
33
|
+
$:.select { |path| File.exist?(File.join(path, "tags")) }.join(",")
|
34
|
+
end
|
23
35
|
|
24
|
-
|
36
|
+
def gem_tags
|
37
|
+
gem_specs.filter_map do |spec|
|
38
|
+
tag_path = File.join(spec.full_gem_path, "tags")
|
25
39
|
|
26
|
-
|
27
|
-
|
40
|
+
next unless File.exist?(tag_path)
|
41
|
+
|
42
|
+
tag_path
|
43
|
+
end.sort.join(",")
|
28
44
|
end
|
29
45
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
46
|
+
def gem_paths
|
47
|
+
gem_specs.map(&:full_gem_path).sort.join(",")
|
48
|
+
end
|
49
|
+
|
50
|
+
def gem_specs
|
51
|
+
@gem_specs ||= Bundler.load.specs
|
52
|
+
end
|
53
|
+
|
54
|
+
def write_to_file(file_path, description, payload)
|
55
|
+
puts "#{description} to #{file_path}"
|
56
|
+
|
57
|
+
File.open(file_path, "w") do |f|
|
58
|
+
f.truncate(0)
|
59
|
+
|
60
|
+
f.write payload.to_json
|
61
|
+
end
|
33
62
|
end
|
34
63
|
end
|
35
64
|
|
data/vim-tags.gemspec
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "vim-tags"
|
5
|
-
spec.version = "0.1
|
5
|
+
spec.version = "0.4.1"
|
6
6
|
spec.authors = ["Nick Pezza"]
|
7
7
|
spec.email = ["pezza@hey.com"]
|
8
8
|
|
9
|
-
spec.summary =
|
9
|
+
spec.summary =
|
10
|
+
"Generate cache file of all paths to tags files of dependencies"
|
10
11
|
spec.license = "MIT"
|
11
12
|
spec.required_ruby_version = ">= 2.7.0"
|
12
13
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vim-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Pezza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debug
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- ".rubocop.yml"
|
35
35
|
- Gemfile
|
36
36
|
- Rakefile
|
37
|
+
- plugin/vim-tags.vim
|
37
38
|
- plugins.rb
|
38
39
|
- vim-tags.gemspec
|
39
40
|
homepage:
|