/usr/bin/scvim is in supercollider-vim 1:3.8.0~repack-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | #!/usr/bin/env ruby
#
#scvim [the executable]
#
#Copyright 2008 Alex Norman
#
#This file is part of SCVIM.
#
#SCVIM is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#SCVIM is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with SCVIM. If not, see <http://www.gnu.org/licenses/>.
require 'optparse'
vim = "vim"
#test for MacVim if we're on a darwin/osX box
if RUBY_PLATFORM =~ /darwin/
if system('which mvim')
vim = 'mvim'
elsif File.exists?('/Applications/MacVim.app/Contents/MacOS/Vim')
vim = '/Applications/MacVim.app/Contents/MacOS/Vim'
end
end
rcfilelocs = [
File.join(ENV["HOME"], ".scvimrc"),
"/usr/local/share/scvim/scvimrc",
"/usr/share/scvim/scvimrc"
]
addonlocs = [
File.join(ENV["HOME"], ".vim/"),
"/usr/local/share/vim/addons/",
"/usr/share/vim/addons/",
]
#do we use graphical mode
graphical = false
#the location of the rc file to source
rcloc = nil
#the options that we pass to vim
vimops = []
# debian-based systems do not activate vim plugins automatically, we must check
# test to see if we have vim-addons and if vim-addons knows about scvim
if %x[which vim-addons] != "" and %x[vim-addons -q list | grep supercollider] != ""
if %x[vim-addons -q status supercollider | grep installed] == ""
puts "scvim has detected that you haven't activated the vim supercollider plugin."
puts "to enable scvim to work, please execute either "
puts " vim-addons install supercollider"
puts "to enable it for the current user, or "
puts " sudo vim-addons -w install supercollider"
puts "to enable it system-wide."
puts ""
puts "Would you like me to run \"vim-addons install supercollider\" for you?"
puts "Press 'y' and then Enter if so. Otherwise just press Enter to exit."
userreply = gets.chomp
if userreply == 'y'
%x[vim-addons install supercollider]
else
exit
end
end
else
#ensure that the supercollider ftplugin is in the runtime path
addonlocs.each do |loc|
if File.exists?(File.join(loc, "ftplugin/supercollider.vim"))
vimops += ["-c", "set runtimepath+=#{loc}"]
break
end
end
end
opts = OptionParser.new do |opts|
#the usage banner
opts.banner = "Usage: #{$0} [OPTION]... [FILE]..."
#the options
opts.on("-g", "--graphical", "Use vim -g") do
graphical = true
end
opts.on("-r", "--rcfile rcfile", "Use the file indicated as the scvim configuration file") do |f|
if File.exists?(f)
rcloc = f
else
STDERR.puts "rcfile #{f} does not exists, aborting"; exit
end
end
opts.on_tail("-h", "--help", "Show this message") do
puts opts; exit
end
end
#parse the command line options
begin
opts.parse!(ARGV)
rescue => e
STDERR.puts e.to_s
STDERR.puts opts.to_s
exit
end
unless rcloc
#find the rc file
rcfilelocs.each do |loc|
if File.exists?(loc)
rcloc = loc
break
end
end
#if no rc file found, no user customizations
#hopefully ftplugin/supercollider.vim is in the vimruntime
STDERR.puts "scvimrc file not found" unless rcloc
end
if rcloc
vimops += ["--cmd", "source #{rcloc}"]
puts "scvim: sourcing #{rcloc}"
end
vimops += ["-c",
"set filetype=supercollider | runtime ftplugin/supercollider.vim | SClangStart",
*ARGV
]
#add -g if we're going graphical
vimops = ["-g"] + vimops if graphical
#see if the vim install supports servers
if IO.popen("#{vim} --version") {|f| f.readlines.flatten.join(" ").include?("+clientserver")}
vimops = ["--servername", "scvim"] + vimops
end
#actually execute
exec(vim, *vimops)
|