Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make sure vim-misc is installed, politely complain if it isn't

  • Loading branch information...
commit 75da45abfb13e6ab904e56a040af2021ea155285 1 parent d57636a
@xolox authored
View
1  addon-info.json
@@ -0,0 +1 @@
+{"vim_script_nr": 3104, "dependencies": {"vim-misc": {}}, "homepage": "http://peterodding.com/code/vim/pyref", "name": "vim-pyref"}
View
4 autoload/xolox/pyref.vim
@@ -1,9 +1,9 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: May 20, 2013
+" Last Change: August 19, 2013
" URL: http://peterodding.com/code/vim/pyref/
-let g:xolox#pyref#version = '0.7.14'
+let g:xolox#pyref#version = '0.7.15'
let s:script = expand('<sfile>:p:~')
call xolox#misc#compat#check('pyref.vim', g:xolox#pyref#version, 9)
View
129 doc/pyref.txt
@@ -1,90 +1,96 @@
-*pyref.txt* Context-sensitive documentation for Python source code in Vim
+*pyref.txt* Context-sensitive documentation for Python source code in Vim
===============================================================================
- *pyref-contents*
Contents ~
- 1. Introduction |pyref-introduction|
- 2. Install & usage |pyref-install-usage|
+ 1. Introduction |pyref-introduction|
+ 2. Install & usage |pyref-install-usage|
1. The |g:pyref_mapping| option
2. The |g:pyref_python| option
3. The |g:pyref_django| option
4. The |g:pyref_index| option
- 5. General note about options |pyref-general-note-about-options|
- 3. Contact |pyref-contact|
- 4. License |pyref-license|
+ 5. General note about options |pyref-general-note-about-options|
+ 3. Contact |pyref-contact|
+ 4. License |pyref-license|
+ 5. References |pyref-references|
===============================================================================
- *pyref-introduction*
+ *pyref-introduction*
Introduction ~
-The 'pyref.vim' script is a plug-in for the Vim text editor that helps you
-look up the documentation for keywords and identifiers from the following
-sources using your web browser:
+The 'pyref.vim' script is a plug-in for the Vim text editor that helps you look
+up the documentation for keywords and identifiers from the following sources
+using your web browser:
- - Python language reference [1]
-
- - Python library reference [2]
-
- - Django documentation [3]
+- Python language reference [1]
+- Python library reference [2]
+- Django documentation [3]
The ':PyRef' command looks up the identifier given as an argument while the
'<F1>' mapping (only available in Python buffers) looks up the item under the
-text cursor. The lookup works by scanning through a special index file which
-is included in the ZIP archive below, but you can also create/update the index
+text cursor. The lookup works by scanning through a special index file which is
+included in the ZIP archive below, but you can also create/update the index
yourself using the Python script spider.py [4].
===============================================================================
- *pyref-install-usage*
+ *pyref-install-usage*
Install & usage ~
-Unzip the most recent ZIP archive [5] file inside your Vim profile directory
-(usually this is '~/.vim' on UNIX and '%USERPROFILE%\vimfiles' on Windows),
-restart Vim and execute the command ':helptags ~/.vim/doc' (use ':helptags
-~\vimfiles\doc' instead on Windows). Now try it out: Open a Python script and
-press the '<F1>' key on something interesting. If it doesn't work or you want
-to change how it works, see the options documented below.
+_Please note that the vim-pyref plug-in requires my vim-misc plug-in which is
+separately distributed._
+
+Unzip the most recent ZIP archives of the vim-pyref [5] and vim-misc [6] plug-
+ins inside your Vim profile directory (usually this is '~/.vim' on UNIX and
+'%USERPROFILE%\vimfiles' on Windows), restart Vim and execute the command
+':helptags ~/.vim/doc' (use ':helptags ~\vimfiles\doc' instead on Windows).
+
+If you prefer you can also use Pathogen [7], Vundle [8] or a similar tool to
+install & update the vim-pyref [9] and vim-misc [10] plug-ins using a local
+clone of the git repository.
+
+Now try it out: Open a Python script and press the '<F1>' key on something
+interesting. If it doesn't work or you want to change how it works, see the
+options documented below.
-------------------------------------------------------------------------------
The *g:pyref_mapping* option
If you press '<F1>' and nothing happens you're probably using a terminal that
-doesn't pass '<F1>' through to Vim. In this case you can change the key
-mapping by setting the global variable |g:pyref_mapping| according to the
-syntax expected by Vim's ':imap' and ':nmap' commands:
+doesn't pass '<F1>' through to Vim. In this case you can change the key mapping
+by setting the global variable |g:pyref_mapping| according to the syntax
+expected by Vim's ':imap' and ':nmap' commands:
>
- :let g:pyref_mapping = 'K'
-
+ :let g:pyref_mapping = 'K'
+<
Note that setting |g:pyref_mapping| won't change the key mapping in existing
buffers.
-------------------------------------------------------------------------------
The *g:pyref_python* option
-This option is useful when you don't always have a reliable internet
-connection available while coding. Most Linux distributions have an
-installable package containing the Python documentation, for example on Ubuntu
-[6] and Debian [7] you can execute the following command to install the
-documentation:
+This option is useful when you don't always have a reliable internet connection
+available while coding. Most Linux distributions have an installable package
+containing the Python documentation, for example on Ubuntu [11] and Debian [12]
+you can execute the following command to install the documentation:
>
- $ sudo apt-get install python2.6-doc
-
+ $ sudo apt-get install python2.6-doc
+<
The above package puts the documentation in '/usr/share/doc/python2.6/html/'
which happens to be the default path checked by the 'pyref.vim' script. If
you've installed the documentation in a different location you can change the
global variable |g:pyref_python|, e.g.:
>
- :let g:pyref_python = $HOME . '/docs/python'
-
+ :let g:pyref_python = $HOME . '/docs/python'
+<
-------------------------------------------------------------------------------
The *g:pyref_django* option
-This option works like |g:pyref_python| but allows you to configure the path
-to your local Django documentation. On Ubuntu [8] and Debian [9] you can
-execute the following command to install the Django documentation:
+This option works like |g:pyref_python| but allows you to configure the path to
+your local Django documentation. On Ubuntu [13] and Debian [14] you can execute
+the following command to install the Django documentation:
>
- $ sudo apt-get install python-django-doc
-
+ $ sudo apt-get install python-django-doc
+<
In this case you shouldn't have to change anything because 'pyref.vim' is
already configured to be compatible with the 'python-django-doc' package.
@@ -93,48 +99,53 @@ The *g:pyref_index* option
If you don't like the default location of the index file you can change it by
setting the global variable |g:pyref_index|. A leading '~' in the
-|g:pyref_index| variable is expanded to your current home directory ('$HOME'
-on UNIX, '%USERPROFILE%' on Windows). Be aware that when you change the
+|g:pyref_index| variable is expanded to your current home directory ('$HOME' on
+UNIX, '%USERPROFILE%' on Windows). Be aware that when you change the
|g:pyref_index| option automatic updates using the |getscript| plug-in won't
update the index file anymore!
-------------------------------------------------------------------------------
- *pyref-general-note-about-options*
+ *pyref-general-note-about-options*
General note about options ~
You can change the above options permanently by putting the relevant ':let'
statements in your |vimrc| script.
===============================================================================
- *pyref-contact*
+ *pyref-contact*
Contact ~
If you have questions, bug reports, suggestions, etc. the author can be
contacted at peter@peterodding.com. The latest version is available at
http://peterodding.com/code/vim/pyref/ and http://github.com/xolox/vim-pyref.
-If you like the script please vote for it on Vim Online [10].
+If you like the script please vote for it on Vim Online [15].
===============================================================================
- *pyref-license*
+ *pyref-license*
License ~
-This software is licensed under the MIT license [11]. Š 2013 Peter Odding
+This software is licensed under the MIT license [16]. Š 2013 Peter Odding
<peter@peterodding.com>.
===============================================================================
- *pyref-references*
+ *pyref-references*
References ~
[1] http://docs.python.org/reference/
[2] http://docs.python.org/library/
[3] http://docs.djangoproject.com/
[4] http://github.com/xolox/vim-pyref/blob/master/spider.py
-[5] http://peterodding.com/code/vim/downloads/pyref
-[6] http://packages.ubuntu.com/python2.6-doc
-[7] http://packages.debian.org/python2.6-doc
-[8] http://packages.ubuntu.com/python-django-doc
-[9] http://packages.debian.org/python-django-doc
-[10] http://www.vim.org/scripts/script.php?script_id=3104
-[11] http://en.wikipedia.org/wiki/MIT_License
+[5] http://peterodding.com/code/vim/downloads/pyref.zip
+[6] http://peterodding.com/code/vim/downloads/misc.zip
+[7] http://www.vim.org/scripts/script.php?script_id=2332
+[8] https://github.com/gmarik/vundle
+[9] http://github.com/xolox/vim-pyref
+[10] http://github.com/xolox/vim-misc
+[11] http://packages.ubuntu.com/python2.6-doc
+[12] http://packages.debian.org/python2.6-doc
+[13] http://packages.ubuntu.com/python-django-doc
+[14] http://packages.debian.org/python-django-doc
+[15] http://www.vim.org/scripts/script.php?script_id=3104
+[16] http://en.wikipedia.org/wiki/MIT_License
vim: ft=help
View
15 plugin/pyref.vim
@@ -1,6 +1,6 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: September 4, 2011
+" Last Change: August 19, 2013
" URL: http://peterodding.com/code/vim/pyref/
" Support for automatic update using the GLVS plug-in.
@@ -13,6 +13,19 @@ else
let g:loaded_pyref = 1
endif
+" Make sure vim-misc is installed.
+try
+ " The point of this code is to do something completely innocent while making
+ " sure the vim-misc plug-in is installed. We specifically don't use Vim's
+ " exists() function because it doesn't load auto-load scripts that haven't
+ " already been loaded yet (last tested on Vim 7.3).
+ call type(g:xolox#misc#version)
+catch
+ echomsg "Warning: The vim-pyref plug-in requires the vim-misc plug-in which seems not to be installed! For more information please review the installation instructions in the readme (also available on the homepage and on GitHub). The vim-pyref plug-in will now be disabled."
+ let g:loaded_pyref = 1
+ finish
+endtry
+
" Make sure the default paths below are compatible with Pathogen.
let s:plugindir = expand('<sfile>:p:h') . '/../misc/pyref'
Please sign in to comment.
Something went wrong with that request. Please try again.