Use pathogen to manage the Vim plug-in and host the GitHub reference article "1" "2" to create vim as a python development environment. The article uses pathogen + git to manage the Vim plug-in. For this __python

Source: Internet
Author: User
Tags autoload mkdir set background git clone
Make vim a python development environment. The article uses pathogen + git to manage the Vim plug-in. Students who are not quite clear about this way can refer to the introduction of "3". Pathogen changed the original vim can only throw the plugin all to the. Vim directory operation mode, so that each plug-in can be a separate folder in the. Vim/bundle directory, add and remove plug-ins are very refreshing. With Git's powerful child module management capabilities, you can implement easy plug-in installation and automatic upgrades.

1. Preparatory work

Create the. Vim directory, along with the AutoLoad and bundle directories under it. (If you have previously had a. Vim directory, you can back it up first)

$ mkdir ~/.vim/$ mkdir ~/.vim/{autoload,bundle}$ cd ~/.vim/$ git init

If Git is not installed in Ubuntu, you need to first install Git "4".

2. Install pathogen

Download the Vim-pathogen "5" and copy the Pathogen.vim file under AutoLoad in the ZIP package to the ~/.vim/autoload folder.

Then add the following command to the ~/.VIMRC file (. vimrc file does not exist, create the. vimrc file first).

FileType Offcall pathogen#runtime_append_all_bundles () call Pathogen#helptags ()

When the pathogen command is run, file format detection must be turned off, so filetype off to the front (uptated (20141022)).

In this way, the pathogen plugin is installed.

UPDATED (20141017):

(1) When the use of VIM, when the completion of this article, will be reported errors:

Error detected while Processing/home/maxime/.vim/bundle/tasklist/plugin/tasklist.vim:line  369:e227:mapping already exists for \ t

The reason for the error is: Tasklist would not map to <leader>t if a mapping to <plug>tasklist is found. So, just need to create a mapping to <plug>tasklist in your VIMRC.

The workaround: Add mapping "7" to the ~/.VIMRC file:

Nnoremap <leader>v <plug>tasklist

(2) After adding mapping, the following command line will still pop up when using vim:

Change Pathogen#runtime_append_all_bundles () to Pathogen#infect () press ENTER or type command to continue

Reason: Call Pathogen#infect () which can to used in the latest version of pathogen today deals with this filetype problem Much easier to remember and type than Runtime_append_all_bundles) "8"

This is the hint you pathogen#runtime_append_all_bundles () is too old, now replace it with Pathogen#infect (), and more than Pathogen#runtime_append_all_bundles () It is easier to remember, but also less to play a lot of words.

So you need to change the call Pathogen#runtime_append_all_bundles () in the above setting to Pathogen#infect ().

uptated (20141022)

When setting syntax highlighting in VIMRC, the discovery does not work, and syntax highlighting works if the filetype off is dropped, or before it is raised to syntax on.

So you need to filetype off to the top of the VIMRC file.

UPDATED (20141024)

(1) For the reasons why pathogen should turn off filetype detection, see "12" and also provide a workaround, after filetype off, to not affect other features, after setting up pathogen, then filetype Detection Open.

(2) You must set filetype off because of a bug in Vim's file detection, which was fixed in the >vim 7.3.430 version, so if the version of Vim >vim 7.3.430, you do not have to set filetype off "13".

(3) In order to avoid unnecessary trouble, we will pathogen plug-in set ahead to the beginning of VIMRC.

3. Git submodule add plugin to git repository

The role of Git submodule, in simple terms, is to hook up someone else's git to any location you currently git. Add all the vim plugins as our current repository submodule.

For a detailed tutorial on Git submodule, refer to "6".

Execute the following command under the ~/.vim directory

git submodule add http://github.com/tpope/vim-fugitive.git bundle/vim-fugitivegit submodule add https://github.com/ Msanders/snipmate.vim.git bundle/snipmategit submodule Add https://github.com/tpope/vim-surround.git bundle/ Vim-surroundgit submodule Add https://github.com/tpope/vim-git.git bundle/vim-gitgit submodule add https://github.com /ervandew/supertab.git bundle/supertabgit submodule Add https://github.com/sontek/minibufexpl.vim.git bundle/ Minibufexplgit submodule Add https://github.com/wincent/Command-T.git bundle/command-tgit submodule add https:// Github.com/mitechie/pyflakes-pathogen.git bundle/pyflakes-pathogengit submodule Add https://github.com/mileszs/ Ack.vim.git bundle/ackgit submodule Add https://github.com/sjl/gundo.vim.git bundle/gundogit submodule add https:// Github.com/fs111/pydoc.vim.git bundle/pydocgit submodule Add https://github.com/vim-scripts/pep8.git bundle/pep8git Submodule Add https://github.com/alfredodeza/pytest.vim.git bundle/pytestgit submodule Add https:Github.com/reinh/vim-makegreen bundle/vim-makegreengit submodule Add https://github.com/vim-scripts/ TaskList.vim.git bundle/tasklistgit submodule Add https://github.com/vim-scripts/The-NERD-tree.git bundle/ The-nerd-treegit submodule Add https://github.com/sontek/rope-vim.git bundle/rope-vimgit submodule initgit submodule Updategit submodule foreach git submodule initgit submodule foreach git submodule update

Note: during the installation process, Minibufexpl.vim.git and Rope-vim.git are not installed successfully and require a username and password.

Now, we've put the vim configuration in the Git repository. After performing the above operation, a hidden file is generated under the. Vim directory:. Gitmodules.

UPDATED (20141020):

When these plug-ins are added as submodule, some untracked files (such as bundle/snipmate/doc/tags files) are generated in these plug-ins. Filtering in. Gitignore does not work.

The solution is ("9" is a problem raised in StackOverflow, "10" is the source of the solution):

By adding the "Ignore = dirty option to each one of the" entries in the. gitmodules file.

[Submodule "Zen-coding-gedit3"]    Path = zen-coding-gedit3    url = git://github.com/leafac/zen-coding-gedit3.git    ignore = Dirty

4. Submit it to GitHub

Because the. vimrc file is not in the. Vim directory, copy it from the ~ directory to the. Vim directory and Add. (In UPDATED2)

git statusgit commit-m "Add. Vim plugins" CP ~/.vimrc. Git Add. vimrcgit statusgit commit-m "Add. vimrc file" Git Statusgi T remote Add Origin Https://github.com/zhchnchn/VimConfig.gitgit Push-u Origin Master

UPDATED (20141020):

Git push-u origin master:push to the remote repository, set up the tracking branch, and the next time you push, just type git push, and the remote Master branch is tracked automatically with the local master branch.

UPDATED2 (20141020)

In order to put all the files under version control, we need to move the ~/.VIMRC to the ~/.vim (with GVIMRC, move it together), so that he is no longer a hidden file, we remove the front point (.) "11".

MV ~/.VIMRC ~/.VIM/VIMRCMV ~/.GVIMRC ~/.VIM/GVIMRC

When you start Vim, you will still try to find the. vimrc file below, so we create a symbolic link. Link the ~/.VIM/VIMRC file to the ~/.VIMRC file.

Ln-s ~/.VIM/VIMRC ~/.vimrcln-s ~/.VIM/GVIMRC ~/.GVIMRC

Commit the above modifications to GitHub.

5. How to sync the Vim plug-in to another machine

How to synchronize to another machine after committing the. Vim configuration to GitHub.

Note: the "local" mentioned below refers to the "local" directory of other machines.

(1) Clone the. Vim configuration to the ~/.vim directory of the other machine (if not. Vim creates a new one)

git clone git@github.com:zhchnchn/vimconfig.git ~/.vim

(2) Create symbolic link, link ~/.VIM/VIMRC file to ~/.VIMRC file.

Ln-s ~/.VIM/VIMRC ~/.VIMRC

(3) If you modify the local VIMRC file, after git add and git commit, you can submit the git push directly to the GitHub.

(4) View the clone to the local bundle directory of the various Plug-ins directory, found that they are empty, because it is not synchronized to the local. Sync them to local "11":

~/.vim$ git submodule init~/.vim$ git submodule update

The previous command function is "registers the Submodule".

The latter function is "Checks out" of the version of each plugin ' s repository which is committed to the. Vim repository before "., it will download the various plug-ins to the To

6. How to install the theme style plugin under pathogen.

Pathogen cannot install a color theme style, because it will install all plug-ins in the bundle directory, and vim only recognize the ~/.vim/colors/under the theme style. Therefore, only the theme plug-in can be placed manually under ~/.vim/colors/"14".

For example, to install the following 2 theme Plug-ins, you need to copy the *.vim file (that is, the Solarized.vim, Molokai.vim file, and not the directory containing *.vim files) from the downloaded plug-in to the ~/.vim/colors/directory (if it is not created manually). Solarized (https://github.com/altercation/vim-colors-solarized) Molokai (Https://github.com/tomasr/molokai)

Then set the theme in the. vimrc file:

"Color scheme set background=darkcolorscheme solarized" ColorScheme Molokai

refer


"1" turning Vim into a modern Python IDE (http://www.sontek.net/blog/2011/05/07/turning_vim_into_a_modern_python_ide.html)
"2" turning Vim into a modern Python IDE (Chinese translation, which has many errors, please refer to the citation.) HTTP://PYTHON.42QU.COM/11180003)
"3" Tutorial: Using pathogen + git to manage Vim plug-ins (http://lostjs.com/2012/02/04/use-pathogen-and-git-to-manage-vimfiles/)
"4" Ubuntu12.04 install Git (http://www.cnblogs.com/zhcncn/p/4030078.html)
"5" Vim-pathogen (Https://github.com/tpope/vim-pathogen)
"6" Git submodule using the full tutorial (http://www.kafeitu.me/git/2012/03/27/git-submodule.html)

"7" Resolving a vim plugin mapping conflict-mapping already for \ t (exists SOLVING-A-VIM-PLUGIN-MAPPING-CONFLICT-MAPPING-ALREADY-EXISTS-FOR-T)

"8" pathogen does not load plugins (http://stackoverflow.com/questions/3383502/pathogen-does-not-load-plugins/6365667)

"9" How do I get rid of git submodules untracked status? (http://stackoverflow.com/questions/5126765/ How-to-get-rid-of-git-submodules-untracked-status)

"10" Ignore changes in git submodules (http://www.nils-haldenwang.de/frameworks-and-tools/git/ How-to-ignore-changes-in-git-submodules)

"11" Synchronizing plugins with git submodules and pathogen (http://vimcasts.org/transcripts/27/en/)

"12" A Brief Note on pathogen for Vim (http://blog.darevay.com/2010/10/a-brief-note-on-pathogen-for-vim/)

"13" https://github.com/gmarik/Vundle.vim/issues/176

"14" needed to be obtained: use VIM (https://github.com/yangyangwithgnu/use_vim_as_ide) like the IDE

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.