<type>documentation</type>
<domain>commands</domain>
<id>commands/scripts</id>
<title>Script-provided Add-on Commands</title>
<product>pro+</product>

Ript_c0x3a0x5csrc0x5cide0x5cscripts_debugger Extensions Script
--------------------------------------------------------------

Scripts that extend the debugger in various ways.

**debug-run-to-completion** ()

Run the current debug process to completion.  This disables
all breakpoints temporarily until the process exits.

**set-breaks-from-markers** ()

Scan current file for markers in the form %BP% and places breakpoints on
all lines where those markers are found. A conditional breakpoint can be set
if a condition follows the marker, for example %BP%:x > 10. Removes all old
breakpoints first.

Ript_c0x3a0x5csrc0x5cide0x5cscripts_django Script
-------------------------------------------------

A plugin that provides Django-specific functionality when a project
looks like it contains Django files.

**django-sync-db** ()

Run manage.py migrate (or syncdb in Django 1.6 and earlier)

**django-sql** (appname)

Run manage.py sql for given app name and display the output in a
scratch buffer.

**django-show-docs** ()

Show documentation for using Wing and Django together

**django-validate** ()

Run manage.py check (or validate in Django 1.5 and earlier)

**django-start-project** (django_admin, parent_directory, site_name, superuser, superuser_email, superuser_password, pyexec=None)

Start a new Django project with given site name and superuser account.
This will prompt for the location of django-admin.py, the parent directory,
and the site name to use. It then runs django-admin.py startproject, edits
settings.py fields DATABASE_ENGINE and DATABASE_NAME to use sqlite3 by
default, adds django.contrib.admin to INSTALLED_APPS in settings.py, runs
syncdb/migrate (creating superuser account if one was given), sets up the default
admin templates by copying base_site.html into the project, and then offers
to create a new project in Wing and run the django-setup-wing-project
command to configure the Wing project for use with the new Django
project.

**django-run-tests-to-scratch-buffer** ()

Run manage.py tests with output in a scratch buffer

**django-setup-wing-project** ()

Sets up a Wing project to work with an existing Django project. This
assumes that you have already added files to the project so that your
manage.py and settings.py files are in the project. It sets up the Python
Executable project property, sets "manage.py runserver 8000" as the main entry
point, sets up the Wing project environment by defining DJANGO_SITENAME and
DJANGO_SETTINGS_MODULE, adds the site directory to the Python Path in the Wing
project, turns on child process debugging (for auto-reload), enables template
debugging in the settings.py file, ensures that the Template
Debugging project property is enabled, sets up the unit testing framework and
file patterns in project properties.

**django-start-app** (appname)

Start a new application within the current Django project and add it to the 
INSTALLED_APPS list in the project's settings.py file.

**django-run-tests** ()

Run manage.py unit tests in the Testing tool

**django-migrate-app** (appname)

Run manage.py makemigrations for given app name and display the output in a
scratch buffer.

**django-restart-shell** ()

Show and restart the Python Shell tool, which works in the same
environment as "manage.py shell".  To show the tool without restarting
it, use the Tools menu.

**django-show-migrations** ()

Run manage.py showmigrations and display the output in a scratch buffer.

Ript_c0x3a0x5csrc0x5cide0x5cscripts_django Script
-------------------------------------------------

A plugin that provides Django-specific functionality when a project
looks like it contains Django files.

**django-setup-wing-project** ()

Sets up a Wing project to work with an existing Django project. This
assumes that you have already added files to the project so that your
manage.py and settings.py files are in the project. It sets up the Python
Executable project property, sets "manage.py runserver 8000" as the main entry
point, sets up the Wing project environment by defining DJANGO_SITENAME and
DJANGO_SETTINGS_MODULE, adds the site directory to the Python Path in the Wing
project, turns on child process debugging (for auto-reload), enables template
debugging in the settings.py file, ensures that the Template
Debugging project property is enabled, sets up the unit testing framework and
file patterns in project properties.

**django-start-project** (django_admin, parent_directory, site_name, superuser, superuser_email, superuser_password, pyexec=None)

Start a new Django project with given site name and superuser account.
This will prompt for the location of django-admin.py, the parent directory,
and the site name to use. It then runs django-admin.py startproject, edits
settings.py fields DATABASE_ENGINE and DATABASE_NAME to use sqlite3 by
default, adds django.contrib.admin to INSTALLED_APPS in settings.py, runs
syncdb/migrate (creating superuser account if one was given), sets up the default
admin templates by copying base_site.html into the project, and then offers
to create a new project in Wing and run the django-setup-wing-project
command to configure the Wing project for use with the new Django
project.

Ript_c0x3a0x5csrc0x5cide0x5cscripts_editor Extensions Script
------------------------------------------------------------

Editor extensions that also serve as examples for scripting Wing.

**set-executable-bit** (set_bit=True)

Set the current file's executable bit in its permissions.  If set_bit
is true (the default), the executable bit is set; if set_bit is false,
the executable bit is cleared.  This doesn't do anything on windows. 

**toggle-case** ()

Toggle current selection or current word between common name formats: my_symbol_name,
MySymbolName, and mySymbolName

**fold-python-methods** ()

Fold up all Python methods, expand all classes, and leave other fold
points alone  *Key Bindings: Wing: Alt-1; Brief: Alt-1; Eclipse: Alt-1; Emacs: Alt-1; MATLAB: Alt-1; VI/VIM: Alt-1; Visual Studio: Alt-1; OS X: Command-Alt--*

**word-list-completion** (word)

Provide simple word-list driven auto-completion on the current editor

**smart-cut** ()

Implement a variant of clipboard cut that cuts the whole
current line if there is no selection on the editor.

**kill-line-with-eol** ()

Variant of emacs style kill-line command that always kills the eol 
characters 

**upper-case** ()

Change current selection or current word to all upper case  *Key Bindings: Eclipse: Ctrl-Shift-Y; MATLAB: Shift-Ctrl-U*

**smart-copy** ()

Implement a variant of clipboard copy that copies the whole
current line if there is no selection on the editor.

**hyphen-to-under** ()

Change hyphens (dashes) to underscores in current selection or current word

**batch-search-current-directory** ()

Initial batch search for the current editor's directory

**lower-case** ()

Change current selection or current word to all lower case  *Key Bindings: Eclipse: Ctrl-Shift-X; MATLAB: Ctrl-U*

**cc-checkout** ()

Check the current file out of clearcase.  This is best used with Wing
configured to auto-reload unchanged files.

**cursor-home** ()

Bring cursor to start of line, to start of visible area, or to 
start of document each successive consecutive invocation of this
command.  *Key Bindings: Brief: Home*

**insert-spaces-to-tab-stop** (tab_size=0)

Insert spaces to reach the next tab stop (units of given tab size
or editor's tab size if none is given)

**vs-tab** ()

Modified tab indentation command that acts like tab in Visual Studio.

**vi-fold-more** ()

Approximation of zr key binding in vim  *Key Bindings: VI/VIM: z r*

**fold-python-classes** ()

Fold up all Python classes but leave other fold points alone  *Key Bindings: Wing: Alt-2; Brief: Alt-2; Eclipse: Alt-2; Emacs: Alt-2; MATLAB: Alt-2; VI/VIM: Alt-2; Visual Studio: Alt-2; OS X: Command-Ctrl-/*

**vi-fold-less** ()

Approximation of zm key binding in vim  *Key Bindings: VI/VIM: z m*

**indent-new-comment-line** ()

Enter a newline, indent to match previous line and insert a comment
character and a space.  Assumes that auto-indent is enabled.

**describe-key-briefly** (key)

Display the commands that a key is bound to in the status area.  Does
not fully work for the vi binding. 

**open-filename-from-editor** ()

Open the filename at the caret in current editor  *Key Bindings: MATLAB: Ctrl-D*

**open-clicked-url-from-editor** ()

Open the url being clicked in the current editor

**sort-selected** ()

Sort selected lines of text alphabetically

**search-python-docs** ()

Do a search on the Python documentation for the selected text
in the current editor

**toggle-mark-command** (style='char', select_right=0)

Change between text-marking and non-text-marking mode.  Style is
"char" for stream select, "block" for rectangular select, and "line" for line select.
Set select_right=1 to select the character to right of the cursor
when marking is toggled on.  *Key Bindings: Brief: Alt-L invokes toggle-mark-command(style="line")*

**delete-selected-lines** ()

Delete the line or range of lines that contain the current selection.
This duplicates what the editor command delete-line does.  *Key Bindings: Brief: Alt-D*

**insert-debug-print** ()

Insert a print statement to print a selected variable name and
value, along with the file and line number.

**under-to-hyphen** ()

Change underscores to hyphens (dashes) in current selection or current word

**open-url-from-editor** ()

Open the url at caret in the current editor

**smart-paste** ()

A variant of paste that inserts line just copied with smart-copy above
current line. 

**remove-prompts-and-paste** ()

Paste from clipboard after removing any >>> and ... prompts

**convert-to-lf-lineends** ()

Convert the current editor to use LF style line endings

**close-all-readonly** ()

Close all readonly files 

**insert-text** (text)

Insert given text at current caret location, replacing any existing 
selected text

**convert-to-cr-lineends** ()

Convert the current editor to use CR style line endings

**cursor-end** ()

Bring cursor to end of line, to end of visible area, or to 
end of document each successive consecutive invocation of this
command.  *Key Bindings: Brief: End*

**title-case** ()

Change current selection or current word to capitalize first letter of each word  *Key Bindings: Emacs: Alt-C*

**watch-selection** ()

Add a debug watch for the selected text in the current editor

**copy-filename-to-clipboard** ()

Copy the filename for the currently selected file to the clipboard

**comment-block-toggle** ()

Toggle block comment (with ## at start) on the selected lines in editor.
This is a different style of block commenting than Wing implements by default
(the default in Wing is intended to work better with some of the other
editor functionality)  *Key Bindings: Eclipse: Ctrl-/; MATLAB: Ctrl-T*

**surround** (char)

Surround selected text with (), [], {}, "", '', <>, or \`\`.  Arg char
should be the opening character.  If there is no selection, the current
word is surrounded.

**copy-reference** (include_text=True)

Copy 'filename, lineno (scope)' optionally followed by the current line
or selected lines to the clipboard.  The scope is omitted if there isn't
one or in a non-Python file.

**open-clicked-filename-from-editor** ()

Open the filename being clicked in the current editor

**toggle-vertical-split** ()

If editor is split, unsplit it and show the vertical tools panel.
Otherwise, hide the vertical tools and split the editor left-right
Assumes default windowing policy (combined toolbox & editor windows).
Thanks to Jonathan March for this script.

**convert-to-crlf-lineends** ()

Convert the current editor to use CR + LF style line endings

**fold-python-classes-and-defs** ()

Fold up all Python classes, methods, and functions but leave other fold
points alone  *Key Bindings: Wing: Alt-3; Brief: Alt-3; Eclipse: Alt-3; Emacs: Alt-3; MATLAB: Alt-3; VI/VIM: Alt-3; Visual Studio: Alt-3; OS X: Command-=*

**toggle-toolbox-separate** ()

Toggle between moving the toolboxes to a separate window and
the default single-window mode

Ript_c0x3a0x5csrc0x5cide0x5cscripts_emacs Extensions Script
-----------------------------------------------------------

This file contains scripts that add emacs-like functionality not 
found in Wing's internal emacs support layer.

**add-change-log-entry** (user_name=None, email=None, changelog=None, changed_file=None, func=None, other_window=False, new_entry=False)

Add a change log entry  *Key Bindings: Emacs: Ctrl-X 4 A*

Ript_c0x3a0x5csrc0x5cide0x5cscripts_experimental Script
-------------------------------------------------------

Experimental commands that may be removed from Wing in the future.

**experimental-install-simple-names-callback** (mtype, callback)

Install a callback for using a list of simple names for the autocomplete
popup list for editors for the given mime type.  This an experimental feature
and may change in future releases.  The callback needs to take 2 arguments:
(internal-editor-object, ctx) and should return a list of strings to use
for autocompletion.  The ctx object will have the following attributes:

lineno -- line number of the line with the cursor
cursor_pos -- position of the cursor in the document
start_pos -- position of the word's first character in the document

Currently this cannot be used for python documents

An example of using this from a script is::

  def _callback(ed, ctx):
    return ['one', 'two']
  wingapi.gApplication.ExecuteCommand('experimental_install_simple_names_callback',
                                      mtype='text/plain',
                                      callback=_callback)

Ript_c0x3a0x5csrc0x5cide0x5cscripts_testapi Script
--------------------------------------------------

Tests for Wing's scripting API.

**test-api** (verbose=0)

Test Wing's scripting API
