vim-tags 0.2.0 → 0.3.0
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 +16 -11
 - data/plugins.rb +43 -12
 - data/vim-tags.gemspec +3 -2
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 4bc33aff0be21dfcf28ac60662708d2c0a7605bd3afe07d111006058ea3414f2
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8402bf3eaa4791579010a70cb5ced680114a0b32d3f36535fbfde52189eeec10
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e4421652fb5563fe9ea28742d5db907477379f52be922b0fb040a7b128b1e808adbeb657743ca6cc0102b9c11b73e96ded702c7dcb1a90b7d4dade8f54d7e68d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f04f668af0c693c8c6d4e4aebd0acf88e65c6921d1349d98a871689cb0476ca96f090cf7feaa511b10592121423e9f234122975ae935310164a6a9ceaa109c08
         
     | 
    
        data/plugin/vim-tags.vim
    CHANGED
    
    | 
         @@ -1,19 +1,24 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            function! LoadRubyTags()
         
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
       3 
     | 
    
         
            -
                return
         
     | 
| 
       4 
     | 
    
         
            -
              endif
         
     | 
| 
      
 2 
     | 
    
         
            +
              let l:load_ruby_tags_dir = finddir('.git/..', expand('%:p:h').';')
         
     | 
| 
       5 
3 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
               
     | 
| 
      
 4 
     | 
    
         
            +
              if !empty(l:load_ruby_tags_dir)
         
     | 
| 
      
 5 
     | 
    
         
            +
                let l:load_ruby_tags_gem_tags_path = l:load_ruby_tags_dir . '/.bundle/.gem_tag_files'
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
                if !filereadable(l:load_ruby_tags_gem_tags_path)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  let l:install_response = system('bundler plugin install vim-tags')
         
     | 
| 
      
 9 
     | 
    
         
            +
                  let l:command_response = system('bundler vim-tags')
         
     | 
| 
      
 10 
     | 
    
         
            +
                endif
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
                let g:gem_files = json_decode(readfile(l:load_ruby_tags_gem_tags_path))
         
     | 
| 
      
 13 
     | 
    
         
            +
                let l:gem_comma_tags = join(values(g:gem_files), "/tags,") . '/tags'
         
     | 
| 
      
 14 
     | 
    
         
            +
                let l:ruby_comma_tags = join(readfile(l:load_ruby_tags_dir . '/.bundle/.ruby_tag_files'), "/tags,") . '/tags'
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
                setlocal includeexpr=get(g:gem_files,v:fname,v:fname)
         
     | 
| 
      
 17 
     | 
    
         
            +
                setlocal suffixesadd=/
         
     | 
| 
      
 18 
     | 
    
         
            +
                cnoremap <buffer><expr> <Plug><cfile> get(g:gem_files,expand("<cfile>"),"\022\006")
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                let &l:tags = &tags . ',' . l:gem_comma_tags . ',' . l:ruby_comma_tags
         
     | 
| 
      
 21 
     | 
    
         
            +
              endif
         
     | 
| 
       17 
22 
     | 
    
         
             
            endfunction
         
     | 
| 
       18 
23 
     | 
    
         | 
| 
       19 
24 
     | 
    
         
             
            autocmd FileType ruby :call LoadRubyTags()
         
     | 
    
        data/plugins.rb
    CHANGED
    
    | 
         @@ -1,33 +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
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 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: $: }
         
     | 
| 
      
 29 
     | 
    
         
            +
                )
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              def ruby_tags
         
     | 
| 
      
 33 
     | 
    
         
            +
                $:.select { |path| File.exist?(File.join(path, "tags")) }
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              def gem_tags
         
     | 
| 
      
 37 
     | 
    
         
            +
                gem_specs.filter_map do |spec|
         
     | 
| 
      
 38 
     | 
    
         
            +
                  tag_path = File.join(spec.full_gem_path, "tags")
         
     | 
| 
       15 
39 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                   
     | 
| 
      
 40 
     | 
    
         
            +
                  next unless File.exist?(tag_path)
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  tag_path
         
     | 
| 
       17 
43 
     | 
    
         
             
                end
         
     | 
| 
       18 
44 
     | 
    
         
             
              end
         
     | 
| 
       19 
45 
     | 
    
         | 
| 
       20 
46 
     | 
    
         
             
              def gem_paths
         
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                    !File.exist?(File.join(spec.full_gem_path, "tags"))
         
     | 
| 
      
 47 
     | 
    
         
            +
                gem_specs.to_h { |spec| [spec.name, spec.full_gem_path] }
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
       24 
49 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
      
 50 
     | 
    
         
            +
              def gem_specs
         
     | 
| 
      
 51 
     | 
    
         
            +
                @gem_specs ||= Bundler.load.specs
         
     | 
| 
       27 
52 
     | 
    
         
             
              end
         
     | 
| 
       28 
53 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
              def  
     | 
| 
       30 
     | 
    
         
            -
                 
     | 
| 
      
 54 
     | 
    
         
            +
              def write_to_file(file_path, description, payload)
         
     | 
| 
      
 55 
     | 
    
         
            +
                puts "#{description} to #{cache_file}"
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                File.open(file_path, "w") do |f|
         
     | 
| 
      
 58 
     | 
    
         
            +
                  f.truncate(0)
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  f.write payload.to_json
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
       31 
62 
     | 
    
         
             
              end
         
     | 
| 
       32 
63 
     | 
    
         
             
            end
         
     | 
| 
       33 
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. 
     | 
| 
      
 5 
     | 
    
         
            +
              spec.version = "0.3.0"
         
     | 
| 
       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 
     | 
    
         |