Add e-win
This commit is contained in:
parent
5d0fec77eb
commit
cc63840fcb
38
e-win
Normal file
38
e-win
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/c/Ruby32-x64/bin/ruby
|
||||||
|
|
||||||
|
GVIM = "C:/apps/vim/vim91/gvim.exe"
|
||||||
|
|
||||||
|
def get_server_name(path)
|
||||||
|
if path
|
||||||
|
path = File.expand_path(path)
|
||||||
|
while path !~ %r{^.\\|/$}
|
||||||
|
dirname = File.dirname(path)
|
||||||
|
if File.exist?(File.join(dirname, "project.vim"))
|
||||||
|
if dirname =~ %r{([^/]+)/([^/]+)/*$}
|
||||||
|
sn = "#{$2}(#{$1})"
|
||||||
|
else
|
||||||
|
sn = File.basename(dirname)
|
||||||
|
end
|
||||||
|
return sn
|
||||||
|
end
|
||||||
|
path = dirname
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return "GVIM"
|
||||||
|
end
|
||||||
|
|
||||||
|
def server_running?(server_name)
|
||||||
|
`gvim --serverlist`.lines.map(&:chomp).include?(server_name.upcase)
|
||||||
|
end
|
||||||
|
|
||||||
|
if ARGV.empty?
|
||||||
|
server_name = get_server_name('local_file')
|
||||||
|
exec(GVIM, "--servername", server_name, err: "/dev/null")
|
||||||
|
else
|
||||||
|
ARGV.each_with_index do |path, i|
|
||||||
|
server_name = get_server_name(path)
|
||||||
|
sleep(0.2) if i > 0
|
||||||
|
Process.detach(Process.spawn(GVIM, "--servername", server_name, "--remote-tab-silent", path))
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user