I love Tim Pope's rails.vim, and I'm wondering if there's an equivalent vim plugin for Django. I'm especial开发者_StackOverflow中文版ly looking for easy navigation of the Django file structure via vim command mode.
I use django.vim for Django Templates
Theres nothing as well structured as that plugin.
As far as quick navigation goes I have this in my vimrc
http://code.djangoproject.com/wiki/UsingVimWithDjango#Mappings (That whole doc will give you some good starting points)
Also I've published a couple of offerings on vim.org for some nav tasks
http://www.vim.org/scripts/script.php?script_id=2781 (For Reverse url and template jumping)
http://www.vim.org/scripts/script.php?script_id=2780 (completing imports)
Other than that general purpose vim fu can take you a long way
I've created a repo that I want to add a lot of branches to for vim config (django/python centric). There are already a few branches and some path-hacking for settings.py. Feel free to fork/branch and share!
http://github.com/skyl/vim-config-python-ide
I haven't gotten around to adding nerdtree, but I think that is a really popular plugin for a filebrowser.
The django wiki page on using vim now lists the pony.vim plugin, which seems like it gives similar things to rails.vim, including the ability to jump between models, views, templates, etc per app, as well as run some of the django commands right from within vim. Part of it is that, quite simply, django's folder structure is different than Rails (less complicated?/less defined?/certainly different ethos overall). But pony.vim
seems like it covers most of the bases.
rope-vim can make completions easier, though it does require just a tiny bit of customization, plus it adds direct access to the docs on autocomplete, which is quite nice.
(I'm answering this here because this is the top result on Google when searching for rails.vim equivalent for Django :P)
** Update 10/8/2013 **
I'm now using a jedi driven python vim configuration (along with some tmux config)
https://github.com/JarrodCTaylor/imt_dotfiles
I also have a fairly complete vim config for django development (if you are interested).
https://github.com/toranb/vimfiles
I use rope-vim as mentioned by others but I also have a few other useful plugins to ensure you can run unit tests (using nose) in your django project with QTPY
A few things I ran into that others never seem to mention when doing python / django development on OSX and Ubuntu (day job dev / night time dev) including:
https://github.com/lambdalisue/vim-django-support
https://github.com/jmcantrell/vim-virtualenv
If you ensure vim has the virtualenv activated (assuming you are using virtualenv) the rope plugin will know where to find your site-packages for quick "go to definition" lookups along with other refactoring support.
I use this without any need for pycharm now as I get full autocompletion with rope-vim and supertab. I also have the command-t plugin for quick "find by file" lookups / etc
I recently found that using basic ctags on OSX + Ubuntu enabled me to "find symbol" using the below. I also added a simple "recent files" lookup using the find in buffer. I also added a few shortcuts to show a fuzzy finder like search from the current directory (for the file I happen to have open). I use this to show other related files quickly / etc.
find by symbol equiv (shows classes / methods in a fuzzy finder using your ctags file)
:FufTag
find in buffer (recent files)
:FufBuffer
show fuzzy finder w/ other files in the current dir
:FufFileWithCurrentBufferDir
精彩评论