aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-09-12 11:24:11 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-09-12 11:24:11 -0400
commit9dc8ce16a1efc6482db6f1d5456d42958e79a06c (patch)
treee26ff636143fc74f92a6a3359a73e93194da6bc3 /doc
parent4305f32ac153b7a45a1c001da2fcd412af905168 (diff)
Documentation overhaul.
Rewrote most of the manual and Lua API to complement each other. Key bindings reference moved from Appendix to modules/textadept/keys.lua LuaDoc.
Diffstat (limited to 'doc')
-rw-r--r--doc/.api_index.md6
-rw-r--r--doc/01_Introduction.md67
-rw-r--r--doc/02_Installation.md121
-rw-r--r--doc/03_UserInterface.md53
-rw-r--r--doc/04_WorkingWithFiles.md174
-rw-r--r--doc/05_FileNavigation.md41
-rw-r--r--doc/06_AdeptEditing.md329
-rw-r--r--doc/07_Modules.md165
-rw-r--r--doc/08_Preferences.md181
-rw-r--r--doc/08_Themes.md91
-rw-r--r--doc/09_Preferences.md143
-rw-r--r--doc/09_Themes.md95
-rw-r--r--doc/10_Advanced.md44
-rw-r--r--doc/11_Scripting.md51
-rw-r--r--doc/12_Compiling.md63
-rw-r--r--doc/13_Help.md2
-rw-r--r--doc/14_Appendix.md193
-rw-r--r--doc/images/folding.pngbin0 -> 34954 bytes
-rw-r--r--doc/markdowndoc.lua6
19 files changed, 918 insertions, 907 deletions
diff --git a/doc/.api_index.md b/doc/.api_index.md
new file mode 100644
index 00000000..3a9fb25d
--- /dev/null
+++ b/doc/.api_index.md
@@ -0,0 +1,6 @@
+# Lua API
+
+The Lua API documentation is a complement to the [manual][]. Please ensure you
+are familiar with the basic concepts presented in the manual before proceeding.
+
+[manual]: ../01_Introduction.html
diff --git a/doc/01_Introduction.md b/doc/01_Introduction.md
index f4a27577..5ac05e8c 100644
--- a/doc/01_Introduction.md
+++ b/doc/01_Introduction.md
@@ -7,58 +7,63 @@
Textadept is a fast, minimalist, and ridiculously extensible cross-platform text
editor for programmers. Written in a combination of C and [Lua][] and
relentlessly optimized for speed and minimalism over the years, Textadept is an
-ideal editor for programmers who want endless extensibility options without
-sacrificing speed or succumbing to code bloat and featuritis.
+ideal editor for programmers who want endless extensibility without sacrificing
+speed or succumbing to code bloat and featuritis.
[Lua]: http://lua.org
### Fast
Textadept is _fast_. It starts up instantly and has a very responsive user
-interface (UI). Even though the editor is mostly written in Lua, Lua is one of
-the fastest scripting languages available. With the optional [LuaJIT][] version,
+interface. Even though the editor is mostly written in Lua, Lua is one of the
+fastest scripting languages available. With the optional [LuaJIT][] version,
Textadept is faster than ever before.
[LuaJIT]: http://luajit.org
### Minimalist
-Textadept is minimalist. Not only is this apparent in the UI, but the editor's C
-core was designed to never exceed 2000 lines of code and its Lua extension code
-is not supposed to go beyond 4000 lines. After 5 years of development, Textadept
-has maintained the same amount of code since its inception (~5600 lines) while
-evolving into a vastly superior editor.
+Textadept is minimalist. Not only is this apparent in its appearance, but the
+editor's C core was designed to never exceed 2000 lines of code and its Lua
+extension code is capped at 4000 lines. After 5 years of development, Textadept
+has maintained the same amount of code since its inception while evolving into a
+vastly superior editor.
### Ridiculously Extensible
Textadept is ridiculously extensible. It was designed to be that way from the
-very beginning. The features came later. Most of Textadept is written in Lua,
+very beginning. The features came later. Most of Textadept's internals use Lua,
from syntax highlighting to opening and saving files to searching and replacing
and more. Textadept gives you complete control over the entire application using
Lua. You can do everything from moving the caret to changing menus and key
-commands on-the-fly to handling UI events. The possibilities are limitless.
+commands on-the-fly to handling core events. The possibilities are limitless.
![Split Views](images/splitviews.png)
## Manual Notation
-* `~/` is denoted as the user's home directory. On Windows machines this is the
- value of the `USERHOME` environment variable (typically `C:\Users\<username>\`
- or `C:\Documents and Settings\<username>\`). On Linux and Mac OSX machines it
- is the value of `HOME` (typically `/home/<username>/` and `/Users/<username>/`
- respectively).
-* Any relative directory paths, i.e. paths that do not begin with `/` or `C:\`,
- are relative to the location of Textadept.
-* Key combinations are not case-sensitive. `Ctrl+N` means the `N` key is pressed
- with only the `Control` key being held down, not the `Shift` key.
- `Ctrl+Shift+N` means the `N` key is pressed with both `Control` and `Shift`
- keys being held down. The same notation is applicable to key chains:
- `Ctrl+N, N` vs. `Ctrl+N, Shift+N`. In the first key chain, `Control` and `N`
- are pressed followed by `N` with no modifiers. The second has `Control` and
- `N` pressed followed by `Shift` and `N`.
-* When mentioning key commands, the Mac OSX and ncurses equivalents will often
- be shown in parenthesis. It may be tempting to assume that some Windows/Linux
- keys map to Mac OSX's (e.g. `Ctrl` to `⌘`) or ncurses' (e.g. `Ctrl` to `^`),
- but this is not always the case. Please do not view the key equivalents as
- translations of one another, but rather as separate entities. This will
- minimize confusion.
+This manual uses notation that is worth clarifying.
+
+Directories and file paths are represented like this: `/path/to/file_or_dir`.
+(On Windows machines, `/` and `\` can be used interchangeably as directory
+separators.) Any relative paths, paths that do not begin with `/` or `C:\`, are
+relative to the location of Textadept. `~/` is denoted as the user's home
+directory. On Windows machines this is the value of the `USERHOME` environment
+variable, typically `C:\Users\<username>\` or
+`C:\Documents and Settings\<username>\`. On Linux, BSD, and Mac OSX machines it
+is the value of `HOME`, typically `/home/<username>/` and `/Users/<username>/`
+respectively.
+
+Key bindings are represented like this: `Ctrl+N`. They are not case sensitive.
+`Ctrl+N` means the `N` key is pressed with only the `Control` modifier key being
+held down, not the `Shift` modifier key. `Ctrl+Shift+N` means the `N` key is
+pressed with both `Control` and `Shift` modifiers held down. The same notation
+is applicable to key chains: `Ctrl+N, N` vs. `Ctrl+N, Shift+N`. In the first key
+chain, `Control` and `N` are pressed followed by `N` with no modifiers. The
+second has `Control` and `N` pressed followed by `Shift` and `N`.
+
+When key bindings are mentioned, the Mac OSX and ncurses equivalents are often
+shown in parenthesis. It may be tempting to assume that some Windows/Linux keys
+map to Mac OSX's (e.g. `Ctrl` to `⌘`) or ncurses' (e.g. `Ctrl` to `^`), but this
+is not always the case. Please do not view the key equivalents as translations
+of one another, but rather as separate entities. This will minimize confusion.
diff --git a/doc/02_Installation.md b/doc/02_Installation.md
index 89c224c3..a631e715 100644
--- a/doc/02_Installation.md
+++ b/doc/02_Installation.md
@@ -2,37 +2,32 @@
## Requirements
-In its bid for minimalism, Textadept also needs very little to run. In fact, the
-only thing it needs is [GTK+][] >= 2.18 on Linux systems. GTK is already
-included in Windows and Mac OSX packages. Textadept also has its own version of
-Lua.
-
-The terminal version of Textadept requires [ncurses][]. This dependency is only
-necessary if you wish to run Textadept from a terminal.
-
-Notes:
-
-* The Linux binaries provided require GLib >= 2.28 to support single-instance
- functionality. You can compile Textadept with earlier versions of GLib down to
- 2.22. For reference, Ubuntu 11.04, Debian Wheezy, Fedora 15, and openSUSE 11.4
- support GLib 2.28 or higher.
-* For Win32 and Mac OSX, more than 3/4 of the download and unpackaged
- application sizes are due to GTK+, the cross-platform GUI toolkit Textadept
- uses. Textadept itself is much smaller.
+In its bid for minimalism, Textadept also needs very little to run. The GUI
+version needs only [GTK+][], a cross-platform GUI toolkit, version 2.18 or later
+on Linux and BSD systems. A GTK+ runtime is already bundled into the Windows
+and Mac OSX packages. Textadept also has its own [copy of Lua][]. The terminal
+version of Textadept requires [ncurses][]. This dependency is only necessary if
+you wish to run the editor from a terminal.
[GTK+]: http://gtk.org
+[copy of Lua]: 11_Scripting.html#Lua.Configuration
[ncurses]: http://invisible-island.net/ncurses/ncurses.html
-### Linux
+### Linux and BSD
+
+Most Linux and BSD systems already have GTK+ installed. If not, it is probably
+available through your package manager. Otherwise, compile and install it from
+the [GTK+ website][].
-Most Linux systems already have GTK+ installed. If not, it is probably available
-through your package manager. Otherwise, compile and install it from the
-[GTK+ website][].
+The GUI versions of Textadept in the Linux binary downloads require GLib version
+2.28 or later to support single-instance functionality. You can compile
+Textadept with earlier versions of GLib down to 2.22. For reference, Ubuntu
+11.04, Debian Wheezy, Fedora 15, and openSUSE 11.4 support GLib 2.28 or later.
-Most Linux systems already have ncurses installed. If not, look for it in your
-package manager, or compile and install it from the [ncurses website][]. For
-Debian-based distributions like Ubuntu, the package is typically called
-`libncursesw5`. Note: you should have a version of ncurses compiled with "wide"
+Most Linux and BSD systems already have ncurses installed. If not, look for it in
+your package manager, or compile and install it from the [ncurses website][].
+For Debian-based distributions like Ubuntu, the package is typically called
+`libncursesw5`. Note: you need to have a version of ncurses compiled with "wide"
(multibyte) character support installed.
[GTK+ website]: http://www.gtk.org/download-linux.html
@@ -48,15 +43,18 @@ No requirements.
## Download
-Download Textadept from the [project page][]. Select the appropriate package for
-your platform.
+Download Textadept from the project's [download page][] by selecting the
+appropriate package for your platform. For Windows and Mac OSX, more than 3/4 of
+the download and unpackaged application sizes are due to the bundled GTK+.
+Textadept itself is much smaller.
-You can also download an official set of [language-specific modules][], but this
-is optional. The list of language modules in the package is contained [here][].
-Textadept includes C/C++ and Lua language modules by default.
+You can also download an official set of [language-specific modules][] from the
+download page, but this is optional. The list of language modules in the package
+is contained [here][]. Textadept includes C/C++ and Lua language modules by
+default.
-[project page]: http://foicica.com/textadept
-[language-specific modules]: 7_Modules.html#Language.Specific
+[download page]: http://foicica.com/textadept/download
+[language-specific modules]: 07_Modules.html#Language-Specific
[here]: http://foicica.com/hg
## Installation
@@ -64,47 +62,48 @@ Textadept includes C/C++ and Lua language modules by default.
Textadept is designed to be as easy as possible to install by any user. You do
not need to have administrator privileges.
-### Linux
+### Linux and BSD
Unpack the archive anywhere.
If you downloaded the set of language-specific modules, unpack it where you
-unpacked the Textadept archive. The modules will be contained in
-`/path/to/textadept_VERSION/modules/`.
+unpacked the Textadept archive. The modules will be contained in the
+`/path/to/textadept_VERSION/modules/` directory.
### Mac OSX
Unpack the archive and move `Textadept.app` to your user or system
`Applications` directory like any other Mac OSX application. There is also a
`ta` script for launching Textadept from the command line that you can put in
-your `PATH`, but this is optional.
+your `PATH` (e.g. `/usr/local/bin`), but this is optional.
If you downloaded the set of language-specific modules, unpack it, right-click
`Textadept.app`, select `Show Package Contents`, navigate to
-`Contents/Resources/modules`, and copy the unpacked modules there.
+`Contents/Resources/modules/`, and copy the unpacked modules there.
### Windows
Unpack the archive anywhere.
If you downloaded the set of language-specific modules, unpack it where you
-unpacked the Textadept archive. The modules will be contained in
-`textadept_VERSION\modules\`.
+unpacked the Textadept archive. The modules will be contained in the
+`textadept_VERSION\modules\` directory.
## Running
-### Linux
+### Linux and BSD
Run Textadept by running `/path/to/textadept_VERSION/textadept` from the
-terminal. You can also create a symlink to the executable in your `PATH` (e.g.
-`/usr/bin`) or make a GNOME, KDE, XFCE, etc. button or menu launcher.
+terminal. You can also create a symbolic link to the executable in your `PATH`
+(e.g. `/usr/bin`) or make a GNOME, KDE, XFCE, etc. button or menu launcher.
There is also a `textadeptjit` executable for running Textadept with [LuaJIT][].
Please note there may be [compatibility issues][]. The `textadept` executable is
recommended.
The `textadept-ncurses` and `textadeptjit-ncurses` executables are versions of
-Textadept for the terminal.
+Textadept for the terminal. Run them as you would run the `textadept` and
+`textadeptjit` executables, but from a terminal instead.
[LuaJIT]: http://luajit.org
[compatibility issues]: 11_Scripting.html#LuaJIT
@@ -114,17 +113,21 @@ Textadept for the terminal.
It is difficult to provide a single binary that runs on all Linux platforms
since the versions of software installed vary widely from distribution to
distribution. Because the Linux version of Textadept uses the version of GTK+
-installed on your system, an error like: `error while loading shared libraries:
-<lib>: cannot open shared object file: No such file or directory` may occur when
-trying to run the program. The solution is actually quite painless even though
-it requires recompiling Textadept. See the [compiling][] page for more
-information.
+installed on your system, an error like:
+
+ error while loading shared libraries: <lib>: cannot open shared object
+ file: No such file or directory
+
+may occur when trying to run the program. The solution is actually quite
+painless even though it requires recompiling Textadept. See the [compiling][]
+page for more information.
[compiling]: 12_Compiling.html
### Mac OSX
-Run Textadept by double-clicking `Textadept.app`.
+Run Textadept by double-clicking `Textadept.app`. You can also pin it to your
+dock.
`Textadept.app` also contains an executable for running Textadept with
[LuaJIT][]. You can enable it by setting a `TEXTADEPTJIT`
@@ -137,16 +140,16 @@ non-LuaJIT executable is recommended.
#### Environment Variables
-By default, GUI apps like Textadept do not utilize environment variables such as
+By default, GUI apps like Textadept do not utilize environment variables like
`PATH` from your shell profile. Therefore, any [modules][] that use programs
contained in `PATH` (e.g. the progams in `/usr/local/bin/`) for run and compile
-commands will not be found. The solution is to follow these [instructions][] to
+commands will not be found. The solution is to follow [these instructions][] to
export whichever environment variables you need. At the very least, set `PATH`
to be `$PATH`. You will have to logout and log back in for the changes to take
effect.
-[modules]: 7_Modules.html
-[instructions]: http://developer.apple.com/library/mac/#qa/qa1067/_index.html
+[modules]: 07_Modules.html
+[these instructions]: http://developer.apple.com/library/mac/#qa/qa1067/_index.html
### Windows
@@ -160,14 +163,20 @@ There is also a `textadeptjit.exe` executable for running Textadept with
[LuaJIT]: http://luajit.org
[compatibility issues]: 11_Scripting.html#LuaJIT
+### `~/.textadept`
+
+Textadept stores all of your preferences and user-data in your `~/.textadept/`
+folder. If this folder does not exist, Textadept creates it on startup. You will
+learn more about this folder later.
+
## Single Instance
Textadept is a single-instance application on Linux, BSD, and Mac OSX. This
means that after Textadept is opened, running `textadept file.ext`
(`ta file.ext` on Mac OSX) from the command line or opening a file with
-Textadept from a file manager will open `file.ext` in the already open instance
-of Textadept. You can override this and open the file in a new instance by
-passing a `-f` or `--force` switch to Textadept: `textadept -f file.ext`
+Textadept from a file manager will open `file.ext` in the existing instance of
+Textadept. You can override this and open the file in a new instance by passing
+a `-f` or `--force` switch to Textadept: `textadept -f file.ext`
(`ta -f file.ext`). When the force switch is not present, files will be opened
in the original Textadept instance, regardless of how many instances are open.
diff --git a/doc/03_UserInterface.md b/doc/03_UserInterface.md
index 540ba2cc..948038cb 100644
--- a/doc/03_UserInterface.md
+++ b/doc/03_UserInterface.md
@@ -2,40 +2,47 @@
![UI](images/ui.png)
-Textadept's user interface was designed to be simple. It consists of a menubar
-(GUI version), editor view, initially hidden find/replace dialog, initially
-hidden command entry, and statusbar. Below are brief descriptions of these
-features. More in-depth discussion about some of them is provided later in the
-manual.
+Textadept's user interface was designed to be simple. It consists of a menu (GUI
+version only), editor view, and statusbar. There is also a find & replace pane
+and a command entry, both of which are initially hidden. Below are brief
+descriptions of these features. More in-depth discussion about some of them is
+provided later in the manual.
-## Menubar
+## Menu
-The completely customizable (and optional!) menubar provides access to all of
-Textadept's features. It is only available in the GUI version of Textadept.
-In the terminal, you can use the
-[command selection](10_Advanced.html#Command.Selection) dialog instead.
+The completely customizable menu provides access to all of Textadept's features.
+It is only available in the GUI version of Textadept. In the terminal, you can
+use the [command selection][] dialog instead. Textadept is very keyboard-driven
+so most menu items have an assigned key shortcut. Key bindings are changeable
+in your [key preferences][] and will reflect in the menu. Here is a
+[complete list][] of default key bindings.
+
+[command selection]: 10_Advanced.html#Command.Selection
+[key preferences]: 08_Preferences.html#Key.Bindings
+[complete list]: api/_M.textadept.keys.html#Key.Bindings
## Editor View
-The editor view is where you will spend most of your time in Textadept. It
-supports unlimited split views (GUI version) and is completely controllable by
-Lua.
+The editor view is where you will spend most of your time in Textadept. In the
+GUI version, you can split this view into as many other views as you would like.
+Each view is completely controllable by Lua.
-## Find and Replace Dialog
+## Find & Replace Pane
-This compact dialog is a great way to slice and dice through your document or
+This compact pane is a great way to slice and dice through your document or a
directory of files. You can even find and replace text using Lua patterns. It is
-available when you need it and quickly gets out of your way when you do not,
-minimizing distractions.
+available only when you need it and quickly gets out of your way when you do
+not, minimizing distractions.
## Command Entry
-The versatile command entry functions as both a place to execute Lua commands
-with the internal Lua state and find text incrementally. You can extend it to do
-even more if you would like. Like the find/replace dialog, the command entry
-pops in and out as you wish.
+The versatile command entry functions as, among other things, a place to execute
+Lua commands with Textadept's internal Lua state, find text incrementally, and
+execute shell commands. You can extend it to do even more. Like the Find &
+Replace pane, the command entry pops in and out as you wish.
## Statusbar
-The left side of the statusbar displays any status messages. The right side
-shows the current buffer's status.
+The statusbar is actually composed to two statusbars. The one on the left-hand
+side displays temporary status messages. The one on the right-hand side
+persistently shows the current buffer status.
diff --git a/doc/04_WorkingWithFiles.md b/doc/04_WorkingWithFiles.md
index 4508e4a1..dd9f515c 100644
--- a/doc/04_WorkingWithFiles.md
+++ b/doc/04_WorkingWithFiles.md
@@ -1,22 +1,15 @@
# Working with Files
-## Lack of Tabs
+## Buffers
One of the first things you will notice when opening multiple files in Textadept
is that there is no tab bar showing the files that are open. This was a design
-decision. Textadept was built to support unlimited split views, so having a tab
-bar with all open buffers would clutter the interface greatly. There is also the
-question of where to place the bar (above, below, or to one side) and how many
-to have (one for each split view or a single one under the menubar).
+decision because Textadept was built to support unlimited split views. Having a
+single tab bar for multiple views would cause confusion and having one tab bar
+per view would clutter the interface.
-You can see which buffer is active by looking at Textadept's titlebar. Pressing
-`Ctrl+Tab` (`^⇥` on Mac OSX | `M-N` in ncurses) cycles to the next buffer and
-`Ctrl+Shift+Tab` (`^⇧⇥` | `M-P`) cycles to the previous one.
-
-## Buffer Browser
-
-To move quickly between buffers, press `Ctrl+B` (`⌘B` on Mac OSX | `M-B` or
-`M-S-B` in ncurses) to open the buffer browser.
+Instead of having tabs, Textadept has the buffer browser. Press `Ctrl+B` (`⌘B`
+on Mac OSX | `M-B` or `M-S-B` in ncurses) to open it.
![Buffer Browser](images/bufferbrowser.png)
@@ -27,17 +20,104 @@ wildcards. You can also just use the arrow keys. Pressing `Enter` or selecting
![Buffer Browser Filtered](images/bufferbrowserfiltered.png)
-## Split Views
+You can see which buffer is active by looking at Textadept's titlebar. Pressing
+`Ctrl+Tab` (`^⇥` on Mac OSX | `M-N` in ncurses) cycles to the next buffer and
+`Ctrl+Shift+Tab` (`^⇧⇥` | `M-P`) cycles to the previous one.
+
+### Settings
+
+Individual files have three configurable settings: indentation, line endings,
+and encoding. Indentation is composed of an indentation character and an
+indentation size. Line endings are characters that separate lines. File
+encoding determines how text characters are displayed. Textadept shows these
+settings in the buffer status statusbar.
+
+![Document Statusbar](images/docstatusbar.png)
+
+#### Indentation
+
+Indentation is usually set by a [language-specific module][] or the current
+[theme][]. By default, indentation is 2 spaces. You can toggle between using
+tabs and spaces manually by pressing `Ctrl+Alt+Shift+T` (`^⇧T` on Mac OSX |
+`M-T` or `M-S-T` in ncurses). Toggling between tabs and spaces only affects
+future indentation; it does not convert existing indentation. `Ctrl+Alt+I` (`^I`
+| `M-I`) performs the conversion. (If the buffer is using tabs, all indenting
+spaces are converted to tabs. If the buffer is using spaces, all indenting tabs
+are converted to spaces.) Similarly, you can set indentation size manually using
+the `Buffer -> Indentation` menu.
+
+[language-specific module]: 07_Modules.html#Buffer.Properties
+[theme]: 09_Themes.html#Buffer
+
+#### Line Endings
+
+Line endings, commonly known as end-of-line (EOL) markers, are set based on the
+current platform. On Windows, CRLF (`\r\n`) is used. Otherwise, LF (`\n`) is.
+This can be changed manually using the `Buffer -> EOL Mode` menu.
+
+#### Encodings
+
+Textadept represents all characters and strings internally as UTF-8. You will
+not notice any difference for working with files containing ASCII text since
+UTF-8 is compatible with it. Textadept can also detect ISO-8859-1 and MacRoman,
+the primary encodings used on Windows and Mac OSX respectively. Files with more
+exotic encodings may not be detected properly, if at all. You can change the
+list of encodings Textadept tries to detect via [`io.try_encodings`][].
+
+It is recommended to use UTF-8 encoded files because UTF-8 is very well
+supported by other text editors and operating systems. You can change file
+encoding via the `Buffer -> Encoding` menu. Conversion is immediate, requiring
+no separate steps. Textadept saves new files as UTF-8 by default, but does not
+alter the encoding of existing files.
+
+[`io.try_encodings`]: api/io.html#try_encodings
+
+### Recent Files
+
+Pressing `Ctrl+Alt+O` (`^⌘O` on Mac OSX | `M-^O` in ncurses) brings up a dialog
+that behaves like the buffer browser, but displays a list of recently opened
+files to reopen.
-Textadept allows you to split the editor window as many times as you like either
-horizontally or vertically. `Ctrl+Alt+S` or `Ctrl+Alt+H` splits horizontally
-(top-bottom) and `Ctrl+Alt+V` splits vertically (`^S` and `^V` respectively on
-Mac OSX | N/A in ncurses). You can resize the splitter bar by clicking and
-dragging with the mouse or using `Ctrl+Alt++` and `Ctrl+Alt+-` (`^+` and `^-` |
-N/A). The same file can be worked with in multiple split views.
+### Sessions
+
+By default, Textadept saves its state on exit so it can be restored the next
+time the editor starts up. You can disable this by passing the `-n` or
+`--no-session` switch to Textadept on startup. Sessions can be manually saved
+and opened via the `File -> Save Session...` and `File -> Load Session...`
+menus. Session files store information such as open buffers, current split
+views, caret and scroll positions in each buffer, Textadept's window size, and
+recently opened files. Tampering with session files may have unintended
+consequences.
+
+### Snapopen
+
+A quicker, though slightly more limited alternative to the standard file
+selection dialog is snapopen. It behaves like the buffer browser, but displays a
+list of files to open, including files in sub-directories. You can snapopen the
+current file's directory with `Ctrl+Alt+Shift+O` (`^⌘⇧O` on Mac OSX | `M-S-O` in
+ncurses) or from the `Tools -> Snapopen -> Current Directory` menu. Snapopen is
+pretty limited from the menu, but more versatile in [scripts][]. `Ctrl+U` (`⌘U`
+| `^U`) snaps open `~/.textadept/`.
+
+[scripts]: api/_M.textadept.snapopen.html
+
+![Snapopen](images/snapopen.png)
+
+## Views
+
+### Split Views
+
+Textadept allows you to split the editor window as many times as you like both
+horizontally and vertically. `Ctrl+Alt+S` or `Ctrl+Alt+H` splits horizontally
+into top and bottom views and `Ctrl+Alt+V` splits vertically (`^S` and `^V`
+respectively on Mac OSX | N/A in ncurses) into side-by-side views. You can
+resize the splitter bar by clicking and dragging with the mouse or using
+`Ctrl+Alt++` and `Ctrl+Alt+-` (`^+` and `^-` | N/A). The same file can be worked
+with in multiple views.
Pressing `Ctrl+Alt+N` (`^⌥⇥` on Mac OSX | N/A in ncurses) goes to the next view
-and `Ctrl+Alt+P` (`^⌥⇧⇥` | N/A) goes to the previous one.
+and `Ctrl+Alt+P` (`^⌥⇧⇥` | N/A) goes to the previous one. Note: depending on the
+split sequence, the order when cycling between views may be unexpected.
To unsplit a view, enter the view to keep open and press `Ctrl+Alt+W` (`^W` on
Mac OSX | N/A in ncurses). To unsplit all views, use `Ctrl+Alt+Shift+W` (`^⇧W` |
@@ -45,28 +125,42 @@ N/A).
Split views are unavailable in ncurses.
-## Sessions
+### Settings
-By default, Textadept saves the list of open buffers on exit so it can reload
-them the next time it starts up. You can disable this by passing the `-n` or
-`--no-session` switch to Textadept on startup. Sessions can be manually saved
-and opened via the `File -> Save Session...` and `File -> Load Session...`
-menus.
+Individual views have many configurable settings. Among the more useful settings
+are viewing line endings, handling long lines, viewing indentation guides, and
+viewing whitespace. These options change how buffers in the view are displayed.
-Sessions save additional information such as current split views, caret and
-scroll positions in each buffer, Textadept's window size, and recently opened
-files.
+#### Line Endings
-## Snapopen
+Normally, EOL characters (`\r` and `\n`) are invisible. Pressing
+`Ctrl+Alt+Enter` (`^↩` on Mac OSX | none in ncurses) toggles their visibility.
-A quicker, though slightly more limited alternative to the standard
-`File -> Open` dialog is snapopen. It behaves like the buffer browser, but
-displays a list of files to open, including files in subdirectories. You can
-snapopen the current file's directory with `Ctrl+Alt+Shift+O` (`^⌘⇧O` on Mac
-OSX | `M-S-O` in ncurses) or from the `Tools -> Snapopen -> Current Directory`
-menu. Snapopen is pretty limited from the menu, but more versatile in scripts.
-See its [LuaDoc][]. `Ctrl+U` (`⌘U` | `^U`) snaps open `~/.textadept/`.
+#### Long Lines
-[LuaDoc]: api/_M.textadept.snapopen.html
+By default, lines with more characters than the view can show are not wrapped
+into view. `Ctrl+Alt+\` (`^\` on Mac OSX | none in ncurses) toggles line
+wrapping.
-![Snapopen](images/snapopen.png)
+#### Indentation Guides
+
+By default, small guiding lines are shown based on indentation level.
+`Ctrl+Alt+Shift+I` (`^⇧I` on Mac OSX | N/A in ncurses) toggles showing these
+guides.
+
+Indentation guides are unavailable in ncurses.
+
+#### Whitespace
+
+Normally, whitespace characters, tabs and spaces, are invisible. Pressing
+`Ctrl+Alt+Shift+S` (`^⇧S` on Mac OSX | none in ncurses) toggles their
+visibility. Visible spaces are shown as dots and visible tabs are shown as
+arrows.
+
+### Zoom
+
+You can temporarily increase or decrease the font size in a view with `Ctrl+=`
+(`⌘=` on Mac OSX | N/A in ncurses) and `Ctrl+-` (`⌘-` | N/A) respectively.
+`Ctrl+0` (`⌘0` | N/A) resets the zoom.
+
+Zooming is unavailable in ncurses.
diff --git a/doc/05_FileNavigation.md b/doc/05_FileNavigation.md
index 93e7f9d9..e0749313 100644
--- a/doc/05_FileNavigation.md
+++ b/doc/05_FileNavigation.md
@@ -1,26 +1,37 @@
# File Navigation
-## Bookmarks
+## Basic Movements
-You can place bookmarks on lines in buffers to jump back to them later. Use the
-`Tools -> Bookmark` menu options or key commands to do so.
+Textadept supports the key bindings you are accustomed to for navigating text
+fields on your platform. The arrow keys move the caret in a particular
+direction, `Ctrl+Left` and `Ctrl+Right` (`^⇠` and `^⇢` on Mac OSX | `^Left` and
+`^Right` in ncurses) move by words, `PgUp` and `PgDn` (`⇞` and `⇟` | `PgUp` and
+`PgDn`) move by pages, etc. Mac OSX and ncurses also support some Bash-style
+bindings like `^B`, `^F`, `^P`, `^N`, `^A`, and `^E`. A complete list of
+movement bindings is found in the "Movement" section of the
+[key bindings list][].
-## Goto Line
+[key bindings list]: api/_M.textadept.keys.html#Key.Bindings
-To jump to a specific line in a file, press `Ctrl+J` (`⌘J` on Mac OSX | `^J` in
-ncurses) and specify the line number in the prompt and press `Enter` (`↩` |
-`Enter`) or select `OK`.
-
-## Goto Matching Brace
+## Brace Match
By default, Textadept will highlight the matching brace characters under the
-caret : `(`, `)`, `[`, `]`, `{`, `}`, `<`, and `>`. Pressing `Ctrl+M` (`^M` on
-Mac OSX | `M-M` in ncurses) moves the caret to that matching brace and
-`Ctrl+Shift+M` (`^⇧M` | `M-S-M`) extends the selection.
+caret : `(`, `)`, `[`, `]`, `{`, and `}`. Pressing `Ctrl+M` (`^M` on Mac OSX |
+`M-M` in ncurses) moves the caret to that matching brace.
![Matching Braces](images/matchingbrace.png)
-## Mac OSX and ncurses
+## Bookmarks
-Textadept supports the keybindings you are accustomed to for navigating text
-fields in Mac OSX and entering commands in the Linux/BSD terminal.
+You can place bookmarks on lines in buffers to jump back to them later.
+`Ctrl+F2` (`⌘F2` on Mac OSX | none in ncurses) toggles a bookmark on the current
+line, `F2` jumps to the next bookmarked line, `Shift+F2` (`⇧F2` | none) jumps to
+the previously bookmarked line, `Alt+F2` (`⌥F2` | none) jumps to the bookmark
+selected from a list, and `Ctrl+Shift+F2` (`⌘⇧F2` | none) clears all bookmarks
+in the current buffer.
+
+## Goto Line
+
+To jump to a specific line in a file, press `Ctrl+J` (`⌘J` on Mac OSX | `^J` in
+ncurses) and specify the line number in the prompt and press `Enter` (`↩` |
+`Enter`) or select `OK`.
diff --git a/doc/06_AdeptEditing.md b/doc/06_AdeptEditing.md
index b09487ec..8ae6ae6e 100644
--- a/doc/06_AdeptEditing.md
+++ b/doc/06_AdeptEditing.md
@@ -1,197 +1,270 @@
# Adept Editing
-## Key Commands
+## Basic Editing
-Textadept is entirely keyboard-driven. See the comprehensive list of key
-commands in the [appendix][]. Key commands can be modified in your
-[key preferences][].
+Textadept has many basic editing features you are familiar with: basic text
+entry, undo/redo, clipboard manipulation, deleting characters and words,
+duplicating lines, joining lines, and transposing characters. These are
+accessible from the top-level `Edit` menu and have associated key bindings.
+Some of the basic editing features you may not be familiar with are discussed
+below.
-[appendix]: 14_Appendix.html#Key.Bindings
-[key preferences]: 9_Preferences.html#Key.Commands
-
-## Character Autopairing
+### Autopaired Characters
Usually, quote (`'`, `"`) and brace (`(`, `[`, `{`) characters go together in
pairs. By default, Textadept automatically inserts the complement character when
-the first is typed. Similarly, the complement is deleted when you press
-`Backspace` (`⌫`) over the first. See the [preferences][] page if you would like
-to disable this.
+the first is typed. Similarly, the complement is deleted when you press `Bksp`
+(`⌫` on Mac OSX | `Bksp` in ncurses) over the first. See the [preferences][]
+page if you would like to disable this.
-[preferences]: 9_Preferences.html#Module.Settings
+[preferences]: 08_Preferences.html#Generic
-## Word Completion
+### Word Completion
Textadept provides buffer-based word completion. Start typing a word, press
-`Ctrl+Return` (`^⎋` on Mac OSX | `M-Enter` in ncurses), and a list of suggested
-completions based on words in the current document is provided. Continuing to
-type changes the suggestion. Press `Enter` (`↩` | `Enter`) to complete the
-selected word.
+`Ctrl+Enter` (`^⎋` on Mac OSX | `M-Enter` in ncurses), and a list of suggested
+completions based on words in the current buffer is provided. Continuing to type
+changes the suggestion. Press `Enter` (`↩` | `Enter`) to complete the selected
+word.
![Word Completion](images/wordcompletion.png)
-## Adeptsense
+### Virtual Space Mode
-Textadept has the capability to autocomplete symbols for programming languages
-and display API documentation. Lua is of course supported extremely well and
-other languages have basic support with the help of [ctags][]. Symbol completion
-is available by pressing `Ctrl+Space` (`⌥⎋` on Mac OSX | `^Space` in ncurses).
-Documentation for symbols is available with `Ctrl+H` (`^H` | `M-H` or `M-S-H`).
+Virtual space (freehand) mode is enabled and disabled with `Ctrl+Alt+Shift+V`
+(`^⇧V` in Mac OSX | none in ncurses). When enabled, caret movement is not
+restricted by line endings.
-![Adeptsense Lua](images/adeptsense_lua.png)
-&nbsp;&nbsp;&nbsp;&nbsp;
-![Adeptsense Lua String](images/adeptsense_string.png)
+### Overwrite Mode
-![Adeptsense Doc](images/adeptsense_doc.png)
+Overwrite mode is enabled and disabled with the `Insert` key. When enabled,
+characters in the buffer will be overwritten instead of inserted as you type.
+The caret also changes to an underline when in overwrite mode.
-For more information on adding adeptsense support for another language, see
-the [LuaDoc][].
+## Selections
-[ctags]: http://ctags.sf.net
-[LuaDoc]: api/_M.textadept.adeptsense.html
+Textadept has many ways of creating and working with selections. Basic
+selections are what you get when you do things like hold the `Shift` modifier
+key (`⇧` on Mac OSX | `S-` in ncurses) while pressing the arrow keys, click and
+drag the mouse over a range of text, or press `Ctrl+A` (`⌘A` | `M-A`) for
+"Select All". More advanced selections like multiple and rectangular selections
+are more complicated to create, but have powerful uses.
-## Find and Replace
+### Multiple Selection
-`Ctrl+F` (`⌘F` on Mac OSX | `M-F` or `M-S-F` in ncurses) brings up the
-Find/Replace dialog. In addition to offering the usual find and replace,
-Textadept allows you to find with [Lua patterns][] and replace with Lua captures
-and even Lua code! For example: replacing all `(%w+)` with
-`%(string.upper('%1'))` capitalizes all words in the buffer. Lua captures (`%n`)
-are only available from a Lua pattern search, but embedded Lua code enclosed in
-`%()` is always allowed.
+Clicking the mouse at a point in the buffer while holding the `Ctrl` modifier
+key (`^` on Mac OSX | N/A in ncurses) places an additional caret at that point.
+Clicking and dragging while holding the same modifier creates multiple
+selections. When you start typing, the text is mirrored at each selection.
-Note the `Ctrl+G`, `Ctrl+Shift+G`, `Ctrl+Alt+R`, `Ctrl+Alt+Shift+R` key commands
-for find next, find previous, replace, and replace all (`⌘G`, `⌘⇧G`, `^R`, `^⇧R`
-respectively on Mac OSX | `M-G`, `M-S-G`, `M-R`, `M-S-R` in ncurses) only work
-when the Find/Replace dialog is hidden. When it is visible in the GUI version,
-use the button mnemonics: `Alt+N`, `Alt+P`, `Alt+R`, and `Alt+A` (`⌘N`, `⌘P`,
-`⌘R`, `⌘A` | N/A) for English locale.
+This is currently unavailable in ncurses.
-In the ncurses version, use `Tab` and `S-Tab` to toggle between the find next,
-find previous, replace, and replace all buttons; `Up` and `Down` arrows switch
-between the find and replace text fields; `^P` and `^N` cycles through history;
-and `F1-F4` toggles find options.
+### Rectangular Selection
-[Lua patterns]: 14_Appendix.html#Lua.Patterns
+Holding `Alt+Shift` (`⌥⇧` on Mac OSX | `M-S-` in ncurses) and pressing the arrow
+keys enables rectangular selections to be made. Start typing to type on each
+line.
-### Find in Files
+![Rectangular Selection](images/rectangularselection.png)
+&nbsp;&nbsp;&nbsp;&nbsp;
+![Rectangular Edit](images/rectangularselection2.png)
-`Ctrl+Shift+F` brings up Find in Files (`⌘⇧F` on Mac OSX | none in ncurses) and
-will prompt for a directory to search. The results are displayed in a new
-buffer. Double-clicking a search result jumps to it in the file. You can also
-use the `Ctrl+Alt+G` and `Ctrl+Alt+Shift+G` (`^⌘G` and `^⌘⇧G` on Mac OSX | none
-in ncurses) key commands. Replace in Files is not supported. You will have to
-`Find in Files` first, and then `Replace All` for each file a result is found
-in. The `Match Case`, `Whole Word`, and `Lua pattern` flags still apply.
+### Select to Matching Brace
-![Find in Files](images/findinfiles.png)
+Putting the caret over a brace character (`(`, `)`, `[`, `]`, `{`, or `}`) and
+pressing `Ctrl+Shift+M` (`^⇧M` on Mac OSX| `M-S-M` in ncurses) extends the
+selection to the brace character's matching brace.
-### Find Incremental
+### Entity Selection
-You can start an incremental search by pressing `Ctrl+Alt+F` (`^⌘F` on Mac OSX |
-`M-^F` in ncurses). Incremental search searches the buffer as you type. Only the
-`Match Case` option is recognized. Pressing `Esc` (`⎋` | `Esc`) stops it.
+Textadept allows you to select many different entities from the caret. For
+example, `Ctrl+"` (`^"` on Mac OSX | `M-"` in ncurses) selects all characters in
+a `""` sequence. Typing `Ctrl++` (`^+` | `M-+`) as a follow-up selects the
+double-quotes too. See the `Edit -> Select In...` menu for available entities
+and their key bindings.
-### Replace in Selection
+### Transforms
-By default, `Replace All` replaces all text in the buffer. If you want to
-replace all text in just a portion of the buffer, select a block of text and
-then `Replace All`.
+#### Enclose Entities
-## Indentation
+As a complement to selecting entities, you can enclose text as entities. The
+`Edit -> Selection -> Enclose In...` menu contains all available entities and
+their key bindings.
-### Change Indent Level
+If no text is selected, the word to the left of the caret is enclosed.
+
+#### Change Case
+
+Pressing `Ctrl+Alt+U` or `Ctrl+Alt+Shift+U` (`^U` or `^⇧U` on Mac OSX | `M-^U`
+or `M-^L` in ncurses) converts selected text to upper-case letters or lower-case
+letters respectively.
+
+#### Change Indent Level
The amount of indentation for a selected set of lines is increased by pressing
-`Tab` (`⇥` | `Tab`) and decreased by pressing `Shift+Tab` (`⇧⇥` | `S-Tab`).
-Using these key sequences when no selection is present does not have the same
-effect.
+`Tab` (`⇥` on Mac OSX | `Tab` in ncurses) and decreased by pressing `Shift+Tab`
+(`⇧⇥` | `S-Tab`). Whole lines do not have to be selected. As long as any part of
+a line is selected, the entire line is eligible for indenting/dedenting. Using
+these key sequences when no selection is present does not have the same effect.
+
+#### Move Lines
+
+Selected lines are moved with the `Ctrl+Shift+Up` and `Ctrl+Shift+Down` (`^⇧⇡`
+and `^⇧⇣` on Mac OSX | `S-^Up` and `S-^Down` in ncurses) keys. Like with
+changing indent level, as long as any part of a line is selected, the entire
+line is eligible for moving.
+
+## Find & Replace
-### Change Indent Size
+`Ctrl+F` (`⌘F` on Mac OSX | `M-F` or `M-S-F` in ncurses) brings up the Find &
+Replace pane. In addition to offering the usual find and replace with "Match
+Case" and "Whole Word" options and find/replace history, Textadept allows you to
+find with [Lua patterns][] and replace with Lua captures and even Lua code! For
+example: replacing all `(%w+)` with `%(string.upper('%1'))` upper-cases all
+words in the buffer. Lua captures (`%`_`n`_) are only available from a Lua
+pattern search, but embedded Lua code enclosed in `%()` is always allowed.
-The indent size is usually set by a [language-specific module][] or the
-[theme][]. You can set it manually using the `Buffer -> Indentation` menu.
-Textadept shows what it is using for indentation in the document statusbar.
+Note the `Ctrl+G`, `Ctrl+Shift+G`, `Ctrl+Alt+R`, `Ctrl+Alt+Shift+R` key bindings
+for find next, find previous, replace, and replace all (`⌘G`, `⌘⇧G`, `^R`, `^⇧R`
+respectively on Mac OSX | `M-G`, `M-S-G`, `M-R`, `M-S-R` in ncurses) only work
+when the Find & Replace pane is hidden. When the pane is visible in the GUI
+version, use the button mnemonics: `Alt+N`, `Alt+P`, `Alt+R`, and `Alt+A` (`⌘N`,
+`⌘P`, `⌘R`, `⌘A` | N/A) for English locale.
-![Document Statusbar](images/docstatusbar.png)
+In the ncurses version, `Tab` and `S-Tab` toggles between the find next, find
+previous, replace, and replace all buttons; `Up` and `Down` arrows switch
+between the find and replace text fields; `^P` and `^N` cycles through history;
+and `F1-F4` toggles find options.
-[language-specific module]: 7_Modules.html#Buffer.Properties
-[theme]: 8_Themes.html#Buffer
+[Lua patterns]: 14_Appendix.html#Lua.Patterns
-### Using Tabs
+### Replace in Selection
-You can use tabs instead of the default spaces by pressing `Ctrl+Alt+Shift+T`
-(`^⇧T` on Mac OSX | `M-T` or `M-S-T` in ncurses) or using the `Buffer -> Toggle
-Use Tabs` menu. Textadept shows what it is using for indentation in the document
-statusbar.
+By default, `Replace All` replaces all text in the buffer. If you want to
+replace all text in just a portion of the buffer, select a block of text and
+then `Replace All`.
-The default option is usually set by a [language-specific module][] or the
-[theme][].
+### Find in Files
-[language-specific module]: 7_Modules.html#Buffer.Properties
-[theme]: 8_Themes.html#Buffer
+`Ctrl+Shift+F` brings up Find in Files (`⌘⇧F` on Mac OSX | none in ncurses) and
+will prompt for a directory to search. The results are displayed in a new
+buffer. Double-clicking a search result jumps to it in the file. You can also
+use the `Ctrl+Alt+G` and `Ctrl+Alt+Shift+G` (`^⌘G` and `^⌘⇧G` on Mac OSX | none
+in ncurses) key bindings. Replace in Files is not supported. You will have to
+`Find in Files` first, and then `Replace All` for each file a result is found
+in. The `Match Case`, `Whole Word`, and `Lua pattern` flags still apply.
-### Converting Indentation
+_Warning_: currently, there is no way to specify a file-type filter, so Find in
+Files will scan **all** files, even binary ones, in **all** sub-directories.
+Searches also block Textadept from receiving additional input, making the
+interface temporarily unresponsive. Searching large directories or projects can
+be very time consuming and frustrating, so using a specialized, external tool
+such as [ack][] is recommended.
-Use the `Edit -> Convert Indentation` menu to convert indentation. If the buffer
-is using tabs, all spaces are converted to tabs. If the buffer is using spaces,
-all tabs are converted to spaces.
+![Find in Files](images/findinfiles.png)
-## Selecting Text
+[ack]: http://betterthangrep.com/
-### Rectangular Selection
+### Incremental Find
-Holding `Alt+Shift` (`⌥⇧` on Mac OSX | `M-S` in ncurses) and pressing the arrow
-keys enables rectangular selections to be made. Start typing to type on each
-line.
+You can start an incremental search by pressing `Ctrl+Alt+F` (`^⌘F` on Mac OSX |
+`M-^F` in ncurses). Incremental search searches the buffer as you type. Only the
+`Match Case` option is recognized. Pressing `Esc` (`⎋` | `Esc`) stops the
+search.
-![Rectangular Selection](images/rectangularselection.png)
-&nbsp;&nbsp;&nbsp;&nbsp;
-![Rectangular Edit](images/rectangularselection2.png)
+## Source Code Editing
-### Multiple Selection
+Textadept would not be a programmer's editor without some features for editing
+source code. Textadept understands the syntax and structure of more than 80
+different programming languages and recognizes hundreds of file types. It uses
+this knowledge to make viewing and editing code faster and easier.
-Clicking the mouse at a point in the buffer while holding `Control` places an
-additional caret at that point. Clicking and dragging while holding `Control`
-creates multiple selections. Start typing to enter text at each selection.
+### Lexers
-This is currently unavailable in ncurses.
+When you open a file, chances are that Textadept will identify the programming
+language associated with that file and set a "lexer" to highlight syntactic
+elements of the code. You can set or change the lexer manually by pressing
+`Ctrl+Shift+L` (`⌘⇧L` on Mac OSX | `M-S-L` in ncurses) and selecting a lexer
+from the list. You can customize how Textadept recognizes files in your
+[file type preferences][].
-### Selecting Entities
+Lexers can sometimes lose track of their context while you are editing and
+highlight syntax incorrectly. Pressing `F5` triggers a full redraw.
-Textadept allows you to select many different entities from the caret. For
-example, `Ctrl+"` (`^"` on Mac OSX | `M-"` in ncurses) selects all characters in
-a `""` sequence. Typing `Ctrl++` (`^+` | `M-+`) as a follow-up selects the
-double-quotes too. See the `Edit -> Select In...` menu for available entities
-and their key commands.
+[file type preferences]: 08_Preferences.html#File.Types
-## Enclosing Text
+### Code Folding
-As a complement to selecting entities, you can enclose text as entities. The
-`Edit -> Selection -> Enclose In...` menu contains all available entities and
-their key commands.
+Some lexers support code folding, where blocks of code can be temporarily
+hidden, making viewing easier. Fold points are denoted by arrows in the margin
+to the left of the code. Clicking on one toggles the folding for that block of
+code.
-If no text is selected, the word to the left of the caret is enclosed.
+![Folding](images/folding.png)
-## Word Highlight
+### Word Highlight
All occurrences of a given word are highlighted by putting the caret over the
word and pressing `Ctrl+Alt+Shift+H` (`⌘⇧H` on Mac OSX | N/A in ncurses). This
-is useful to show occurrences of a variable name in source code.
+is useful to show occurrences of a variable name, but is not limited to source
+code.
+
+![Word Highlight](images/wordhighlight.png)
This is not supported in ncurses.
-![Word Highlight](images/wordhighlight.png)
+### Adeptsense
+
+Textadept has the capability to autocomplete symbols for programming languages
+and display API documentation. Symbol completion is available by pressing
+`Ctrl+Space` (`⌥⎋` on Mac OSX | `^Space` in ncurses). Documentation for symbols
+is available with `Ctrl+H` (`^H` | `M-H` or `M-S-H`). Note: In order for this
+feature to work, the language you are working with must have an [Adeptsense][]
+defined. Language-specific modules usually [define Adeptsenses][].
-## Editing Modes
+![Adeptsense Lua](images/adeptsense_lua.png)
+&nbsp;&nbsp;&nbsp;&nbsp;
+![Adeptsense Lua String](images/adeptsense_string.png)
-### Virtual Space
+![Adeptsense Doc](images/adeptsense_doc.png)
-Virtual space (freehand) mode is enabled and disabled with `Ctrl+Alt+Shift+V`
-(`^⇧V` in Mac OSX | none in ncurses). When enabled, caret movement is not
-restricted by line endings.
+[Adeptsense]: api/_M.textadept.adeptsense.html
+[define Adeptsenses]: api/_M.html#Adeptsense
+
+### Snippets
+
+Snippets are essentially pieces of text inserted into a document. However,
+snippets are not limited to static text. They can be dynamic templates which
+contain placeholders for further user input, can mirror or transform those user
+inputs, and/or execute arbitrary code. Snippets are useful for rapidly
+constructing blocks of code such as control structures, method calls, and
+function declarations. Press `Ctrl+K` (`⌥⇥` on Mac OSX | `M-K` in ncurses) for a
+list of available snippets. Snippets are composed of trigger word and snippet
+text. Instead of manually selecting a snippet, you can type its trigger word
+followed by the `Tab` (`⇥` | `Tab`) key. Subsequent presses of `Tab` (`⇥` |
+`Tab`) cause the caret to enter placeholders in sequential order, `Shift+Tab`
+(`⇧⇥` | `S-Tab`) goes back to the previous placeholder, and `Ctrl+Shift+K`
+(`⌥⇧⇥` | `M-S-K`) cancels the current snippet. Snippets can be nested (inserted
+from within another snippet) and are not limited to source code.
+Language-specific modules usually [define snippets][], but you can create your
+own custom snippets in your [snippet preferences][].
+
+![Snippet](images/snippet.png)
+&nbsp;&nbsp;&nbsp;&nbsp;
+![Snippet Expanded](images/snippet2.png)
-### Overwrite
+[define snippets]: api/_M.html#Snippets
+[snippet preferences]: 08_Preferences.html#Snippets
-Overwrite mode is enabled and disabled with the `Insert` key. When enabled,
-characters in the buffer will be overwritten instead of inserted as you type.
-The caret also changes to an underline when in overwrite mode.
+### Toggle Comments
+
+Pressing `Ctrl+/` (`⌘/` on Mac OSX | `M-/` in ncurses) comments or uncomments
+the code on the selected lines. As long as any part of a line is selected, the
+entire line will be commented or uncommented. Note: In order for this feature to
+work, the language you are working with must have its comment prefix defined.
+Language-specific modules usually [define prefixes][], but it can also be done
+[manually][] in your [user-init file][].
+
+[define prefixes]: api/_M.html#Block.Comment
+[manually]: http://foicica.com/wiki/comment-supplemental
+[user-init file]: 08_Preferences.html#User.Init
diff --git a/doc/07_Modules.md b/doc/07_Modules.md
index afe9f0db..8ea211e8 100644
--- a/doc/07_Modules.md
+++ b/doc/07_Modules.md
@@ -1,92 +1,69 @@
# Modules
-Most of Textadept's functionality comes from modules written in Lua. A module
-consists of a single directory with an `init.lua` script to load any additional
-Lua files (typically in the same location). Essentially there are two classes of
-module: generic and language-specific.
+Most of Textadept's functionality comes from Lua modules. Essentially there are
+two classes of module: generic and language-specific. A generic module provides
+features for all programming languages while a language-specific module provides
+features for a specific programming language.
## Generic
-This class of modules is usually available globally for programming in all
-languages or writing plain-text. An example is the [textadept module][] which
-implements most of Textadept's functionality (find/replace, key commands, menus,
-snippets, etc.). These kinds of modules are generally loaded on startup. See the
-[preferences][] page for instructions on how to load generic modules when
-Textadept starts.
+Generic modules have a broad scope and are usually available for programming in
+all languages or writing plain-text. An example is the [textadept module][]
+which implements most of Textadept's functionality (find & replace, key
+bindings, menus, snippets, etc.). These kinds of modules are generally loaded on
+startup. See the [preferences][] page for instructions on how to load generic
+modules when Textadept starts.
[textadept module]: api/_M.textadept.html
-[preferences]: 9_Preferences.html#User.Init
+[preferences]: 08_Preferences.html#Loading.Modules
-## Language Specific
+## Language-Specific
-Each module of this class of modules is named after a language lexer in the
-`lexers/` directory and is only available only for editing code in that
-particular programming language unless you specify otherwise. Examples are the
-[cpp][] and [lua][] modules which provide special editing features for the C/C++
-and Lua languages respectively.
+Language-specific modules have a scope limited to a single programming language.
+The name of the module is named after the language's lexer in the `lexers/`
+directory and is automatically loaded when editing source code in that
+particular language. In addition to some of the editing features discussed
+[earlier][], these kinds of modules typically also have shell commands for
+running and compiling code, indentation settings, custom key bindings, and
+perhaps a custom context menu. These features are discussed below.
-[cpp]: api/_M.cpp.html
-[lua]: api/_M.lua.html
+[earlier]: 06_AdeptEditing.html#Source.Code.Editing
-### Lexer
+### Compile and Run
-All languages have a [lexer][] that performs syntax highlighting on the source
-code. While the lexer itself is not part of the module, its existence in
-`lexers/` is required.
+Most language-specific modules have a command that compiles and/or runs the code
+in the current file. Pressing `Ctrl+Shift+R` (`⌘⇧R` on Mac OSX | `M-^R` in
+ncurses) executes the command for compiling code and `Ctrl+R` (`⌘R` | `^R`)
+executes the command for running code. Double-clicking on any error messages
+will jump to where the errors occurred. Note: In order for these features to
+work, the language you are working with must have its run command and error
+format defined. If the language-specific module does not exist or does not
+[define][] commands or an error format, it can be done [manually][] in your
+[user-init file][].
-[lexer]: api/lexer.html
+[define]: api/_M.html#Compile.and.Run
+[manually]: http://foicica.com/wiki/run-supplemental
+[user-init file]: 08_Preferences.html#User.Init
-### Activation
-
-Language-specific modules are automatically loaded when a file of that language
-is loaded or a buffer's lexer is set to that language.
-
-### Snippets
-
-Most language-specific modules have a set of [snippets][]. Press `Ctrl+K` (`⌥⇥`
-on Mac OSX | `M-K` in ncurses) for a list of available snippets or see the
-module's Lua code. To insert a snippet, type its trigger followed by the `Tab`
-(`⇥` | `Tab`) key. Subsequent presses of `Tab` (`⇥` | `Tab`) causes the caret to
-enter tab stops in sequential order, `Shift+Tab` (`⇧⇥` | `S-Tab`) goes back to
-the previous tab stop, and `Ctrl+Shift+K` (`⌥⇧⇥` | `M-S-K`) cancels the current
-snippet. Snippets can be nested (inserted from within another snippet).
-
-![Snippet](images/snippet.png)
-&nbsp;&nbsp;&nbsp;&nbsp;
-![Snippet Expanded](images/snippet2.png)
-
-[snippets]: api/_M.textadept.snippets.html
-
-### Commands
-
-Most language-specific modules have a set of [key commands][]. See the module's
-Lua code for which key commands are available. They are typically stored in the
-`Ctrl+L` (`⌘L` on Mac OSX | `M-L` in ncurses) key prefix.
-
-[key commands]: api/_M.textadept.keys.html
-
-#### Run
-
-Most language-specific modules have a command that runs the code in the current
-file. Pressing `Ctrl+R` (`⌘R` on Mac OSX | `^R` in ncurses) runs that command.
-
-#### Compile
+### Buffer Properties
-Most language-specific modules have a command that compiles the code in the
-current file. Pressing `Ctrl+Shift+R` (`⌘⇧R` on Mac OSX | `M-^R` in ncurses)
-runs that command.
+Some programming languages have style guidelines for indentation and/or line
+endings which differ from Textadept's defaults. In this case, language-specific
+modules [set][] these preferences. If you wish to change them or use your own
+preferences, see the [language module preferences][] section.
-#### Block Comments
+[set]: api/_M.html#Buffer.Properties
+[language module preferences]: 08_Preferences.html#Language-Specific
-Pressing `Ctrl+/` (`⌘/` on Mac OSX | `M-/` in ncurses) comments or uncomments
-the code on the selected lines.
+### Key Bindings
-### Buffer Properties
+Most language-specific modules have a set of key bindings for
+[custom commands][]. See the module's [LuaDoc][] or code to find out which key
+bindings are assigned. They are typically stored in the `Ctrl+L` (`⌘L` on Mac
+OSX | `M-L` in ncurses) key chain prefix.
-Sometimes language-specific modules set default buffer properties like tabs and
-indentation size. See the module's Lua code for these settings. If you wish to
-change them or use different settings, see the
-[Customizing Modules](#Customizing.Modules) section below.
+[custom commands]: api/_M.html#Commands
+[LuaDoc]: api/index.html
### Context Menu
@@ -99,9 +76,7 @@ The officially supported language modules are hosted [here][] and are available
as a separate download. To upgrade to the most recent version of a module, you
can either use [Mercurial][] (run `hg pull` and then `hg update` on or from
within the module) or download a zipped version from the module's repository
-homepage and overwrite the existing one. If you do not have access to `_HOME`,
-place the updated module in your `_USERHOME` and replace all instances of
-`_HOME` with `_USERHOME` in the module's `init.lua`.
+homepage and overwrite the existing one.
For now, user-created modules are obtained from the [wiki][].
@@ -111,7 +86,10 @@ For now, user-created modules are obtained from the [wiki][].
## Installing Modules
-It is recommended to put all custom or user-created modules in your
+If you do not have write permissions for the directory Textadept is installed
+in, place the module in your `~/.textadept/modules/` folder and replace all
+instances of `_HOME` with `_USERHOME` in the module's `init.lua`. It is
+recommended to put all custom or user-created modules in your
`~/.textadept/modules/` directory so they will not be overwritten when you
update Textadept. Also, modules in that directory override any modules in
Textadept's `modules/` directory. This means that if you have your own `lua`
@@ -119,41 +97,6 @@ module, it will be loaded instead of the one that comes with Textadept.
## Developing Modules
-See the [LuaDoc][] for modules.
-
-[LuaDoc]: api/_M.html
-
-## Customizing Modules
-
-It is never recommended to modify the default modules that come with Textadept,
-even if you just want to change the buffer settings for a language-specific
-module or add a few more snippets. Instead you have two options: load your own
-module instead of the default one or load your custom module code after the
-default module loads. To load your own module, simply place it appropriately in
-`~/.textadept/modules/`. To load your module code after the default module
-loads, create a `post_init.lua` Lua script in the appropriate
-`~/.textadept/modules/` sub-folder. Please note that for generic modules, only
-the first option applies. Either option applies for language-specific modules.
-
-Suppose you wanted to completely change the menubar structure. You would first
-create a new `menu.lua` and then put it in `~/.textadept/modules/textadept/`.
-Now when Textadept looks for `menu.lua`, it will load yours instead of its own.
-Similarly, if you copy the default Lua language-specific module (`modules/lua`)
-to `~/.textadept/modules/` and make custom changes, that module is loaded for
-editing Lua code instead of the default module.
-
-If you keep a modified copy of language-specific modules, you will likely want
-to update them with each new Textadept release. Instead of potentially wasting
-time merging your changes, you can load custom code independent of the module in
-a `post_init.lua` file. For example, instead of copying the `lua` module and
-changing its `set_buffer_properties()` function to use tabs, you can do this
-from `post_init.lua`:
-
- function _M.lua.set_buffer_properties()
- buffer.use_tabs = true
- end
-
-Similarly, you can use `post_init.lua` to change the compile/run commands, load
-more [Adeptsense tags][], and add additional key commands and snippets.
+See the [module LuaDoc][].
-[Adeptsense tags]: api/_M.textadept.adeptsense.html#load_ctags
+[module LuaDoc]: api/_M.html
diff --git a/doc/08_Preferences.md b/doc/08_Preferences.md
new file mode 100644
index 00000000..f0cdd2f0
--- /dev/null
+++ b/doc/08_Preferences.md
@@ -0,0 +1,181 @@
+# Preferences
+
+At this point it is assumed you are at least familiar with the basics of
+[Lua][]. You do not have to know a lot of the language to configure Textadept.
+
+[Lua]: http://www.lua.org
+
+## User Init
+
+Textadept executes a `~/.textadept/init.lua`, your user-init file, on startup.
+If this file does not exist, Textadept creates it for you. You can use the file
+to indicate what you want Textadept to do when the application starts. At first,
+it simply loads a module that contains most of Textadept's functionality.
+However, you are not restricted to just loading modules. You can run any Lua
+code you desire. It is important to realize that Textadept will not load
+anything you do not tell it to. If your `~/.textadept/init.lua` exists and is
+empty, no modules are loaded (pretty much rendering Textadept useless).
+
+## Modules
+
+It is never recommended to modify the default modules that come with Textadept,
+even if you just want to change an option in a generic module, modify the buffer
+settings for a language-specific module, edit file types, or just add a small
+bit of custom code. Those changes may be overwritten when you upgrade Textadept
+to a newer version. Instead you have two options: load your own module instead
+of the default one, or run your custom module code after the default module
+loads. To load your own module, simply place it appropriately in
+`~/.textadept/modules/`. To run your module code after a default generic module
+loads, put your code in `~/.textadept/init.lua`. To run your module code after a
+default language-specific module loads, create a `post_init.lua` Lua script in
+the appropriate `~/.textadept/modules/` module folder.
+
+### Generic
+
+Many of Textadept's generic modules have settings you can change from
+`~/.textadept/init.lua` after the module is loaded. These settings are viewed
+from module's [LuaDoc][]. For example, to disable character autopairing and
+stripping whitespace on save, your `~/.textadept/init.lua` might look like:
+
+ _M.textadept = require 'textadept'
+
+ _M.textadept.editing.AUTOPAIR = false
+ _M.textadept.editing.STRIP_WHITESPACE_ON_SAVE = false
+
+Now suppose you wanted to load all of Textadept's default modules except for the
+menu. Copy the `textadept` module's `init.lua` (located in the
+`modules/textadept/` directory) to `~/.textadept/modules/textadept/` and change
+
+ M.menu = require 'textadept.menu'
+
+to
+
+ --M.menu = require 'textadept.menu'
+
+Now when Textadept looks for `modules/textadept/init.lua`, it will load yours
+instead of its own, and load everything but the menu. If instead you wanted to
+completely change the menu structure, you would first create a new `menu.lua`
+and then put it in `~/.textadept/modules/textadept/`. Textadept will now load
+your `menu.lua` instead of its own.
+
+[LuaDoc]: api/index.html
+
+### Language-Specific
+
+Similar to generic modules, copying the default Lua language-specific module
+(`modules/lua`) to `~/.textadept/modules/` causes Textadept to load that module
+for editing Lua code instead of the default one. If you make custom changes to
+these kinds of copies of language-specific modules, you will likely want to
+update them with each new Textadept release. Instead of potentially wasting time
+merging your changes, you can run custom code independent of a module in the
+module's `post_init.lua` file. For example, instead of copying the `lua` module
+and changing its `set_buffer_properties()` function to use tabs, you can do this
+from `~/.textadept/modules/lua/post_init.lua`:
+
+ function _M.lua.set_buffer_properties()
+ buffer.use_tabs = true
+ end
+
+Similarly, you can use `post_init.lua` to change the module's
+[compile and run][] commands, load more [Adeptsense tags][], and add additional
+[key bindings](#Key.Bindings) and [snippets](#Snippets) (instead of in
+`~/.textadept/init.lua`). For example:
+
+ _M.textadept.run.run_command.lua = 'lua5.2'
+ _M.lua.sense:load_ctags('/path/to/my/projects/tags')
+ keys.lua['c\n'] = function()
+ buffer:line_end() buffer:add_text('end') buffer:new_line()
+ end
+ snippets.lua['ver'] = '%<_VERSION>'
+
+[compile and run]: 07_Modules.html#Compile.and.Run
+[Adeptsense tags]: api/_M.textadept.adeptsense.html#load_ctags
+
+### Loading Modules
+
+Suppose you created or downloaded a generic module called `foo` that you wanted
+to load along with the default modules Your `~/.textadept/init.lua` would
+contain the following:
+
+ _M.textadept = require 'textadept'
+ _M.foo = require 'foo'
+
+### Key Bindings
+
+For simple changes to key bindings, `~/.textadept/init.lua` is a good place to
+put them. For example, maybe you want `Ctrl+Shift+C` to create a new buffer
+instead of `Ctrl+N`:
+
+ keys.cC = new_buffer
+ keys.cn = nil
+
+If you plan on redefining most key bindings, you would probably want to copy or
+create a new `keys.lua` and then put it in `~/.textadept/modules/textadept/`.
+You can learn more about key bindings in the [key bindings LuaDoc][].
+
+[key bindings LuaDoc]: api/keys.html
+
+### Snippets
+
+You can add global snippets in `~/.textadept/init.lua`, such as:
+
+ snippets['file'] = '%<buffer.filename>'
+ snippets['path'] = "%<(buffer.filename or ''):match('^.+[/\\]')>"
+
+So typing `file` or `path` and then pressing `Tab` (`⇥` on Mac OSX | `Tab` in
+ncurses) will insert the snippet, regardless of the current programming
+language. You can learn about snippet syntax in the [snippets LuaDoc][].
+
+[snippets LuaDoc]: api/_M.textadept.snippets.html
+
+## Locale
+
+Textadept attempts to auto-detect your locale settings using the `LANG`
+environment variable. If it is unsuccessful, the English locale is used by
+default. To set the locale manually, copy the desired locale file from the
+`core/locales/` folder to `~/.textadept/locale.conf`. If your language is not
+yet supported by Textadept, please translate the English messages in
+`core/locale.conf` to your language and send the modified `locale.conf` file to
+[me][]. I will include it in a future release.
+
+[me]: README.html#Contact
+
+## File Types
+
+Textadept recognizes a wide range of programming language files by any of the
+following:
+
+* File extension.
+* Keywords in the file's shebang (`#!/path/to/exe`) line.
+* A pattern that matches the text of the file's first line.
+
+Built-in file types are located in `modules/textadept/mime_types.conf`. You
+can override or add to them in your `~/.textadept/mime_types.conf`:
+
+ % Recognize .luadoc files as Lua code.
+ luadoc lua
+
+ % Change .html files to be recognized as XML files instead of HTML ones.
+ html xml
+
+### Detect by Extension
+
+ file_ext lexer
+
+Note: `file_ext` should not start with a `.` (period).
+
+### Detect by Shebang
+
+ #shebang_word lexer
+
+Examples of `shebang_word`s are `lua`, `ruby`, `python`.
+
+### Detect by Pattern
+
+ /pattern lexer
+
+[Lua pattern syntax][] is used. Only the last space, the one separating the
+pattern from the lexer, is significant. No spaces in the pattern need to be
+escaped.
+
+[Lua pattern syntax]: 14_Appendix.html#Lua.Patterns
diff --git a/doc/08_Themes.md b/doc/08_Themes.md
deleted file mode 100644
index 5a171c82..00000000
--- a/doc/08_Themes.md
+++ /dev/null
@@ -1,91 +0,0 @@
-# Themes
-
-Textadept's look and feel can be customized with themes. The themes that come
-with Textadept are `light`, `dark`, and `term`. By default the `light` theme is
-used for the GUI version and `term` for the ncurses version. To change the
-theme, create a `~/.textadept/theme` and/or `~/.textadept/theme_term` whose
-first lines of text are the names of the themes you would like to use.
-
-![Light Theme](images/lighttheme.png)
-&nbsp;&nbsp;
-![Dark Theme](images/darktheme.png)
-&nbsp;&nbsp;
-![Term Theme](images/termtheme.png)
-
-Themes apply to all buffers. You cannot assign a theme to a particular file or
-filetype. You can change things like tab and indent settings per filetype
-however by creating a [language-specific module].
-
-[language-specific module]: 7_Modules.html#Buffer.Properties
-
-## Creating or Modifying Themes
-
-Each theme is a single folder on the filesystem composed of three files:
-`lexer.lua`, `buffer.lua`, and `view.lua`. It is recommended to put themes in
-your `~/.textadept/themes/` directory so they will not be overwritten when you
-update Textadept. Themes in that directory override any themes in Textadept's
-`themes/` directory. This means that if you have your own `light` theme, it will
-be loaded instead of the one that comes with Textadept.
-
-To use a theme not located in `~/.textadept/themes/` or Textadept's `themes/`
-directory, you need to specify an absolute path to the theme's folder in your
-`~/.textadept/theme` file.
-
-### Lexer
-
-Textadept uses lexers to assign names to buffer elements like comments, strings,
-and keywords. These elements are assigned styles composed of font and color
-information in the theme's `lexer.lua`. See the `Styling Tokens` section of the
-[lexer][] page for more information on how to create styles and colors.
-
-[lexer]: api/lexer.html
-
-### Buffer
-
-`buffer.lua` contains buffer-specific properties like indentation size and
-whether or not to use tabs. For example, to set the default tab size to 4 and
-use tabs:
-
- buffer.tab_width = 4
- buffer.use_tabs = true
- buffer.indent = 4
-
-See the [LuaDoc][] for documentation on the properties.
-
-[LuaDoc]: api/buffer.html
-
-### View
-
-`view.lua` contains view-specific properties like caret and selection colors.
-See the [LuaDoc][] for documentation on the properties.
-
-[LuaDoc]: api/buffer.html
-
-## Testing Themes
-
-You can reload or switch between themes on the fly using `Ctrl+Shift+T` (`⌘⇧T`
-on Mac OSX | none in ncurses), but be aware that the Scintilla views do not
-reset themselves, so any options set explicitly in the previous theme's
-`view.lua` file that are not set explicitly in the new theme will carry over.
-The switch feature is intended primarily for theme exploration and/or
-development and can be slow when many buffers or views are open.
-
-Any errors that occur in the theme are printed to `io.stderr`.
-
-## Theming the GUI
-
-There is no way to theme GUI controls like text fields and buttons from within
-Textadept. Instead, use [GTK Resource files][]. The `GtkWindow` name is
-`textadept`. For example, styling all text fields with a
-`"textadept-entry-style"` would be done like this:
-
- widget "textadept*GtkEntry*" style "textadept-entry-style"
-
-[GTK Resource files]: http://library.gnome.org/devel/gtk/stable/gtk-Resource-Files.html
-
-## Getting Themes
-
-For now, user-created themes are obtained from the [wiki][]. The classic `dark`,
-`light`, and `scite` themes prior to version 4.3 have been moved there.
-
-[wiki]: http://foicica.com/wiki/textadept
diff --git a/doc/09_Preferences.md b/doc/09_Preferences.md
deleted file mode 100644
index 64f63dbd..00000000
--- a/doc/09_Preferences.md
+++ /dev/null
@@ -1,143 +0,0 @@
-# Preferences
-
-At this point it is assumed you are at least familiar with the basics of
-[Lua][]. You do not have to know a lot of the language to configure Textadept.
-
-[Lua]: http://www.lua.org
-
-## User Init
-
-Textadept loads modules from your `~/.textadept/init.lua` on startup. If this
-file does not exist, Textadept creates it with a list of default modules to
-load. You can then use the file to indicate what else you want Textadept to
-load. For example if you created a generic module called `foo` that you wanted
-to load alongside the default modules, your `~/.textadept/init.lua` would
-contain
-
- require 'textadept'
- _M.foo = require 'foo'
-
-Please note that the `textadept` module populates the `_M.textadept` table
-itself because of internal dependencies. Normally, modules do not do this, hence
-why `_M.foo = require 'foo'` is used.
-
-If instead you wanted to load all of Textadept's default modules except for the
-menu, copy the `textadept` module's `init.lua` (located in the
-`modules/textadept/` directory) to `~/.textadept/modules/textadept/` and change
-
- M.menu = require 'textadept.menu'
-
-to
-
- --M.menu = require 'textadept.menu'
-
-Of course if you prefer, you can put the relevant code directly in
-`~/.textadept/init.lua` instead.
-
-It is important to realize that Textadept will not load anything you do not tell
-it to. If your `~/.textadept/init.lua` exists and is empty, no modules are
-loaded (pretty much rendering Textadept useless).
-
-### Module Settings
-
-Many of Textadept's modules have settings you can change from your
-`~/.textadept/init.lua`. These settings are viewed from module's
-[LuaDoc][]. For example, to disable character autopairing and
-whitespace stripping on save, your `~/.textadept/init.lua` might look like:
-
- require 'textadept'
-
- _M.textadept.editing.AUTOPAIR = false
- _M.textadept.editing.STRIP_WHITESPACE_ON_SAVE = false
-
-[LuaDoc]: api/index.html
-
-### Other
-
-Your `~/.textadept/init.lua` is not restricted to just loading modules or
-setting preferences. It is just Lua code that is run when Textadept loads. For
-more information, see the [scripting][] page.
-
-[scripting]: 11_Scripting.html
-
-#### Snippets
-
-You can add global snippets to `snippets` such as:
-
- snippets['file'] = '%<buffer.filename>'
- snippets['path'] = "%<(buffer.filename or ''):match('^.+[/\\]')>"
-
-So typing `file` or `path` and then pressing `Tab` (`⇥` on Mac OSX | `Tab` in
-ncurses) will insert the snippet.
-
-#### Key Commands
-
-It is not recommended to edit Textadept's `modules/textadept/keys.lua` for
-changing the key bindings since your changes could be overwritten when updating
-Textadept. Instead, modify `keys` from within your `~/.textadept/init.lua` or
-from a file loaded by `~/.textadept/init.lua`. For example maybe you want
-`Ctrl+Shift+C` to create a new buffer instead of `Ctrl+N`:
-
- keys.cC = new_buffer
- keys.cn = nil
-
-## Locale
-
-Most messages displayed by Textadept are localized. `core/locale.conf` contains
-these messages. By default, Textadept is localized in English. To use a
-different language, put a translated version of `core/locale.conf` in your
-`~/.textadept/` folder. Translations are located in `core/locales/`.
-
-Feel free to translate Textadept and send your modified `locale.conf` files
-to me. I will include them in future releases.
-
-## Mime Types
-
-Textadept recognizes a wide range of programming language files by any of the
-following:
-
-* File extension.
-* Keywords in the file's shebang (`#!/path/to/exe`) line.
-* A pattern that matches the text of the file's first line.
-
-Built-in mime-types are located in `modules/textadept/mime_types.conf`. You
-can override or add to them in your `~/.textadept/mime_types.conf`:
-
- % Recognize .luadoc files as Lua code.
- luadoc lua
-
- % Change .html files to be recognized as XML files instead of HTML ones.
- html xml
-
-It is not recommended to edit Textadept's `modules/textadept/mime_types.conf`
-because your changes may be overwritten when updating Textadept.
-
-### Detect by File Extension
-
- file_ext lexer
-
-Note: `file_ext` should not start with a `.` (period).
-
-### Detect by Shebang Keywords
-
- #shebang_word lexer
-
-Examples of `shebang_word`'s are `lua`, `ruby`, `python`.
-
-### Detect by Pattern
-
- /pattern lexer
-
-Only the last space, the one separating the pattern from the lexer, is
-significant. No spaces in the pattern need to be escaped.
-
-## More Language Preferences
-
-Textadept does not come with language-specific modules for all languages so you
-can add run commands, compile commands, and block quotes manually:
-
-* [Run/Compile commands][]
-* [Block Quotes][]
-
-[Run/Compile commands]: http://foicica.com/wiki/RunSupplemental
-[Block Quotes]: http://foicica.com/wiki/CommentSupplemental
diff --git a/doc/09_Themes.md b/doc/09_Themes.md
new file mode 100644
index 00000000..37f5379e
--- /dev/null
+++ b/doc/09_Themes.md
@@ -0,0 +1,95 @@
+# Themes
+
+Textadept's look and feel is customized with themes. The themes that come with
+Textadept are `light`, `dark`, and `term`. By default the `light` theme is used
+for the GUI version and `term` for the ncurses version.
+
+<span style="display: block; clear: right;"></span>
+
+![Light Theme](images/lighttheme.png)
+&nbsp;&nbsp;
+![Dark Theme](images/darktheme.png)
+&nbsp;&nbsp;
+![Term Theme](images/termtheme.png)
+
+## Structure
+
+Each theme is a single folder composed of three files: `lexer.lua`,
+`buffer.lua`, and `view.lua`. It is recommended to put custom or downloaded
+themes in your `~/.textadept/themes/` directory so they will not be overwritten
+when you update Textadept. Also, themes in that directory override any themes in
+Textadept's `themes/` directory. This means that if you have your own `light`
+theme, it will be loaded instead of the one that comes with Textadept.
+
+### Lexer
+
+`lexer.lua` contains definitions for how to "style" syntactic elements like
+comments, strings, and keywords in programming languages. [Styles][] are
+composed of fonts and colors and apply universally to all programming language
+elements, resulting in a single, unified theme.
+
+[Styles]: api/lexer.html#Styling.Tokens
+
+### Buffer
+
+`buffer.lua` contains [buffer-specific properties][] like the indentation
+character and indentation size. For example, to use tabs instead of spaces and
+have a tab size of 4 spaces by default:
+
+ buffer.tab_width = 4
+ buffer.use_tabs = true
+
+You can use [Adeptsense][] to view a property's documentation or read the
+[buffer LuaDoc][].
+
+[buffer-specific properties]: 04_WorkingWithFiles.html#Settings
+[Adeptsense]: 06_AdeptEditing.html#Adeptsense
+[buffer LuaDoc]: api/buffer.html
+
+### View
+
+`view.lua` contains view-specific properties which apply to all buffers. These
+properties are numerous and control many aspects of how buffers are displayed,
+from caret and selection colors to margin configurations to marker definitions.
+View properties also control editor behaviors like scrolling and autocompletion.
+Existing themes have various properties commented out. Uncomment a property to
+turn it on or change its value. You can use [Adeptsense][] to view a property's
+documentation or read the [LuaDoc][].
+
+[Adeptsense]: 06_AdeptEditing.html#Adeptsense
+[LuaDoc]: api/buffer.html
+
+## Switch Themes
+
+You can switch between or reload themes using `Ctrl+Shift+T` (`⌘⇧T` on Mac OSX |
+none in ncurses). However, be aware that the views do not reset themselves. Any
+properties set explicitly in the previous theme's `view.lua` file that are not
+set explicitly in the new theme will carry over. Restarting Textadept will fix
+this. Also, be aware that themes apply to all buffers. You cannot assign a theme
+to a particular file or file type. (You can change things like tab and indent
+settings per filetype, however, by creating a [language-specific module][].)
+Behind the scenes, Textadept is setting the theme name in a `~/.textadept/theme`
+or `~/.textadept/theme_term` file. To use a theme not listed, specify an
+absolute path to the theme's folder in your `~/.textadept/theme` or
+`~/.textadept/theme_term` file. When testing themes, any errors that occur are
+printed to standard error.
+
+[language-specific module]: 07_Modules.html#Buffer.Properties
+
+## GUI Theme
+
+There is no way to theme GUI controls like text fields and buttons from within
+Textadept. Instead, use [GTK+ Resource files][]. The `GtkWindow` name is
+`textadept`. For example, styling all text fields with a
+`"textadept-entry-style"` would be done like this:
+
+ widget "textadept*GtkEntry*" style "textadept-entry-style"
+
+[GTK+ Resource files]: http://library.gnome.org/devel/gtk/stable/gtk-Resource-Files.html
+
+## Getting Themes
+
+For now, user-created themes are obtained from the [wiki][]. The classic `dark`,
+`light`, and `scite` themes prior to version 4.3 have been moved there.
+
+[wiki]: http://foicica.com/wiki/textadept
diff --git a/doc/10_Advanced.md b/doc/10_Advanced.md
index adae9ad7..1009733e 100644
--- a/doc/10_Advanced.md
+++ b/doc/10_Advanced.md
@@ -4,17 +4,20 @@
Access to the Lua state is available through the command entry. Press `Ctrl+E`
(`⌘E` on Mac OSX | `M-C` in ncurses) to access it. It is useful for debugging,
-inspecting, and entering buffer or view commands. If you try to cause
+inspecting, and entering `buffer` or `view` commands. If you try to cause
instability in Textadept's Lua state, you might very well succeed so be careful.
-For more information, see the [scripting][] page.
-
-Abbreviated commands for the `buffer`, `view` and `gui` are available. So
-`buffer:append_text('foo')` can be shortened to `append_text('foo')`. `print()`
-redirects to [`gui.print()`][]. Use `_G.print()` for Lua's `print()`.
+For available commands, see the [Lua API][]. Abbreviated commands for
+[`buffer`][], [`view`][] and [`gui`][] are available: the command
+`buffer:append_text('foo')` can be shortened to `append_text('foo')`. As a
+result, use `_G.print()` for Lua's `print()` since [`gui.print()`][] is
+shortened to `print()`.
![Command Entry](images/commandentry.png)
-[scripting]: 11_Scripting.html
+[Lua API]: api/index.html
+[`buffer`]: api/buffer.html
+[`view`]: api/view.html
+[`gui`]: api/gui.html
[`gui.print()`]: api/gui.html#print
### Tab Completion
@@ -38,12 +41,15 @@ the implementation.
If you did not disable the menu in your [preferences][], then pressing
`Ctrl+Shift+E` (`⌘⇧E` on Mac OSX | `M-S-C` in ncurses) brings up the command
-selection dialog. Typing part of any command filters the list with spaces being
+selection dialog. Typing part of any command filters the list, with spaces being
wildcards. This is an easy way to run commands without navigating the menus,
-using the mouse, or remembering key commands. It is also useful for looking up
-particular key commands quickly.
+using the mouse, or remembering key bindings. It is also useful for looking up
+particular key bindings quickly. Note: the key bindings in the dialog do not
+look like those in the menu. This different notation is how bindings are
+represented internally. You can learn more about this in the [keys LuaDoc].
-[preferences]: 9_Preferences.html#User.Init
+[preferences]: 08_Preferences.html#User.Init
+[keys LuaDoc]: api/keys.html
## Shell Commands and Filtering Text
@@ -67,19 +73,3 @@ The standard input (stdin) for shell commands is determined as follows:
* If no text is selected, the entire buffer is used.
The input text is replaced with the standard output (stdout) of the command.
-
-## File Encoding
-
-Textadept represents all characters and strings internally as UTF-8. You will
-not notice any difference for working with files containing ASCII text since
-UTF-8 is compatible with it. Textadept can also detect ISO-8859-1 and MacRoman,
-the primary encodings used on Windows and Mac OSX respectively. Files with more
-exotic encodings may not be detected properly, if at all. You can change the
-list of encodings Textadept tries to detect via [`io.try_encodings`][].
-
-It is recommended to use UTF-8 encoded files because UTF-8 is very well
-supported by other text editors and operating systems. You can change the file's
-encoding via the `Buffer -> Encoding` menu. Textadept saves new files as UTF-8
-by default.
-
-[`io.try_encodings`]: api/io.html#try_encodings
diff --git a/doc/11_Scripting.md b/doc/11_Scripting.md
index a214fe0f..3c546f1a 100644
--- a/doc/11_Scripting.md
+++ b/doc/11_Scripting.md
@@ -1,41 +1,37 @@
# Scripting
-Textadept has superb support for editing Lua code. Syntax autocomplete and
-LuaDoc is available for many Textadept objects as well as Lua's standard
-libraries. See the [`lua` module documentation][] for more information.
+Textadept is entirely scriptable with Lua. In fact, the editor is mostly written
+in Lua. As a result, Textadept has superb support for editing Lua code. Syntax
+autocomplete and API documentation is available for many Textadept objects as
+well as Lua's standard libraries. The [`lua` module][] also has more tools for
+working with Lua code.
![Adeptsense ta](images/adeptsense_ta.png)
&nbsp;&nbsp;&nbsp;&nbsp;
![Adeptsense tadoc](images/adeptsense_tadoc.png)
-[`lua` module documentation]: api/_M.lua.html
+[`lua` module]: api/_M.lua.html
## LuaDoc and Examples
-Textadept's API is heavily documented. The [API docs][] are the ultimate
+Textadept's API is heavily documented. The [API documentation][] is the ultimate
resource on scripting Textadept. There are of course abundant scripting examples
-since Textadept is mostly written in Lua.
+since the editor is written primarily in Lua.
-[API docs]: api/index.html
+[API documentation]: api/index.html
### Generating LuaDoc
You can generate API documentation for your own modules using the
-`doc/markdowndoc.lua` [LuaDoc][] module:
+`doc/markdowndoc.lua` [LuaDoc][] module (you must have [Discount][] installed):
- luadoc -d . --doclet _HOME/doc/markdowndoc [module(s)]
-
-or
-
- luadoc -d . -t template_dir --doclet _HOME/doc/markdowndoc [module(s)]
+ luadoc -d . [-t template_dir] --doclet _HOME/doc/markdowndoc [module(s)]
where `_HOME` is where Textadept is installed and `template_dir` is an optional
template directory that contains two Markdown files: `.header.md` and
`.footer.md`. (See `doc/.header.md` and `doc/.footer.md` for examples.) An
-`api/` directory containing the API documentation is created in the current
-directory.
-
-You must have [Discount][] installed.
+`api/` directory containing the API documentation HTML files is created in the
+current directory.
[LuaDoc]: http://keplerproject.github.com/luadoc/
[Discount]: http://www.pell.portland.or.us/~orc/Code/discount/
@@ -82,19 +78,19 @@ an organized folder structure.
Textadept's core Lua modules are contained in `core/`. These are absolutely
necessary in order for the application to run. They are responsible for
-Textadept's Lua to C interface, event structure, file input/output, and
+Textadept's Lua to C interface, event structure, file interactions, and
localization.
### Lexers
-Lexer Lua modules are responsible for the syntax highlighting of source code.
-They are located in `lexers/`.
+Lexer modules are responsible for the syntax highlighting of source code. They
+are located in `lexers/`.
### Modules
-Editor Lua modules are contained in `modules/`. These provide advanced text
-editing capabilities and can be available for all programming languages or
-targeted at specific ones.
+Editing modules are contained in `modules/`. These provide advanced text editing
+capabilities and can be available for all programming languages or targeted at
+specific ones.
### Themes
@@ -103,10 +99,11 @@ Built-in themes to customize the look and behavior of Textadept are located in
### User
-User Lua modules are contained in the `~/.textadept/` folder. This folder may
-contain `lexers/`, `modules/`, and `themes/` subdirectories.
+User preferences, Lua modules, themes, and user-data are contained in the
+`~/.textadept/` folder. This folder may contain `lexers/`, `modules/`, and
+`themes/` sub-directories.
-### GTK
+### GTK+
-The `etc/`, `lib/`, and `share/` directories are used by GTK and only appear in
+The `etc/`, `lib/`, and `share/` directories are used by GTK+ and only appear in
the Win32 and Mac OSX packages.
diff --git a/doc/12_Compiling.md b/doc/12_Compiling.md
index e16aba01..c6481176 100644
--- a/doc/12_Compiling.md
+++ b/doc/12_Compiling.md
@@ -7,21 +7,23 @@ as running it.
### Linux and BSD
-Linux systems need the GTK+ development libraries. Your package manager should
-allow you to install them. For Debian-based distributions like Ubuntu, the
-package is typically called `libgtk2.0-dev`. Otherwise, compile and install GTK
-from the [GTK+ website][]. Additionally you will need the [GNU C compiler][]
-(`gcc`) and [GNU Make][] (`make`). Both should be available for your Linux
-distribution through its package manager. For example, Ubuntu includes these
-tools in the `build-essential` package.
+First, Linux and BSD systems will need the [GNU C compiler][] (`gcc`) and
+[GNU Make][] (`make`). Both should be available for your distribution through a
+package manager. For example, Ubuntu includes these tools in the
+`build-essential` package.
+
+Next, the GTK+ development libraries are necessary for compiling the GUI version
+of Textadept. Your package manager should allow you to install them. For
+Debian-based Linux distributions like Ubuntu, the package is typically called
+`libgtk2.0-dev`. Otherwise, compile and install GTK+ from the [GTK+ website][].
If you would like to compile the terminal version of Textadept, you will need
the ncurses development library. Similarly, it should be available from your
-package manager. For Debian-based distributions like Ubuntu, the package is
-typically called `libncurses5-dev`. Otherwise, compile and install ncurses from
-the [ncurses website][]. Note: you should have a development version of ncurses
-compiled with "wide" (multibyte) character support installed. (Therefore, Debian
-users will also need `libncursesw5-dev`.)
+package manager. For Debian-based Linux distributions like Ubuntu, the package
+is typically called `libncurses5-dev`. Otherwise, compile and install ncurses
+from the [ncurses website][]. Note: you need to have a development version of
+ncurses compiled with "wide" (multibyte) character support installed.
+(Therefore, Debian users will _also_ need `libncursesw5-dev`.)
In addition, BSD users will need to have [libiconv][] installed.
@@ -34,31 +36,31 @@ In addition, BSD users will need to have [libiconv][] installed.
### Windows
Compiling Textadept on Windows is no longer supported. If you wish to do so
-however, you need a C compiler that supports the C99 standard (Microsoft's does
-not), the [GTK+ for Windows bundle][] (2.24 is recommended), and [libiconv][]
+however, you need a C compiler that supports the C99 standard, the
+[GTK+ for Windows bundle][] (2.24 is recommended), and [libiconv for Windows][]
(the "Developer files" zip).
The preferred way to compile for Windows is cross-compiling from Linux. To do
-so, in addition to the GTK bundle mentioned above, you need [MinGW][] with the
+so, in addition to the GTK+ bundle mentioned above, you need [MinGW][] with the
Windows header files. They should be available from your package manager.
[GTK+ for Windows bundle]: http://www.gtk.org/download/win32.html
-[libiconv]: http://gnuwin32.sourceforge.net/packages/libiconv.htm
+[libiconv for Windows]: http://gnuwin32.sourceforge.net/packages/libiconv.htm
[MinGW]: http://mingw.org
### Mac OSX
Compiling Textadept on Mac OSX is no longer supported. The preferred way is
cross-compiling from Linux. To do so, you will need my [GTK+ for OSX bundle][]
-and the [Apple Crosscompiler][] binaries.
+and the [Apple Cross-compiler][] binaries.
[GTK+ for OSX bundle]: download/gtkosx-2.24.9.zip
-[Apple Crosscompiler]: https://launchpad.net/~flosoft/+archive/cross-apple
+[Apple Cross-compiler]: https://launchpad.net/~flosoft/+archive/cross-apple
## Compiling
-Make sure you downloaded the `textadept_x.x.src.zip` (regardless of what
-platform you are on) and not a platform-specific binary package.
+Make sure you downloaded the `textadept_x.x.src.zip`, regardless of what
+platform you are on, and not a platform-specific binary package.
### Linux and BSD
@@ -68,10 +70,13 @@ Make a symlink from them to `/usr/bin/` or elsewhere in your `PATH`.
Similarly, `make ncurses` builds `textadept-ncurses` and `textadeptjit-ncurses`.
-Note: you may have to run `make CFLAGS="-I/usr/local/include"
-CXXFLAGS="-I/usr/local/include -L/usr/local/lib"` if the prefix where any
-dependencies are installed is `/usr/local` and your compiler flags do not
-include them by default.
+Note: you may have to run
+
+ make CFLAGS="-I/usr/local/include" \
+ CXXFLAGS="-I/usr/local/include -L/usr/local/lib"
+
+if the prefix where any dependencies are installed is `/usr/local` and your
+compiler flags do not include them by default.
#### Installing
@@ -79,8 +84,8 @@ Textadept is self-contained, meaning it does not need to be installed and can be
run from wherever it is located. However, if you want to install Textadept like
a normal Linux application, run the usual `make` and then `make install` or
`sudo make install` depending on your privilages. The default prefix is
-`/usr/local` but you can change this by setting `DESTDIR` (e.g. `make install
-DESTDIR=/prefix/to/install/to`).
+`/usr/local` but you can change this by setting `DESTDIR` (e.g.
+`make install DESTDIR=/prefix/to/install/to`).
### Cross Compiling for Windows
@@ -109,12 +114,12 @@ Similarly, `make osx-ncurses` builds `../textadept-ncurses.osx` and
#### Compiling on OSX (Legacy)
-[XCode][] is needed for Mac OSX as well as [jhbuild][] (for GTK). After building
-`meta-gtk-osx-bootstrap` and `meta-gtk-osx-core`, you need to build
+[XCode][] is needed for Mac OSX as well as [jhbuild][] (for GTK+). After
+building `meta-gtk-osx-bootstrap` and `meta-gtk-osx-core`, you need to build
`meta-gtk-osx-themes`. Note that the entire compiling process can easily take 30
minutes or more and ultimately consume nearly 1GB of disk space.
-After using `jhbuild`, GTK is in `~/gtk` so make a symlink from `~/gtk/inst` to
+After using `jhbuild`, GTK+ is in `~/gtk` so make a symlink from `~/gtk/inst` to
`src/gtkosx` in Textadept. Then open `src/Makefile` and uncomment the `Darwin`
block. Finally, run `make osx` to build `../textadept.osx` and
`../textadeptjit.osx`.
diff --git a/doc/13_Help.md b/doc/13_Help.md
index afddcde4..ee245fcc 100644
--- a/doc/13_Help.md
+++ b/doc/13_Help.md
@@ -5,6 +5,8 @@
Passing `-h` or `--help` to Textadept shows a list of available command line
parameters.
+This is unavailable in ncurses.
+
## Online Help
Textadept has a [mailing list][] and a [wiki][]. You can also join us on IRC via
diff --git a/doc/14_Appendix.md b/doc/14_Appendix.md
index 67f318d7..5057445c 100644
--- a/doc/14_Appendix.md
+++ b/doc/14_Appendix.md
@@ -1,184 +1,5 @@
# Appendix
-## Key Bindings
-
-Linux / Win32 | Mac OSX | Terminal | Command |
---------------|---------|----------|---------|
-**File** ||||
-Ctrl+N |⌘N |M-^N|New file
-Ctrl+O |⌘O |^O |Open file
-Ctrl+Alt+O |^⌘O |M-^O|Open recent file...
-Ctrl+Shift+O|⌘⇧O |M-O |Reload file
-Ctrl+S |⌘S |^S |Save file
-Ctrl+Shift+S|⌘⇧S |M-^S|Save file as..
-Ctrl+W |⌘W |^W |Close file
-Ctrl+Shift+W|⌘⇧W |M-^W|Close all files
-None |None|None|Load session...
-None |None|None|Load session...
-Ctrl+Q |⌘Q |^Q |Quit
-**Edit** ||||
-Ctrl+Z<br/>Alt+Backspace|⌘Z |^Z |Undo
-Ctrl+Y<br/>Ctrl+Shift+Z |⌘⇧Z |^Y |Redo
-Ctrl+X<br/>Shift+Del |⌘X<br/>⇧⌦|^X |Cut
-Ctrl+C<br/>Ctrl+Ins |⌘C |^C |Copy
-Ctrl+V<br/>Shift+Ins |⌘V |^V |Paste
-Ctrl+D |⌘D |None |Duplicate line
-Del |⌦<br/>^D |Del<br/>^D |Delete
-Alt+Del |^⌦ |M-Del<br/>M-D|Delete word
-Ctrl+A |⌘A |M-A |Select all
-Ctrl+M |^M |M-M |Match brace
-Ctrl+Enter |^⎋ |M-Enter |Complete word
-Ctrl+Alt+Shift+H |⌘⇧H |None |Highlight word
-Ctrl+/ |^/ |M-/ |Toggle block comment
-Ctrl+T |^T |^T |Transpose characters
-Ctrl+Shift+J |^J |M-J |Join lines
-Ctrl+Shift+M |^⇧M |M-S-M |Select to matching brace
-Ctrl+< |⌘< |M-< |Select between XML tags
-Ctrl+> |⌘> |None |Select in XML tag
-Ctrl+" |⌘" |M-" |Select in double quotes
-Ctrl+' |⌘' |M-' |Select in single quotes
-Ctrl+( |⌘( |M-( |Select in parentheses
-Ctrl+[ |⌘[ |M-[ |Select in brackets
-Ctrl+{ |⌘{ |M-{ |Select in braces
-Ctrl+Shift+D |⌘⇧D |M-S-W |Select word
-Ctrl+Shift+N |⌘⇧N |M-S-N |Select line
-Ctrl+Shift+P |⌘⇧P |M-S-P |Select paragraph
-Ctrl+Shift+I |⌘⇧I |M-S-I |Select indented block
-Ctrl+Alt+U |^U |M-^U |Upper case selection
-Ctrl+Alt+Shift+U |^⇧U |M-^L |Lower case selection
-Alt+< |^< |M-> |Enclose as XML tags
-Alt+> |^> |None |Enclose as single XML tag
-Alt+" |^" |None |Enclose in double quotes
-Alt+' |^' |None |Enclose in single quotes
-Alt+( |^( |M-) |Enclose in parentheses
-Alt+[ |^[ |M-] |Enclose in brackets
-Alt+{ |^{ |M-} |Enclose in braces
-Ctrl++ |⌘+ |M-+ |Grow selection bounds by 1
-Ctrl+\_ |⌘\_ |M-\_ |Shrink selection bounds by 1
-Ctrl+Shift+Up |^⇧⇡ |S-^Up |Move selected lines up
-Ctrl+Shift+Down |^⇧⇣ |S-^Down |Move selected lines down
-**Search** ||||
-Ctrl+F |⌘F |M-F<br/>M-S-F|Find
-Ctrl+G<br/>F3 |⌘G |M-G |Find next
-Ctrl+Shift+G<br/>Shift+F3|⌘⇧G |M-S-G |Find previous
-Ctrl+Alt+R |^R |M-R |Replace
-Ctrl+Alt+Shift+R |^⇧R |M-S-R |Replace all
-Ctrl+Alt+F |^⌘F |M-^F |Find incremental
-Ctrl+Shift+F |⌘⇧F |None |Find in files
-Ctrl+Alt+G |^⌘G |None |Goto next file found
-Ctrl+Alt+Shift+G |^⌘⇧G|None |Goto previous file found
-Ctrl+J |⌘J |^J |Jump to line
-**Tools** ||||
-Ctrl+E |⌘E |M-C |Command entry
-Ctrl+Shift+E |⌘⇧E |M-S-C |Select command
-Ctrl+R |⌘R |^R |Run
-Ctrl+Shift+R |⌘⇧R |M-^R |Compile
-Ctrl+&#124; |⌘&#124;|^\ |Filter text through
-Ctrl+Space |⌥⎋ |^Space |Complete symbol
-Ctrl+H |^H |M-H<br/>M-S-H|Show documentation
-Tab |⇥ |Tab |Expand snippet or next placeholder
-Ctrl+K |⌥⇥ |M-K |Insert snippet...
-Shift+Tab |⇧⇥ |S-Tab |Previous snippet placeholder
-Ctrl+Shift+K |⌥⇧⇥ |M-S-K |Cancel snippet
-Ctrl+F2 |⌘F2 |None |Toggle bookmark
-Ctrl+Shift+F2 |⌘⇧F2 |None |Clear bookmarks
-F2 |F2 |None |Next bookmark
-Shift+F2 |⇧F2 |None |Previous bookmark
-Alt+F2 |⌥F2 |None |Goto bookmark...
-Ctrl+U |⌘U |^U |Snapopen `_USERHOME`
-None |None |None |Snapopen `_HOME`
-Ctrl+Alt+Shift+O|^⌘⇧O |M-S-O |Snapopen current directory
-Ctrl+I |⌘I |None |Show style
-**Buffer** ||||
-Ctrl+Tab |^⇥ |M-N |Next buffer
-Ctrl+Shift+Tab |^⇧⇥ |M-P |Previous buffer
-Ctrl+B |⌘B |M-B<br/>M-S-B|Switch to buffer...
-None |None |None |Tab width: 2
-None |None |None |Tab width: 3
-None |None |None |Tab width: 4
-None |None |None |Tab width: 8
-Ctrl+Alt+Shift+T|^⇧T |M-T<br/>M-S-T|Toggle use tabs
-Ctrl+Alt+I |^I |M-I |Convert indentation
-None |None |None |`CRLF` EOL mode
-None |None |None |`CR` EOL mode
-None |None |None |`LF` EOL mode
-None |None |None |`UTF-8` encoding
-None |None |None |`ASCII` encoding
-None |None |None |`ISO-8859-1` encoding
-None |None |None |`UTF-16` encoding
-Ctrl+Shift+L |⌘⇧L |M-S-L |Select lexer...
-F5 |F5 |^L<br/>F5 |Refresh syntax highlighting
-**View** ||||
-Ctrl+Alt+N |^⌥⇥ |N/A |Next view
-Ctrl+Alt+P |^⌥⇧⇥ |N/A |Previous view
-Ctrl+Alt+S<br/>Ctrl+Alt+H|^S |N/A |Split view horizontal
-Ctrl+Alt+V |^V |N/A |Split view vertical
-Ctrl+Alt+W |^W |N/A |Unsplit view
-Ctrl+Alt+Shift+W |^⇧W |N/A |Unsplit all views
-Ctrl+Alt++<br/>Ctrl+Alt+=|^+<br/>^=|N/A |Grow view
-Ctrl+Alt+- |^- |N/A |Shrink view
-None |None |None |Toggle current fold
-Ctrl+Alt+Enter |^↩ |None |Toggle view EOL
-Ctrl+Alt+\\ |^\\ |None |Toggle wrap mode
-Ctrl+Alt+Shift+I |^⇧I |None |Toggle show indent guides
-Ctrl+Alt+Shift+S |^⇧S |None |Toggle view whitespace
-Ctrl+Alt+Shift+V |^⇧V |None |Toggle virtual space
-Ctrl+= |⌘= |M-= |Zoom in
-Ctrl+- |⌘- |M-- |Zoom out
-Ctrl+0 |⌘0 |M-0 |Reset zoom
-Ctrl+Shift+T |⌘⇧T |None |Select theme...
-**Help** ||||
-F1 |F1 |None|Open manual
-Shift+F1|⇧F1 |None|Open LuaDoc
-None |None|None|About
-**Movement** ||||
-Down |⇣<br/>^N |^N<br/>Down |Line down
-Shift+Down |⇧⇣<br/>^⇧N |S-Down |Line down extend selection
-Ctrl+Down |^⇣ |^Down |Scroll line down
-Alt+Shift+Down |⌥⇧⇣ |M-S-Down |Line down extend rect. selection
-Up |⇡<br/>^P |^P<br/>Up |Line up
-Shift+Up |⇧⇡<br/>^⇧P |S-Up |Line up extend selection
-Ctrl+Up |^⇡ |^Up |Scroll line up
-Alt+Shift+Up |⌥⇧⇡ |M-S-Up |Line up extend rect. selection
-Left |⇠<br/>^B |^B<br/>Left |Char left
-Shift+Left |⇧⇠<br/>^⇧B |S-Left |Char left extend selection
-Ctrl+Left |^⇠<br/>^⌘B |^Left |Word left
-Ctrl+Shift+Left |^⇧⇠<br/>^⌘⇧B|S-^Left |Word left extend selection
-Alt+Shift+Left |⌥⇧⇠ |M-S-Left |Char left extend rect. selection
-Right |⇢<br/>^F |^F<br/>Right|Char right
-Shift+Right |⇧⇢<br/>^⇧F |S-Right |Char right extend selection
-Ctrl+Right |^⇢<br/>^⌘F |^Right |Word right
-Ctrl+Shift+Right |^⇧⇢<br/>^⌘⇧F|S-^Right |Word right extend selection
-Alt+Shift+Right |⌥⇧⇢ |M-S-Right |Char right extend rect. selection
-Home |⌘⇠<br/>^A |^A<br/>Home |Line start
-Shift+Home |⌘⇧⇠<br/>^⇧A |M-S-A |Line start extend selection
-Ctrl+Home |⌘⇡<br/>⌘↖ |M-^A |Document start
-Ctrl+Shift+Home |⌘⇧⇡<br/>⌘⇧↖ |None |Document start extend selection
-Alt+Shift+Home |⌥⇧↖ |None |Line start extend rect. selection
-End |⌘⇢<br/>^E |^E<br/>End |Line end
-Shift+End |⌘⇧⇢<br/>^⇧E |M-S-E |Line end extend selection
-Ctrl+End |⌘⇣<br/>⌘↘ |M-^E |Document end
-Ctrl+Shift+End |⌘⇧⇣<br/>⌘⇧↘ |None |Document end extend selection
-Alt+Shift+End |⌥⇧↘ |None |Line end extend rect. selection
-PageUp |⇞ |PageUp |Page up
-Shift+PageUp |⇧⇞ |M-S-U |Page up extend selection
-Alt+Shift+PageUp |⌥⇧⇞ |None |Page up extend rect. selection
-PageDown |⇟ |PageDown |Page down
-Shift+PageDown |⇧⇟ |M-S-D |Page down extend selection
-Alt+Shift+PageDown |⌥⇧⇟ |None |Page down extend rect. selection
-Ctrl+Del |⌘⌦ |^Del |Delete word right
-Ctrl+Shift+Del |⌘⇧⌦ |S-^Del |Delete line right
-Ins |Ins |Ins |Toggle overtype
-Backspace |⌫<br/>⇧⌫ |^H<br/>Bksp |Delete back
-Ctrl+Backspace |⌘⌫ |None |Delete word left
-Ctrl+Shift+Backspace|⌘⇧⌫ |None |Delete line left
-Tab |⇥ |Tab |Insert tab or indent
-Shift+Tab |⇧⇥ |S-Tab |Dedent
-None |^K |^K |Cut to line end
-None |^L |None |Center line vertically
-**Other** ||||
-Ctrl+Shift+U, xxxx, Enter|None|None|Input Unicode character U-xxxx.
-
## Lua Patterns
The following is taken from the [Lua 5.2 Reference Manual][].
@@ -282,7 +103,7 @@ As a special case, the empty capture `()` captures the current string position
Textadept 5.5 beta introduced an ncurses version that can run in a terminal
emulator. However, since ncurses is quite low-level in terms of graphics
-capability compared to GTK, the ncurses version of Textadept lacks some
+capability compared to GTK+, the ncurses version of Textadept lacks some
features in its editing component Scintilla:
* Any settings with alpha values are not supported.
@@ -694,9 +515,9 @@ Notice the `l.` prefix before most identifiers.
#### Key and Menu Changes
-Textadept 4 allow key shortcuts to appear in menus, but only simple ones, not
-keychains. Therefore, Textadept's key commands have changed radically, as has
-the menu structure and menu mnemonics. In order for key shortcuts to appear in
+Textadept 4 allow key bindings to appear in menus, but only simple ones, not
+keychains. Therefore, Textadept's key bindings have changed radically, as has
+the menu structure and menu mnemonics. In order for key bindings to appear in
menus, `_m.textadept.menu` needs to know which commands are assigned to which
keys. Therefore, the menu module needs to be `require`d *after*
`_m.textadept.keys`. If your `~/.textadept/init.lua` is calling
@@ -704,7 +525,7 @@ keys. Therefore, the menu module needs to be `require`d *after*
individual modules from `_m.textadept`, ensure `_m.textadept.menu` is loaded
after `_m.textadept.keys`.
-On Mac OSX, key command definition has changed. `m` is now ⌘ (command) and `a`
+On Mac OSX, key binding definition has changed. `m` is now ⌘ (command) and `a`
is now ⌥ (alt/option). `c` remains ^ (control). Previously `a` was ⌘ and ⌥ was
undefined. Please note, however, that not all ⌥ combinations by themselves will
work since that key is typically used to compose locale-dependent characters.
@@ -738,11 +559,11 @@ in your `~/.textadept/init.lua` will load all the modules you would expect.
Please see the [preferences][] page for instructions on how to load specific
modules.
-[preferences]: 9_Preferences.html#User.Init
+[preferences]: 08_Preferences.html#User.Init
##### Autoloading
-Key commands in `~/.textadept/key_commands.lua` and snippets in
+Key bindings in `~/.textadept/key_commands.lua` and snippets in
`~/.textadept/snippets.lua` are no longer auto-loaded. Instead, modify
[`keys`][] and/or [`snippets`][] from within your `~/.textadept/init.lua` or a
file loaded by `~/.textadept/init.lua`.
diff --git a/doc/images/folding.png b/doc/images/folding.png
new file mode 100644
index 00000000..7eb6d87d
--- /dev/null
+++ b/doc/images/folding.png
Binary files differ
diff --git a/doc/markdowndoc.lua b/doc/markdowndoc.lua
index 85069370..e44e8c37 100644
--- a/doc/markdowndoc.lua
+++ b/doc/markdowndoc.lua
@@ -170,6 +170,12 @@ function M.start(doc)
-- Write index.html.
template.nav = nav
+ local api_index = M.options.output_dir..'/.api_index.md'
+ if (require 'lfs').attributes(api_index) then
+ local p = io_popen('markdown -f toc -T "'..api_index..'"')
+ template.toc, template.main = p:read('*all'):match('^(.-\n</ul>\n)(.+)$')
+ p:close()
+ end
f = io_open(M.options.output_dir..'/api/index.html', 'wb')
local html = HTML:gsub('%%%(([^)]+)%)', template)
f:write(html)