Sha256: acf48aa3b3cc12c3b4c7a6d65f79eb37cad7d0c504843be5d3e13e2feea0fbc8

Contents?: true

Size: 639 Bytes

Versions: 3

Compression:

Stored size: 639 Bytes

Contents

# TODO: Save irb history if in irb session.

module ReadSource
  module VimSource
    def vim servername=nil
      (file, line_num = send :source_location) || return
      read_only = !!/#{ENV["GEM_HOME"]}/.match(file) ? "-M" : ""
      remote = "#{('--servername ' + servername.to_s) if servername} --remote-silent"
      serverlist = `vim --serverlist`.split("\n")
      if serverlist.include?(servername.to_s) || serverlist.include?("VIM")
        `#{"vim #{remote} %s +%s %s" % [read_only, line_num, file]}` 
        :success
      else
        exec("vim #{remote} %s +%s %s" % [read_only, line_num, file])
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
read_source-0.2.6 lib/read_source/vim_source.rb
read_source-0.2.5 lib/read_source/vim_source.rb
read_source-0.2.4 lib/read_source/vim_source.rb