Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option for using VCS's list command instead of Vim's globpath() #17

Closed
wants to merge 1 commit into from
Closed

Conversation

wjkoh
Copy link

@wjkoh wjkoh commented Oct 8, 2011

Hi,

I made a functionality using VCS's list command instead of globpath(). It is much faster than globpath() but it may be little slower than find in Linux. However, there are some pros in compare with find or globpath(). For example, only version-tracked files are listed, it works in any OS without configuration, faster for a huge repository and so on.

I added supports for not only Git and Mercurial but also Subversion. However, subversion's list is slower than globpath() because of its distributed .svn directories. You can remove it.

Please pull my changes, and modify or integrate as you want. Since I don't have much experiences in Vim script, I tried to minimize changes and side effects of my code. So it may be inefficient in many ways.

  • Add g:ctrlp_use_vcs_ls variable
  • Support Git, Mercurial and Subversion

* Add g:ctrlp_use_vcs_ls variable
* Support Git, Mercurial and Subversion
@kien
Copy link
Owner

kien commented Oct 8, 2011

Awesome, thank you for donating time! I'll check it out and see what's best (probably will just integrate it instead of merging).

@kien
Copy link
Owner

kien commented Oct 8, 2011

OK, looks like adding a new option for this is a little unnecessary. Also, hg locate returns the paths of the files relative to the repo's root, this will make opening files fail when user is in a subdir of the repo and g:ctrlp_working_path_mode is set to 1. git ls-files seems to work perfectly everywhere.

I think I'll just add a few lines in the doc for these commands and how to set them up correctly.

Thanks!

@kien kien closed this Oct 8, 2011
@wjkoh
Copy link
Author

wjkoh commented Oct 8, 2011

Thanks for your comment! However, I tested both working path modes and it worked well. I used a --fullpath option for Mercurial to get an absolute path always. On top of that, the reason I modified ctrlp.vim itself is because if a user fixes g:ctrlp_user_command to one of those VCS commands, ctrlp.vim will not work in non-version tracked directories and the other VCS's. To resolve this, I modified ctrlp.vim and made it automatically choose among default (''), Git or Mercurial command. As a result, it works well in every case and improve performance at no extra cost. However, because it violates the conditon of pure Vim scripts, I had to add the option variable and make users choose on their own.

@kien
Copy link
Owner

kien commented Oct 8, 2011

Using --fullpath with hg locate will return paths with mixed \ and / on Windows and makes opening files fail. I see your point, though, so I'll definitely try to find a fix for this and make it work.

@wjkoh
Copy link
Author

wjkoh commented Oct 8, 2011

Oh my. I didn't notice that because I tested it only in Mac OS X and Linux.
Thanks for your brilliant plugin and effort again. I'll be waiting that feature happily.

@kien
Copy link
Owner

kien commented Oct 8, 2011

Let me know how this works. Instead of hardcoding the commands, this will allow people to use something other than just hg, git or svn.

nfvs pushed a commit to nfvs/ctrlp.vim that referenced this pull request Aug 8, 2014
Check shell in Windows before assuming cmd.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants