Changes between Version 62 and Version 63 of UsingVimWithDjango


Ignore:
Timestamp:
Jul 10, 2014, 5:05:29 AM (10 years ago)
Author:
wayneye
Comment:

Removed seriously outdated Omnicomplete/snippetsEmu/snipMate with two modern and super powerful plugins: YouCompleteMe and Ultisnips, with recommended settings.

Legend:

Unmodified
Added
Removed
Modified
  • UsingVimWithDjango

    v62 v63  
    2323}}}
    2424
    25 === Omnicomplete ===
    26 Here's a [http://blog.fluther.com/blog/2008/10/17/django-vim/ tutorial] for enabling omnicompletion specifically for django.
    27 
    28 Also under development: [http://orestis.gr/blog/2008/10/13/pysmell-v06-released/ PySmell]
    29 
    3025== Plugins ==
    31 === snippetsEmu ===
    32 Development takes place on [http://code.google.com/p/snippetsemu Google Code], where the subversion repository includes predefined snippets for django/python/etc.
    33 
    34 [http://www.vim.org/scripts/script.php?script_id=1318 SnippetsEmu] allows one to define abbreviations which can be expanded into larger blocks of text.  The abbreviations can also contain place markers which can be 'jumped to' in a similar manner to the macros defined in TextMate on OS X.
    35 
    36 One can add specific abbreviations for models or templates based on file contents.  Adding the following line to your ~/.vim/after/ftplugin/python.vim file (create it if you don't have it) will allow you to define abbreviations just for models (use the file \Program Files\vim\vimfiles\after\ftplugin\python.vim under Windows):
    37 {{{
    38 if getline(1) =~ 'from django.db import models'
    39     "Your abbreviations here
    40 endif
    41 }}}
    42 
    43 The following is an example collection of Django specific abbreviations for use with the plugin. More examples can be found in the [http://snippetsemu.googlecode.com/svn/trunk/after/ftplugin/ subversion repository]. Please email the author with any of your own additions (f dot ingram dot lists at gmail dot com):
    44 
    45 Models:
    46 {{{
    47 Snippet addmodel class <{}>(models.Model):<CR><><CR><CR>def __unicode__(self):<CR>return "%s" % (<{}>,)
    48 Snippet mcf models.CharField(max_length=<{}>)<CR><{}>
    49 Snippet mff models.FileField(upload_to=<{}>)<CR><{}>
    50 Snippet mfpf models.FilePathField(path=<{}>, match="<{}>", recursive=<False>)<CR><{}>
    51 Snippet mfloat models.FloatField(max_digits=<{}>, decimal_places=<{}>)<CR><{}>
    52 Snippet mfk models.ForeignKey(<{}>)<CR><{}>
    53 Snippet m2m models.ManyToManyField(<{}>)<CR><{}>
    54 Snippet o2o models.OneToOneField(<{}>)<CR><{}>
    55 }}}
    56 
    57 Templates:
    58 
    59 {{{
    60 Snippet fore {% for <{entry}> in <{list}> %}<CR>{{ <{entry}>.<{}> }}<CR><{}>{% endfor %}<CR><{}>
    61 }}}
    62 
    63 snippetsEmu for '''urls.py''' and '''views.py''' files can be found on the attachment section. To use this snippets, copy them into ''~/.vim/after/ftplugin/'' directory
    64 
    65 
    66 === !SnipMate.vim ===
    67 
    68 [http://www.vim.org/scripts/script.php?script_id=2540 SnipMate] is another plugin that adds TextMate-style snippets for Vim.  The [http://github.com/robhudson/snipmate_for_django/tree/master snipmate_for_django] Git repository, by Rob Hudson, contains many of the TextMate snippets converted to !SnipMate.
     26=== YouCompleteMe ===
     27[https://github.com/Valloric/YouCompleteMe YouCompleteMe] is a fast, as-you-type, fuzzy-search code completion engine for Vim, it provide a [http://jedi.jedidjah.ch/en/latest/ Jedi]-based completion engine for Python.
     28
     29Lines below are recommended settings for YCM:
     30{{{
     31let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
     32let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
     33let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
     34let g:ycm_complete_in_comments = 1 " Completion in comments
     35let g:ycm_complete_in_strings = 1 " Completion in string
     36}}}
     37
     38=== Ultisnips.vim ===
     39
     40[https://github.com/SirVer/ultisnips UltiSnips] is the ultimate solution for snippets in Vim, it is written in python and works perfectly with [https://github.com/Valloric/YouCompleteMe YouCompleteMe].
     41
     42Lines below are recommended settings for Ultisnips to be working with YouCompleteMe:
     43
     44{{{
     45let g:UltiSnipsExpandTrigger       = "<c-j>"
     46let g:UltiSnipsJumpForwardTrigger  = "<c-j>"
     47let g:UltiSnipsJumpBackwardTrigger = "<c-p>"
     48let g:UltiSnipsListSnippets        = "<c-k>" "List possible snippets based on current file
     49}}}
    6950
    7051=== XMLEdit.vim ===
Back to Top