1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 18:47:58 +01:00

Make abbreviations expand on quotes as well as space.

Also added rough documentation for insert mode.

TODO: Abbreviations should also expand on <CR> and <Tab>, but right now
adding <CR> to the mappings.add() has no effect, and adding <Tab> to the
mappings.add() breaks tab completion.

TODO: Rather than listing non-keyword characters in two places (ui.js
and mappings.js), they should be specified in one location (that could
someday be trumped by an 'iskeyword' option).
This commit is contained in:
Ted Pavlic
2009-01-20 10:41:19 -05:00
parent 3abd88276e
commit 9993f0594e
6 changed files with 54 additions and 12 deletions

View File

@@ -878,8 +878,15 @@ function CommandLine() //{{{
["<C-c>"], "Focus content", ["<C-c>"], "Focus content",
function () { events.onEscape(); }); function () { events.onEscape(); });
// Any "non-keyword" character triggers abbreviation expansion
// TODO: Add "<CR>" and "<Tab>" to this list
// At the moment, adding "<Tab>" breaks tab completion. Adding
// "<CR>" has no effect.
// TODO: Make non-keyword recognition smarter so that there need not
// be two lists of the same characters (one here and a regexp in
// mappings.js)
mappings.add(myModes, mappings.add(myModes,
["<Space>"], "Expand command line abbreviation", ["<Space>", '"', "'"], "Expand command line abbreviation",
function () function ()
{ {
commandline.resetCompletions(); commandline.resetCompletions();

View File

@@ -113,11 +113,11 @@ const config = { //{{{
// they are sorted by relevance, not alphabetically // they are sorted by relevance, not alphabetically
helpFiles: [ helpFiles: [
"intro.html", "tutorial.html", "starting.html", "browsing.html", "intro.html", "tutorial.html", "starting.html", "browsing.html",
"buffer.html", "cmdline.html", "options.html", "pattern.html", "buffer.html", "cmdline.html", "insert.html", "options.html",
"tabs.html", "hints.html", "map.html", "eval.html", "marks.html", "pattern.html", "tabs.html", "hints.html", "map.html", "eval.html",
"repeat.html", "autocommands.html", "print.html", "gui.html", "marks.html", "repeat.html", "autocommands.html", "print.html",
"styling.html", "message.html", "developer.html", "various.html", "gui.html", "styling.html", "message.html", "developer.html",
"index.html" "various.html", "index.html"
], ],
scripts: [ scripts: [

View File

@@ -1,6 +1,6 @@
HEADER HEADER
|Command-line-mode| |Command-line| + |Command-line-mode| |Command-line| |mode-cmdline| +
Command-line mode is used to enter Ex commands (":") and text search patterns Command-line mode is used to enter Ex commands (":") and text search patterns
("/" and "?"). ("/" and "?").

View File

@@ -4,6 +4,11 @@ HEADER
This file contains a list of all available commands. This file contains a list of all available commands.
section:Insert{nbsp}mode[insert-index]
||<C-i>|| Launch the external editor +
||<C-]>|| Expand an insert-mode abbreviation +
section:Normal{nbsp}mode[normal-index] section:Normal{nbsp}mode[normal-index]
||<C-^>|| Select the alternate tab or the [count]th tab + ||<C-^>|| Select the alternate tab or the [count]th tab +

View File

@@ -0,0 +1,30 @@
HEADER
|Insert-mode| |Insert| |mode-insert| +
Insert mode is used to enter text in text boxes and text areas. When
'insertmode' is set, focusing on a text area immediately switches to
insert mode.
|i| +
||i||
________________________________________________________________________________
Starts insert mode in text areas when 'insertmode' is not set.
________________________________________________________________________________
section:Insert-mode{nbsp}special{nbsp}keys[ins-special-keys]
|i_<C-i>| +
||<C-i>||
________________________________________________________________________________
Launch the external editor. See the 'editor' option.
________________________________________________________________________________
|i_<C-]>| +
||<C-]>||
________________________________________________________________________________
Expand an insert-mode abbreviation.
________________________________________________________________________________
// vim: set filetype=asciidoc:

View File

@@ -189,9 +189,9 @@ contains any non-whitespace character (e.g., "def'").
Strings that cannot be abbreviations include "a'b" and "a b". Strings that cannot be abbreviations include "a'b" and "a b".
An abbreviation is recognized when a space is typed after the An abbreviation is recognized when a space, quote character, or
abbreviation. There are no default abbreviations, and abbreviations are [m]<C-]>[m] is typed after the abbreviation. There are no default
never recursive. abbreviations, and abbreviations are never recursive.
|:ab| |:abbreviate| |:ab| |:abbreviate|
||:ab[breviate] {lhs} {rhs}|| + ||:ab[breviate] {lhs} {rhs}|| +
@@ -199,8 +199,8 @@ never recursive.
||:ab[breviate]|| ||:ab[breviate]||
________________________________________________________________________________ ________________________________________________________________________________
Abbreviate a key sequence. Abbreviate {lhs} to {rhs}. If only {lhs} is given, Abbreviate a key sequence. Abbreviate {lhs} to {rhs}. If only {lhs} is given,
list all abbreviations that start with {lhs}. List all abbreviations, if no list all abbreviations that start with {lhs}. If no arguments are given,
arguments are given. list all abbreviations.
________________________________________________________________________________ ________________________________________________________________________________