public
Description: My .vim directory as well as my dev tool scripts
Homepage: http://blog.paulbetts.org/index.php/2007/03/06/my-awesome-vimrc-open-source-libraries-ctags-intellisense-1-for-linux/
Clone URL: git://github.com/xpaulbettsx/vimrc.git
vimrc / ff
100755 36 lines (28 sloc) 0.835 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env ruby
 
require 'pathname'
 
def convert_path_to_dos(path)
    return nil unless path
    path.gsub(/\/cygdrive\/(.)\//, '\1:\\').gsub("/", "\x5C")
end
 
def convert_path_to_cygwin(path)
    return nil unless path
    ret = path.gsub("\\", "/")
    m = /([A-Za-z])\:/.match(ret)
    return ret unless m
 
    drive = m[1].downcase.gsub(':', '')
    ret.gsub!(/[A-Za-z]\:/, "/cygdrive/#{drive}")
    return ret
end
 
flags = []
s = ENV['SDXROOT'] ? ENV['SDXROOT'].clone : '_NOTHERE'
s = s.gsub(/[\/\\]nt$/, '')
db = Pathname.new(s).join('locatedb')
flags << "--database=#{convert_path_to_cygwin(db.to_s)}" if db.exist?
 
ret = `locate "#{flags.join ' '}" #{ARGV.join ' '}`
unless ENV['FF_USE_DOS_PATH']
    puts ret
    exit $?
end
 
ret.split("\n").each { |x| puts convert_path_to_dos(x) }
puts convert_path_to_dos(ret)
exit $?