$Id$
"Unixkeys" -- plugin for Tkabber.


I. The idea

This plugins adds some Unix-style keybindings to various widgets
used to enter text in Tkabber (namely, entry widgets, chat input
windows, comboboxes etc).

The text "Unix-style" is vague, so more precisely it stands for
something like "resembles default keybindings of Emacs text
editor and Readline library". That is, these keybindings should
be familiar to those using bash and Emacs. See the next section
for complete listing of keybindings.

II. Usage

After this plugin is loaded by Tkabber, the keybindings it
provides are available in all controls used to input text
in Tkabber.


The keybindings added are:

* M-a -- move cursor to the start of text.
* M-e -- move cursor to the end of text (but see below).

* M-f -- move cursor one word forward.
* M-b -- move cursor one word backward.

* C-u -- delete text from the cursor to the beginning of the
         current line.

* M-BackSpace, C-w -- delete text from the cursor to the start
                      of the current word.

* M-BackSpace, M-d -- delete text from the cursor to the end
                      of the current word.

* C-x C-u -- Undo the last change (in multiline entry widgets).

* C-x h -- Select all text.

Also, on Windows, another keybinding is added to multiline
entry widgets:

* C-_ (Ctrl-Underscore) -- Undo the last change.

And, finally, two convenience bindings are added to multiline
entry widgets (they're borrowed from single-line entry and
listbox Tk widgets):

* C-/ (Ctrl-slash) -- Select all text.
* C-\ (Ctrl-backslash) -- Clear selection.


Since text-oriented Tk widgets already provide some Unix-style
bindings, we can summarise the complete "Unix-style editing
capabilities" which those widgets provide in concert with this
plugin:

* C-f, C-b -- move cursor one character forward/backward.

* M-f, M-b -- move cursor one word forward/backward.

* C-a, C-e -- move cursor to the start/end of the current line
  (in multiline entry widgets) or to the start/end of text
  (in single-line entry widgets).

* M-a, M-e -- move cursor to the start/end of text.

* C-h, C-d -- delete one character to the left/right from
              the cursor.

* C-w, M-BackSpace -- delete text to the start of the current
                      word.

* M-d, M-Delete -- delete text to the end of the current word.

* C-u, C-k -- delete text from the cursor to the start/end of
              the current line.

* C-x C-u, C-_, C-z -- Undo the last change (only in multiline
                       entry widgets).

* C-/, C-x h -- Select all text.

* C-\ -- Clear selection.


III. Configuration.

No configuration is needed except for one issue explained below.

The built-in Tkabber plugin providing support for emoticons
binds its action "show menu with available emoticons" to M-e
(<Alt-Key-e> and <Meta-Key-e>) in chat input windows thus
effectively cancelling the effect of pressing M-e which this
plugin adds.

If you prefer M-e to be used for cursor motion as provided by
this plugin, add something like construct in the postload
section of your config.tcl:

foreach b [event info <<EmoticonsMenu>>] {
	event delete <<EmoticonsMenu>> $b
}

This will unbind *all* bindings from the Tk virtual event that
shows the emoticons palette, effectivly disabling its usage.
If you want to access this palette via some other gesture, add
it like this, for instance:

event add <<EmoticonsMenu>> <F10>

This will made the emoticons palette to pop up when you press
<F10> on your keyboard.


IV. Limitations.

The bindings do not match *exactly* the behaviours of software
they borrow from. For example, M-e in Emacs stands for "end of
sentence", not "end of text in the buffer" as this plugin does
for multiline entry widgets.

The plugin requires special tweaking to get M-e working, as
described above.


# vim:tw=64:noet
