Remove if_ruby adapter

The list of things worse than if_ruby is pretty short, and does not
include if_pyth.
This commit is contained in:
Tim Pope 2013-01-09 00:41:46 -05:00
parent c7f2a2ab6b
commit 7a36f4e8b8
3 changed files with 6 additions and 51 deletions

View File

@ -33,7 +33,8 @@ based on `target/repl-port`, otherwise it's just a `:Connect` away. You can
connect to multiple instances of nREPL for different projects, and it will
use the right one automatically.
The only external dependency is that you have Ruby installed.
The only external dependency is that you have either a Vim with Python support
compiled in, or `ruby` in your path. (Don't ask.)
Oh, and if you don't have an nREPL connection, installing [classpath.vim][]
lets it fall back to using `java clojure.main`, using a class path based on

View File

@ -198,51 +198,10 @@ let s:nrepl = {
\ 'path': s:function('s:nrepl_path'),
\ 'process': s:function('s:nrepl_process')}
if has('ruby')
ruby <<
require 'timeout'
require 'socket'
class << ::VIM
def string_encode(str)
'"' + str.gsub(/[\000-\037"\\]/) { |x| "\\%03o" % (x.respond_to?(:ord) ? x.ord : x[0]) } + '"'
end
def let(var, value)
command("let #{var} = #{string_encode(value)}")
end
end
.
function! s:nrepl_call(payload) dict abort
let payload = nrepl#foreplay_connection#bencode(a:payload)
ruby <<
begin
buffer = ''
Timeout.timeout(16) do
TCPSocket.open(::VIM.evaluate('self.host'), ::VIM.evaluate('self.port').to_i) do |s|
s.write(::VIM.evaluate('payload'))
loop do
body = s.readpartial(8192)
raise "not an nREPL server: upgrade to Leiningen 2" if body =~ /=> $/
buffer << body
break if body.include?("6:statusl4:done")
end
::VIM.let('out', buffer)
end
end
rescue
::VIM.let('err', $!.to_s)
end
.
if !exists('err')
return nrepl#foreplay_connection#bdecode('l'.out.'e')
endif
throw 'nREPL Connection Error: '.err
endfunction
finish
if !has('python')
finish
endif
if has('python')
python << EOF
import vim
import socket
@ -295,7 +254,4 @@ EOF
throw 'nREPL Connection Error: '.err
endfunction
finish
endif
" vim:set et sw=2:

View File

@ -41,10 +41,8 @@ buffer and classpath.vim is installed, java (or $JAVA_CMD) is invoked
directly, which can be quite slow depending on your setup.
The only adapter shipped with foreplay.vim is for nREPL. You need Ruby
installed and either |if_ruby| or the ruby command in your PATH.
Alternatively, if |if_ruby| is not available, it will attempt to use
|if_pyth|. If neither exists, however, it will still attempt to use the ruby
command in your PATH.
installed and either |if_pyth| or the ruby command in your PATH.
(This curious combination is an accident of history.)
DOCUMENTATION *foreplay-documentation*