6

Notes:

  • I have set path=$PWD/** in my .vimrc
  • I am using Vim 7.3

Often times, I am sitting with Vim open at the root of my project and I enter :find somef<Tab> to find and open a file at an arbitrary depth. This always works when I am sitting at the project root with no file open.

When I have a file open, however, I can't just type :find anotherfi<Tab> to get a list of possible options - Vim gives me a quick :find anotherfi... and then leaves me with :find anotherfi.

How can I make tab completion with :find work with my path when I am visiting any file as it does when I am sitting at the root with nothing open?

  • Perhaps version specific. Works fine on 7.4.617, with vim -u NONE, and after :set wc=<Tab>, :set path=$PWD/**. – muru Feb 12 '15 at 21:12
  • I will check, I also just noticed that the path is changing when I visit a file.. Is there a way to keep the path at what I was when I opened vim? – user489 Feb 12 '15 at 21:13
  • 1
    Perhaps a plugin? My path remains the same. – muru Feb 12 '15 at 21:16
  • It's definitely vim-classpath.. Will confirm. – user489 Feb 12 '15 at 21:16
  • 2
    You don't need $PWD/**, ** is enough. Also, .,** is more useful because it lets you find files in the directory of the current file even if it is not under the working directory. – romainl Feb 13 '15 at 9:15
3

The issue is caused by a changing path due to Tim Pope's vim-classpath plugin. To fix the issue, simply remove that plugin.

To confirm this, either run vim with vim -u NONE and manually run :set path=$PWD/** to test, or temporarily remove the plugin.

If you require the plugin this may not be a viable option.

  • The help text for path says it's recommended that you append instead of assign, so if the plugin is overwriting the path, perhaps it should be treated as a bug and a issue raised on Github. – muru Feb 14 '15 at 19:07
  • I raised the bug, but it was closed almost immediately and I was fairly satisfied with the reasoning. If you or anyone else feels it should be reopened and is affected by it feel free to comment, the issue shouldn't be too hard to find on GitHub – user489 Feb 14 '15 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy