Bug#704618: vim-runtime: Distinguish between python and python.django, setting filetype accordingly

Mark Caglienzi mark.caglienzi at gmail.com
Wed Apr 3 16:52:54 UTC 2013


Package: vim-runtime
Version: 2:7.3.547-7
Severity: wishlist
Tags: patch

Dear Maintainer,
I am experimenting with https://github.com/mcagl/snipmate.vim (which is the
snipmate plugin, plus https://github.com/robhudson/snipmate_for_django to
handle specific django snippets).

I found that the django specific snippets are triggered when vim is aware that
I am editing a htmldjango or python.django file. The former is already taken
care of in /usr/share/vim/vim73/filetype.vim but the latter is not.

I never wrote a vimscript, so maybe the proposed patch isn't the better way to
handle this, but for me it seems to work. I used the function that distinguishes
html and htmldjango as a base for my patch.

If '.*django.*' (I thought that in the beginning of the file there will be some
import from django.something) is found in the first 20 lines of the .py file,
vim will set 'python.django' (and snipmate will expand, for example, model<TAB>),
otherwise it will set 'python' (and the django related snippets aren't loaded).

Kind regards,
Mark



-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5-trunk-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

vim-runtime depends on no packages.

Versions of packages vim-runtime recommends:
ii  vim-gnome [vim]  2:7.3.547-7
ii  vim-gtk [vim]    2:7.3.547-7
ii  vim-nox [vim]    2:7.3.547-7
ii  vim-tiny         2:7.3.547-7

vim-runtime suggests no packages.

-- no debconf information

-- 
. ''`.  | GPG Public Key  : 0xCD542422 - Download it from http://is.gd/fOa7Vm
: :'  : | GPG Fingerprint : 0823 A40D F31B 67A8 5621 AD32 E293 A2EB CD54 2422
`. `'`  | Powered by Debian GNU/Linux, http://www.debian.org
  `-    | Try not. Do, or do not. There is no try. - Master Yoda, TESB.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filetype.vim-patch.diff
Type: text/x-diff
Size: 636 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20130403/f8a500b4/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20130403/f8a500b4/attachment.pgp>


More information about the pkg-vim-maintainers mailing list