Adding new stuff

This commit is contained in:
Viktor Barzin 2017-10-19 00:00:02 +01:00
parent ba7d75438f
commit 397b9554eb
232 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,21 @@
*vim-python-complete.html*
Python Code Completion
**********************
Python code completion uses the standard Vim code completion mechanism
(vim-code_completion) like so:
>
class Test (object):
def testMethod (self):
pass
t = Test()
t.te<C-X><C-U>
t.testMethod
<
vim:ft=eclimhelp

View file

@ -0,0 +1,285 @@
*vim-python-django.html*
Django
******
*:DjangoManage*
Django manage.py
================
For each project you create with the django framework, django provides
you with a manage.py which can be used to perform various tasks. To
make the invocation of the manage.py script even easier, eclim
provides the command :DjangoManage which can be invoked from any file
in the same directory as your manage.py or in any of the child
directories.
:DjangoManage supports all the same commands as manage.py and supports
command line completion of command names and app names where
supported.
Several of the manage.py commands simply perform an action without
generating much if any output. However there is also a set of
commands which generate sql statements. For all of these commands,
instead of just running the command in a shell, :DjangoManage will run
the command and populate a new buffer with the resulting output and
set the proper file type.
Configuration
=============
Vim Settings (vim-settings)
*g:EclimDjangoAdmin*
- g:EclimDjangoAdmin (Default: 'django-admin.py') - This setting
specifies the location of your django-admin.py file. By default it
will attempt to locate it in your system path, but you can
optionally set an absolute path for eclim to use. Eclim currently
only needs access to this script when running :DjangoManage
startproject <project_name> [destination]. All other :DjangoManage
commands will use your project's manage.py.
Django python support
=====================
*:DjangoTemplateOpen*
Locating templates
The command :DjangoTemplateOpen supports finding and opening a
template referenced under the cursor.
Ex.
>
# w/ cursor on 'mytemplates/mytemplate.html'
return render_to_response('mytemplates/mytemplate.html', ...)
<
*:DjangoViewOpen*
Locating views
The command :DjangoViewOpen supports finding and opening a view
referenced under the cursor.
Ex.
>
# w/ cursor on 'myproject.myapp.views' or 'my_view' on the second line.
urlpatterns = patterns('myproject.myapp.views',
(r'^$', 'my_view'),
)
<
*:DjangoContextOpen*
Contextually locate file
The command :DjangoContextOpen supports executing :DjangoViewOpen,
:DjangoTemplateOpen, or :PythonSearchContext depending on the
context of the text under the cursor.
Specifying the open command to use
All of the above :Django*Open commands support an optional -a
argument to specify the vim command used to open the result:
- -a: The vim command to use to open the result (edit, split,
tabnew, etc).
*htmldjango*
Django html template support
============================
Syntax
Vim ships with a syntax file for django html template files, but
eclim builds on that base to support highlighting of user defined
tags and filters (see the configuration section below.
Indent
Using the same settings as the enhanced syntax file, eclim also
ships with an indent script which provides indentation support all
of the default django tags and any user defined tags that have been
configured.
Match It
Again, using the same set of variables, eclim sets the necessary
variables to allow proper matchit.vim support for django default
and user defined tags.
End Tag Completion
Using the |g:HtmlDjangoUserBodyElements| setting along with the
pre-configured default list of body elements, eclim includes
support for auto completion of ending template tags when you type
an {%e or {% e.
*:DjangoFind*
Contextual Find
While editing django html templates, the command :DjangoFind which
will attempt to locate the relevant resource depending on what is
under the cursor.
- If on a user defined tag, attempt to find the tag definition
within the python tag definition file.
Ex.
>
{# w/ cursor on 'mytag' #}
{% mytag somearg %}
<
- If on a user defined filter, attempt to find the filter
definition within the python filter definition file.
Ex.
>
{# w/ cursor on 'myfilter' #}
{{ somevalue|myfilter }}
<
- If on the tag/filter definition portion of of a 'load' tag,
attempt to find the definition file.
Ex.
>
{# w/ cursor on 'mytags' #}
{% load mytags %}
<
- If on a reference to a template for ethier an 'extends' or
'include' tag, attempt to find that template file.
Ex.
>
{# w/ cursor on 'include/mytemplate.html' #}
{% include "include/mytemplate.html" %}
<
- If on static file reference, as defined in a 'src' or 'href'
attribute of an element, attempt to find that static file.
Ex.
>
{# w/ cursor on '/css/my.css' #}
<link rel="stylesheet" href="/css/my.css" type="text/css" />
<
Note: this functionality requires that g:EclimDjangoStaticPaths
is set to a list of absolute or django project relative (relative
to directory containing manage.py and settings.py) directories,
though it will fallback to using eclim's locate file
functionality.
Ex.
>
let g:EclimDjangoStaticPaths = ["../static/"]
<
Like the :Django*Open commands, :DjangoFind supports an optional -a
<action> argument to specify the vim command used to open the
resulting file.
Configuration
=============
Vim Settings (vim-settings)
*g:HtmlDjangoUserBodyElements*
- g:HtmlDjangoUserBodyElements - List of lists, where each list
contains the name of the start and end tag, as well as any
intermediary tags of any custom tags which have a body.
Ex.
>
let g:HtmlDjangoUserBodyElements = [
\ ['repeat', 'endrepeat'],
\ ['try', 'except', 'finally', 'endtry'],
\ ]
<
This setting is used for indentation of the custom tag's body, as
well as arguments for proper matchit support, end tag completion,
and syntax highlighting.
*g:HtmlDjangoUserTags*
- g:HtmlDjangoUserTags - This setting is a list of any non-body tags
which don't require indentation or matchit support. The items
configured here will be used for syntax highlighting.
*g:HtmlDjangoUserFilters*
- g:HtmlDjangoUserFilters - This settings contains a list of any
user defined django filters. It is currently used for syntax
highlighting.
*g:HtmlDjangoCompleteEndTag*
- g:HtmlDjangoCompleteEndTag (Default: 1) - When set to 0, disables
the auto completion of end tags.
*g:EclimDjangoStaticPaths*
- g:EclimDjangoStaticPaths - Used as a list of directories to search
when looking for static files (js, css, etc). Expected to be a list
of absolute or django project relative (relative to directory
containing manage.py and settings.py) directories.
Ex.
>
let g:EclimDjangoStaticPaths = ["../static/"]
<
*g:EclimDjangoStaticPattern*
- g:EclimDjangoStaticPattern - If you have a custom tag to load
static files, then eclim by default may not be able to determine
that it should be attempting to search for the static file
referenced by that custom tag. In this case you can set
g:EclimDjangoStaticPattern to a vim regular expression which matches
your custom tag. For example, if you have a custom tag called static
to load static files like so:
>
{% static 'lib/somefile.js' %}
<
Then you could set g:EclimDjangoStaticPattern to:
>
let g:EclimDjangoStaticPattern = "{%\\s*static(['\"]<element>['\"]"
<
Note that this pattern allows either ' or " to quote the static file
path and since we are doing this we need to use double quotes around
the pattern which in turn means that we need to double escape back
slashes (note the double backslashes when matching 0 or more spaces:
\\s*). Also note that the <element> portion of the pattern will be
replaced with the path of the static file that eclim extracted while
the cursor was over that portion of the tag.
*g:EclimDjangoFindAction*
- g:EclimDjangoFindAction (Default: "split") - For :DjangoFind and
:DjangoTemplateOpen, used as the action to perform on the file
found.
vim:ft=eclimhelp

View file

@ -0,0 +1,41 @@
*vim-python-index.html*
Python
******
Features
========
- Python Interpreter / Paths (vim-python-path)
- Python Validation (vim-python-validate)
- Python Code Completion (vim-python-complete)
- Python Search (vim-python-search)
- Django (vim-python-django)
Suggested Mappings
==================
Here are some mappings for the python funtionality provided by eclim.
To make use of these mappings, simply create a ftplugin file for
python and place your mappings there (:help ftplugin-name).
- The following mapping allows you to simply hit <enter> on an
element to perform a search to find its definition or occurrences
depending on the context.
>
nnoremap <silent> <buffer> <cr> :PythonSearchContext<cr>
<
- If you are doing django development you may want to use the
following mapping instead which also supports locating django
templates when executed over a quoted template path in a view, or
locating django views when executed on a quoted view name in a
urls.py file.
>
nnoremap <silent> <buffer> <cr> :DjangoContextOpen<cr>
<
vim:ft=eclimhelp

View file

@ -0,0 +1,100 @@
*vim-python-path.html*
Python Interpreter / Paths
**************************
Python code completion, searching, and other features require that you
first create a python (pydev) project:
>
:ProjectCreate path/to/project -n python
<
If you haven't already configured a python interpreter, then you will
be prompted to do so when creating your first python project. When
creating your project a .pydevproject file will be also be created.
This file is used to define which interpreter to use for your project,
the location of your project's python source files, and the location
of any third party libraries your project requires (if not already on
your project's interpreter path).
Note: When saving the .pydevproject file from within vim, eclim will
update your project's configuration in memory or report any errors
raised by pydev.Also note that although the .pydevproject file is
xml, pydev doesn't handle stripping leading/trailing space or new
lines from xml text values, so refrain from attempting to format
this file and try to stick to using the commands below to configure
your project.
Interpreter
===========
Eclim provides commands to help you manage python interpreters
available to pydev projects as well as which interpreter to use for
each of your projects.
*:PythonInterpreterAdd*
- :PythonInterpreterAdd [-n <name>] </path/to/pythonX> Command to
add a new interpreter to pydev which will then be available to your
projects. If you supply only the path to the interpreter, then eclim
will set the name of that interpreter to the basename of the path
supplied.
>
:PythonInterpreterAdd /usr/bin/python3
:PythonInterpreterAdd -n python3.3 /usr/bin/python3
<
*:PythonInterpreterRemove*
- :PythonInterpreterRemove </path/of/pythonX> Command to remove an
interpreter from pydev.
>
:PythonInterpreterRemove /usr/bin/python3
<
*:PythonInterpreterList*
- :PythonInterpreterList Command to list all interpreters configured
with pydev.
*:PythonInterpreter*
- :PythonInterpreter [<interpreter_name or /path/to/interpreter>]
When invoked with no arguments this command will print out the path
to the python interpreter currently set for your project. This
command can also be use to set your project's interpreter by
supplying either the name of an interpreter already configured with
pydev (via |:PythonInterpreterAdd|), or the absolute path to an
interpreter on your system.
>
:PythonInterpreter python_2.7
:PythonInterpreter /usr/bin/python3
<
This command supports command completion of interpreter names or
paths (if you start typing an absolute path).
Paths
=====
*:NewSrcEntry_pydev*
- :NewSrcEntry <dir> - Add a new source entry which references a
source directory in your project.
>
<path>/myproject/src</path>
<
This command supports command completion of project relative
directories.
vim:ft=eclimhelp

View file

@ -0,0 +1,80 @@
*vim-python-search.html*
Python Search
*************
*:PythonSearch*
Element Search
==============
Element searching allows you to place the cursor over just about any
element in a source file (method call, class name, constant) and
perform a search for that element by issuing the command
:PythonSearch. By default this command will search for declarations,
but you can specify that you want to search for references using:
>
:PythonSearch -x references
<
If only one result is found and that result is in the current source
file, the cursor will be moved to the element found. Otherwise, on
single result matches, the value of |g:EclimPythonSearchSingleResult|
will be consulted for the action to take. If there are multiple
results, the quickfix list will be opened with the list of results.
You can also force the action to use for the current search by
suppling the -a <action> arg:
>
:PythonSearch -x references -a edit
<
Note: :PythonSearch does not currently support searching for
patterns. Attempting to supply a pattern to search for will result
in an error.
*:PythonSearchContext*
As a convenience eclim also provides the command :PythonSearchContext.
This command accepts only the optional -a argument described above,
and will perform the appropriate search depending on the context of
the element under the cursor.
- If the cursor is on the declaration of a class, function, or
method then it will search for all occurrences.
- Otherwise, it will search for the declaration of the element.
Configuration
=============
Vim Settings (vim-settings)
*g:EclimPythonSearchSingleResult*
- g:EclimPythonSearchSingleResult (Default: 'split') - Determines
what action to take when a only a single result is found.
Possible values include:
- 'split' - open the result in a new window via "split".
- 'edit' - open the result in the current window.
- 'tabnew' - open the result in a new tab.
This setting overrides the global default for all supported language
types which can be set using the g:EclimDefaultFileOpenAction
setting which accepts the same possible values.
- g:EclimQuickFixOpen (Default: 'botright copen') Specifies the
command used to open the quickfix window when multiple results are
found.
- g:EclimQuickFixHeight (Default: 10) - Sets the height, in lines,
of the quickfix window when eclim opens it to display search
results.
vim:ft=eclimhelp

View file

@ -0,0 +1,47 @@
*vim-python-validate.html*
Python Validation
*****************
When editing a python file eclim will default to validating the file
when it is written. Any errors will be added to the current window's
location list (:help location-list) and their corresponding line
number noted via Vim's sign functionality.
If you don't want python files validated when saving them, you can set
the g:EclimPythonValidate variable described in the configuration
section below.
*:Validate_python*
Regardless of whether you have validation enabled upon saving or not,
the command :Validate is available to manual validate the file.
Configuration
=============
Vim Settings (vim-settings)
*g:EclimPythonValidate*
- g:EclimPythonValidate (Default 1) - If set to 0, disables python
validation when saving the file.
Note: When enabled, syntastic
(https://github.com/scrooloose/syntastic) is disabled so that
eclim and syntastic don't step on each other. If you'd like to use
syntastic over eclim for validation, then simply disable eclim's
validation.If you'd like to disable eclim's source code validation
for all languages, eclim provides a global variable for that as
well:>
let g:EclimFileTypeValidate = 0
<
- g:EclimValidateSortResults (Default: 'occurrence') - If set to
'severity', the validation results will be sorted by severity
(errors > warnings > info > etc.)
vim:ft=eclimhelp