FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Surprising 'path' handling in $VIMRUNTIME/ftplugin/ruby.vim · Issue #9133 · vim/vim · GitHub

/ vim Public

Surprising 'path' handling in $VIMRUNTIME/ftplugin/ruby.vim #9133

Description

Steps to reproduce

Default behaviour (no filetype detection)

The default value of 'path' includes . and ,,, which allow us to find files in the directory of the current file and the working directory. This makes it possible to use gf and other commands that depend on 'path' for project-wide navigation out of the box.

  1. Create a test directory: $ mkdir testrubypath.

  2. Change to that directory: $ cd $_.

  3. Create two Ruby files: $ touch a.rb b.rb.

  4. Open a.rb in a barebones Vim: $ vim -u NONE a.rb.

  5. Check the global value of 'path' with :set path?. The output should be .,/usr/include,,.

  6. Add the line below to the buffer and write it:

    require 'b.rb'
    
  7. Press gf on the filename. You should jump to b.rb.

Current behaviour (uses $VIMRUNTIME/ftplugin/ruby.vim)

The Ruby ftplugin overrides the default 'path' value in a way that makes it impossible to use gf and other commands that depend on 'path' for project-wide navigation.

  1. In the same directory as above, start a clean Vim: $ vim --clean.

  2. Check the global value of 'path' with :set path?. The output should be .,/usr/include,,.

  3. Open a.rb: :edit a.rb.

  4. Check the local value of 'path' with :setlocal path?. The output should be a comma-separated list of Ruby-specific directories. Something like this (YMMV):

    path=/Library/Ruby/Site/2.3.0,/Library/Ruby/Site/2.3.0/x86_64-darwin18,/Library/Ruby/Site/2.3.0/universal-darwin18,/Library/Ruby/Site,/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0,[...]
    

    Note that the default value as disappeared, as well as the possibility to find files in the directory of the current file and the working directory.

  5. Press gf on the filename. You should get an E345 error.

Expected behaviour

  1. In the same directory as above, start a clean Vim: $ vim --clean.

  2. Check the global value of 'path' with :set path?. The output should be .,/usr/include,,.

  3. Open a.rb: :edit a.rb.

  4. Check the local value of 'path' with :setlocal path?. The output should have a comma-separated list of Ruby-specific directories appended to the default value. Something like this (YMMV):

    path=.,/usr/include,,/Library/Ruby/Site/2.3.0,/Library/Ruby/Site/2.3.0/x86_64-darwin18,/Library/Ruby/Site/2.3.0/universal-darwin18,/Library/Ruby/Site,/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0,[...]
    
  5. Press gf on the filename. You should jump to b.rb.

Operating system

Unix-like system

Version of Vim

8.2.3455

Logs and stack traces

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL