command-t 1.4 → 1.5
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.
- data/Gemfile +4 -2
- data/README.txt +56 -15
- data/doc/command-t.txt +56 -15
- data/doc/tags +54 -0
- data/plugin/command-t.vim +5 -1
- data/ruby/command-t/Makefile +30 -30
- data/ruby/command-t/controller.rb +22 -6
- data/ruby/command-t/ext.bundle +0 -0
- data/ruby/command-t/match.c +92 -65
- data/ruby/command-t/match_window.rb +7 -6
- data/ruby/command-t/matcher.c +32 -27
- data/ruby/command-t/scanner/file_scanner.rb +19 -2
- data/ruby/command-t/vim.rb +5 -1
- metadata +3 -2
data/Gemfile
CHANGED
data/README.txt
CHANGED
@@ -158,7 +158,7 @@ of the following commands:
|
|
158
158
|
|
159
159
|
Note: Make sure you compile targeting the same architecture Vim was built for.
|
160
160
|
For instance, MacVim binaries are built for i386, but sometimes GCC compiles
|
161
|
-
for x86_64. First you have to check the
|
161
|
+
for x86_64. First you have to check the platform Vim was built for:
|
162
162
|
|
163
163
|
vim --version
|
164
164
|
...
|
@@ -206,9 +206,9 @@ Or you can switch to a specific release with:
|
|
206
206
|
|
207
207
|
After installing or updating you must build the extension:
|
208
208
|
|
209
|
-
cd ~/.vim/bundle/command-t
|
210
|
-
|
211
|
-
|
209
|
+
cd ~/.vim/bundle/command-t/ruby/command-t
|
210
|
+
ruby extconf.rb
|
211
|
+
make
|
212
212
|
|
213
213
|
While the Vimball installation automatically generates the help tags, under
|
214
214
|
Pathogen it is necessary to do so explicitly from inside Vim:
|
@@ -323,6 +323,7 @@ has focus:
|
|
323
323
|
<C-p> select previous file in the file listing
|
324
324
|
<Up> select previous file in the file listing
|
325
325
|
<C-f> flush the cache (see |:CommandTFlush| for details)
|
326
|
+
<C-q> place the current matches in the quickfix window
|
326
327
|
<C-c> cancel (dismisses file listing)
|
327
328
|
|
328
329
|
The following is also available on terminals which support it:
|
@@ -420,7 +421,7 @@ changes via |:let|.
|
|
420
421
|
Following is a list of all available options:
|
421
422
|
|
422
423
|
*g:CommandTMaxFiles*
|
423
|
-
|g:CommandTMaxFiles| number (default
|
424
|
+
|g:CommandTMaxFiles| number (default 30000)
|
424
425
|
|
425
426
|
The maximum number of files that will be considered when scanning the
|
426
427
|
current directory. Upon reaching this number scanning stops. This
|
@@ -435,7 +436,7 @@ Following is a list of all available options:
|
|
435
436
|
skipped.
|
436
437
|
|
437
438
|
*g:CommandTMaxCachedDirectories*
|
438
|
-
|g:CommandTMaxCachedDirectories|
|
439
|
+
|g:CommandTMaxCachedDirectories| number (default 1)
|
439
440
|
|
440
441
|
The maximum number of directories whose contents should be cached when
|
441
442
|
recursively scanning. With the default value of 1, each time you change
|
@@ -528,6 +529,23 @@ Following is a list of all available options:
|
|
528
529
|
When this setting is off (the default) the matches in the |:CommandTTag|
|
529
530
|
listing do not include filenames.
|
530
531
|
|
532
|
+
*g:CommandTHighlightColor*
|
533
|
+
|g:CommandTHighlightColor| string (default: 'PmenuSel')
|
534
|
+
|
535
|
+
Specifies the highlight color that will be used to show the currently
|
536
|
+
selected item in the match listing window.
|
537
|
+
|
538
|
+
*g:CommandTWildIgnore*
|
539
|
+
|g:CommandTWildIgnore| string (default: none)
|
540
|
+
|
541
|
+
Optionally override Vim's global |'wildignore'| setting during Command-T
|
542
|
+
seaches. If you wish to supplement rather than replace the global
|
543
|
+
setting, you can use a syntax like:
|
544
|
+
|
545
|
+
let g:CommandTWildIgnore=&wildignore . ",**/bower_components/*"
|
546
|
+
|
547
|
+
See also |command-t-wildignore|.
|
548
|
+
|
531
549
|
As well as the basic options listed above, there are a number of settings that
|
532
550
|
can be used to override the default key mappings used by Command-T. For
|
533
551
|
example, to set <C-x> as the mapping for cancelling (dismissing) the Command-T
|
@@ -585,6 +603,9 @@ Following is a list of all map settings and their defaults:
|
|
585
603
|
*g:CommandTRefreshMap*
|
586
604
|
|g:CommandTRefreshMap| <C-f>
|
587
605
|
|
606
|
+
*g:CommandTQuickfixMap*
|
607
|
+
|g:CommandTQuickfixMap| <C-q>
|
608
|
+
|
588
609
|
*g:CommandTCursorLeftMap*
|
589
610
|
|g:CommandTCursorLeftMap| <Left>
|
590
611
|
<C-h>
|
@@ -619,6 +640,11 @@ settings can be used to control behavior:
|
|
619
640
|
|
620
641
|
See the |'wildignore'| documentation for more information.
|
621
642
|
|
643
|
+
If you want to influence Command-T's file exclusion behavior without
|
644
|
+
changing your global |'wildignore'| setting, you can use the
|
645
|
+
|g:CommandTWildIgnore| setting to apply an override that takes effect
|
646
|
+
only during Command-T searches.
|
647
|
+
|
622
648
|
|
623
649
|
AUTHORS *command-t-authors*
|
624
650
|
|
@@ -626,14 +652,16 @@ Command-T is written and maintained by Wincent Colaiuta <win@wincent.com>.
|
|
626
652
|
Other contributors that have submitted patches include (in alphabetical
|
627
653
|
order):
|
628
654
|
|
629
|
-
Anthony Panozzo Mike Lundy
|
630
|
-
Daniel Hahler Nate Kane
|
631
|
-
Felix Tjandrawibawa Nicholas Alpi
|
632
|
-
Gary Bernhardt Nadav Samet
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
655
|
+
Anthony Panozzo Mike Lundy Sung Pae
|
656
|
+
Daniel Hahler Nate Kane Thomas Pelletier
|
657
|
+
Felix Tjandrawibawa Nicholas Alpi Victor Hugo Borja
|
658
|
+
Gary Bernhardt Nadav Samet Woody Peterson
|
659
|
+
Ivan Ukhov Noon Silk Yan Pritzker
|
660
|
+
Jeff Kreeftmeijer Paul Jolly Zak Johnson
|
661
|
+
Lucas de Vries Rainux Luo
|
662
|
+
Marcus Brito Scott Bronson
|
663
|
+
Marian Schubert Seth Fowler
|
664
|
+
Matthew Todd Steven Moazami
|
637
665
|
|
638
666
|
As this was the first Vim plug-in I had ever written I was heavily influenced
|
639
667
|
by the design of the LustyExplorer plug-in by Stephen Bach, which I understand
|
@@ -711,7 +739,7 @@ PayPal to win@wincent.com:
|
|
711
739
|
|
712
740
|
LICENSE *command-t-license*
|
713
741
|
|
714
|
-
Copyright 2010-
|
742
|
+
Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
|
715
743
|
|
716
744
|
Redistribution and use in source and binary forms, with or without
|
717
745
|
modification, are permitted provided that the following conditions are met:
|
@@ -736,6 +764,19 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
736
764
|
|
737
765
|
HISTORY *command-t-history*
|
738
766
|
|
767
|
+
1.5 (18 September 2013)
|
768
|
+
- don't scan "pathological" filesystem structures (ie. circular or
|
769
|
+
self-referential symlinks; patch from Marcus Brito)
|
770
|
+
- gracefully handle files starting with "+" (patch from Ivan Ukhov)
|
771
|
+
- switch default selection highlight color for better readability (suggestion
|
772
|
+
from André Arko), but make it possible to configure via the
|
773
|
+
|g:CommandTHighlightColor| setting
|
774
|
+
- added a mapping to take the current matches and put then in the quickfix
|
775
|
+
window
|
776
|
+
- performance improvements, particularly noticeable with large file
|
777
|
+
hierarchies
|
778
|
+
- added |g:CommandTWildIgnore| setting (patch from Paul Jolly)
|
779
|
+
|
739
780
|
1.4 (20 June 2012)
|
740
781
|
|
741
782
|
- added |:CommandTTag| command (patches from Noon Silk)
|
data/doc/command-t.txt
CHANGED
@@ -158,7 +158,7 @@ of the following commands:
|
|
158
158
|
|
159
159
|
Note: Make sure you compile targeting the same architecture Vim was built for.
|
160
160
|
For instance, MacVim binaries are built for i386, but sometimes GCC compiles
|
161
|
-
for x86_64. First you have to check the
|
161
|
+
for x86_64. First you have to check the platform Vim was built for:
|
162
162
|
|
163
163
|
vim --version
|
164
164
|
...
|
@@ -206,9 +206,9 @@ Or you can switch to a specific release with:
|
|
206
206
|
|
207
207
|
After installing or updating you must build the extension:
|
208
208
|
|
209
|
-
cd ~/.vim/bundle/command-t
|
210
|
-
|
211
|
-
|
209
|
+
cd ~/.vim/bundle/command-t/ruby/command-t
|
210
|
+
ruby extconf.rb
|
211
|
+
make
|
212
212
|
|
213
213
|
While the Vimball installation automatically generates the help tags, under
|
214
214
|
Pathogen it is necessary to do so explicitly from inside Vim:
|
@@ -323,6 +323,7 @@ has focus:
|
|
323
323
|
<C-p> select previous file in the file listing
|
324
324
|
<Up> select previous file in the file listing
|
325
325
|
<C-f> flush the cache (see |:CommandTFlush| for details)
|
326
|
+
<C-q> place the current matches in the quickfix window
|
326
327
|
<C-c> cancel (dismisses file listing)
|
327
328
|
|
328
329
|
The following is also available on terminals which support it:
|
@@ -420,7 +421,7 @@ changes via |:let|.
|
|
420
421
|
Following is a list of all available options:
|
421
422
|
|
422
423
|
*g:CommandTMaxFiles*
|
423
|
-
|g:CommandTMaxFiles| number (default
|
424
|
+
|g:CommandTMaxFiles| number (default 30000)
|
424
425
|
|
425
426
|
The maximum number of files that will be considered when scanning the
|
426
427
|
current directory. Upon reaching this number scanning stops. This
|
@@ -435,7 +436,7 @@ Following is a list of all available options:
|
|
435
436
|
skipped.
|
436
437
|
|
437
438
|
*g:CommandTMaxCachedDirectories*
|
438
|
-
|g:CommandTMaxCachedDirectories|
|
439
|
+
|g:CommandTMaxCachedDirectories| number (default 1)
|
439
440
|
|
440
441
|
The maximum number of directories whose contents should be cached when
|
441
442
|
recursively scanning. With the default value of 1, each time you change
|
@@ -528,6 +529,23 @@ Following is a list of all available options:
|
|
528
529
|
When this setting is off (the default) the matches in the |:CommandTTag|
|
529
530
|
listing do not include filenames.
|
530
531
|
|
532
|
+
*g:CommandTHighlightColor*
|
533
|
+
|g:CommandTHighlightColor| string (default: 'PmenuSel')
|
534
|
+
|
535
|
+
Specifies the highlight color that will be used to show the currently
|
536
|
+
selected item in the match listing window.
|
537
|
+
|
538
|
+
*g:CommandTWildIgnore*
|
539
|
+
|g:CommandTWildIgnore| string (default: none)
|
540
|
+
|
541
|
+
Optionally override Vim's global |'wildignore'| setting during Command-T
|
542
|
+
seaches. If you wish to supplement rather than replace the global
|
543
|
+
setting, you can use a syntax like:
|
544
|
+
|
545
|
+
let g:CommandTWildIgnore=&wildignore . ",**/bower_components/*"
|
546
|
+
|
547
|
+
See also |command-t-wildignore|.
|
548
|
+
|
531
549
|
As well as the basic options listed above, there are a number of settings that
|
532
550
|
can be used to override the default key mappings used by Command-T. For
|
533
551
|
example, to set <C-x> as the mapping for cancelling (dismissing) the Command-T
|
@@ -585,6 +603,9 @@ Following is a list of all map settings and their defaults:
|
|
585
603
|
*g:CommandTRefreshMap*
|
586
604
|
|g:CommandTRefreshMap| <C-f>
|
587
605
|
|
606
|
+
*g:CommandTQuickfixMap*
|
607
|
+
|g:CommandTQuickfixMap| <C-q>
|
608
|
+
|
588
609
|
*g:CommandTCursorLeftMap*
|
589
610
|
|g:CommandTCursorLeftMap| <Left>
|
590
611
|
<C-h>
|
@@ -619,6 +640,11 @@ settings can be used to control behavior:
|
|
619
640
|
|
620
641
|
See the |'wildignore'| documentation for more information.
|
621
642
|
|
643
|
+
If you want to influence Command-T's file exclusion behavior without
|
644
|
+
changing your global |'wildignore'| setting, you can use the
|
645
|
+
|g:CommandTWildIgnore| setting to apply an override that takes effect
|
646
|
+
only during Command-T searches.
|
647
|
+
|
622
648
|
|
623
649
|
AUTHORS *command-t-authors*
|
624
650
|
|
@@ -626,14 +652,16 @@ Command-T is written and maintained by Wincent Colaiuta <win@wincent.com>.
|
|
626
652
|
Other contributors that have submitted patches include (in alphabetical
|
627
653
|
order):
|
628
654
|
|
629
|
-
Anthony Panozzo Mike Lundy
|
630
|
-
Daniel Hahler Nate Kane
|
631
|
-
Felix Tjandrawibawa Nicholas Alpi
|
632
|
-
Gary Bernhardt Nadav Samet
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
655
|
+
Anthony Panozzo Mike Lundy Sung Pae
|
656
|
+
Daniel Hahler Nate Kane Thomas Pelletier
|
657
|
+
Felix Tjandrawibawa Nicholas Alpi Victor Hugo Borja
|
658
|
+
Gary Bernhardt Nadav Samet Woody Peterson
|
659
|
+
Ivan Ukhov Noon Silk Yan Pritzker
|
660
|
+
Jeff Kreeftmeijer Paul Jolly Zak Johnson
|
661
|
+
Lucas de Vries Rainux Luo
|
662
|
+
Marcus Brito Scott Bronson
|
663
|
+
Marian Schubert Seth Fowler
|
664
|
+
Matthew Todd Steven Moazami
|
637
665
|
|
638
666
|
As this was the first Vim plug-in I had ever written I was heavily influenced
|
639
667
|
by the design of the LustyExplorer plug-in by Stephen Bach, which I understand
|
@@ -711,7 +739,7 @@ PayPal to win@wincent.com:
|
|
711
739
|
|
712
740
|
LICENSE *command-t-license*
|
713
741
|
|
714
|
-
Copyright 2010-
|
742
|
+
Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
|
715
743
|
|
716
744
|
Redistribution and use in source and binary forms, with or without
|
717
745
|
modification, are permitted provided that the following conditions are met:
|
@@ -736,6 +764,19 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
736
764
|
|
737
765
|
HISTORY *command-t-history*
|
738
766
|
|
767
|
+
1.5 (18 September 2013)
|
768
|
+
- don't scan "pathological" filesystem structures (ie. circular or
|
769
|
+
self-referential symlinks; patch from Marcus Brito)
|
770
|
+
- gracefully handle files starting with "+" (patch from Ivan Ukhov)
|
771
|
+
- switch default selection highlight color for better readability (suggestion
|
772
|
+
from André Arko), but make it possible to configure via the
|
773
|
+
|g:CommandTHighlightColor| setting
|
774
|
+
- added a mapping to take the current matches and put then in the quickfix
|
775
|
+
window
|
776
|
+
- performance improvements, particularly noticeable with large file
|
777
|
+
hierarchies
|
778
|
+
- added |g:CommandTWildIgnore| setting (patch from Paul Jolly)
|
779
|
+
|
739
780
|
1.4 (20 June 2012)
|
740
781
|
|
741
782
|
- added |:CommandTTag| command (patches from Noon Silk)
|
data/doc/tags
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
:CommandT command-t.txt /*:CommandT*
|
2
|
+
:CommandTBuffer command-t.txt /*:CommandTBuffer*
|
3
|
+
:CommandTFlush command-t.txt /*:CommandTFlush*
|
4
|
+
:CommandTJumps command-t.txt /*:CommandTJumps*
|
5
|
+
:CommandTTag command-t.txt /*:CommandTTag*
|
6
|
+
command-t command-t.txt /*command-t*
|
7
|
+
command-t-authors command-t.txt /*command-t-authors*
|
8
|
+
command-t-commands command-t.txt /*command-t-commands*
|
9
|
+
command-t-contents command-t.txt /*command-t-contents*
|
10
|
+
command-t-development command-t.txt /*command-t-development*
|
11
|
+
command-t-donations command-t.txt /*command-t-donations*
|
12
|
+
command-t-history command-t.txt /*command-t-history*
|
13
|
+
command-t-installation command-t.txt /*command-t-installation*
|
14
|
+
command-t-intro command-t.txt /*command-t-intro*
|
15
|
+
command-t-license command-t.txt /*command-t-license*
|
16
|
+
command-t-mappings command-t.txt /*command-t-mappings*
|
17
|
+
command-t-options command-t.txt /*command-t-options*
|
18
|
+
command-t-pathogen command-t.txt /*command-t-pathogen*
|
19
|
+
command-t-requirements command-t.txt /*command-t-requirements*
|
20
|
+
command-t-trouble-shooting command-t.txt /*command-t-trouble-shooting*
|
21
|
+
command-t-usage command-t.txt /*command-t-usage*
|
22
|
+
command-t-website command-t.txt /*command-t-website*
|
23
|
+
command-t-wildignore command-t.txt /*command-t-wildignore*
|
24
|
+
command-t.txt command-t.txt /*command-t.txt*
|
25
|
+
g:CommandTAcceptSelectionMap command-t.txt /*g:CommandTAcceptSelectionMap*
|
26
|
+
g:CommandTAcceptSelectionSplitMap command-t.txt /*g:CommandTAcceptSelectionSplitMap*
|
27
|
+
g:CommandTAcceptSelectionTabMap command-t.txt /*g:CommandTAcceptSelectionTabMap*
|
28
|
+
g:CommandTAcceptSelectionVSplitMap command-t.txt /*g:CommandTAcceptSelectionVSplitMap*
|
29
|
+
g:CommandTAlwaysShowDotFiles command-t.txt /*g:CommandTAlwaysShowDotFiles*
|
30
|
+
g:CommandTBackspaceMap command-t.txt /*g:CommandTBackspaceMap*
|
31
|
+
g:CommandTCancelMap command-t.txt /*g:CommandTCancelMap*
|
32
|
+
g:CommandTClearMap command-t.txt /*g:CommandTClearMap*
|
33
|
+
g:CommandTCursorEndMap command-t.txt /*g:CommandTCursorEndMap*
|
34
|
+
g:CommandTCursorLeftMap command-t.txt /*g:CommandTCursorLeftMap*
|
35
|
+
g:CommandTCursorRightMap command-t.txt /*g:CommandTCursorRightMap*
|
36
|
+
g:CommandTCursorStartMap command-t.txt /*g:CommandTCursorStartMap*
|
37
|
+
g:CommandTDeleteMap command-t.txt /*g:CommandTDeleteMap*
|
38
|
+
g:CommandTHighlightColor command-t.txt /*g:CommandTHighlightColor*
|
39
|
+
g:CommandTMatchWindowAtTop command-t.txt /*g:CommandTMatchWindowAtTop*
|
40
|
+
g:CommandTMatchWindowReverse command-t.txt /*g:CommandTMatchWindowReverse*
|
41
|
+
g:CommandTMaxCachedDirectories command-t.txt /*g:CommandTMaxCachedDirectories*
|
42
|
+
g:CommandTMaxDepth command-t.txt /*g:CommandTMaxDepth*
|
43
|
+
g:CommandTMaxFiles command-t.txt /*g:CommandTMaxFiles*
|
44
|
+
g:CommandTMaxHeight command-t.txt /*g:CommandTMaxHeight*
|
45
|
+
g:CommandTMinHeight command-t.txt /*g:CommandTMinHeight*
|
46
|
+
g:CommandTNeverShowDotFiles command-t.txt /*g:CommandTNeverShowDotFiles*
|
47
|
+
g:CommandTQuickfixMap command-t.txt /*g:CommandTQuickfixMap*
|
48
|
+
g:CommandTRefreshMap command-t.txt /*g:CommandTRefreshMap*
|
49
|
+
g:CommandTScanDotDirectories command-t.txt /*g:CommandTScanDotDirectories*
|
50
|
+
g:CommandTSelectNextMap command-t.txt /*g:CommandTSelectNextMap*
|
51
|
+
g:CommandTSelectPrevMap command-t.txt /*g:CommandTSelectPrevMap*
|
52
|
+
g:CommandTTagIncludeFilenames command-t.txt /*g:CommandTTagIncludeFilenames*
|
53
|
+
g:CommandTToggleFocusMap command-t.txt /*g:CommandTToggleFocusMap*
|
54
|
+
g:CommandTWildIgnore command-t.txt /*g:CommandTWildIgnore*
|
data/plugin/command-t.vim
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
" command-t.vim
|
2
|
-
" Copyright 2010-
|
2
|
+
" Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
|
3
3
|
"
|
4
4
|
" Redistribution and use in source and binary forms, with or without
|
5
5
|
" modification, are permitted provided that the following conditions are met:
|
@@ -120,6 +120,10 @@ function CommandTAcceptSelectionVSplit()
|
|
120
120
|
ruby $command_t.accept_selection :command => 'vs'
|
121
121
|
endfunction
|
122
122
|
|
123
|
+
function CommandTQuickfix()
|
124
|
+
ruby $command_t.quickfix
|
125
|
+
endfunction
|
126
|
+
|
123
127
|
function CommandTRefresh()
|
124
128
|
ruby $command_t.refresh
|
125
129
|
endfunction
|
data/ruby/command-t/Makefile
CHANGED
@@ -4,65 +4,65 @@ SHELL = /bin/sh
|
|
4
4
|
#### Start of system configuration section. ####
|
5
5
|
|
6
6
|
srcdir = .
|
7
|
-
topdir = /
|
7
|
+
topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0
|
8
8
|
hdrdir = $(topdir)
|
9
9
|
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
10
|
+
prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
|
10
11
|
exec_prefix = $(prefix)
|
11
|
-
|
12
|
-
sharedstatedir = $(prefix)/com
|
13
|
-
mandir = $(datarootdir)/man
|
14
|
-
psdir = $(docdir)
|
15
|
-
oldincludedir = $(DESTDIR)/usr/include
|
16
|
-
localedir = $(datarootdir)/locale
|
17
|
-
bindir = $(exec_prefix)/bin
|
18
|
-
libexecdir = $(exec_prefix)/libexec
|
19
|
-
sitedir = $(libdir)/ruby/site_ruby
|
20
|
-
htmldir = $(docdir)
|
12
|
+
archdir = $(rubylibdir)/$(arch)
|
21
13
|
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
14
|
+
vendordir = $(libdir)/ruby/vendor_ruby
|
15
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
22
16
|
includedir = $(prefix)/include
|
23
|
-
|
17
|
+
libexecdir = $(exec_prefix)/libexec
|
18
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
24
19
|
vendorlibdir = $(vendordir)/$(ruby_version)
|
25
|
-
|
20
|
+
datarootdir = $(prefix)/share
|
26
21
|
libdir = $(exec_prefix)/lib
|
27
|
-
sbindir = $(exec_prefix)/sbin
|
28
|
-
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
29
22
|
docdir = $(datarootdir)/doc/$(PACKAGE)
|
23
|
+
localedir = $(datarootdir)/locale
|
24
|
+
sitedir = $(DESTDIR)/Library/Ruby/Site
|
25
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
26
|
+
mandir = $(DESTDIR)/usr/share/man
|
30
27
|
dvidir = $(docdir)
|
31
|
-
|
32
|
-
datarootdir = $(prefix)/share
|
33
|
-
pdfdir = $(docdir)
|
34
|
-
archdir = $(rubylibdir)/$(arch)
|
35
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
28
|
+
oldincludedir = $(DESTDIR)/usr/include
|
36
29
|
datadir = $(datarootdir)
|
30
|
+
sysconfdir = $(prefix)/etc
|
37
31
|
localstatedir = $(prefix)/var
|
38
|
-
|
32
|
+
sharedstatedir = $(prefix)/com
|
33
|
+
infodir = $(DESTDIR)/usr/share/info
|
34
|
+
sbindir = $(exec_prefix)/sbin
|
35
|
+
psdir = $(docdir)
|
36
|
+
htmldir = $(docdir)
|
37
|
+
pdfdir = $(docdir)
|
38
|
+
bindir = $(exec_prefix)/bin
|
39
39
|
|
40
|
-
CC =
|
40
|
+
CC = xcrun cc
|
41
41
|
LIBRUBY = $(LIBRUBY_SO)
|
42
42
|
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
43
43
|
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
44
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
|
44
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
|
45
45
|
|
46
46
|
RUBY_EXTCONF_H =
|
47
|
-
CFLAGS = -fno-common -g -
|
47
|
+
CFLAGS = -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common $(cflags)
|
48
48
|
INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
|
49
49
|
DEFS =
|
50
50
|
CPPFLAGS = -DHAVE_RUBY_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
|
51
51
|
CXXFLAGS = $(CFLAGS)
|
52
|
-
ldflags = -L.
|
52
|
+
ldflags = -L. -arch i386 -arch x86_64
|
53
53
|
dldflags =
|
54
54
|
archflag =
|
55
55
|
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
56
|
-
LDSHARED = cc -
|
56
|
+
LDSHARED = cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup
|
57
57
|
AR = ar
|
58
58
|
EXEEXT =
|
59
59
|
|
60
60
|
RUBY_INSTALL_NAME = ruby
|
61
61
|
RUBY_SO_NAME = ruby
|
62
|
-
arch =
|
63
|
-
sitearch =
|
62
|
+
arch = universal-darwin12.0
|
63
|
+
sitearch = universal-darwin12.0
|
64
64
|
ruby_version = 1.8
|
65
|
-
ruby = /
|
65
|
+
ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
|
66
66
|
RUBY = $(ruby)
|
67
67
|
RM = rm -f
|
68
68
|
MAKEDIRS = mkdir -p
|
@@ -86,7 +86,7 @@ extout =
|
|
86
86
|
extout_prefix =
|
87
87
|
target_prefix =
|
88
88
|
LOCAL_LIBS =
|
89
|
-
LIBS = $(LIBRUBYARG_SHARED) -ldl -lobjc
|
89
|
+
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
|
90
90
|
SRCS = ext.c match.c matcher.c
|
91
91
|
OBJS = ext.o match.o matcher.o
|
92
92
|
TARGET = ext
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2010-
|
1
|
+
# Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
|
2
2
|
#
|
3
3
|
# Redistribution and use in source and binary forms, with or without
|
4
4
|
# modification, are permitted provided that the following conditions are met:
|
@@ -79,6 +79,18 @@ module CommandT
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
# Take current matches and stick them in the quickfix window.
|
83
|
+
def quickfix
|
84
|
+
hide
|
85
|
+
|
86
|
+
matches = @matches.map do |match|
|
87
|
+
"{ 'filename': '#{VIM::escape_for_single_quotes match}' }"
|
88
|
+
end.join(', ')
|
89
|
+
|
90
|
+
::VIM::command 'call setqflist([' + matches + '])'
|
91
|
+
::VIM::command 'cope'
|
92
|
+
end
|
93
|
+
|
82
94
|
def refresh
|
83
95
|
return unless @active_finder && @active_finder.respond_to?(:flush)
|
84
96
|
@active_finder.flush
|
@@ -175,10 +187,11 @@ module CommandT
|
|
175
187
|
@initial_window = $curwin
|
176
188
|
@initial_buffer = $curbuf
|
177
189
|
@match_window = MatchWindow.new \
|
178
|
-
:
|
190
|
+
:highlight_color => get_string('g:CommandTHighlightColor'),
|
179
191
|
:match_window_at_top => get_bool('g:CommandTMatchWindowAtTop'),
|
180
192
|
:match_window_reverse => get_bool('g:CommandTMatchWindowReverse'),
|
181
|
-
:min_height => min_height
|
193
|
+
:min_height => min_height,
|
194
|
+
:prompt => @prompt
|
182
195
|
@focus = @prompt
|
183
196
|
@prompt.focus
|
184
197
|
register_for_key_presses
|
@@ -260,6 +273,7 @@ module CommandT
|
|
260
273
|
selection = File.expand_path selection, @path
|
261
274
|
selection = relative_path_under_working_directory selection
|
262
275
|
selection = sanitize_path_string selection
|
276
|
+
selection = File.join('.', selection) if selection =~ /^\+/
|
263
277
|
ensure_appropriate_window_selection
|
264
278
|
|
265
279
|
@active_finder.open_selection command, selection, options
|
@@ -298,6 +312,7 @@ module CommandT
|
|
298
312
|
'CursorRight' => ['<Right>', '<C-l>'],
|
299
313
|
'CursorStart' => '<C-a>',
|
300
314
|
'Delete' => '<Del>',
|
315
|
+
'Quickfix' => '<C-q>',
|
301
316
|
'Refresh' => '<C-f>',
|
302
317
|
'SelectNext' => ['<C-n>', '<C-j>', '<Down>'],
|
303
318
|
'SelectPrev' => ['<C-p>', '<C-k>', '<Up>'],
|
@@ -327,8 +342,8 @@ module CommandT
|
|
327
342
|
end
|
328
343
|
|
329
344
|
def list_matches
|
330
|
-
matches = @active_finder.sorted_matches_for @prompt.abbrev, :limit => match_limit
|
331
|
-
@match_window.matches = matches
|
345
|
+
@matches = @active_finder.sorted_matches_for @prompt.abbrev, :limit => match_limit
|
346
|
+
@match_window.matches = @matches
|
332
347
|
end
|
333
348
|
|
334
349
|
def buffer_finder
|
@@ -342,7 +357,8 @@ module CommandT
|
|
342
357
|
:max_caches => get_number('g:CommandTMaxCachedDirectories'),
|
343
358
|
:always_show_dot_files => get_bool('g:CommandTAlwaysShowDotFiles'),
|
344
359
|
:never_show_dot_files => get_bool('g:CommandTNeverShowDotFiles'),
|
345
|
-
:scan_dot_directories => get_bool('g:CommandTScanDotDirectories')
|
360
|
+
:scan_dot_directories => get_bool('g:CommandTScanDotDirectories'),
|
361
|
+
:wild_ignore => get_string('g:CommandTWildIgnore')
|
346
362
|
end
|
347
363
|
|
348
364
|
def jump_finder
|
data/ruby/command-t/ext.bundle
CHANGED
Binary file
|
data/ruby/command-t/match.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright 2010 Wincent Colaiuta. All rights reserved.
|
1
|
+
// Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
|
2
2
|
//
|
3
3
|
// Redistribution and use in source and binary forms, with or without
|
4
4
|
// modification, are permitted provided that the following conditions are met:
|
@@ -21,66 +21,79 @@
|
|
21
21
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
22
|
// POSSIBILITY OF SUCH DAMAGE.
|
23
23
|
|
24
|
+
#include "float.h"
|
24
25
|
#include "match.h"
|
25
26
|
#include "ext.h"
|
26
27
|
#include "ruby_compat.h"
|
27
28
|
|
28
29
|
// use a struct to make passing params during recursion easier
|
29
|
-
typedef struct
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
long abbrev_len; // length of same
|
30
|
+
typedef struct {
|
31
|
+
char *haystack_p; // pointer to the path string to be searched
|
32
|
+
long haystack_len; // length of same
|
33
|
+
char *needle_p; // pointer to search string (needle)
|
34
|
+
long needle_len; // length of same
|
35
35
|
double max_score_per_char;
|
36
36
|
int dot_file; // boolean: true if str is a dot-file
|
37
37
|
int always_show_dot_files; // boolean
|
38
38
|
int never_show_dot_files; // boolean
|
39
|
+
double *memo; // memoization
|
39
40
|
} matchinfo_t;
|
40
41
|
|
41
|
-
double recursive_match(matchinfo_t *m,
|
42
|
-
long
|
43
|
-
long
|
44
|
-
long last_idx,
|
45
|
-
double score)
|
42
|
+
double recursive_match(matchinfo_t *m, // sharable meta-data
|
43
|
+
long haystack_idx, // where in the path string to start
|
44
|
+
long needle_idx, // where in the needle string to start
|
45
|
+
long last_idx, // location of last matched character
|
46
|
+
double score) // cumulative score so far
|
46
47
|
{
|
47
|
-
double seen_score = 0;
|
48
|
-
int dot_file_match = 0;
|
49
|
-
int dot_search = 0;
|
48
|
+
double seen_score = 0; // remember best score seen via recursion
|
49
|
+
int dot_file_match = 0; // true if needle matches a dot-file
|
50
|
+
int dot_search = 0; // true if searching for a dot
|
51
|
+
|
52
|
+
// do we have a memoized result we can return?
|
53
|
+
double memoized = m->memo[needle_idx * m->needle_len + haystack_idx];
|
54
|
+
if (memoized != DBL_MAX)
|
55
|
+
return memoized;
|
50
56
|
|
51
|
-
|
52
|
-
{
|
53
|
-
|
57
|
+
// bail early if not enough room (left) in haystack for (rest of) needle
|
58
|
+
if (m->haystack_len - haystack_idx < m->needle_len - needle_idx) {
|
59
|
+
score = 0.0;
|
60
|
+
goto memoize;
|
61
|
+
}
|
62
|
+
|
63
|
+
for (long i = needle_idx; i < m->needle_len; i++) {
|
64
|
+
char c = m->needle_p[i];
|
54
65
|
if (c == '.')
|
55
66
|
dot_search = 1;
|
56
67
|
int found = 0;
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
68
|
+
|
69
|
+
// similar to above, we'll stop iterating when we know we're too close
|
70
|
+
// to the end of the string to possibly match
|
71
|
+
for (long j = haystack_idx;
|
72
|
+
j <= m->haystack_len - (m->needle_len - i);
|
73
|
+
j++, haystack_idx++) {
|
74
|
+
char d = m->haystack_p[j];
|
75
|
+
if (d == '.') {
|
76
|
+
if (j == 0 || m->haystack_p[j - 1] == '/') {
|
64
77
|
m->dot_file = 1; // this is a dot-file
|
65
78
|
if (dot_search) // and we are searching for a dot
|
66
79
|
dot_file_match = 1; // so this must be a match
|
67
80
|
}
|
68
|
-
}
|
69
|
-
else if (d >= 'A' && d <= 'Z')
|
81
|
+
} else if (d >= 'A' && d <= 'Z') {
|
70
82
|
d += 'a' - 'A'; // add 32 to downcase
|
71
|
-
|
72
|
-
|
83
|
+
}
|
84
|
+
|
85
|
+
if (c == d) {
|
73
86
|
found = 1;
|
74
87
|
dot_search = 0;
|
75
88
|
|
76
89
|
// calculate score
|
77
90
|
double score_for_char = m->max_score_per_char;
|
78
91
|
long distance = j - last_idx;
|
79
|
-
|
80
|
-
{
|
92
|
+
|
93
|
+
if (distance > 1) {
|
81
94
|
double factor = 1.0;
|
82
|
-
char last = m->
|
83
|
-
char curr = m->
|
95
|
+
char last = m->haystack_p[j - 1];
|
96
|
+
char curr = m->haystack_p[j]; // case matters, so get again
|
84
97
|
if (last == '/')
|
85
98
|
factor = 0.9;
|
86
99
|
else if (last == '-' ||
|
@@ -100,8 +113,7 @@ double recursive_match(matchinfo_t *m, // sharable meta-data
|
|
100
113
|
score_for_char *= factor;
|
101
114
|
}
|
102
115
|
|
103
|
-
if (++j < m->
|
104
|
-
{
|
116
|
+
if (++j < m->haystack_len) {
|
105
117
|
// bump cursor one char to the right and
|
106
118
|
// use recursion to try and find a better match
|
107
119
|
double sub_score = recursive_match(m, j, i, last_idx, score);
|
@@ -110,66 +122,81 @@ double recursive_match(matchinfo_t *m, // sharable meta-data
|
|
110
122
|
}
|
111
123
|
|
112
124
|
score += score_for_char;
|
113
|
-
last_idx =
|
125
|
+
last_idx = haystack_idx + 1;
|
114
126
|
break;
|
115
127
|
}
|
116
128
|
}
|
117
|
-
|
118
|
-
|
129
|
+
|
130
|
+
if (!found) {
|
131
|
+
score = 0.0;
|
132
|
+
goto memoize;
|
133
|
+
}
|
119
134
|
}
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
135
|
+
|
136
|
+
if (m->dot_file &&
|
137
|
+
(m->never_show_dot_files ||
|
138
|
+
(!dot_file_match && !m->always_show_dot_files))) {
|
139
|
+
score = 0.0;
|
140
|
+
goto memoize;
|
125
141
|
}
|
126
|
-
|
142
|
+
score = score > seen_score ? score : seen_score;
|
143
|
+
|
144
|
+
memoize:
|
145
|
+
m->memo[needle_idx * m->needle_len + haystack_idx] = score;
|
146
|
+
return score;
|
127
147
|
}
|
128
148
|
|
129
|
-
// Match.new
|
149
|
+
// Match.new needle, string, options = {}
|
130
150
|
VALUE CommandTMatch_initialize(int argc, VALUE *argv, VALUE self)
|
131
151
|
{
|
132
152
|
// process arguments: 2 mandatory, 1 optional
|
133
|
-
VALUE str,
|
134
|
-
if (rb_scan_args(argc, argv, "21", &str, &
|
153
|
+
VALUE str, needle, options;
|
154
|
+
if (rb_scan_args(argc, argv, "21", &str, &needle, &options) == 2)
|
135
155
|
options = Qnil;
|
136
|
-
str
|
137
|
-
|
156
|
+
str = StringValue(str);
|
157
|
+
needle = StringValue(needle); // already downcased by caller
|
138
158
|
|
139
159
|
// check optional options hash for overrides
|
140
160
|
VALUE always_show_dot_files = CommandT_option_from_hash("always_show_dot_files", options);
|
141
161
|
VALUE never_show_dot_files = CommandT_option_from_hash("never_show_dot_files", options);
|
142
162
|
|
143
163
|
matchinfo_t m;
|
144
|
-
m.
|
145
|
-
m.
|
146
|
-
m.
|
147
|
-
m.
|
148
|
-
m.max_score_per_char = (1.0 / m.
|
164
|
+
m.haystack_p = RSTRING_PTR(str);
|
165
|
+
m.haystack_len = RSTRING_LEN(str);
|
166
|
+
m.needle_p = RSTRING_PTR(needle);
|
167
|
+
m.needle_len = RSTRING_LEN(needle);
|
168
|
+
m.max_score_per_char = (1.0 / m.haystack_len + 1.0 / m.needle_len) / 2;
|
149
169
|
m.dot_file = 0;
|
150
170
|
m.always_show_dot_files = always_show_dot_files == Qtrue;
|
151
171
|
m.never_show_dot_files = never_show_dot_files == Qtrue;
|
152
172
|
|
153
173
|
// calculate score
|
154
174
|
double score = 1.0;
|
155
|
-
|
156
|
-
|
175
|
+
|
176
|
+
// special case for zero-length search string
|
177
|
+
if (m.needle_len == 0) {
|
178
|
+
|
157
179
|
// filter out dot files
|
158
|
-
if (!m.always_show_dot_files)
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
if (c == '.' && (i == 0 || m.str_p[i - 1] == '/'))
|
164
|
-
{
|
180
|
+
if (!m.always_show_dot_files) {
|
181
|
+
for (long i = 0; i < m.haystack_len; i++) {
|
182
|
+
char c = m.haystack_p[i];
|
183
|
+
|
184
|
+
if (c == '.' && (i == 0 || m.haystack_p[i - 1] == '/')) {
|
165
185
|
score = 0.0;
|
166
186
|
break;
|
167
187
|
}
|
168
188
|
}
|
169
189
|
}
|
170
|
-
}
|
171
|
-
|
190
|
+
} else if (m.haystack_len > 0) { // normal case
|
191
|
+
|
192
|
+
// prepare for memoization
|
193
|
+
double memo[m.haystack_len * m.needle_len];
|
194
|
+
for (long i = 0, max = m.haystack_len * m.needle_len; i < max; i++)
|
195
|
+
memo[i] = DBL_MAX;
|
196
|
+
m.memo = memo;
|
197
|
+
|
172
198
|
score = recursive_match(&m, 0, 0, 0, 0.0);
|
199
|
+
}
|
173
200
|
|
174
201
|
// clean-up and final book-keeping
|
175
202
|
rb_iv_set(self, "@score", rb_float_new(score));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2010-
|
1
|
+
# Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
|
2
2
|
#
|
3
3
|
# Redistribution and use in source and binary forms, with or without
|
4
4
|
# modification, are permitted provided that the following conditions are met:
|
@@ -34,9 +34,10 @@ module CommandT
|
|
34
34
|
@@buffer = nil
|
35
35
|
|
36
36
|
def initialize options = {}
|
37
|
-
@
|
38
|
-
@
|
39
|
-
@
|
37
|
+
@highlight_color = options[:highlight_color] || 'PmenuSel'
|
38
|
+
@min_height = options[:min_height]
|
39
|
+
@prompt = options[:prompt]
|
40
|
+
@reverse_list = options[:match_window_reverse]
|
40
41
|
|
41
42
|
# save existing window dimensions so we can restore them later
|
42
43
|
@windows = []
|
@@ -112,7 +113,7 @@ module CommandT
|
|
112
113
|
'gui=bold,underline'
|
113
114
|
end
|
114
115
|
|
115
|
-
::VIM::command
|
116
|
+
::VIM::command "highlight link CommandTSelection #{@highlight_color}"
|
116
117
|
::VIM::command 'highlight link CommandTNoEntries Error'
|
117
118
|
::VIM::evaluate 'clearmatches()'
|
118
119
|
|
@@ -227,7 +228,7 @@ module CommandT
|
|
227
228
|
if @has_focus
|
228
229
|
@has_focus = false
|
229
230
|
if VIM::has_syntax?
|
230
|
-
::VIM::command
|
231
|
+
::VIM::command "highlight link CommandTSelection #{@highlight_color}"
|
231
232
|
end
|
232
233
|
end
|
233
234
|
end
|
data/ruby/command-t/matcher.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright 2010 Wincent Colaiuta. All rights reserved.
|
1
|
+
// Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
|
2
2
|
//
|
3
3
|
// Redistribution and use in source and binary forms, with or without
|
4
4
|
// modification, are permitted provided that the following conditions are met:
|
@@ -32,40 +32,39 @@ int comp_alpha(const void *a, const void *b)
|
|
32
32
|
{
|
33
33
|
VALUE a_val = *(VALUE *)a;
|
34
34
|
VALUE b_val = *(VALUE *)b;
|
35
|
-
ID
|
36
|
-
|
35
|
+
ID to_s = rb_intern("to_s");
|
37
36
|
VALUE a_str = rb_funcall(a_val, to_s, 0);
|
38
37
|
VALUE b_str = rb_funcall(b_val, to_s, 0);
|
39
|
-
char
|
40
|
-
long
|
41
|
-
char
|
42
|
-
long
|
43
|
-
int
|
44
|
-
|
45
|
-
{
|
38
|
+
char *a_p = RSTRING_PTR(a_str);
|
39
|
+
long a_len = RSTRING_LEN(a_str);
|
40
|
+
char *b_p = RSTRING_PTR(b_str);
|
41
|
+
long b_len = RSTRING_LEN(b_str);
|
42
|
+
int order = 0;
|
43
|
+
|
44
|
+
if (a_len > b_len) {
|
46
45
|
order = strncmp(a_p, b_p, b_len);
|
47
46
|
if (order == 0)
|
48
47
|
order = 1; // shorter string (b) wins
|
49
|
-
}
|
50
|
-
else if (a_len < b_len)
|
51
|
-
{
|
48
|
+
} else if (a_len < b_len) {
|
52
49
|
order = strncmp(a_p, b_p, a_len);
|
53
50
|
if (order == 0)
|
54
51
|
order = -1; // shorter string (a) wins
|
55
|
-
}
|
56
|
-
else
|
52
|
+
} else {
|
57
53
|
order = strncmp(a_p, b_p, a_len);
|
54
|
+
}
|
55
|
+
|
58
56
|
return order;
|
59
57
|
}
|
60
58
|
|
61
59
|
// comparison function for use with qsort
|
62
60
|
int comp_score(const void *a, const void *b)
|
63
61
|
{
|
64
|
-
VALUE
|
65
|
-
VALUE
|
66
|
-
ID
|
62
|
+
VALUE a_val = *(VALUE *)a;
|
63
|
+
VALUE b_val = *(VALUE *)b;
|
64
|
+
ID score = rb_intern("score");
|
67
65
|
double a_score = RFLOAT_VALUE(rb_funcall(a_val, score, 0));
|
68
66
|
double b_score = RFLOAT_VALUE(rb_funcall(b_val, score, 0));
|
67
|
+
|
69
68
|
if (a_score > b_score)
|
70
69
|
return -1; // a scores higher, a should appear sooner
|
71
70
|
else if (a_score < b_score)
|
@@ -78,21 +77,26 @@ VALUE CommandTMatcher_initialize(int argc, VALUE *argv, VALUE self)
|
|
78
77
|
{
|
79
78
|
// process arguments: 1 mandatory, 1 optional
|
80
79
|
VALUE scanner, options;
|
80
|
+
|
81
81
|
if (rb_scan_args(argc, argv, "11", &scanner, &options) == 1)
|
82
82
|
options = Qnil;
|
83
83
|
if (NIL_P(scanner))
|
84
84
|
rb_raise(rb_eArgError, "nil scanner");
|
85
|
+
|
85
86
|
rb_iv_set(self, "@scanner", scanner);
|
86
87
|
|
87
88
|
// check optional options hash for overrides
|
88
89
|
VALUE always_show_dot_files = CommandT_option_from_hash("always_show_dot_files", options);
|
89
90
|
if (always_show_dot_files != Qtrue)
|
90
91
|
always_show_dot_files = Qfalse;
|
92
|
+
|
91
93
|
VALUE never_show_dot_files = CommandT_option_from_hash("never_show_dot_files", options);
|
92
94
|
if (never_show_dot_files != Qtrue)
|
93
95
|
never_show_dot_files = Qfalse;
|
96
|
+
|
94
97
|
rb_iv_set(self, "@always_show_dot_files", always_show_dot_files);
|
95
98
|
rb_iv_set(self, "@never_show_dot_files", never_show_dot_files);
|
99
|
+
|
96
100
|
return Qnil;
|
97
101
|
}
|
98
102
|
|
@@ -119,8 +123,7 @@ VALUE CommandTMatcher_sorted_matches_for(VALUE self, VALUE abbrev, VALUE options
|
|
119
123
|
limit = RARRAY_LEN(matches);
|
120
124
|
|
121
125
|
// will return an array of strings, not an array of Match objects
|
122
|
-
for (long i = 0; i < limit; i++)
|
123
|
-
{
|
126
|
+
for (long i = 0; i < limit; i++) {
|
124
127
|
VALUE str = rb_funcall(RARRAY_PTR(matches)[i], rb_intern("to_s"), 0);
|
125
128
|
RARRAY_PTR(matches)[i] = str;
|
126
129
|
}
|
@@ -129,6 +132,7 @@ VALUE CommandTMatcher_sorted_matches_for(VALUE self, VALUE abbrev, VALUE options
|
|
129
132
|
if (limit < RARRAY_LEN(matches))
|
130
133
|
(void)rb_funcall(matches, rb_intern("slice!"), 2, LONG2NUM(limit),
|
131
134
|
LONG2NUM(RARRAY_LEN(matches) - limit));
|
135
|
+
|
132
136
|
return matches;
|
133
137
|
}
|
134
138
|
|
@@ -136,29 +140,30 @@ VALUE CommandTMatcher_matches_for(VALUE self, VALUE abbrev)
|
|
136
140
|
{
|
137
141
|
if (NIL_P(abbrev))
|
138
142
|
rb_raise(rb_eArgError, "nil abbrev");
|
143
|
+
|
139
144
|
VALUE matches = rb_ary_new();
|
140
145
|
VALUE scanner = rb_iv_get(self, "@scanner");
|
141
146
|
VALUE always_show_dot_files = rb_iv_get(self, "@always_show_dot_files");
|
142
147
|
VALUE never_show_dot_files = rb_iv_get(self, "@never_show_dot_files");
|
143
148
|
VALUE options = Qnil;
|
144
|
-
|
145
|
-
{
|
149
|
+
|
150
|
+
if (always_show_dot_files == Qtrue) {
|
146
151
|
options = rb_hash_new();
|
147
152
|
rb_hash_aset(options, ID2SYM(rb_intern("always_show_dot_files")), always_show_dot_files);
|
148
|
-
}
|
149
|
-
else if (never_show_dot_files == Qtrue)
|
150
|
-
{
|
153
|
+
} else if (never_show_dot_files == Qtrue) {
|
151
154
|
options = rb_hash_new();
|
152
155
|
rb_hash_aset(options, ID2SYM(rb_intern("never_show_dot_files")), never_show_dot_files);
|
153
156
|
}
|
157
|
+
|
154
158
|
abbrev = rb_funcall(abbrev, rb_intern("downcase"), 0);
|
155
159
|
VALUE paths = rb_funcall(scanner, rb_intern("paths"), 0);
|
156
|
-
|
157
|
-
{
|
160
|
+
|
161
|
+
for (long i = 0, max = RARRAY_LEN(paths); i < max; i++) {
|
158
162
|
VALUE path = RARRAY_PTR(paths)[i];
|
159
163
|
VALUE match = rb_funcall(cCommandTMatch, rb_intern("new"), 3, path, abbrev, options);
|
160
164
|
if (rb_funcall(match, rb_intern("matches?"), 0) == Qtrue)
|
161
165
|
rb_funcall(matches, rb_intern("push"), 1, match);
|
162
166
|
}
|
167
|
+
|
163
168
|
return matches;
|
164
169
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2010-
|
1
|
+
# Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
|
2
2
|
#
|
3
3
|
# Redistribution and use in source and binary forms, with or without
|
4
4
|
# modification, are permitted provided that the following conditions are met:
|
@@ -35,9 +35,11 @@ module CommandT
|
|
35
35
|
@paths_keys = []
|
36
36
|
@path = path
|
37
37
|
@max_depth = options[:max_depth] || 15
|
38
|
-
@max_files = options[:max_files] ||
|
38
|
+
@max_files = options[:max_files] || 30_000
|
39
39
|
@max_caches = options[:max_caches] || 1
|
40
40
|
@scan_dot_directories = options[:scan_dot_directories] || false
|
41
|
+
@wild_ignore = options[:wild_ignore]
|
42
|
+
@base_wild_ignore = VIM::wild_ignore
|
41
43
|
end
|
42
44
|
|
43
45
|
def paths
|
@@ -48,8 +50,11 @@ module CommandT
|
|
48
50
|
@depth = 0
|
49
51
|
@files = 0
|
50
52
|
@prefix_len = @path.chomp('/').length
|
53
|
+
set_wild_ignore(@wild_ignore)
|
51
54
|
add_paths_for_directory @path, @paths[@path]
|
52
55
|
rescue FileLimitExceeded
|
56
|
+
ensure
|
57
|
+
set_wild_ignore(@base_wild_ignore)
|
53
58
|
end
|
54
59
|
@paths[@path]
|
55
60
|
end
|
@@ -76,6 +81,17 @@ module CommandT
|
|
76
81
|
::VIM::evaluate("empty(expand(fnameescape('#{path}')))").to_i == 1
|
77
82
|
end
|
78
83
|
|
84
|
+
def looped_symlink? path
|
85
|
+
if File.symlink?(path)
|
86
|
+
target = File.expand_path(File.readlink(path), File.dirname(path))
|
87
|
+
target.include?(@path) || @path.include?(target)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def set_wild_ignore(ignore)
|
92
|
+
::VIM::command("set wildignore=#{ignore}") if @wild_ignore
|
93
|
+
end
|
94
|
+
|
79
95
|
def add_paths_for_directory dir, accumulator
|
80
96
|
Dir.foreach(dir) do |entry|
|
81
97
|
next if ['.', '..'].include?(entry)
|
@@ -88,6 +104,7 @@ module CommandT
|
|
88
104
|
elsif File.directory?(path)
|
89
105
|
next if @depth >= @max_depth
|
90
106
|
next if (entry.match(/\A\./) && !@scan_dot_directories)
|
107
|
+
next if looped_symlink?(path)
|
91
108
|
@depth += 1
|
92
109
|
add_paths_for_directory path, accumulator
|
93
110
|
@depth -= 1
|
data/ruby/command-t/vim.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2010-
|
1
|
+
# Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
|
2
2
|
#
|
3
3
|
# Redistribution and use in source and binary forms, with or without
|
4
4
|
# modification, are permitted provided that the following conditions are met:
|
@@ -42,6 +42,10 @@ module CommandT
|
|
42
42
|
::VIM::evaluate 'getcwd()'
|
43
43
|
end
|
44
44
|
|
45
|
+
def self.wild_ignore
|
46
|
+
exists?('&wildignore') && ::VIM::evaluate('&wildignore').to_s
|
47
|
+
end
|
48
|
+
|
45
49
|
# Execute cmd, capturing the output into a variable and returning it.
|
46
50
|
def self.capture cmd
|
47
51
|
::VIM::command 'silent redir => g:command_t_captured_output'
|
metadata
CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
version: "1.
|
7
|
+
- 5
|
8
|
+
version: "1.5"
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Wincent Colaiuta
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- ruby/command-t/vim/window.rb
|
62
62
|
- ruby/command-t/vim.rb
|
63
63
|
- doc/command-t.txt
|
64
|
+
- doc/tags
|
64
65
|
- plugin/command-t.vim
|
65
66
|
has_rdoc: true
|
66
67
|
homepage: https://wincent.com/products/command-t
|