This file is indexed.

/usr/bin/vim-addon-manager is in vim-addon-manager 0.5.5.

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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#!/usr/bin/ruby
#
# vim-addons: command line manager of Vim addons
#
# Copyright (C) 2007 Stefano Zacchiroli
# Copyright (C) 2009 James Vega
#
# This program 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.
#
# Created:    Tue, 16 Jan 2007 10:04:20 +0100 zack
#

=begin

== NAME

vim-addon-manager - command line manager of Vim add-ons

== SYNOPSIS

vim-addons [OPTION ...] [COMMAND [ADDON ...]]

== DESCRIPTION

Manage Vim addons installed system-wide, enabling on a per-user basis their
installation, removal, ...

vim-addons is capable of managing all Vim addons registered in the system-wide
registry of Vim addons (see vim-registry(5)). Each system-wide addon can be,
with respect to a user Vim configuration, in one of the following states:

:installed
  all of the files composing the addon are installed (i.e. symlinked) to their
  respective places under the target directory. The addon is fully functional
  for the current user

:removed
  the files composing the addon are not installed under the target directory.
  The addon might still be working for the current user if it is installed
  system-wide by the local administrator

:disabled
  the files composing the addon are not installed under the target directory,
  but the addon is installed system-wide. However, the addon has been disabled
  for the current user explicitly via some configuration line in
  plugin/vim-addons.vim under the target directory. The addon is not working
  for the current user

:broken
  only some of the files composing the addon are installed under the target
  directory. The addon is probably not working for the current user

:unavailable
  some (or all) of the files composing the addon are missing from the source
  directory

=== COMMANDS

A number of commands can be given to vim-addons to inspect or alter the status
of the addons: list, status, install, remove, disable, amend, files, show.

A description of the semantics of each command is reported below.

:list
  list, one per line, the names of the addons available in the system (i.e. of
  all the addons mentioned in the registry, not necessarily of all enabled
  addons)

:status
  show, one per line, the status of the addons available in the system. If one
  or more addon arguments are specified only show the status of those addons.
  This is the default command if nothing is specified.

:install
  install one or more addons under the target directory. Requires at least one
  addon argument

:remove
  remove one or more addons from the target directory. Requires at least one
  addon argument

:disable
  disable one or more addons to be used by the current user. Usually used for
  addons which are system-wide enabled by the local administrator but that the
  current user does not want to be used. Using this command will automatically
  change the content of plugin/vim-addons.vim under the target directory,
  probably adding ":let" commands which will inhibit the given addon from being
  used.  Requires at least one addon argument

:enable
  undo the effects of a previous disable command. Requires at least one addon
  argument

:files
  list, one per line, the files composing the specified addons. Files are
  listed relative to components of the Vim runtimepath (see 'runtimepath' in
  the Vim help). Requires at least one addon argument

:show
  displays detailed information about the specified addons

== OPTIONS

All commands accept the following options:

:-h, --help
  show this usage message and exit

:-q, --query
  be quiet and make the output more parseable (for "status")

:-r, --registry-dir
  set the registry directory (default: /usr/share/vim/registry)

:-s, --source-dir
  set the addons source directory (default: /usr/share/vim/addons)

:-t, --target-dir
  set the addons target directory (default: $HOME/.vim)

:-v, --verbose
  increase verbosity level

:-z, --silent
  silent mode: suppress most of the output

:-y, --system-dir
  set the system-wide target directory (default: /var/lib/vim/addons)

:-w, --system-wide
  set the addons target directory to the system-wide target directory, possibly
  overriding the -t option

== AUTHOR

Stefano Zacchiroli <zack@debian.org>
James Vega <jamessan@debian.org>

== SEE ALSO

vim(1), vim-registry(5)

== COPYRIGHT

Copyright (C) 2007 Stefano Zacchiroli
Copyright (C) 2009 James Vega

This program is free software, you can redistribute it and/or modify it under
the terms of the GNU General Public License version 3 as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.

=end

require 'etc'
require 'getoptlong'

require 'vim/addon_manager'
require 'vim/addon_manager/registry'

def usage(status = 0)
  print <<EOS
Usage:
  vim-addons [OPTION ...] [COMMAND [ADDON ...]]
Commands:
  list, status (default command), install, remove, disable, enable, files, show
Options:
  -h, --help          show this usage message and exit
  -q, --query         be quiet and make the output more parseable
  -r, --registry-dir  set the registry directory
                        (default: /usr/share/vim/registry)
  -s, --source-dir    set the addons source directory
                        (default: /usr/share/vim/addons)
  -t, --target-dir    set the addons target directory
                        (default: $HOME/.vim)
  -v, --verbose       increase verbosity
  -z, --silent        silent mode: supress most of the output
  -y, --system-dir    set the system-wide target directory
                        (default: /var/lib/vim/addons)
  -w, --system-wide   set target directory to the system-wide one
                        (overrides -t setting)
EOS
  exit status
end

def die_usage
  usage(1)
end

def logger
  Vim::AddonManager.logger
end

def parse_cmdline
  options = { # defaults
    :registry_dir => '/usr/share/vim/registry',
    :source_dir   => '/usr/share/vim/addons',
    :system_dir   => '/var/lib/vim/addons',
    :target_dir   => File.join(ENV['HOME'] || (Etc.getpwnam Etc.getlogin).dir, '.vim'),
    :query        => false,
    :system_wide  => false,
  }
  cmds = %w{install remove disable enable list status files show upgrade-from-legacy}
  req_arg_cmds = # commands requiring >= 1 arg
    %w{install remove disable amend files}
  cmdline =
    GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT],
                   ['--registry-dir', '-r', GetoptLong::REQUIRED_ARGUMENT],
                   ['--source-dir', '-s', GetoptLong::REQUIRED_ARGUMENT],
                   ['--target-dir', '-t', GetoptLong::REQUIRED_ARGUMENT],
                   ['--query', '-q', GetoptLong::NO_ARGUMENT],
                   ['--verbose', '-v', GetoptLong::NO_ARGUMENT],
                   ['--silent', '-z', GetoptLong::NO_ARGUMENT],
                   ['--system-dir', '-y', GetoptLong::REQUIRED_ARGUMENT],
                   ['--system-wide', '-w', GetoptLong::NO_ARGUMENT])
  begin
    cmdline.each do |opt, arg|
      case opt
      when '--help'
        usage
      when '--registry-dir'
        options[:registry_dir] = arg
      when '--source-dir'
        options[:source_dir] = arg
      when '--target-dir'
        options[:target_dir] = arg
      when '--query'
        options[:query] = true
      when '--verbose'
        logger.increase_verbosity
      when '--silent'
        logger.quiet!
      when '--system-dir'
        options[:system_dir] = arg
      when '--system-wide'
        options[:system_wide] = true
      end
    end
  rescue GetoptLong::Error
    die_usage
  end
  options[:target_dir] = options[:system_dir] if options[:system_wide]
  cmd = 'status' unless cmd = ARGV.shift
  die_usage unless cmds.member? cmd
  die_usage if req_arg_cmds.member? cmd and ARGV.empty?
  [cmd, ARGV, options]
end

cmd, args, options = parse_cmdline
registry = Vim::AddonManager::Registry.new(options[:registry_dir], options[:source_dir])
selected_addons =
  args.empty? ? registry.to_a : registry.select {|a| args.member? a.name}
unknown = args.select {|name| registry.all? {|a| a.name != name} }
logger.warn "Ignoring unknown addons: #{unknown.join ', '}" unless unknown.empty?

case cmd
when 'list'
  puts registry.sort
when 'status'
  if options[:query]
    selected_addons.sort.each do |a|
      printf("%s\t%s\n", a, options[:system_wide] ? \
             a.status(options[:system_dir]) : a.status(options[:target_dir]))
    end
  else
    printf("# %-25s%-13s%-14s\n", 'Name', 'User Status', 'System Status')
    selected_addons.sort.each do |a|
      printf("%-28s%-14s%-14s\n", a, a.status(options[:target_dir]),
             a.status(options[:system_dir]))
    end
  end
when 'files'
  selected_addons.each {|a| puts a.files.to_a}
when 'upgrade-from-legacy'
  mgr = Vim::AddonManager.new options[:target_dir]
  mgr.upgrade_from_legacy(registry.to_a)
else
  mgr = Vim::AddonManager.new options[:target_dir]
  mgr.send cmd, selected_addons
end