From 9993f0594e5a28ac53f49eca38b8b0ac171ea487 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Tue, 20 Jan 2009 10:41:19 -0500 Subject: [PATCH] Make abbreviations expand on quotes as well as space. Also added rough documentation for insert mode. TODO: Abbreviations should also expand on and , but right now adding to the mappings.add() has no effect, and adding 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). --- common/content/ui.js | 9 ++++++++- vimperator/content/config.js | 10 +++++----- vimperator/locale/en-US/cmdline.txt | 2 +- vimperator/locale/en-US/index.txt | 5 +++++ vimperator/locale/en-US/insert.txt | 30 +++++++++++++++++++++++++++++ vimperator/locale/en-US/map.txt | 10 +++++----- 6 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 vimperator/locale/en-US/insert.txt diff --git a/common/content/ui.js b/common/content/ui.js index 6254b67d..622fb6ac 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -878,8 +878,15 @@ function CommandLine() //{{{ [""], "Focus content", function () { events.onEscape(); }); + // Any "non-keyword" character triggers abbreviation expansion + // TODO: Add "" and "" to this list + // At the moment, adding "" breaks tab completion. Adding + // "" 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, - [""], "Expand command line abbreviation", + ["", '"', "'"], "Expand command line abbreviation", function () { commandline.resetCompletions(); diff --git a/vimperator/content/config.js b/vimperator/content/config.js index 33ea2a4c..7d4dd586 100644 --- a/vimperator/content/config.js +++ b/vimperator/content/config.js @@ -113,11 +113,11 @@ const config = { //{{{ // they are sorted by relevance, not alphabetically helpFiles: [ "intro.html", "tutorial.html", "starting.html", "browsing.html", - "buffer.html", "cmdline.html", "options.html", "pattern.html", - "tabs.html", "hints.html", "map.html", "eval.html", "marks.html", - "repeat.html", "autocommands.html", "print.html", "gui.html", - "styling.html", "message.html", "developer.html", "various.html", - "index.html" + "buffer.html", "cmdline.html", "insert.html", "options.html", + "pattern.html", "tabs.html", "hints.html", "map.html", "eval.html", + "marks.html", "repeat.html", "autocommands.html", "print.html", + "gui.html", "styling.html", "message.html", "developer.html", + "various.html", "index.html" ], scripts: [ diff --git a/vimperator/locale/en-US/cmdline.txt b/vimperator/locale/en-US/cmdline.txt index 076bac4b..a0499e6e 100644 --- a/vimperator/locale/en-US/cmdline.txt +++ b/vimperator/locale/en-US/cmdline.txt @@ -1,6 +1,6 @@ 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 ("/" and "?"). diff --git a/vimperator/locale/en-US/index.txt b/vimperator/locale/en-US/index.txt index d573b28d..747e3f53 100644 --- a/vimperator/locale/en-US/index.txt +++ b/vimperator/locale/en-US/index.txt @@ -4,6 +4,11 @@ HEADER This file contains a list of all available commands. +section:Insert{nbsp}mode[insert-index] + +|||| Launch the external editor + +|||| Expand an insert-mode abbreviation + + section:Normal{nbsp}mode[normal-index] |||| Select the alternate tab or the [count]th tab + diff --git a/vimperator/locale/en-US/insert.txt b/vimperator/locale/en-US/insert.txt new file mode 100644 index 00000000..67ff3d8c --- /dev/null +++ b/vimperator/locale/en-US/insert.txt @@ -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_| + +|||| +________________________________________________________________________________ +Launch the external editor. See the 'editor' option. +________________________________________________________________________________ + +|i_| + +|||| +________________________________________________________________________________ +Expand an insert-mode abbreviation. +________________________________________________________________________________ + +// vim: set filetype=asciidoc: diff --git a/vimperator/locale/en-US/map.txt b/vimperator/locale/en-US/map.txt index d0306571..5cbb10da 100644 --- a/vimperator/locale/en-US/map.txt +++ b/vimperator/locale/en-US/map.txt @@ -189,9 +189,9 @@ contains any non-whitespace character (e.g., "def'"). Strings that cannot be abbreviations include "a'b" and "a b". -An abbreviation is recognized when a space is typed after the -abbreviation. There are no default abbreviations, and abbreviations are -never recursive. +An abbreviation is recognized when a space, quote character, or +[m][m] is typed after the abbreviation. There are no default +abbreviations, and abbreviations are never recursive. |:ab| |:abbreviate| ||:ab[breviate] {lhs} {rhs}|| + @@ -199,8 +199,8 @@ never recursive. ||:ab[breviate]|| ________________________________________________________________________________ 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 -arguments are given. +list all abbreviations that start with {lhs}. If no arguments are given, +list all abbreviations. ________________________________________________________________________________