Pysmell (Vim Python Django plugin) Installation Details

Source: Internet
Author: User

I have read several installation methods from the Internet, but they are not clear enough, and the README of this project is too simple. As a result, the plug-in has been successfully installed for a long time.

1. Install pysmell

Python Installation Tool: APT-Get install Python-setuptools
Sudo easy_install pysmell

2. Set Vim

According to the installation documentation, copy pysmell. Vim to the. Vim/plugin directory, and then modify Python's omnicomplete in. vimrc to use pysmell.

First, through the first step of installation, I did not find pysmell. Vim on the machine.

I had to download one from address: https://github.com/orestis/pysmell

Then, the plug-in address on my Ubuntu is/usr/share/Vim/vim73/plugin.

Copy the plug-in here and open/etc/Vim/vimrc.

Add:

set ts=4set expandtabfiletype plugin on"autocmd FileType python set omnifunc=pythoncomplete#Completeautocmd FileType python setlocal omnifunc=pysmell#Complete

Note: The first line sets four spaces at the tab interval.

The third line opens the plug-in. The fourth line is because I used the pythoncomplete plug-in that comes with vim. For the installation method, see enable the python plug-in vim.

The reason why you don't need to change the pysmell plug-in is that the pysmell plug-in is more flexible and can come with more module prompts, such as Django.

The fifth line is the new configuration, using pysmell

3. Create pysmelltags

The idea of this plug-in is to compress all modules that need to be added with the prompt function into tags, and then put these tags in the project root directory for use.

Use the following methods to access the python Directory:/usr/lib/python2.7

Then execute:

Pysmell.-X dist-packages test-O pysmelltags. pythonlib

Pysmell dist-packages/Django-O pysmelltags. Django

Copy the generated tags to the developed project directory, for example:

MV pysmelltags .*~ /Django-celery-rabbitmq/mysite/

Then go to the development project directory and execute

Pysmell.

The pysmelltags file is generated in the directory.

4. Use of VIM

Use Vim to open a file, such as Vim polls/models. py.

Enter models. Click Ctrl + X and then Ctrl + O. The prompt is displayed, as shown in:

Summary:

This plug-in can be said to be powerful, but it took some time to install the plug-in because the document was relatively simple and did not understand its ideas. After installation, it feels quite easy to use and can flexibly load the required modules.

Refer:

Http://acheron.iteye.com/blog/394654

Http://www.vim.org/scripts/script.php? Script_id = 1, 1318

Http://code.google.com/p/snippetsemu/

Https://code.djangoproject.com/wiki/UsingVimWithDjango#no1

Http://johnsonqu.blogbus.com/logs/33135172.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.