command-t 1.10 → 1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.txt +85 -17
- data/Rakefile +4 -14
- data/doc/command-t.txt +85 -17
- data/ruby/command-t/Makefile +3 -23
- data/ruby/command-t/controller.rb +29 -5
- data/ruby/command-t/extconf.rb +1 -0
- data/ruby/command-t/finder/file_finder.rb +3 -0
- data/ruby/command-t/match_window.rb +52 -37
- data/ruby/command-t/scanner/file_scanner.rb +15 -7
- data/ruby/command-t/scanner/file_scanner/git_file_scanner.rb +41 -0
- data/ruby/command-t/scanner/file_scanner/watchman_file_scanner.rb +1 -1
- data/ruby/command-t/settings.rb +1 -0
- data/ruby/command-t/vim.rb +4 -0
- data/ruby/command-t/vim/path_utilities.rb +13 -0
- data/ruby/command-t/watchman.c +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e542a39c30001daa8498a0dadc7e646fa5c9d342
|
4
|
+
data.tar.gz: 4a1aedd0bc94d9afae2fa03c6ded35a8e1e4b9c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee44802106f493bc3138703b3b86c9b615c2d44a6fecfa348a22da310213605452c9205151c023ea65717c620b288885e546720b80de497019cc9cf639763e2
|
7
|
+
data.tar.gz: e27e0fe5744d7f5b6833ad767ec8f04f2540c84d80f1d90464a26a6f9cd16981bf0ca985ca4fc8206b57a4a231eb06514eeb866a6d55dd542e22d03cd7004c8a
|
data/README.txt
CHANGED
@@ -302,6 +302,17 @@ repository with:
|
|
302
302
|
|
303
303
|
su -c 'yum install vim-command-t'
|
304
304
|
|
305
|
+
*command-t-appstream*
|
306
|
+
AppStream Metadata ~
|
307
|
+
|
308
|
+
When preparing a Command-T package for distribution on Linux using Gnome
|
309
|
+
Software or another AppStream compatible application, there is a metafile in
|
310
|
+
appstream directory.
|
311
|
+
|
312
|
+
You can find more about AppStream specification at:
|
313
|
+
|
314
|
+
http://www.freedesktop.org/software/appstream/docs/
|
315
|
+
|
305
316
|
|
306
317
|
TROUBLE-SHOOTING *command-t-trouble-shooting*
|
307
318
|
|
@@ -311,12 +322,11 @@ linked against at compile time. For example, if one is 32-bit and the other is
|
|
311
322
|
64-bit, or one is from the Ruby 1.9 series and the other is from the 1.8
|
312
323
|
series, then the plug-in is not likely to work.
|
313
324
|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
extension.
|
325
|
+
On OS X, Apple tends to change the version of Ruby that comes with the system
|
326
|
+
with each major release. See |command-t-requirements| above for details about
|
327
|
+
specific versions. If you wish to use custom builds of Ruby or of MacVim then
|
328
|
+
you will have to take extra care to ensure that the exact same Ruby
|
329
|
+
environment is in effect when building Ruby, Vim and the Command-T extension.
|
320
330
|
|
321
331
|
For Windows, the following combination is known to work:
|
322
332
|
|
@@ -342,6 +352,17 @@ flags or architecture flags are different then it is likely that something
|
|
342
352
|
has changed in your Ruby environment and the extension may not work until
|
343
353
|
you eliminate the discrepancy.
|
344
354
|
|
355
|
+
From inside Vim, you can confirm the version of Ruby that it is using by
|
356
|
+
issuing this command:
|
357
|
+
|
358
|
+
:ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
|
359
|
+
|
360
|
+
Finally, beware that if you change your installation method for Command-T (for
|
361
|
+
example, switching from one plugin manager to another) you should verify that
|
362
|
+
you remove all of the files installed by the previous installation method; if
|
363
|
+
you fail to do this, Vim may end up executing the old code, invalidating all
|
364
|
+
your attempts to get Vim and Command-T using the same version of Ruby.
|
365
|
+
|
345
366
|
|
346
367
|
USAGE *command-t-usage*
|
347
368
|
|
@@ -573,6 +594,10 @@ Following is a list of all available options:
|
|
573
594
|
work on systems without the tool or with an incompatible version of
|
574
595
|
the tool.
|
575
596
|
|
597
|
+
- "git": uses `git ls-files` to quickly produce a list of files; when
|
598
|
+
Git isn't available or the path being searched is not inside a Git
|
599
|
+
repository falls back to "find".
|
600
|
+
|
576
601
|
- "watchman": uses Watchman (https://github.com/facebook/watchman) if
|
577
602
|
available; otherwise falls back to "find". Note that this scanner is
|
578
603
|
intended for use with very large hierarchies (hundreds of thousands of
|
@@ -581,6 +606,34 @@ Following is a list of all available options:
|
|
581
606
|
Command-T would usually consult, such as 'wildignore' and
|
582
607
|
|g:CommandTScanDotDirectories| are ignored.
|
583
608
|
|
609
|
+
*g:CommandTTraverseSCM*
|
610
|
+
|g:CommandTTraverseSCM| string (default: 'file')
|
611
|
+
|
612
|
+
Instructs Command-T how to chose a root path when opening a file finder
|
613
|
+
without an explicit path argument. Possible values are:
|
614
|
+
|
615
|
+
- "file": starting from the file currently being edited, traverse
|
616
|
+
upwards through the filesystem hierarchy until you find an SCM root
|
617
|
+
(as indicated by the presence of a ".git", ".hg" or similar directory)
|
618
|
+
and use that as the base path. If no such root is found, fallback to
|
619
|
+
using Vim's present working directory as a root. The list of SCM
|
620
|
+
directories that Command-T uses to detect an SCM root can be
|
621
|
+
customized with the |g:CommandTSCMDirectories| option.
|
622
|
+
|
623
|
+
- "dir": traverse upwards looking for an SCM root just like the "file"
|
624
|
+
setting (above), but instead of starting from the file currently being
|
625
|
+
edited, start from Vim's present working directory instead.
|
626
|
+
|
627
|
+
- "pwd": use Vim's present working directory as a root (ie. attempt no
|
628
|
+
traversal).
|
629
|
+
|
630
|
+
*g:CommandTSCMDirectories*
|
631
|
+
|g:CommandTSCMDirectories| string (default: '.git,.hg,.svn,.bzr,_darcs')
|
632
|
+
|
633
|
+
The marker directories that Command-T will use to identify SCM roots
|
634
|
+
during traversal (see |g:CommandTTraverseSCM| above).
|
635
|
+
|
636
|
+
|
584
637
|
*g:CommandTMinHeight*
|
585
638
|
|g:CommandTMinHeight| number (default: 0)
|
586
639
|
|
@@ -712,7 +765,7 @@ Following is a list of all available options:
|
|
712
765
|
|
713
766
|
function! GotoOrOpen(...)
|
714
767
|
for file in a:000
|
715
|
-
if
|
768
|
+
if bufwinnr(file) != -1
|
716
769
|
exec "sb " . file
|
717
770
|
else
|
718
771
|
exec "tabe " . file
|
@@ -724,6 +777,8 @@ Following is a list of all available options:
|
|
724
777
|
|
725
778
|
let g:CommandTAcceptSelectionTabCommand = 'GotoOrOpen'
|
726
779
|
|
780
|
+
For a slightly more comprehensive example, see: https://wt.pe/e
|
781
|
+
|
727
782
|
*g:CommandTAcceptSelectionSplitCommand*
|
728
783
|
|g:CommandTAcceptSelectionSplitCommand| string (default: 'sp')
|
729
784
|
|
@@ -1020,19 +1075,21 @@ Command-T is written and maintained by Greg Hurrell <greg@hurrell.net>.
|
|
1020
1075
|
Other contributors that have submitted patches include (in alphabetical
|
1021
1076
|
order):
|
1022
1077
|
|
1078
|
+
Abhinav Gupta Marian Schubert Scott Bronson
|
1023
1079
|
Andy Waite Matthew Todd Seth Fowler
|
1024
1080
|
Anthony Panozzo Mike Lundy Shlomi Fish
|
1025
1081
|
Artem Nezvigin Nadav Samet Steven Moazami
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1082
|
+
Ben Osheroff Nate Kane Sung Pae
|
1083
|
+
Daniel Hahler Nicholas Alpi Thomas Pelletier
|
1084
|
+
David Szotten Noon Silk Ton van den Heuvel
|
1085
|
+
Felix Tjandrawibawa Ole Petter Bang Victor Hugo Borja
|
1086
|
+
Gary Bernhardt Patrick Hayes Vít Ondruch
|
1087
|
+
Ivan Ukhov Paul Jolly Woody Peterson
|
1088
|
+
Jacek Wysocki Pavel Sergeev Yan Pritzker
|
1089
|
+
Jeff Kreeftmeijer Rainux Luo Yiding Jia
|
1090
|
+
Kevin Webster Richard Feldman Zak Johnson
|
1091
|
+
Lucas de Vries Roland Puntaier
|
1092
|
+
Marcus Brito Ross Lagerwall
|
1036
1093
|
|
1037
1094
|
As this was the first Vim plug-in I had ever written I was heavily influenced
|
1038
1095
|
by the design of the LustyExplorer plug-in by Stephen Bach, which I understand
|
@@ -1126,6 +1183,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
1126
1183
|
|
1127
1184
|
HISTORY *command-t-history*
|
1128
1185
|
|
1186
|
+
1.11 (15 August 2014)
|
1187
|
+
|
1188
|
+
- improve edge-case handling in match results window code (patches from
|
1189
|
+
Richard Feldman)
|
1190
|
+
- add "git" file scanner (patch from Patrick Hayes)
|
1191
|
+
- speed-up when 'wildignore' is unset (patch from Patrick Hayes)
|
1192
|
+
- add |g:CommandTTraverseSCM| setting which anchors Command-T's file finder to
|
1193
|
+
the nearest SCM directory (based on patches from David Szotten and Ben
|
1194
|
+
Osheroff)
|
1195
|
+
- add AppStream metadata (patch from Vít Ondruch)
|
1196
|
+
|
1129
1197
|
1.10 (15 July 2014)
|
1130
1198
|
|
1131
1199
|
- improve tag finder performance by caching tag lists (patch from Artem
|
data/Rakefile
CHANGED
@@ -86,24 +86,14 @@ The general release sequence is:
|
|
86
86
|
rake prerelease
|
87
87
|
rake gem
|
88
88
|
rake push
|
89
|
-
|
89
|
+
rake upload:all
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
with the environment in a way that breaks multiruby.
|
94
|
-
|
95
|
-
We use Bundler for the upload task because the www.vim.org
|
96
|
-
uploader uses Bundler to ensure that the Mechanize gem is available.
|
91
|
+
Note: the upload task depends on the Mechanize gem; and may require a
|
92
|
+
prior `gem install mechanize`
|
97
93
|
|
98
94
|
END
|
99
95
|
end
|
100
96
|
|
101
|
-
task :check_bundler do
|
102
|
-
unless ENV.has_key? 'BUNDLE_GEMFILE'
|
103
|
-
warn 'warning: Bundler is not loaded; try running with `bundle exec rake`'
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
97
|
desc 'Run specs'
|
108
98
|
task :spec do
|
109
99
|
system 'bundle exec rspec spec'
|
@@ -179,7 +169,7 @@ namespace :upload do
|
|
179
169
|
end
|
180
170
|
|
181
171
|
desc 'Upload current vimball to www.vim.org'
|
182
|
-
task :vim =>
|
172
|
+
task :vim => :vimball do
|
183
173
|
prepare_release_notes
|
184
174
|
sh "vendor/vimscriptuploader/vimscriptuploader.rb \
|
185
175
|
--id 3025 \
|
data/doc/command-t.txt
CHANGED
@@ -302,6 +302,17 @@ repository with:
|
|
302
302
|
|
303
303
|
su -c 'yum install vim-command-t'
|
304
304
|
|
305
|
+
*command-t-appstream*
|
306
|
+
AppStream Metadata ~
|
307
|
+
|
308
|
+
When preparing a Command-T package for distribution on Linux using Gnome
|
309
|
+
Software or another AppStream compatible application, there is a metafile in
|
310
|
+
appstream directory.
|
311
|
+
|
312
|
+
You can find more about AppStream specification at:
|
313
|
+
|
314
|
+
http://www.freedesktop.org/software/appstream/docs/
|
315
|
+
|
305
316
|
|
306
317
|
TROUBLE-SHOOTING *command-t-trouble-shooting*
|
307
318
|
|
@@ -311,12 +322,11 @@ linked against at compile time. For example, if one is 32-bit and the other is
|
|
311
322
|
64-bit, or one is from the Ruby 1.9 series and the other is from the 1.8
|
312
323
|
series, then the plug-in is not likely to work.
|
313
324
|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
extension.
|
325
|
+
On OS X, Apple tends to change the version of Ruby that comes with the system
|
326
|
+
with each major release. See |command-t-requirements| above for details about
|
327
|
+
specific versions. If you wish to use custom builds of Ruby or of MacVim then
|
328
|
+
you will have to take extra care to ensure that the exact same Ruby
|
329
|
+
environment is in effect when building Ruby, Vim and the Command-T extension.
|
320
330
|
|
321
331
|
For Windows, the following combination is known to work:
|
322
332
|
|
@@ -342,6 +352,17 @@ flags or architecture flags are different then it is likely that something
|
|
342
352
|
has changed in your Ruby environment and the extension may not work until
|
343
353
|
you eliminate the discrepancy.
|
344
354
|
|
355
|
+
From inside Vim, you can confirm the version of Ruby that it is using by
|
356
|
+
issuing this command:
|
357
|
+
|
358
|
+
:ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
|
359
|
+
|
360
|
+
Finally, beware that if you change your installation method for Command-T (for
|
361
|
+
example, switching from one plugin manager to another) you should verify that
|
362
|
+
you remove all of the files installed by the previous installation method; if
|
363
|
+
you fail to do this, Vim may end up executing the old code, invalidating all
|
364
|
+
your attempts to get Vim and Command-T using the same version of Ruby.
|
365
|
+
|
345
366
|
|
346
367
|
USAGE *command-t-usage*
|
347
368
|
|
@@ -573,6 +594,10 @@ Following is a list of all available options:
|
|
573
594
|
work on systems without the tool or with an incompatible version of
|
574
595
|
the tool.
|
575
596
|
|
597
|
+
- "git": uses `git ls-files` to quickly produce a list of files; when
|
598
|
+
Git isn't available or the path being searched is not inside a Git
|
599
|
+
repository falls back to "find".
|
600
|
+
|
576
601
|
- "watchman": uses Watchman (https://github.com/facebook/watchman) if
|
577
602
|
available; otherwise falls back to "find". Note that this scanner is
|
578
603
|
intended for use with very large hierarchies (hundreds of thousands of
|
@@ -581,6 +606,34 @@ Following is a list of all available options:
|
|
581
606
|
Command-T would usually consult, such as 'wildignore' and
|
582
607
|
|g:CommandTScanDotDirectories| are ignored.
|
583
608
|
|
609
|
+
*g:CommandTTraverseSCM*
|
610
|
+
|g:CommandTTraverseSCM| string (default: 'file')
|
611
|
+
|
612
|
+
Instructs Command-T how to chose a root path when opening a file finder
|
613
|
+
without an explicit path argument. Possible values are:
|
614
|
+
|
615
|
+
- "file": starting from the file currently being edited, traverse
|
616
|
+
upwards through the filesystem hierarchy until you find an SCM root
|
617
|
+
(as indicated by the presence of a ".git", ".hg" or similar directory)
|
618
|
+
and use that as the base path. If no such root is found, fallback to
|
619
|
+
using Vim's present working directory as a root. The list of SCM
|
620
|
+
directories that Command-T uses to detect an SCM root can be
|
621
|
+
customized with the |g:CommandTSCMDirectories| option.
|
622
|
+
|
623
|
+
- "dir": traverse upwards looking for an SCM root just like the "file"
|
624
|
+
setting (above), but instead of starting from the file currently being
|
625
|
+
edited, start from Vim's present working directory instead.
|
626
|
+
|
627
|
+
- "pwd": use Vim's present working directory as a root (ie. attempt no
|
628
|
+
traversal).
|
629
|
+
|
630
|
+
*g:CommandTSCMDirectories*
|
631
|
+
|g:CommandTSCMDirectories| string (default: '.git,.hg,.svn,.bzr,_darcs')
|
632
|
+
|
633
|
+
The marker directories that Command-T will use to identify SCM roots
|
634
|
+
during traversal (see |g:CommandTTraverseSCM| above).
|
635
|
+
|
636
|
+
|
584
637
|
*g:CommandTMinHeight*
|
585
638
|
|g:CommandTMinHeight| number (default: 0)
|
586
639
|
|
@@ -712,7 +765,7 @@ Following is a list of all available options:
|
|
712
765
|
|
713
766
|
function! GotoOrOpen(...)
|
714
767
|
for file in a:000
|
715
|
-
if
|
768
|
+
if bufwinnr(file) != -1
|
716
769
|
exec "sb " . file
|
717
770
|
else
|
718
771
|
exec "tabe " . file
|
@@ -724,6 +777,8 @@ Following is a list of all available options:
|
|
724
777
|
|
725
778
|
let g:CommandTAcceptSelectionTabCommand = 'GotoOrOpen'
|
726
779
|
|
780
|
+
For a slightly more comprehensive example, see: https://wt.pe/e
|
781
|
+
|
727
782
|
*g:CommandTAcceptSelectionSplitCommand*
|
728
783
|
|g:CommandTAcceptSelectionSplitCommand| string (default: 'sp')
|
729
784
|
|
@@ -1020,19 +1075,21 @@ Command-T is written and maintained by Greg Hurrell <greg@hurrell.net>.
|
|
1020
1075
|
Other contributors that have submitted patches include (in alphabetical
|
1021
1076
|
order):
|
1022
1077
|
|
1078
|
+
Abhinav Gupta Marian Schubert Scott Bronson
|
1023
1079
|
Andy Waite Matthew Todd Seth Fowler
|
1024
1080
|
Anthony Panozzo Mike Lundy Shlomi Fish
|
1025
1081
|
Artem Nezvigin Nadav Samet Steven Moazami
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1082
|
+
Ben Osheroff Nate Kane Sung Pae
|
1083
|
+
Daniel Hahler Nicholas Alpi Thomas Pelletier
|
1084
|
+
David Szotten Noon Silk Ton van den Heuvel
|
1085
|
+
Felix Tjandrawibawa Ole Petter Bang Victor Hugo Borja
|
1086
|
+
Gary Bernhardt Patrick Hayes Vít Ondruch
|
1087
|
+
Ivan Ukhov Paul Jolly Woody Peterson
|
1088
|
+
Jacek Wysocki Pavel Sergeev Yan Pritzker
|
1089
|
+
Jeff Kreeftmeijer Rainux Luo Yiding Jia
|
1090
|
+
Kevin Webster Richard Feldman Zak Johnson
|
1091
|
+
Lucas de Vries Roland Puntaier
|
1092
|
+
Marcus Brito Ross Lagerwall
|
1036
1093
|
|
1037
1094
|
As this was the first Vim plug-in I had ever written I was heavily influenced
|
1038
1095
|
by the design of the LustyExplorer plug-in by Stephen Bach, which I understand
|
@@ -1126,6 +1183,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
1126
1183
|
|
1127
1184
|
HISTORY *command-t-history*
|
1128
1185
|
|
1186
|
+
1.11 (15 August 2014)
|
1187
|
+
|
1188
|
+
- improve edge-case handling in match results window code (patches from
|
1189
|
+
Richard Feldman)
|
1190
|
+
- add "git" file scanner (patch from Patrick Hayes)
|
1191
|
+
- speed-up when 'wildignore' is unset (patch from Patrick Hayes)
|
1192
|
+
- add |g:CommandTTraverseSCM| setting which anchors Command-T's file finder to
|
1193
|
+
the nearest SCM directory (based on patches from David Szotten and Ben
|
1194
|
+
Osheroff)
|
1195
|
+
- add AppStream metadata (patch from Vít Ondruch)
|
1196
|
+
|
1129
1197
|
1.10 (15 July 2014)
|
1130
1198
|
|
1131
1199
|
- improve tag finder performance by caching tag lists (patch from Artem
|
data/ruby/command-t/Makefile
CHANGED
@@ -81,7 +81,7 @@ CCDLFLAGS = -fno-common
|
|
81
81
|
CFLAGS = $(CCDLFLAGS) -O3 -Wno-error=shorten-64-to-32 -pipe $(ARCH_FLAG)
|
82
82
|
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
83
83
|
DEFS = -DWATCHMAN_BUILD
|
84
|
-
CPPFLAGS = -DHAVE_FCNTL_H -DHAVE_SYS_ERRNO_H -DHAVE_SYS_SOCKET_H -DHAVE_RUBY_ST_H -DHAVE_ST_H -I/Users/glh/.rbenv/versions/2.0.0-p451/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
84
|
+
CPPFLAGS = -DHAVE_FCNTL_H -DHAVE_STDINT_H -DHAVE_SYS_ERRNO_H -DHAVE_SYS_SOCKET_H -DHAVE_RUBY_ST_H -DHAVE_ST_H -I/Users/glh/.rbenv/versions/2.0.0-p451/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
85
85
|
CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
|
86
86
|
ldflags = -L. -L/Users/glh/.rbenv/versions/2.0.0-p451/lib
|
87
87
|
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress
|
@@ -236,27 +236,7 @@ $(DLLIB): $(OBJS) Makefile
|
|
236
236
|
|
237
237
|
|
238
238
|
###
|
239
|
-
# Copyright 2010-2014
|
240
|
-
#
|
241
|
-
# Redistribution and use in source and binary forms, with or without
|
242
|
-
# modification, are permitted provided that the following conditions are met:
|
243
|
-
#
|
244
|
-
# 1. Redistributions of source code must retain the above copyright notice,
|
245
|
-
# this list of conditions and the following disclaimer.
|
246
|
-
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
247
|
-
# this list of conditions and the following disclaimer in the documentation
|
248
|
-
# and/or other materials provided with the distribution.
|
249
|
-
#
|
250
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
251
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
252
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
253
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
254
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
255
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
256
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
257
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
258
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
259
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
260
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
239
|
+
# Copyright 2010-2014 Greg Hurrell. All rights reserved.
|
240
|
+
# Licensed under the terms of the BSD 2-clause license.
|
261
241
|
|
262
242
|
CFLAGS += -Wall -Wextra -Wno-unused-parameter
|
@@ -45,7 +45,21 @@ module CommandT
|
|
45
45
|
|
46
46
|
def show_file_finder
|
47
47
|
# optional parameter will be desired starting directory, or ""
|
48
|
-
|
48
|
+
|
49
|
+
arg = ::VIM::evaluate('a:arg')
|
50
|
+
if arg && arg.size > 0
|
51
|
+
@path = File.expand_path(arg, VIM::pwd)
|
52
|
+
else
|
53
|
+
traverse = get_string('g:CommandTTraverseSCM') || 'file'
|
54
|
+
case traverse
|
55
|
+
when 'file'
|
56
|
+
@path = nearest_ancestor(VIM::current_file_dir, scm_markers)
|
57
|
+
when 'dir'
|
58
|
+
@path = nearest_ancestor(VIM::pwd, scm_markers)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
@path = VIM::pwd unless @path
|
49
63
|
@active_finder = file_finder
|
50
64
|
file_finder.path = @path
|
51
65
|
show
|
@@ -202,6 +216,13 @@ module CommandT
|
|
202
216
|
|
203
217
|
private
|
204
218
|
|
219
|
+
def scm_markers
|
220
|
+
markers = get_string('g:CommandTSCMDirectories')
|
221
|
+
markers = markers && markers.split(/\s*,\s*/)
|
222
|
+
markers = %w[.git .hg .svn .bzr _darcs] unless markers && markers.length
|
223
|
+
markers
|
224
|
+
end
|
225
|
+
|
205
226
|
def list_matches!
|
206
227
|
list_matches(:force => true)
|
207
228
|
end
|
@@ -387,11 +408,14 @@ module CommandT
|
|
387
408
|
::VIM::command 'augroup END'
|
388
409
|
end
|
389
410
|
|
390
|
-
# Returns the desired maximum number of matches, based on available
|
391
|
-
#
|
411
|
+
# Returns the desired maximum number of matches, based on available vertical
|
412
|
+
# space and the g:CommandTMaxHeight option.
|
413
|
+
#
|
414
|
+
# Note the "available" space is actually a theoretical upper bound; it takes
|
415
|
+
# into account screen dimensions but not things like existing splits which
|
416
|
+
# may reduce the amount of space in practice.
|
392
417
|
def match_limit
|
393
|
-
limit = VIM::Screen.lines - 5
|
394
|
-
limit = 1 if limit < 0
|
418
|
+
limit = [1, VIM::Screen.lines - 5].max
|
395
419
|
limit = [limit, max_height].min if max_height > 0
|
396
420
|
limit
|
397
421
|
end
|
data/ruby/command-t/extconf.rb
CHANGED
@@ -6,6 +6,7 @@ require 'command-t/finder'
|
|
6
6
|
require 'command-t/scanner/file_scanner/ruby_file_scanner'
|
7
7
|
require 'command-t/scanner/file_scanner/find_file_scanner'
|
8
8
|
require 'command-t/scanner/file_scanner/watchman_file_scanner'
|
9
|
+
require 'command-t/scanner/file_scanner/git_file_scanner'
|
9
10
|
|
10
11
|
module CommandT
|
11
12
|
class FileFinder < Finder
|
@@ -17,6 +18,8 @@ module CommandT
|
|
17
18
|
@scanner = FileScanner::FindFileScanner.new(path, options)
|
18
19
|
when 'watchman'
|
19
20
|
@scanner = FileScanner::WatchmanFileScanner.new(path, options)
|
21
|
+
when 'git'
|
22
|
+
@scanner = FileScanner::GitFileScanner.new(path, options)
|
20
23
|
else
|
21
24
|
raise ArgumentError, "unknown scanner type '#{options[:scanner]}'"
|
22
25
|
end
|
@@ -35,6 +35,7 @@ module CommandT
|
|
35
35
|
set 'equalalways', false # don't auto-balance window sizes
|
36
36
|
set 'timeoutlen', 0 # respond immediately to mappings
|
37
37
|
set 'report', 9999 # don't show "X lines changed" reports
|
38
|
+
set 'scrolloff', 0 # don't scroll near buffer edges
|
38
39
|
set 'sidescroll', 0 # don't sidescroll in jumps
|
39
40
|
set 'sidescrolloff', 0 # don't sidescroll automatically
|
40
41
|
set 'updatetime', options[:debounce_interval]
|
@@ -106,7 +107,6 @@ module CommandT
|
|
106
107
|
::VIM::command 'autocmd BufUnload <buffer> silent! ruby $command_t.unload'
|
107
108
|
|
108
109
|
@has_focus = false
|
109
|
-
@selection = nil
|
110
110
|
@abbrev = ''
|
111
111
|
@window = $curwin
|
112
112
|
end
|
@@ -160,32 +160,17 @@ module CommandT
|
|
160
160
|
end
|
161
161
|
|
162
162
|
def select_next
|
163
|
-
|
164
|
-
@selection += 1
|
165
|
-
print_match(@selection - 1) # redraw old selection (removes marker)
|
166
|
-
print_match(@selection) # redraw new selection (adds marker)
|
167
|
-
move_cursor_to_selected_line
|
168
|
-
else
|
169
|
-
# (possibly) loop or scroll
|
170
|
-
end
|
163
|
+
@reverse_list ? _prev : _next
|
171
164
|
end
|
172
165
|
|
173
166
|
def select_prev
|
174
|
-
|
175
|
-
@selection -= 1
|
176
|
-
print_match(@selection + 1) # redraw old selection (removes marker)
|
177
|
-
print_match(@selection) # redraw new selection (adds marker)
|
178
|
-
move_cursor_to_selected_line
|
179
|
-
else
|
180
|
-
# (possibly) loop or scroll
|
181
|
-
end
|
167
|
+
@reverse_list ? _next : _prev
|
182
168
|
end
|
183
169
|
|
184
170
|
def matches= matches
|
185
|
-
matches = matches.reverse if @reverse_list
|
186
171
|
if matches != @matches
|
187
172
|
@matches = matches
|
188
|
-
@selection =
|
173
|
+
@selection = 0
|
189
174
|
print_matches
|
190
175
|
move_cursor_to_selected_line
|
191
176
|
end
|
@@ -209,7 +194,7 @@ module CommandT
|
|
209
194
|
end
|
210
195
|
end
|
211
196
|
|
212
|
-
def find
|
197
|
+
def find(char)
|
213
198
|
# is this a new search or the continuation of a previous one?
|
214
199
|
now = Time.now
|
215
200
|
if @last_key_time.nil? or @last_key_time < (now - 0.5)
|
@@ -220,10 +205,11 @@ module CommandT
|
|
220
205
|
@last_key_time = now
|
221
206
|
|
222
207
|
# see if there's anything up ahead that matches
|
223
|
-
@matches.
|
208
|
+
matches = @reverse_list ? @matches.reverse : @matches
|
209
|
+
matches.each_with_index do |match, idx|
|
224
210
|
if match[0, @find_string.length].casecmp(@find_string) == 0
|
225
211
|
old_selection = @selection
|
226
|
-
@selection = idx
|
212
|
+
@selection = @reverse_list ? matches.length - idx - 1 : idx
|
227
213
|
print_match(old_selection) # redraw old selection (removes marker)
|
228
214
|
print_match(@selection) # redraw new selection (adds marker)
|
229
215
|
break
|
@@ -242,6 +228,30 @@ module CommandT
|
|
242
228
|
|
243
229
|
private
|
244
230
|
|
231
|
+
def _next
|
232
|
+
if @selection < [@window.height, @matches.length].min - 1
|
233
|
+
@selection += 1
|
234
|
+
print_match(@selection - 1) # redraw old selection (removes marker)
|
235
|
+
print_match(@selection) # redraw new selection (adds marker)
|
236
|
+
move_cursor_to_selected_line
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def _prev
|
241
|
+
if @selection > 0
|
242
|
+
@selection -= 1
|
243
|
+
print_match(@selection + 1) # redraw old selection (removes marker)
|
244
|
+
print_match(@selection) # redraw new selection (adds marker)
|
245
|
+
move_cursor_to_selected_line
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
# Translate from a 0-indexed match index to a 1-indexed Vim line number.
|
250
|
+
# Also takes into account reversed listings.
|
251
|
+
def line(match_index)
|
252
|
+
@reverse_list ? @window.height - match_index : match_index + 1
|
253
|
+
end
|
254
|
+
|
245
255
|
def set(setting, value)
|
246
256
|
@settings ||= Settings.new
|
247
257
|
@settings.set(setting, value)
|
@@ -251,14 +261,14 @@ module CommandT
|
|
251
261
|
# on some non-GUI terminals, the cursor doesn't hide properly
|
252
262
|
# so we move the cursor to prevent it from blinking away in the
|
253
263
|
# upper-left corner in a distracting fashion
|
254
|
-
@window.cursor = [@selection
|
264
|
+
@window.cursor = [line(@selection), 0]
|
255
265
|
end
|
256
266
|
|
257
267
|
def print_error msg
|
258
268
|
return unless VIM::Window.select(@window)
|
259
269
|
unlock
|
260
270
|
clear
|
261
|
-
@window.height =
|
271
|
+
@window.height = [1, @min_height].min
|
262
272
|
@@buffer[1] = "-- #{msg} --"
|
263
273
|
lock
|
264
274
|
end
|
@@ -321,13 +331,17 @@ module CommandT
|
|
321
331
|
end
|
322
332
|
|
323
333
|
# Print just the specified match.
|
324
|
-
def print_match
|
334
|
+
def print_match(idx)
|
325
335
|
return unless VIM::Window.select(@window)
|
326
336
|
unlock
|
327
|
-
@@buffer[idx
|
337
|
+
@@buffer[line(idx)] = match_text_for_idx idx
|
328
338
|
lock
|
329
339
|
end
|
330
340
|
|
341
|
+
def max_lines
|
342
|
+
[1, VIM::Screen.lines - 5].max
|
343
|
+
end
|
344
|
+
|
331
345
|
# Print all matches.
|
332
346
|
def print_matches
|
333
347
|
match_count = @matches.length
|
@@ -337,19 +351,20 @@ module CommandT
|
|
337
351
|
return unless VIM::Window.select(@window)
|
338
352
|
unlock
|
339
353
|
clear
|
340
|
-
actual_lines = 1
|
341
354
|
@window_width = @window.width # update cached value
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
355
|
+
desired_lines = [match_count, @min_height].max
|
356
|
+
desired_lines = [max_lines, desired_lines].min
|
357
|
+
@window.height = desired_lines
|
358
|
+
matches = []
|
359
|
+
(0...@window.height).each do |idx|
|
360
|
+
text = match_text_for_idx(idx)
|
361
|
+
@reverse_list ? matches.unshift(text) : matches.push(text)
|
362
|
+
end
|
363
|
+
matches.each_with_index do |match, idx|
|
364
|
+
if @@buffer.count > idx
|
365
|
+
@@buffer[idx + 1] = match
|
351
366
|
else
|
352
|
-
@@buffer.append
|
367
|
+
@@buffer.append(idx, match)
|
353
368
|
end
|
354
369
|
end
|
355
370
|
lock
|
@@ -26,10 +26,14 @@ module CommandT
|
|
26
26
|
@base_wild_ignore = VIM::wild_ignore
|
27
27
|
end
|
28
28
|
|
29
|
+
def prepare_paths
|
30
|
+
ensure_cache_under_limit
|
31
|
+
@prefix_len = @path.chomp('/').length
|
32
|
+
end
|
33
|
+
|
29
34
|
def paths
|
30
35
|
@paths[@path] || begin
|
31
|
-
|
32
|
-
@prefix_len = @path.chomp('/').length
|
36
|
+
prepare_paths
|
33
37
|
nil
|
34
38
|
end
|
35
39
|
end
|
@@ -49,11 +53,15 @@ module CommandT
|
|
49
53
|
@paths_keys << @path
|
50
54
|
end
|
51
55
|
|
52
|
-
def path_excluded?(path)
|
53
|
-
#
|
54
|
-
|
55
|
-
|
56
|
-
|
56
|
+
def path_excluded?(path, prefix_len = @prefix_len)
|
57
|
+
# if there is no wild_ignore, skip the call to evaluate which can be
|
58
|
+
# expensive for large file lists
|
59
|
+
if @wild_ignore && !@wild_ignore.empty?
|
60
|
+
# first strip common prefix (@path) from path to match VIM's behavior
|
61
|
+
path = path[(prefix_len + 1)..-1]
|
62
|
+
path = VIM::escape_for_single_quotes path
|
63
|
+
::VIM::evaluate("empty(expand(fnameescape('#{path}')))").to_i == 1
|
64
|
+
end
|
57
65
|
end
|
58
66
|
|
59
67
|
def set_wild_ignore(ignore)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright 2014 Greg Hurrell. All rights reserved.
|
2
|
+
# Licensed under the terms of the BSD 2-clause license.
|
3
|
+
|
4
|
+
require 'command-t/scanner/file_scanner/find_file_scanner'
|
5
|
+
|
6
|
+
module CommandT
|
7
|
+
class FileScanner
|
8
|
+
# Uses git ls-files to scan for files
|
9
|
+
class GitFileScanner < FindFileScanner
|
10
|
+
def paths
|
11
|
+
@paths[@path] ||= begin
|
12
|
+
Dir.chdir(@path) do
|
13
|
+
set_wild_ignore(@wild_ignore)
|
14
|
+
prepare_paths
|
15
|
+
|
16
|
+
stdin, stdout, stderr = Open3.popen3(*[
|
17
|
+
'git',
|
18
|
+
'ls-files',
|
19
|
+
'--exclude-standard',
|
20
|
+
@path
|
21
|
+
])
|
22
|
+
|
23
|
+
all_files = stdout.readlines.
|
24
|
+
map { |path| path.chomp }.
|
25
|
+
reject { |path| path_excluded?(path, 0) }.
|
26
|
+
take(@max_files).
|
27
|
+
to_a
|
28
|
+
|
29
|
+
# will fall back to find if not a git repository or there's an error
|
30
|
+
stderr.gets ? super : all_files
|
31
|
+
end
|
32
|
+
rescue Errno::ENOENT => e
|
33
|
+
# git executable not present and executable
|
34
|
+
super
|
35
|
+
ensure
|
36
|
+
set_wild_ignore(@base_wild_ignore)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end # class GitFileScanner
|
40
|
+
end # class FileScanner
|
41
|
+
end # module CommandT
|
data/ruby/command-t/settings.rb
CHANGED
data/ruby/command-t/vim.rb
CHANGED
@@ -26,6 +26,10 @@ module CommandT
|
|
26
26
|
exists?('&wildignore') && ::VIM::evaluate('&wildignore').to_s
|
27
27
|
end
|
28
28
|
|
29
|
+
def self.current_file_dir
|
30
|
+
::VIM::evaluate 'expand("%:p:h")'
|
31
|
+
end
|
32
|
+
|
29
33
|
# Execute cmd, capturing the output into a variable and returning it.
|
30
34
|
def self.capture cmd
|
31
35
|
::VIM::command 'silent redir => g:command_t_captured_output'
|
@@ -15,6 +15,19 @@ module CommandT
|
|
15
15
|
pwd = File.expand_path(VIM::pwd) + '/'
|
16
16
|
path.index(pwd) == 0 ? path[pwd.length..-1] : path
|
17
17
|
end
|
18
|
+
|
19
|
+
def nearest_ancestor(starting_directory, markers)
|
20
|
+
path = File.expand_path(starting_directory)
|
21
|
+
while !markers.
|
22
|
+
map { |dir| File.join(path, dir) }.
|
23
|
+
map { |dir| File.exist?(dir) }.
|
24
|
+
any?
|
25
|
+
return nil if path == '/'
|
26
|
+
path = File.expand_path(File.join(path, '..'))
|
27
|
+
end
|
28
|
+
path
|
29
|
+
end
|
30
|
+
|
18
31
|
end # module PathUtilities
|
19
32
|
end # module VIM
|
20
33
|
end # module CommandT
|
data/ruby/command-t/watchman.c
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: command-t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.11'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Hurrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Command-T provides a fast, intuitive mechanism for opening files with a
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- ruby/command-t/ruby_compat.h
|
49
49
|
- ruby/command-t/scanner/buffer_scanner.rb
|
50
50
|
- ruby/command-t/scanner/file_scanner/find_file_scanner.rb
|
51
|
+
- ruby/command-t/scanner/file_scanner/git_file_scanner.rb
|
51
52
|
- ruby/command-t/scanner/file_scanner/ruby_file_scanner.rb
|
52
53
|
- ruby/command-t/scanner/file_scanner/watchman_file_scanner.rb
|
53
54
|
- ruby/command-t/scanner/file_scanner.rb
|