vim-mule


Ⅰ. 插件描述

:horse: Django productivity plugin for VIM.

Ⅱ. 基本信息

创建日期:  2016-10-23
使用用户:  1
Github星:  48
插件作者:  Umut Çağdaş Coşkun

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'umutcoskun/vim-mule'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'umutcoskun/vim-mule'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'umutcoskun/vim-mule'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/umutcoskun/vim-mule

Ⅳ. 文档说明

vim-mule

Features

You can change default key mappings. See customization section.

  • :DjangoSwitch Switch to related application file by pressing F4.

django-switch

  • :DjangoSettings Open project settings by pressing F8.
  • :DjangoManage You can run manage.py commands anywhere in the project with TAB completion. By pressing F9.

Example: r{TAB} turns into runserver, m{TAB} turns into makemigrations and mi{TAB} turns into migrate.

More: https://docs.djangoproject.com/en/1.10/ref/django-admin/#available-commands

  • Virtual Environment Support: When you run a :DjangoManage command and if you are not in a virtual environment, vim-mule activates projects virtual environment (usually, in the parent directory of the project root) just for the command. Then you will no suprised with ImportError.
  • :DjangoTemplates Lists all the templates in the project in a quick fix window. By pressing F6. Requires ctrlpvim/ctrlp.vim.

Quick Jump Commands

Jump commands are goes to commonly used files in spesific applications.

You can auto complete application name with TAB.

  • :DjangoViews [app] Jumps to app's views.py
  • :DjangoModels [app] Jumps to app's models.py
  • :DjangoForms [app] Jumps to app's forms.py
  • :DjangoAdmin [app] Jumps to app's admin.py
  • :DjangoUrls [app] Jumps to urls.py
  • :DjangoTests [app] Jumps to tests.py

Installation

  • Install using vim-plug:

    `Plug 'umutcoskun/vim-mule'`
    
  • Install using Vundle:

    `Plugin 'umutcoskun/vim-mule'`
    
  • Install using Pathogen:

    `cd ~/.vim/bundle && git clone https://github.com/umutcoskun/vim-mule.git`
    

Customization

Here is the defeault options that you can change:

" Selected interpreter to run commands.
let g:mule_python_command = 'python3'

" Auto enable virtual environment.
" If you don't want, set it to 0 (zero).
let g:mule_auto_env = 1

" Only set if you don't want auto hotkey mappings.
" Hotkeys will mapped for only python filetype.
let g:mule_no_hotkeys = 1

" Uses CtrlP to list templates.
let g:mule_use_ctrlp = 1

Here is the default mappings if auto hotkeys enabled:

nmap <silent> <F4> :DjangoSwitch<CR>
nmap <silent> <F4> :DjangoTemplates<CR>
nmap <silent> <F8> :DjangoSettings<CR>
nmap <F9> :DjangoManage 

Pull requests are welcome!

添加新评论