Created
June 19, 2013 23:22
-
-
Save egonSchiele/5819008 to your computer and use it in GitHub Desktop.
Search hackage from vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
_import = $stdin.gets | |
import = _import.chomp.gsub("import", "").gsub("qualified", "").gsub(/as .*/, "") | |
cmd = "hoogle -i '#{import}'" | |
puts cmd | |
packages = `#{cmd}` | |
lines = packages.split("\n") | |
package = lines.find do |line| | |
line =~ /.*package.*/ | |
end | |
if package | |
package.gsub!(/.*package /, "") | |
`open http://hackage.haskell.org/package/#{package}` | |
end | |
puts _import |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this to your
.vimrc
: