Bug#440843: vim-addon-manager: add bash completion for vim-addons

Antonio Terceiro terceiro at softwarelivre.org
Tue Sep 4 19:12:54 UTC 2007


Package: vim-addon-manager
Version: 0.3
Severity: wishlist

Please consider adding the bash completion script in this message.  The
attached patch was made against the current state of vim-addon-manager
subversion repository.

Cheers,

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-4-486
Locale: LANG=pt_BR.utf8, LC_CTYPE=pt_BR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages vim-addon-manager depends on:
ii  ruby                         1.8.2-1     An interpreter of object-oriented 
ii  vim-common                   1:7.1-056+2 Vi IMproved - Common files

Versions of packages vim-addon-manager recommends:
ii  vim                          1:7.1-056+2 Vi IMproved - enhanced vi editor
ii  vim-ruby [gvim]              1:7.1-056+2 Vi IMproved - enhanced vi editor -
ii  vim-tiny                     1:7.1-056+2 Vi IMproved - enhanced vi editor -

-- no debconf information

-- 
Antonio Terceiro <terceiro at softwarelivre.org>
http://people.softwarelivre.org/~terceiro/
GnuPG ID: 0F9CB28F


-------------- next part --------------
Index: debian/vim-addon-manager.install
===================================================================
--- debian/vim-addon-manager.install	(revision 1019)
+++ debian/vim-addon-manager.install	(working copy)
@@ -1,2 +1,3 @@
 src/vim-addons	    /usr/bin/
 src/vim		    /usr/lib/ruby/1.8/
+bash_completion.d/vim-addons /etc/bash_completion.d/
Index: bash_completion.d/vim-addons
===================================================================
--- bash_completion.d/vim-addons	(revision 0)
+++ bash_completion.d/vim-addons	(revision 0)
@@ -0,0 +1,52 @@
+# vim-addons completion script for vim-addons
+# 
+# Copyright (c) 2007, Antonio Terceiro <terceiro at softwarelivre.org>
+# 
+# This program is free software, you can redistribute it and/or modify it under
+# the terms of the GNU General Public License version 2 as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+
+
+_complete_vim_addons() {
+
+  COMPREPLY=()
+  cur=${COMP_WORDS[COMP_CWORD]}
+  prev=${COMP_WORDS[COMP_CWORD-1]}
+
+  commands="list status install remove disable amend files show"
+  options="-h --help -r --registry-dir -s --source-dir -t --target-dir -v --verbose -y --system-dir -w --system-wide"
+
+  # complete option names
+  if [[ "$cur" == -* ]]; then
+    COMPREPLY=( $( compgen -W "$options" -- $cur) )
+    return 0
+  fi
+
+  case "$prev" in
+
+    # complete commands
+    vim-addons)
+      COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+      return 0
+      ;;
+
+    # complete directory names
+    -r|--registry-dir|-s|--source-dir|-t|--target-dir|-y|--system-dir)
+      COMPREPLY=( $( compgen -o dirnames -- $cur ) )
+      return 0
+      ;;
+
+    # complete addon names
+    *)
+      COMPREPLY=($(grep -h "^addon: $cur" /usr/share/vim/registry/*.yaml | sed -e 's/^addon:\s*//'))
+
+      return 0
+      ;;
+  esac
+
+
+}
+complete -F _complete_vim_addons -o default vim-addons
+
+# vim: sw=2 expandtab ft=sh


More information about the pkg-vim-maintainers mailing list