command-t 1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,46 @@
1
+ # Copyright 2010-2011 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
+ class Stub
26
+ @@load_error = ['command-t.vim could not load the C extension',
27
+ 'Please see INSTALLATION and TROUBLE-SHOOTING in the help',
28
+ 'For more information type: :help command-t']
29
+
30
+ def show_file_finder
31
+ warn *@@load_error
32
+ end
33
+
34
+ def flush
35
+ warn *@@load_error
36
+ end
37
+
38
+ private
39
+
40
+ def warn *msg
41
+ ::VIM::command 'echohl WarningMsg'
42
+ msg.each { |m| ::VIM::command "echo '#{m}'" }
43
+ ::VIM::command 'echohl none'
44
+ end
45
+ end # class Stub
46
+ end # module CommandT
@@ -0,0 +1,43 @@
1
+ # Copyright 2010 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/screen'
25
+ require 'command-t/vim/window'
26
+
27
+ module CommandT
28
+ module VIM
29
+ def self.has_syntax?
30
+ ::VIM::evaluate('has("syntax")').to_i != 0
31
+ end
32
+
33
+ def self.pwd
34
+ ::VIM::evaluate 'getcwd()'
35
+ end
36
+
37
+ # Escape a string for safe inclusion in a Vim single-quoted string
38
+ # (single quotes escaped by doubling, everything else is literal)
39
+ def self.escape_for_single_quotes str
40
+ str.gsub "'", "''"
41
+ end
42
+ end # module VIM
43
+ end # module CommandT
@@ -0,0 +1,40 @@
1
+ # Copyright 2010-2011 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'
25
+
26
+ module CommandT
27
+ module VIM
28
+ module PathUtilities
29
+
30
+ private
31
+
32
+ def relative_path_under_working_directory path
33
+ # any path under the working directory will be specified as a relative
34
+ # path to improve the readability of the buffer list etc
35
+ pwd = File.expand_path(VIM::pwd) + '/'
36
+ path.index(pwd) == 0 ? path[pwd.length..-1] : path
37
+ end
38
+ end # module PathUtilities
39
+ end # module VIM
40
+ end # module CommandT
@@ -0,0 +1,32 @@
1
+ # Copyright 2010 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
+ module VIM
26
+ module Screen
27
+ def self.lines
28
+ ::VIM::evaluate('&lines').to_i
29
+ end
30
+ end # module Screen
31
+ end # module VIM
32
+ end # module CommandT
@@ -0,0 +1,38 @@
1
+ # Copyright 2010 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
+ module VIM
26
+ class Window
27
+ def self.select window
28
+ return true if $curwin == window
29
+ initial = $curwin
30
+ while true do
31
+ ::VIM::command 'wincmd w' # cycle through windows
32
+ return true if $curwin == window # have selected desired window
33
+ return false if $curwin == initial # have already looped through all
34
+ end
35
+ end
36
+ end # class Window
37
+ end # module VIM
38
+ end # module CommandT
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: command-t
3
+ version: !ruby/object:Gem::Version
4
+ hash: 11
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 2
9
+ version: "1.2"
10
+ platform: ruby
11
+ authors:
12
+ - Wincent Colaiuta
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-01-05 00:00:00 -08:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: " The Command-T plug-in provides an extremely fast, intuitive mechanism for\n opening files with a minimal number of keystrokes. It's named \"Command-T\"\n because it is inspired by the \"Go to File\" window bound to Command-T in\n TextMate.\n\n Files are selected by typing characters that appear in their paths, and are\n ordered by an algorithm which knows that characters that appear in certain\n locations (for example, immediately after a path separator) should be given\n more weight.\n\n To search efficiently, especially in large projects, you should adopt a\n \"path-centric\" rather than a \"filename-centric\" mentality. That is you\n should think more about where the desired file is found rather than what it\n is called. This means narrowing your search down by including some\n characters from the upper path components rather than just entering\n characters from the filename itself.\n\n The full functionality of Command-T is only available when installed as a\n Vim plug-in, but it is also made available as a RubyGem so that other\n applications can make use of the searching algorithm.\n"
22
+ email: win@wincent.com
23
+ executables: []
24
+
25
+ extensions:
26
+ - ruby/command-t/extconf.rb
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - README.txt
31
+ - LICENSE
32
+ - Gemfile
33
+ - Rakefile
34
+ - ruby/command-t/controller.rb
35
+ - ruby/command-t/depend
36
+ - ruby/command-t/ext.c
37
+ - ruby/command-t/ext.h
38
+ - ruby/command-t/extconf.rb
39
+ - ruby/command-t/finder/buffer_finder.rb
40
+ - ruby/command-t/finder/file_finder.rb
41
+ - ruby/command-t/finder.rb
42
+ - ruby/command-t/Makefile
43
+ - ruby/command-t/match.c
44
+ - ruby/command-t/match.h
45
+ - ruby/command-t/match_window.rb
46
+ - ruby/command-t/matcher.c
47
+ - ruby/command-t/matcher.h
48
+ - ruby/command-t/prompt.rb
49
+ - ruby/command-t/ruby_compat.h
50
+ - ruby/command-t/scanner/buffer_scanner.rb
51
+ - ruby/command-t/scanner/file_scanner.rb
52
+ - ruby/command-t/scanner.rb
53
+ - ruby/command-t/settings.rb
54
+ - ruby/command-t/stub.rb
55
+ - ruby/command-t/vim/path_utilities.rb
56
+ - ruby/command-t/vim/screen.rb
57
+ - ruby/command-t/vim/window.rb
58
+ - ruby/command-t/vim.rb
59
+ - doc/command-t.txt
60
+ - doc/README.txt
61
+ - plugin/command-t.vim
62
+ has_rdoc: true
63
+ homepage: https://wincent.com/products/command-t
64
+ licenses: []
65
+
66
+ post_install_message:
67
+ rdoc_options: []
68
+
69
+ require_paths:
70
+ - ruby
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ requirements: []
90
+
91
+ rubyforge_project:
92
+ rubygems_version: 1.6.2
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: The Command-T plug-in for VIM.
96
+ test_files: []
97
+