Top Level Namespace

Defined Under Namespace

Modules: Spackle

Instance Method Summary collapse

Instance Method Details

#argumentsObject



41
42
43
44
45
46
47
48
# File 'bin/spackle-vim-open', line 41

def arguments
  arguments = ['gvim', '--servername', servername]
  unless ARGV.empty?
    arguments << "--remote-silent"
    arguments += ARGV
  end
  arguments
end

#server_running?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'bin/spackle-vim-load-quickfix', line 35

def server_running?
  !`gvim --serverlist`.grep(/#{servername}/i).empty?
end

#servernameObject



37
38
39
# File 'bin/spackle-vim-open', line 37

def servername
  servername_from_arguments || servername_from_project_root || "DEFAULT"
end

#servername_from_argumentsObject

Load a Vim Quickfix file in an active vim session.

Usage: spackle-vim-load-quickfix [servername] quickfix_file

If servername is specified, try to use it as the vim server. Otherwise, assume the name for the vim server is the from ruby-project-root -basename, if successful. If no Ruby project root was found, use DEFAULT as the servername.

If the server doesn’t exist, we’ll create a new gvim session.



22
23
24
25
26
27
28
29
30
# File 'bin/spackle-vim-open', line 22

def servername_from_arguments
  ARGV.count.times do |index|
    if ARGV[index] == "--servername"
      ARGV.delete_at index
      return ARGV.delete_at_index
    end
  end
  nil
end

#servername_from_project_rootObject



32
33
34
35
# File 'bin/spackle-vim-open', line 32

def servername_from_project_root
  project_root = ProjectScout.scan Dir.pwd
  File.basename(project_root) if project_root
end