<commit_before>-- Copyright 2007-2012 Mitchell mitchell.<EMAIL>. See LICENSE.

local M = {}

--[[ This comment is for LuaDoc.
---
-- Defines key commands for Textadept.
-- This set of key commands is pretty standard among other text editors.
-- This module should be `require`d last, but before `_M.textadept.menu`.
--
-- ## 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      |N/A  |Toggle show indent guides
-- Ctrl+Alt+Shift+S         |^⇧S      |None |Toggle view whitespace
-- Ctrl+Alt+Shift+V         |^⇧V      |None |Toggle virtual space
-- Ctrl+=                   |⌘=       |N/A  |Zoom in
-- Ctrl+-                   |⌘-       |N/A  |Zoom out
-- Ctrl+0                   |⌘0       |N/A  |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
-- PgUp            |⇞           |PgUp        |Page up
-- Shift+PgUp      |⇧⇞          |M-S-U       |Page up extend selection
-- Alt+Shift+PgUp  |⌥⇧⇞         |None        |Page up extend rect. selection
-- PgDn            |⇟           |PgDn        |Page down
-- Shift+PgDn      |⇧⇟          |M-S-D       |Page down extend selection
-- Alt+Shift+PgDn  |⌥⇧⇟         |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
-- Bksp            |⌫<br/>⇧⌫    |^H<br/>Bksp |Delete back
-- Ctrl+Bksp       |⌘⌫          |None        |Delete word left
-- Ctrl+Shift+Bksp |⌘⇧⌫         |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.
module('_M.textadept.keys')]]

-- Utility functions.
M.utils = {
  delete_word = function()
    _M.textadept.editing.select_word()
    buffer:delete_back()
  end,
  enclose_as_xml_tags = function()
    _M.textadept.editing.enclose('<', '>')
    local buffer = buffer
    local pos = buffer.current_pos
    while buffer.char_at[pos - 1] ~= 60 do pos = pos - 1 end -- '<'
    buffer:insert_text(-1, '</'..buffer:text_range(pos, buffer.current_pos))<commit_msg>Added ncurses CDK field key bindings to list; modules/textadept/keys.lua<commit_after>-- Copyright 2007-2012 Mitchell mitchell.att.foicica.com. See LICENSE.

local M = {}

--[[ This comment is for LuaDoc.
---
-- Defines key commands for Textadept.
-- This set of key commands is pretty standard among other text editors.
-- This module should be `require`d last, but before `_M.textadept.menu`.
--
-- ## 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      |N/A  |Toggle show indent guides
-- Ctrl+Alt+Shift+S         |^⇧S      |None |Toggle view whitespace
-- Ctrl+Alt+Shift+V         |^⇧V      |None |Toggle virtual space
-- Ctrl+=                   |⌘=       |N/A  |Zoom in
-- Ctrl+-                   |⌘-       |N/A  |Zoom out
-- Ctrl+0                   |⌘0       |N/A  |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
-- PgUp            |⇞           |PgUp        |Page up
-- Shift+PgUp      |⇧⇞          |M-S-U       |Page up extend selection
-- Alt+Shift+PgUp  |⌥⇧⇞         |None        |Page up extend rect. selection
-- PgDn            |⇟           |PgDn        |Page down
-- Shift+PgDn      |⇧⇟          |M-S-D       |Page down extend selection
-- Alt+Shift+PgDn  |⌥⇧⇟         |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
-- Bksp            |⌫<br/>⇧⌫    |^H<br/>Bksp |Delete back
-- Ctrl+Bksp       |⌘⌫          |None        |Delete word left
-- Ctrl+Shift+Bksp |⌘⇧⌫         |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.
-- **ncurses CDK Fields**|   |            |
-- N/A                   |N/A|^B<br/>Left |Cursor left
-- N/A                   |N/A|^F<br/>Right|Cursor right
-- N/A                   |N/A|Del         |Delete forward
-- N/A                   |N/A|^H<br/>Bksp |Delete back
-- N/A                   |N/A|^V          |Paste
-- N/A                   |N/A|^X          |Cut all
-- N/A                   |N/A|^Y          |Copy all
-- N/A                   |N/A|^U          |Erase all
-- N/A                   |N/A|^A          |Home
-- N/A                   |N/A|^E          |End
-- N/A                   |N/A|^T          |Transpose characters
-- N/A                   |N/A|^L          |Refresh
module('_M.textadept.keys')]]

-- Utility functions.
M.utils = {
  delete_word = function()
    _M.textadept.editing.select_word()
    buffer:delete_back()
  end,
  enclose_as_xml_tags = function()
    _M.textadept.editing.enclose('<', '>')
    local buffer = buffer
    local pos = buffer.current_pos
    while buffer.char_at[pos - 1] ~= 60 do pos = pos - 1 end -- '<'
    buffer:insert_text(-1, '</'..buffer:text_range(pos, buffer.current_pos))
{'fraction_non_alphanumeric': 0.17123060326943823, 'fraction_numerical': 0.004646917268276492, 'mean_word_length': 1.182649642307344, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 113, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '893488', 'n_tokens_mistral': 9197, 'n_tokens_neox': 8642, 'n_words': 2051}