Python development How to configure Vim on Ubuntu 15.10

Source: Internet
Author: User
1. To install VIM, you can install it using the Apt-get tool that comes with Ubuntu.

Apt-get Install Vim-gnome

2, after the installation is successful, configure

1> first automatic hint completion configuration (pydiction)

From the official download http://www.vim.org/scripts/script.php?script_id=850 the latest can, after decompression, into the extracted directory, execute the following command

# CP python_pydiction.vim/usr/share/vim/vim74/ftplugin# mkdir/usr/share/vim/vim74/pydiction# CP complete-dict pydiction.py/usr/share/vim/vim74/pydiction/# VI ~/.VIMRC

Explain:

The first line is to copy the downloaded file to/usr/share/vim/vim74/ftplugin
The second line is to create a folder under the/usr/share/vim/vim74/directory Pydiction
The third line replicates complete-dict pydiction.py these two files to
Line four opens the. VIMC configuration file

Then copy the following three lines of code into the inside and save it, it should be.

After you click ESC, do: Wq, save

Let g:pydiction_location = '/usr/share/vim/vim74/pydiction/complete-dict ' Let g:pydiction_menu_height = 20autocmd FileType Python set Omnifunc=pythoncomplete#complete

2> Install Python_fold Auto-collapse plugin from the official download http://www.vim.org/scripts/script.php?script_id=515 the latest plug-in, unzip, into the extracted directory, execute the following command

# CP python_fold.vim/usr/share/vim/vim74/plugin/# VI ~/.VIMRC

Explain:

The first line is to copy the downloaded file to/usr/share/vim/vim74/plugin
The second line opens the. VIMC configuration file

and copy the following line of code into it.

Set Foldmethod=indent

3> Install the automatic highlighting plugin from the official download: http://www.vim.org/scripts/script.php?script_id=790, downloading the latest plug-in, unzip, into the extracted directory, execute the following command

Mv/usr/share/vim/vim74/syntax/python.vim/usr/share/vim/vim74/syntax/python.vim_backup CP python.vim/usr/share/ Vim/vim74/syntax

Explain:

The first line is to back up the Python.vim
The second line replicates Python.vim to the/usr/share/vim/vim74/syntax directory

4> Generating Ctag sequences

Go to the directory where the Python program script (project) is located and execute in that directory:

Ctags-r *

If you are prompted not to install Ctags, perform apt-get install Ctags.

Generates a ctags file that records analysis sequence records for a program/project's functions, classes, and so on. For detailed usage of Ctag please read Ctag's manpage.

5> Installing the TagList plugin

From the official download plug-in: http://www.vim.org/scripts/script.php?script_id=273, with the latest can, unzip, into the extracted directory, execute the following command.

# CP plugin/taglist.vim/usr/share/vim/vim74/plugin/# CP doc/taglist.txt/usr/share/vim/vim74/doc/# VI

Execute the following command

: Helptags/usr/share/vim/vim74/doc
: Help taglist.txt the first line to generate a list of taglist assist files in the second line view TagList Help information configuration VIMRC, vi ~/.VIMRC, add the following code after

Let Tlist_show_one_file = 1let Tlist_exit_onlywindow = 1let Tlist_use_right_window = 1let Tlist_auto_open=1let Tlist_File _fold_auto_close=1

Explain:

The first line does not display the tag of multiple files at the same time, only the current file is displayed.
Second line if the TagList window is the last window, exit vim.
The third line displays the TagList window in the right window.
The line four automatically opens the TagList window after Vim is started.
The five lines only show the current file tag, the other file's tag folding.

The final configuration results are as follows:

The contents of the configuration file are as follows: required to be replicable.

Set Tabstop=4set softtabstop=4set shiftwidth=4set expandtabset autoindentset foldmethod=indentlet Tlist_Auto_ Highlight_tag=1let tlist_auto_open=1let Tlist_auto_update=1let Tlist_display_tag_scope=1let Tlist_Exit_OnlyWindow= 1let tlist_enable_dold_column=1let Tlist_file_fold_auto_close=1let Tlist_show_one_file=1let Tlist_Use_Right_Window =1let tlist_use_singleclick=1nnoremap <silent> <F8>: Tlisttoggle<cr>filetype plugin Onautocmd FileType python set omnifunc=pythoncomplete#completeautocmd FileType javascrīpt set omnifunc=javascriptcomplete# Completejsautocmd FileType HTML set omnifunc=htmlcomplete#completetagsautocmd FileType CSS set omnifunc=csscomplete# Completecssautocmd FileType XML set omnifunc=xmlcomplete#completetagsautocmd FileType PHP set omnifunc=phpcomplete# Completephpautocmd FileType C set omnifunc=ccomplete#completeautocmd FileType python set omnifunc=pythoncomplete# Completelet g:pydiction_location = '/usr/share/vim/vim74/pydiction/complete-dict ' let G:pydictioN_menu_height = 20set foldmethod=indent 

After configuration, the file editing results are as follows:

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.