command-t 1.8 → 1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c55e2ba2d749e3863e2f3a2d2d1d609c5425d4b4
4
- data.tar.gz: 6320c53cbf425cd71a877f17b70e6e038c5772b4
3
+ metadata.gz: 5ea08cbb41b53e0a6082ceb5a9742a0c5ed49ad4
4
+ data.tar.gz: 3aff58b953abcb7b3bc60b502e4ab3fc6aa27148
5
5
  SHA512:
6
- metadata.gz: df4c6b4065a0c165b0a62542a4e9fa27d5c4752fd5fc8be2557d43158aba160c1df14040d7f027f9327bf4d16ee6c22e090f76f4eb1716398d7e7970d1d39940
7
- data.tar.gz: c6cdb4305a1f306a8f018773c1979cb9512e0fb4e33941658eb93f50151a3ed5d69707f09753e00de25e91ac57e5f6cd109e9927fc3c6427577cf2ab44b512cd
6
+ metadata.gz: 45148109bc52ac99034472a769bb7dfd9b0372fc587bda34f2a13603958acc25b2737a3da8f1ca62deed908e277936b3583245aaa3f6f38f5c102a159d7ca527
7
+ data.tar.gz: c7020d77f8466b583348b46f10a49a2c139075e181e3d54f05e1b2bab3f6f5ce9c22124cb608cc4497cebb04615b22dd2f0c4563fee5985ff1f1b983bde0679e
data/README.txt CHANGED
@@ -369,18 +369,30 @@ paths which begin with the same prefix.
369
369
  COMMANDS *command-t-commands*
370
370
 
371
371
  *:CommandT*
372
- |:CommandT| Brings up the Command-T file window, starting in the
372
+ |:CommandT| Brings up the Command-T file window, starting in the
373
373
  current working directory as returned by the|:pwd|
374
374
  command.
375
375
 
376
376
  *:CommandTBuffer*
377
- |:CommandTBuffer|Brings up the Command-T buffer window.
377
+ |:CommandTBuffer| Brings up the Command-T buffer window.
378
378
  This works exactly like the standard file window,
379
379
  except that the selection is limited to files that
380
380
  you already have open in buffers.
381
381
 
382
+ *:CommandTMRU*
383
+ |:CommandTMRU| Brings up the Command-T buffer window, except that matches
384
+ are shown in MRU (most recently used) order. If you prefer to
385
+ use this over the normal buffer finder, I suggest overwriting
386
+ the standard mapping with a command like:
387
+
388
+ :nnoremap <silent> <leader>b :CommandTMRU<CR>
389
+
390
+ Note that Command-T only starts recording most recently used
391
+ buffers when you first use a Command-T command or mapping;
392
+ this is an optimization to improve startup time.
393
+
382
394
  *:CommandTJumps*
383
- |:CommandTJump| Brings up the Command-T jumplist window.
395
+ |:CommandTJump| Brings up the Command-T jumplist window.
384
396
  This works exactly like the standard file window,
385
397
  except that the selection is limited to files that
386
398
  you already have in the jumplist. Note that jumps
@@ -388,13 +400,13 @@ COMMANDS *command-t-commands*
388
400
  documentation for more info).
389
401
 
390
402
  *:CommandTTag*
391
- |:CommandTTag| Brings up the Command-T window tags window, which can
403
+ |:CommandTTag| Brings up the Command-T window tags window, which can
392
404
  be used to select from the tags, if any, returned by
393
405
  Vim's |taglist()| function. See Vim's |tag| documentation
394
406
  for general info on tags.
395
407
 
396
408
  *:CommandTFlush*
397
- |:CommandTFlush|Instructs the plug-in to flush its path cache, causing
409
+ |:CommandTFlush| Instructs the plug-in to flush its path cache, causing
398
410
  the directory to be rescanned for new or deleted paths
399
411
  the next time the file window is shown (pressing <C-f> when
400
412
  a match listing is visible flushes the cache immediately; this
@@ -742,6 +754,19 @@ To disable flow control, add the following to your `.zshrc` or
742
754
 
743
755
  See the `stty` man page for more details.
744
756
 
757
+ Why doesn't the Escape key close the match listing in terminal Vim? ~
758
+
759
+ In some terminals such as xterm the Escape key misbehaves, so Command-T
760
+ doesn't set up a mapping for it. If you want to try using the escape key
761
+ anyway, you can add something like the following to your ~/.vimrc file:
762
+
763
+ if &term =~ "xterm" || &term =~ "screen"
764
+ let g:CommandTCancelMap = ['<ESC>', '<C-c>']
765
+ endif
766
+
767
+ This configuration has worked for me with recent versions of Vim on multiple
768
+ platforms (OS X, CentOS etc).
769
+
745
770
 
746
771
  TIPS *command-t-tips*
747
772
 
@@ -863,17 +888,18 @@ Command-T is written and maintained by Wincent Colaiuta <win@wincent.com>.
863
888
  Other contributors that have submitted patches include (in alphabetical
864
889
  order):
865
890
 
866
- Andy Waite Mike Lundy Shlomi Fish
867
- Anthony Panozzo Nadav Samet Steven Moazami
868
- Daniel Hahler Nate Kane Sung Pae
869
- Felix Tjandrawibawa Nicholas Alpi Thomas Pelletier
870
- Gary Bernhardt Noon Silk Victor Hugo Borja
871
- Ivan Ukhov Paul Jolly Vít Ondruch
872
- Jeff Kreeftmeijer Pavel Sergeev Woody Peterson
873
- Lucas de Vries Rainux Luo Yan Pritzker
874
- Marcus Brito Roland Puntaier Yiding Jia
891
+ Andy Waite Nadav Samet Steven Moazami
892
+ Anthony Panozzo Nate Kane Sung Pae
893
+ Daniel Hahler Nicholas Alpi Thomas Pelletier
894
+ Felix Tjandrawibawa Noon Silk Ton van den Heuvel
895
+ Gary Bernhardt Paul Jolly Victor Hugo Borja
896
+ Ivan Ukhov Pavel Sergeev Vít Ondruch
897
+ Jeff Kreeftmeijer Rainux Luo Woody Peterson
898
+ Lucas de Vries Roland Puntaier Yan Pritzker
899
+ Marcus Brito Ross Lagerwall Yiding Jia
875
900
  Marian Schubert Scott Bronson Zak Johnson
876
901
  Matthew Todd Seth Fowler
902
+ Mike Lundy Shlomi Fish
877
903
 
878
904
  As this was the first Vim plug-in I had ever written I was heavily influenced
879
905
  by the design of the LustyExplorer plug-in by Stephen Bach, which I understand
@@ -976,6 +1002,18 @@ POSSIBILITY OF SUCH DAMAGE.
976
1002
 
977
1003
  HISTORY *command-t-history*
978
1004
 
1005
+ 1.9 (25 May 2014)
1006
+
1007
+ - improved startup time using Vim's autload mechanism (patch from Ross
1008
+ Lagerwall)
1009
+ - added MRU (most-recently-used) buffer finder (patch from Ton van den Heuvel)
1010
+ - fixed edge case in matching algorithm which could cause spurious matches
1011
+ with queries containing repeated characters
1012
+ - fixed slight positive bias in the match scoring algorithm's weighting of
1013
+ matching characters based on distance from last match
1014
+ - tune memoization in match scoring algorithm, yield a more than 10% speed
1015
+ boost
1016
+
979
1017
  1.8 (31 March 2014)
980
1018
 
981
1019
  - taught Watchman file scanner to use the binary protocol instead of JSON,
@@ -369,18 +369,30 @@ paths which begin with the same prefix.
369
369
  COMMANDS *command-t-commands*
370
370
 
371
371
  *:CommandT*
372
- |:CommandT| Brings up the Command-T file window, starting in the
372
+ |:CommandT| Brings up the Command-T file window, starting in the
373
373
  current working directory as returned by the|:pwd|
374
374
  command.
375
375
 
376
376
  *:CommandTBuffer*
377
- |:CommandTBuffer|Brings up the Command-T buffer window.
377
+ |:CommandTBuffer| Brings up the Command-T buffer window.
378
378
  This works exactly like the standard file window,
379
379
  except that the selection is limited to files that
380
380
  you already have open in buffers.
381
381
 
382
+ *:CommandTMRU*
383
+ |:CommandTMRU| Brings up the Command-T buffer window, except that matches
384
+ are shown in MRU (most recently used) order. If you prefer to
385
+ use this over the normal buffer finder, I suggest overwriting
386
+ the standard mapping with a command like:
387
+
388
+ :nnoremap <silent> <leader>b :CommandTMRU<CR>
389
+
390
+ Note that Command-T only starts recording most recently used
391
+ buffers when you first use a Command-T command or mapping;
392
+ this is an optimization to improve startup time.
393
+
382
394
  *:CommandTJumps*
383
- |:CommandTJump| Brings up the Command-T jumplist window.
395
+ |:CommandTJump| Brings up the Command-T jumplist window.
384
396
  This works exactly like the standard file window,
385
397
  except that the selection is limited to files that
386
398
  you already have in the jumplist. Note that jumps
@@ -388,13 +400,13 @@ COMMANDS *command-t-commands*
388
400
  documentation for more info).
389
401
 
390
402
  *:CommandTTag*
391
- |:CommandTTag| Brings up the Command-T window tags window, which can
403
+ |:CommandTTag| Brings up the Command-T window tags window, which can
392
404
  be used to select from the tags, if any, returned by
393
405
  Vim's |taglist()| function. See Vim's |tag| documentation
394
406
  for general info on tags.
395
407
 
396
408
  *:CommandTFlush*
397
- |:CommandTFlush|Instructs the plug-in to flush its path cache, causing
409
+ |:CommandTFlush| Instructs the plug-in to flush its path cache, causing
398
410
  the directory to be rescanned for new or deleted paths
399
411
  the next time the file window is shown (pressing <C-f> when
400
412
  a match listing is visible flushes the cache immediately; this
@@ -742,6 +754,19 @@ To disable flow control, add the following to your `.zshrc` or
742
754
 
743
755
  See the `stty` man page for more details.
744
756
 
757
+ Why doesn't the Escape key close the match listing in terminal Vim? ~
758
+
759
+ In some terminals such as xterm the Escape key misbehaves, so Command-T
760
+ doesn't set up a mapping for it. If you want to try using the escape key
761
+ anyway, you can add something like the following to your ~/.vimrc file:
762
+
763
+ if &term =~ "xterm" || &term =~ "screen"
764
+ let g:CommandTCancelMap = ['<ESC>', '<C-c>']
765
+ endif
766
+
767
+ This configuration has worked for me with recent versions of Vim on multiple
768
+ platforms (OS X, CentOS etc).
769
+
745
770
 
746
771
  TIPS *command-t-tips*
747
772
 
@@ -863,17 +888,18 @@ Command-T is written and maintained by Wincent Colaiuta <win@wincent.com>.
863
888
  Other contributors that have submitted patches include (in alphabetical
864
889
  order):
865
890
 
866
- Andy Waite Mike Lundy Shlomi Fish
867
- Anthony Panozzo Nadav Samet Steven Moazami
868
- Daniel Hahler Nate Kane Sung Pae
869
- Felix Tjandrawibawa Nicholas Alpi Thomas Pelletier
870
- Gary Bernhardt Noon Silk Victor Hugo Borja
871
- Ivan Ukhov Paul Jolly Vít Ondruch
872
- Jeff Kreeftmeijer Pavel Sergeev Woody Peterson
873
- Lucas de Vries Rainux Luo Yan Pritzker
874
- Marcus Brito Roland Puntaier Yiding Jia
891
+ Andy Waite Nadav Samet Steven Moazami
892
+ Anthony Panozzo Nate Kane Sung Pae
893
+ Daniel Hahler Nicholas Alpi Thomas Pelletier
894
+ Felix Tjandrawibawa Noon Silk Ton van den Heuvel
895
+ Gary Bernhardt Paul Jolly Victor Hugo Borja
896
+ Ivan Ukhov Pavel Sergeev Vít Ondruch
897
+ Jeff Kreeftmeijer Rainux Luo Woody Peterson
898
+ Lucas de Vries Roland Puntaier Yan Pritzker
899
+ Marcus Brito Ross Lagerwall Yiding Jia
875
900
  Marian Schubert Scott Bronson Zak Johnson
876
901
  Matthew Todd Seth Fowler
902
+ Mike Lundy Shlomi Fish
877
903
 
878
904
  As this was the first Vim plug-in I had ever written I was heavily influenced
879
905
  by the design of the LustyExplorer plug-in by Stephen Bach, which I understand
@@ -976,6 +1002,18 @@ POSSIBILITY OF SUCH DAMAGE.
976
1002
 
977
1003
  HISTORY *command-t-history*
978
1004
 
1005
+ 1.9 (25 May 2014)
1006
+
1007
+ - improved startup time using Vim's autload mechanism (patch from Ross
1008
+ Lagerwall)
1009
+ - added MRU (most-recently-used) buffer finder (patch from Ton van den Heuvel)
1010
+ - fixed edge case in matching algorithm which could cause spurious matches
1011
+ with queries containing repeated characters
1012
+ - fixed slight positive bias in the match scoring algorithm's weighting of
1013
+ matching characters based on distance from last match
1014
+ - tune memoization in match scoring algorithm, yield a more than 10% speed
1015
+ boost
1016
+
979
1017
  1.8 (31 March 2014)
980
1018
 
981
1019
  - taught Watchman file scanner to use the binary protocol instead of JSON,
data/doc/tags CHANGED
@@ -2,6 +2,7 @@
2
2
  :CommandTBuffer command-t.txt /*:CommandTBuffer*
3
3
  :CommandTFlush command-t.txt /*:CommandTFlush*
4
4
  :CommandTJumps command-t.txt /*:CommandTJumps*
5
+ :CommandTMRU command-t.txt /*:CommandTMRU*
5
6
  :CommandTTag command-t.txt /*:CommandTTag*
6
7
  command-t command-t.txt /*command-t*
7
8
  command-t-authors command-t.txt /*command-t-authors*
@@ -1,4 +1,3 @@
1
- " command-t.vim
2
1
  " Copyright 2010-2014 Wincent Colaiuta. All rights reserved.
3
2
  "
4
3
  " Redistribution and use in source and binary forms, with or without
@@ -27,168 +26,21 @@ if exists("g:command_t_loaded") || &cp
27
26
  endif
28
27
  let g:command_t_loaded = 1
29
28
 
30
- command CommandTBuffer call <SID>CommandTShowBufferFinder()
31
- command CommandTJump call <SID>CommandTShowJumpFinder()
32
- command CommandTTag call <SID>CommandTShowTagFinder()
33
- command -nargs=? -complete=dir CommandT call <SID>CommandTShowFileFinder(<q-args>)
34
- command CommandTFlush call <SID>CommandTFlush()
29
+ command CommandTBuffer call commandt#CommandTShowBufferFinder()
30
+ command CommandTJump call commandt#CommandTShowJumpFinder()
31
+ command CommandTMRU call commandt#CommandTShowMRUFinder()
32
+ command CommandTTag call commandt#CommandTShowTagFinder()
33
+ command -nargs=? -complete=dir CommandT call commandt#CommandTShowFileFinder(<q-args>)
34
+ command CommandTFlush call commandt#CommandTFlush()
35
35
 
36
- if !hasmapto(':CommandT<CR>')
36
+ if !hasmapto(':CommandT<CR>') && maparg('<Leader>t', 'n') == ''
37
37
  silent! nnoremap <unique> <silent> <Leader>t :CommandT<CR>
38
38
  endif
39
39
 
40
- if !hasmapto(':CommandTBuffer<CR>')
40
+ if !hasmapto(':CommandTBuffer<CR>') && maparg('<Leader>b', 'n') == ''
41
41
  silent! nnoremap <unique> <silent> <Leader>b :CommandTBuffer<CR>
42
42
  endif
43
43
 
44
- function s:CommandTRubyWarning()
45
- echohl WarningMsg
46
- echo "command-t.vim requires Vim to be compiled with Ruby support"
47
- echo "For more information type: :help command-t"
48
- echohl none
49
- endfunction
50
-
51
- function s:CommandTShowBufferFinder()
52
- if has('ruby')
53
- ruby $command_t.show_buffer_finder
54
- else
55
- call s:CommandTRubyWarning()
56
- endif
57
- endfunction
58
-
59
- function s:CommandTShowFileFinder(arg)
60
- if has('ruby')
61
- ruby $command_t.show_file_finder
62
- else
63
- call s:CommandTRubyWarning()
64
- endif
65
- endfunction
66
-
67
- function s:CommandTShowJumpFinder()
68
- if has('ruby')
69
- ruby $command_t.show_jump_finder
70
- else
71
- call s:CommandTRubyWarning()
72
- endif
73
- endfunction
74
-
75
- function s:CommandTShowTagFinder()
76
- if has('ruby')
77
- ruby $command_t.show_tag_finder
78
- else
79
- call s:CommandTRubyWarning()
80
- endif
81
- endfunction
82
-
83
- function s:CommandTFlush()
84
- if has('ruby')
85
- ruby $command_t.flush
86
- else
87
- call s:CommandTRubyWarning()
88
- endif
89
- endfunction
90
-
91
44
  if !has('ruby')
92
45
  finish
93
46
  endif
94
-
95
- function CommandTListMatches()
96
- ruby $command_t.list_matches
97
- endfunction
98
-
99
- function CommandTHandleKey(arg)
100
- ruby $command_t.handle_key
101
- endfunction
102
-
103
- function CommandTBackspace()
104
- ruby $command_t.backspace
105
- endfunction
106
-
107
- function CommandTDelete()
108
- ruby $command_t.delete
109
- endfunction
110
-
111
- function CommandTAcceptSelection()
112
- ruby $command_t.accept_selection
113
- endfunction
114
-
115
- function CommandTAcceptSelectionTab()
116
- ruby $command_t.accept_selection :command => 'tabe'
117
- endfunction
118
-
119
- function CommandTAcceptSelectionSplit()
120
- ruby $command_t.accept_selection :command => 'sp'
121
- endfunction
122
-
123
- function CommandTAcceptSelectionVSplit()
124
- ruby $command_t.accept_selection :command => 'vs'
125
- endfunction
126
-
127
- function CommandTQuickfix()
128
- ruby $command_t.quickfix
129
- endfunction
130
-
131
- function CommandTRefresh()
132
- ruby $command_t.refresh
133
- endfunction
134
-
135
- function CommandTToggleFocus()
136
- ruby $command_t.toggle_focus
137
- endfunction
138
-
139
- function CommandTCancel()
140
- ruby $command_t.cancel
141
- endfunction
142
-
143
- function CommandTSelectNext()
144
- ruby $command_t.select_next
145
- endfunction
146
-
147
- function CommandTSelectPrev()
148
- ruby $command_t.select_prev
149
- endfunction
150
-
151
- function CommandTClear()
152
- ruby $command_t.clear
153
- endfunction
154
-
155
- function CommandTCursorLeft()
156
- ruby $command_t.cursor_left
157
- endfunction
158
-
159
- function CommandTCursorRight()
160
- ruby $command_t.cursor_right
161
- endfunction
162
-
163
- function CommandTCursorEnd()
164
- ruby $command_t.cursor_end
165
- endfunction
166
-
167
- function CommandTCursorStart()
168
- ruby $command_t.cursor_start
169
- endfunction
170
-
171
- ruby << EOF
172
- # require Ruby files
173
- begin
174
- # prepare controller
175
- require 'command-t/vim'
176
- require 'command-t/controller'
177
- $command_t = CommandT::Controller.new
178
- rescue LoadError
179
- load_path_modified = false
180
- ::VIM::evaluate('&runtimepath').to_s.split(',').each do |path|
181
- lib = "#{path}/ruby"
182
- if !$LOAD_PATH.include?(lib) and File.exist?(lib)
183
- $LOAD_PATH << lib
184
- load_path_modified = true
185
- end
186
- end
187
- retry if load_path_modified
188
-
189
- # could get here if C extension was not compiled, or was compiled
190
- # for the wrong architecture or Ruby version
191
- require 'command-t/stub'
192
- $command_t = CommandT::Stub.new
193
- end
194
- EOF
@@ -11,12 +11,12 @@ ECHO = $(ECHO1:0=@echo)
11
11
  #### Start of system configuration section. ####
12
12
 
13
13
  srcdir = .
14
- topdir = /Users/glh/.rbenv/versions/2.0.0-p247/include/ruby-2.0.0
14
+ topdir = /Users/glh/.rbenv/versions/2.0.0-p451/include/ruby-2.0.0
15
15
  hdrdir = $(topdir)
16
- arch_hdrdir = /Users/glh/.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/x86_64-darwin13.1.0
16
+ arch_hdrdir = /Users/glh/.rbenv/versions/2.0.0-p451/include/ruby-2.0.0/x86_64-darwin13.1.0
17
17
  PATH_SEPARATOR = :
18
18
  VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
19
- prefix = /Users/glh/.rbenv/versions/2.0.0-p247
19
+ prefix = /Users/glh/.rbenv/versions/2.0.0-p451
20
20
  rubysitearchprefix = $(rubylibprefix)/$(sitearch)
21
21
  rubyarchprefix = $(rubylibprefix)/$(arch)
22
22
  rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
@@ -81,9 +81,9 @@ 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-p247/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
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)
85
85
  CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
86
- ldflags = -L. -L/Users/glh/.rbenv/versions/2.0.0-p247/lib
86
+ ldflags = -L. -L/Users/glh/.rbenv/versions/2.0.0-p451/lib
87
87
  dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress
88
88
  ARCH_FLAG =
89
89
  DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
@@ -24,6 +24,7 @@
24
24
  require 'command-t/finder/buffer_finder'
25
25
  require 'command-t/finder/jump_finder'
26
26
  require 'command-t/finder/file_finder'
27
+ require 'command-t/finder/mru_buffer_finder'
27
28
  require 'command-t/finder/tag_finder'
28
29
  require 'command-t/match_window'
29
30
  require 'command-t/prompt'
@@ -50,6 +51,12 @@ module CommandT
50
51
  show
51
52
  end
52
53
 
54
+ def show_mru_finder
55
+ @path = VIM::pwd
56
+ @active_finder = mru_finder
57
+ show
58
+ end
59
+
53
60
  def show_tag_finder
54
61
  @path = VIM::pwd
55
62
  @active_finder = tag_finder
@@ -372,6 +379,10 @@ module CommandT
372
379
  @buffer_finder ||= CommandT::BufferFinder.new
373
380
  end
374
381
 
382
+ def mru_finder
383
+ @mru_finder ||= CommandT::MRUBufferFinder.new
384
+ end
385
+
375
386
  def file_finder
376
387
  @file_finder ||= CommandT::FileFinder.new nil,
377
388
  :max_depth => get_number('g:CommandTMaxDepth'),
@@ -393,4 +404,4 @@ module CommandT
393
404
  :include_filenames => get_bool('g:CommandTTagIncludeFilenames')
394
405
  end
395
406
  end # class Controller
396
- end # module commandT
407
+ end # module CommandT
Binary file
@@ -0,0 +1,50 @@
1
+ # Copyright 2014 Wincent Colaiuta. All rights reserved.
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are met:
5
+ #
6
+ # 1. Redistributions of source code must retain the above copyright notice,
7
+ # this list of conditions and the following disclaimer.
8
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
9
+ # this list of conditions and the following disclaimer in the documentation
10
+ # and/or other materials provided with the distribution.
11
+ #
12
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ # POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ require 'command-t/ext' # CommandT::Matcher
25
+ require 'command-t/scanner/mru_buffer_scanner'
26
+ require 'command-t/finder/buffer_finder'
27
+
28
+ module CommandT
29
+ class MRUBufferFinder < BufferFinder
30
+ # Override sorted_matches_for to prevent MRU ordered matches from being
31
+ # ordered alphabetically.
32
+ def sorted_matches_for str, options = {}
33
+ matches = super(str, options.merge(:sort => false))
34
+
35
+ # take current buffer (by definition, the most recently used) and move it
36
+ # to the end of the results
37
+ if MRU.stack.last &&
38
+ relative_path_under_working_directory(MRU.stack.last.name) == matches.first
39
+ matches[1..-1] + [matches.first]
40
+ else
41
+ matches
42
+ end
43
+ end
44
+
45
+ def initialize
46
+ @scanner = MRUBufferScanner.new
47
+ @matcher = Matcher.new @scanner, :always_show_dot_files => true
48
+ end
49
+ end # class MRUBufferFinder
50
+ end # CommandT
@@ -1,4 +1,4 @@
1
- // Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
1
+ // Copyright 2010-2014 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:
@@ -51,9 +51,10 @@ double recursive_match(matchinfo_t *m, // sharable meta-data
51
51
  long i, j, distance;
52
52
  int found;
53
53
  double score_for_char;
54
+ long memo_idx = haystack_idx;
54
55
 
55
56
  // do we have a memoized result we can return?
56
- double memoized = m->memo[needle_idx * m->needle_len + haystack_idx];
57
+ double memoized = m->memo[needle_idx * m->needle_len + memo_idx];
57
58
  if (memoized != DBL_MAX)
58
59
  return memoized;
59
60
 
@@ -125,11 +126,10 @@ double recursive_match(matchinfo_t *m, // sharable meta-data
125
126
  }
126
127
 
127
128
  score += score_for_char;
128
- last_idx = haystack_idx + 1;
129
+ last_idx = haystack_idx++;
129
130
  break;
130
131
  }
131
132
  }
132
-
133
133
  if (!found) {
134
134
  score = 0.0;
135
135
  goto memoize;
@@ -145,7 +145,7 @@ double recursive_match(matchinfo_t *m, // sharable meta-data
145
145
  score = score > seen_score ? score : seen_score;
146
146
 
147
147
  memoize:
148
- m->memo[needle_idx * m->needle_len + haystack_idx] = score;
148
+ m->memo[needle_idx * m->needle_len + memo_idx] = score;
149
149
  return score;
150
150
  }
151
151
 
@@ -127,12 +127,12 @@ void *match_thread(void *thread_args)
127
127
  return NULL;
128
128
  }
129
129
 
130
-
131
130
  VALUE CommandTMatcher_sorted_matches_for(int argc, VALUE *argv, VALUE self)
132
131
  {
133
132
  long i, limit, path_count, thread_count;
134
133
  #ifdef HAVE_PTHREAD_H
135
134
  long err;
135
+ pthread_t *threads;
136
136
  #endif
137
137
  match_t *matches;
138
138
  thread_args_t *thread_args;
@@ -144,6 +144,7 @@ VALUE CommandTMatcher_sorted_matches_for(int argc, VALUE *argv, VALUE self)
144
144
  VALUE paths;
145
145
  VALUE results;
146
146
  VALUE scanner;
147
+ VALUE sort_option;
147
148
  VALUE threads_option;
148
149
 
149
150
  // process arguments: 1 mandatory, 1 optional
@@ -158,6 +159,7 @@ VALUE CommandTMatcher_sorted_matches_for(int argc, VALUE *argv, VALUE self)
158
159
  // check optional options has for overrides
159
160
  limit_option = CommandT_option_from_hash("limit", options);
160
161
  threads_option = CommandT_option_from_hash("threads", options);
162
+ sort_option = CommandT_option_from_hash("sort", options);
161
163
 
162
164
  // get unsorted matches
163
165
  scanner = rb_iv_get(self, "@scanner");
@@ -176,7 +178,7 @@ VALUE CommandTMatcher_sorted_matches_for(int argc, VALUE *argv, VALUE self)
176
178
  #define THREAD_THRESHOLD 1000 /* avoid the overhead of threading when search space is small */
177
179
  if (path_count < THREAD_THRESHOLD)
178
180
  thread_count = 1;
179
- pthread_t *threads = malloc(sizeof(pthread_t) * thread_count);
181
+ threads = malloc(sizeof(pthread_t) * thread_count);
180
182
  if (!threads)
181
183
  rb_raise(rb_eNoMemError, "memory allocation failed");
182
184
  #endif
@@ -217,13 +219,15 @@ VALUE CommandTMatcher_sorted_matches_for(int argc, VALUE *argv, VALUE self)
217
219
  free(threads);
218
220
  #endif
219
221
 
220
- if (RSTRING_LEN(abbrev) == 0 ||
221
- (RSTRING_LEN(abbrev) == 1 && RSTRING_PTR(abbrev)[0] == '.'))
222
- // alphabetic order if search string is only "" or "."
223
- qsort(matches, path_count, sizeof(match_t), cmp_alpha);
224
- else
225
- // for all other non-empty search strings, sort by score
226
- qsort(matches, path_count, sizeof(match_t), cmp_score);
222
+ if (NIL_P(sort_option) || sort_option == Qtrue) {
223
+ if (RSTRING_LEN(abbrev) == 0 ||
224
+ (RSTRING_LEN(abbrev) == 1 && RSTRING_PTR(abbrev)[0] == '.'))
225
+ // alphabetic order if search string is only "" or "."
226
+ qsort(matches, path_count, sizeof(match_t), cmp_alpha);
227
+ else
228
+ // for all other non-empty search strings, sort by score
229
+ qsort(matches, path_count, sizeof(match_t), cmp_score);
230
+ }
227
231
 
228
232
  results = rb_ary_new();
229
233
 
@@ -0,0 +1,58 @@
1
+ # Copyright 2014 Wincent Colaiuta. All rights reserved.
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are met:
5
+ #
6
+ # 1. Redistributions of source code must retain the above copyright notice,
7
+ # this list of conditions and the following disclaimer.
8
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
9
+ # this list of conditions and the following disclaimer in the documentation
10
+ # and/or other materials provided with the distribution.
11
+ #
12
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ # POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ module CommandT
25
+ # Maintains a stack of seen buffers in MRU (most recently used) order.
26
+ module MRU
27
+ class << self
28
+ # The stack of used buffers in MRU order.
29
+ def stack
30
+ @stack ||= []
31
+ end
32
+
33
+ # Mark the current buffer as having been used, effectively moving it to
34
+ # the top of the stack.
35
+ def touch
36
+ return unless ::VIM::evaluate('buflisted(%d)' % $curbuf.number) == 1
37
+ return unless $curbuf.name
38
+
39
+ stack.delete $curbuf
40
+ stack.push $curbuf
41
+ end
42
+
43
+ # Mark a buffer as deleted, removing it from the stack.
44
+ def delete
45
+ # Note that $curbuf does not point to the buffer that is being deleted;
46
+ # we need to use Vim's <abuf> for the correct buffer number.
47
+ stack.delete_if do |b|
48
+ b.number == ::VIM::evaluate('expand("<abuf>")').to_i
49
+ end
50
+ end
51
+
52
+ # Returns `true` if `buffer` has been used (ie. is present in the stack).
53
+ def used?(buffer)
54
+ stack.include?(buffer)
55
+ end
56
+ end
57
+ end # module MRU
58
+ end # module CommandT
@@ -0,0 +1,48 @@
1
+ # Copyright 2014 Wincent Colaiuta. All rights reserved.
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are met:
5
+ #
6
+ # 1. Redistributions of source code must retain the above copyright notice,
7
+ # this list of conditions and the following disclaimer.
8
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
9
+ # this list of conditions and the following disclaimer in the documentation
10
+ # and/or other materials provided with the distribution.
11
+ #
12
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ # POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ require 'command-t/vim/path_utilities'
25
+ require 'command-t/scanner/buffer_scanner'
26
+
27
+ module CommandT
28
+ # Returns a list of all open buffers, sorted in MRU order.
29
+ class MRUBufferScanner < BufferScanner
30
+ include VIM::PathUtilities
31
+
32
+ def paths
33
+ # Collect all buffers that have not been used yet.
34
+ unused_buffers = (0..(::VIM::Buffer.count - 1)).map do |n|
35
+ buffer = ::VIM::Buffer[n]
36
+ buffer if buffer.name && !MRU.used?(buffer)
37
+ end
38
+
39
+ # Combine all most recently used buffers and all unused buffers, and
40
+ # return all listed buffer paths.
41
+ (unused_buffers + MRU.stack).map do |buffer|
42
+ if buffer && buffer.name
43
+ relative_path_under_working_directory buffer.name
44
+ end
45
+ end.compact.reverse
46
+ end
47
+ end # class MRUBufferScanner
48
+ end # module CommandT
@@ -1,4 +1,4 @@
1
- # Copyright 2010-2011 Wincent Colaiuta. All rights reserved.
1
+ # Copyright 2010-2014 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:
@@ -25,10 +25,18 @@ module CommandT
25
25
  class Stub
26
26
  @@load_error = ['command-t.vim could not load the C extension',
27
27
  'Please see INSTALLATION and TROUBLE-SHOOTING in the help',
28
+ "Vim Ruby version: #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}",
28
29
  'For more information type: :help command-t']
29
30
 
30
- [:flush, :show_buffer_finder, :show_file_finder, :show_tag_finder].each do |method|
31
- define_method(method.to_sym) { warn *@@load_error }
31
+ [
32
+ :flush,
33
+ :show_buffer_finder,
34
+ :show_file_finder,
35
+ :show_jump_finder,
36
+ :show_mru_finder,
37
+ :show_tag_finder
38
+ ].each do |method|
39
+ define_method(method) { warn *@@load_error }
32
40
  end
33
41
 
34
42
  private
@@ -111,4 +111,4 @@ module CommandT
111
111
  end
112
112
  end
113
113
  end # module Util
114
- end # module commandT
114
+ end # module CommandT
@@ -297,6 +297,8 @@ int64_t watchman_load_int(char **ptr, char *end) {
297
297
  * starting at `ptr` and finishing at or before `end`
298
298
  */
299
299
  VALUE watchman_load_string(char **ptr, char *end) {
300
+ int64_t len;
301
+ VALUE string;
300
302
  if (*ptr >= end) {
301
303
  rb_raise(rb_eArgError, "unexpected end of input");
302
304
  }
@@ -310,14 +312,14 @@ VALUE watchman_load_string(char **ptr, char *end) {
310
312
  rb_raise(rb_eArgError, "invalid string header");
311
313
  }
312
314
 
313
- int64_t len = watchman_load_int(ptr, end);
315
+ len = watchman_load_int(ptr, end);
314
316
  if (len == 0) { // special case for zero-length strings
315
317
  return rb_str_new2("");
316
318
  } else if (*ptr + len > end) {
317
319
  rb_raise(rb_eArgError, "insufficient string storage");
318
320
  }
319
321
 
320
- VALUE string = rb_str_new(*ptr, len);
322
+ string = rb_str_new(*ptr, len);
321
323
  *ptr += len;
322
324
  return string;
323
325
  }
@@ -327,11 +329,12 @@ VALUE watchman_load_string(char **ptr, char *end) {
327
329
  * starting at `ptr` and finishing at or before `end`
328
330
  */
329
331
  double watchman_load_double(char **ptr, char *end) {
332
+ double val;
330
333
  *ptr += sizeof(int8_t); // caller has already verified the marker
331
334
  if (*ptr + sizeof(double) > end) {
332
335
  rb_raise(rb_eArgError, "insufficient double storage");
333
336
  }
334
- double val = *(double *)*ptr;
337
+ val = *(double *)*ptr;
335
338
  *ptr += sizeof(double);
336
339
  return val;
337
340
  }
@@ -496,10 +499,14 @@ VALUE watchman_load(char **ptr, char *end) {
496
499
  * format into a normal Ruby object.
497
500
  */
498
501
  VALUE CommandTWatchmanUtils_load(VALUE self, VALUE serialized) {
502
+ char *ptr, *end;
503
+ long len;
504
+ uint64_t payload_size;
505
+ VALUE loaded;
499
506
  serialized = StringValue(serialized);
500
- long len = RSTRING_LEN(serialized);
501
- char *ptr = RSTRING_PTR(serialized);
502
- char *end = ptr + len;
507
+ len = RSTRING_LEN(serialized);
508
+ ptr = RSTRING_PTR(serialized);
509
+ end = ptr + len;
503
510
 
504
511
  // expect at least the binary marker and a int8_t length counter
505
512
  if ((size_t)len < sizeof(WATCHMAN_BINARY_MARKER) - 1 + sizeof(int8_t) * 2) {
@@ -512,21 +519,29 @@ VALUE CommandTWatchmanUtils_load(VALUE self, VALUE serialized) {
512
519
 
513
520
  // get size marker
514
521
  ptr += sizeof(WATCHMAN_BINARY_MARKER) - 1;
515
- uint64_t payload_size = watchman_load_int(&ptr, end);
522
+ payload_size = watchman_load_int(&ptr, end);
516
523
  if (!payload_size) {
517
524
  rb_raise(rb_eArgError, "empty payload");
518
525
  }
519
526
 
520
527
  // sanity check length
521
528
  if (ptr + payload_size != end) {
522
- rb_raise(rb_eArgError, "payload size mismatch (%lu)", end - (ptr + payload_size));
529
+ rb_raise(
530
+ rb_eArgError,
531
+ "payload size mismatch (%lu)",
532
+ (unsigned long)(end - (ptr + payload_size))
533
+ );
523
534
  }
524
535
 
525
- VALUE loaded = watchman_load(&ptr, end);
536
+ loaded = watchman_load(&ptr, end);
526
537
 
527
538
  // one more sanity check
528
539
  if (ptr != end) {
529
- rb_raise(rb_eArgError, "payload termination mismatch (%lu)", end - ptr);
540
+ rb_raise(
541
+ rb_eArgError,
542
+ "payload termination mismatch (%lu)",
543
+ (unsigned long)(end - ptr)
544
+ );
530
545
  }
531
546
 
532
547
  return loaded;
@@ -542,15 +557,17 @@ VALUE CommandTWatchmanUtils_load(VALUE self, VALUE serialized) {
542
557
  * (integers, floats), booleans, and nil.
543
558
  */
544
559
  VALUE CommandTWatchmanUtils_dump(VALUE self, VALUE serializable) {
560
+ uint64_t *len;
561
+ VALUE serialized;
545
562
  watchman_t *w = watchman_init();
546
563
  watchman_dump(w, serializable);
547
564
 
548
565
  // update header with final length information
549
- uint64_t *len = (uint64_t *)(w->data + sizeof(WATCHMAN_HEADER) - sizeof(uint64_t) - 1);
566
+ len = (uint64_t *)(w->data + sizeof(WATCHMAN_HEADER) - sizeof(uint64_t) - 1);
550
567
  *len = w->len - sizeof(WATCHMAN_HEADER) + 1;
551
568
 
552
569
  // prepare final return value
553
- VALUE serialized = rb_str_buf_new(w->len);
570
+ serialized = rb_str_buf_new(w->len);
554
571
  rb_str_buf_cat(serialized, (const char*)w->data, w->len);
555
572
  watchman_free(w);
556
573
  return serialized;
@@ -582,18 +599,29 @@ void watchman_raise_system_call_error(int number) {
582
599
  * returns the result.
583
600
  */
584
601
  VALUE CommandTWatchmanUtils_query(VALUE self, VALUE query, VALUE socket) {
585
- int fileno = NUM2INT(rb_funcall(socket, rb_intern("fileno"), 0));
602
+ char *payload;
603
+ int fileno, flags;
604
+ int8_t peek[WATCHMAN_PEEK_BUFFER_SIZE];
605
+ int8_t sizes[] = { 0, 0, 0, 1, 2, 4, 8 };
606
+ int8_t sizes_idx;
607
+ int8_t *pdu_size_ptr;
608
+ int64_t payload_size;
609
+ long query_len;
610
+ ssize_t peek_size, sent, received;
611
+ void *buffer;
612
+ VALUE loaded, serialized;
613
+ fileno = NUM2INT(rb_funcall(socket, rb_intern("fileno"), 0));
586
614
 
587
615
  // do blocking I/O to simplify the following logic
588
- int flags = fcntl(fileno, F_GETFL);
616
+ flags = fcntl(fileno, F_GETFL);
589
617
  if (fcntl(fileno, F_SETFL, flags & ~O_NONBLOCK) == -1) {
590
618
  rb_raise(rb_eRuntimeError, "unable to clear O_NONBLOCK flag");
591
619
  }
592
620
 
593
621
  // send the message
594
- VALUE serialized = CommandTWatchmanUtils_dump(self, query);
595
- long query_len = RSTRING_LEN(serialized);
596
- ssize_t sent = send(fileno, RSTRING_PTR(serialized), query_len, 0);
622
+ serialized = CommandTWatchmanUtils_dump(self, query);
623
+ query_len = RSTRING_LEN(serialized);
624
+ sent = send(fileno, RSTRING_PTR(serialized), query_len, 0);
597
625
  if (sent == -1) {
598
626
  watchman_raise_system_call_error(errno);
599
627
  } else if (sent != query_len) {
@@ -602,8 +630,7 @@ VALUE CommandTWatchmanUtils_query(VALUE self, VALUE query, VALUE socket) {
602
630
  }
603
631
 
604
632
  // sniff to see how large the header is
605
- int8_t peek[WATCHMAN_PEEK_BUFFER_SIZE];
606
- ssize_t received = recv(fileno, peek, WATCHMAN_SNIFF_BUFFER_SIZE, MSG_PEEK | MSG_WAITALL);
633
+ received = recv(fileno, peek, WATCHMAN_SNIFF_BUFFER_SIZE, MSG_PEEK | MSG_WAITALL);
607
634
  if (received == -1) {
608
635
  watchman_raise_system_call_error(errno);
609
636
  } else if (received != WATCHMAN_SNIFF_BUFFER_SIZE) {
@@ -611,9 +638,12 @@ VALUE CommandTWatchmanUtils_query(VALUE self, VALUE query, VALUE socket) {
611
638
  }
612
639
 
613
640
  // peek at size of PDU
614
- int8_t sizes[] = { 0, 0, 0, 1, 2, 4, 8 };
615
- ssize_t peek_size = sizeof(WATCHMAN_BINARY_MARKER) - 1 + sizeof(int8_t) +
616
- sizes[peek[sizeof(WATCHMAN_BINARY_MARKER) - 1]];
641
+ sizes_idx = peek[sizeof(WATCHMAN_BINARY_MARKER) - 1];
642
+ if (sizes_idx < WATCHMAN_INT8_MARKER || sizes_idx > WATCHMAN_INT64_MARKER) {
643
+ rb_raise(rb_eRuntimeError, "bad PDU size marker");
644
+ }
645
+ peek_size = sizeof(WATCHMAN_BINARY_MARKER) - 1 + sizeof(int8_t) +
646
+ sizes[sizes_idx];
617
647
 
618
648
  received = recv(fileno, peek, peek_size, MSG_PEEK);
619
649
  if (received == -1) {
@@ -621,15 +651,19 @@ VALUE CommandTWatchmanUtils_query(VALUE self, VALUE query, VALUE socket) {
621
651
  } else if (received != peek_size) {
622
652
  rb_raise(rb_eRuntimeError, "failed to peek at PDU header");
623
653
  }
624
- int8_t *pdu_size_ptr = peek + sizeof(WATCHMAN_BINARY_MARKER) - sizeof(int8_t);
625
- int64_t payload_size =
654
+ pdu_size_ptr = peek + sizeof(WATCHMAN_BINARY_MARKER) - sizeof(int8_t);
655
+ payload_size =
626
656
  peek_size +
627
657
  watchman_load_int((char **)&pdu_size_ptr, (char *)peek + peek_size);
628
658
 
629
659
  // actually read the PDU
630
- void *buffer = xmalloc(payload_size);
660
+ buffer = xmalloc(payload_size);
631
661
  if (!buffer) {
632
- rb_raise(rb_eNoMemError, "failed to allocate %lld bytes", payload_size);
662
+ rb_raise(
663
+ rb_eNoMemError,
664
+ "failed to allocate %lld bytes",
665
+ (long long int)payload_size
666
+ );
633
667
  }
634
668
  received = recv(fileno, buffer, payload_size, MSG_WAITALL);
635
669
  if (received == -1) {
@@ -637,8 +671,8 @@ VALUE CommandTWatchmanUtils_query(VALUE self, VALUE query, VALUE socket) {
637
671
  } else if (received != payload_size) {
638
672
  rb_raise(rb_eRuntimeError, "failed to load PDU");
639
673
  }
640
- char *payload = buffer + peek_size;
641
- VALUE loaded = watchman_load(&payload, payload + payload_size);
674
+ payload = (char *)buffer + peek_size;
675
+ loaded = watchman_load(&payload, payload + payload_size);
642
676
  free(buffer);
643
677
  return loaded;
644
678
  }
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.8'
4
+ version: '1.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wincent Colaiuta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-01 00:00:00.000000000 Z
11
+ date: 2014-05-25 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
@@ -34,6 +34,7 @@ files:
34
34
  - ruby/command-t/finder/buffer_finder.rb
35
35
  - ruby/command-t/finder/file_finder.rb
36
36
  - ruby/command-t/finder/jump_finder.rb
37
+ - ruby/command-t/finder/mru_buffer_finder.rb
37
38
  - ruby/command-t/finder/tag_finder.rb
38
39
  - ruby/command-t/finder.rb
39
40
  - ruby/command-t/Makefile
@@ -42,6 +43,7 @@ files:
42
43
  - ruby/command-t/match_window.rb
43
44
  - ruby/command-t/matcher.c
44
45
  - ruby/command-t/matcher.h
46
+ - ruby/command-t/mru.rb
45
47
  - ruby/command-t/prompt.rb
46
48
  - ruby/command-t/ruby_compat.h
47
49
  - ruby/command-t/scanner/buffer_scanner.rb
@@ -50,6 +52,7 @@ files:
50
52
  - ruby/command-t/scanner/file_scanner/watchman_file_scanner.rb
51
53
  - ruby/command-t/scanner/file_scanner.rb
52
54
  - ruby/command-t/scanner/jump_scanner.rb
55
+ - ruby/command-t/scanner/mru_buffer_scanner.rb
53
56
  - ruby/command-t/scanner/tag_scanner.rb
54
57
  - ruby/command-t/scanner.rb
55
58
  - ruby/command-t/settings.rb
@@ -83,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
86
  version: '0'
84
87
  requirements: []
85
88
  rubyforge_project:
86
- rubygems_version: 2.0.3
89
+ rubygems_version: 2.0.14
87
90
  signing_key:
88
91
  specification_version: 4
89
92
  summary: The Command-T plug-in for VIM.