@@ -751,6 +751,194 @@ <h2>Keymaps</h2>
751751 map.</ p >
752752</ section >
753753
754+ < < < < < < < HEAD
755+ =======
756+ < section id =commands >
757+ < h2 > Commands</ h2 >
758+
759+ < p > Commands are parameter-less actions that can be performed on an
760+ editor. Their main use is for key bindings. Commands are defined by
761+ adding properties to the < code > CodeMirror.commands</ code > object.
762+ A number of common commands are defined by the library itself,
763+ most of them used by the default key bindings. The value of a
764+ command property must be a function of one argument (an editor
765+ instance).</ p >
766+
767+ < p > Some of the commands below are referenced in the default
768+ key map, but not defined by the core library. These are intended to
769+ be defined by user code or addons.</ p >
770+
771+ < p > Commands can also be run with
772+ the < a href ="#execCommand "> < code > execCommand</ code > </ a >
773+ method.</ p >
774+
775+ < dl >
776+ < dt class =command id =command_selectAll > < code > < strong > selectAll</ strong > </ code > < span class =keybinding > Ctrl-A (PC), Cmd-A (Mac)</ span > </ dt >
777+ < dd > Select the whole content of the editor.</ dd >
778+
779+ < dt class =command id =command_singleSelection > < code > < strong > singleSelection</ strong > </ code > < span class =keybinding > Esc</ span > </ dt >
780+ < dd > When multiple selections are present, this deselects all but
781+ the primary selection.</ dd >
782+
783+ < dt class =command id =command_killLine > < code > < strong > killLine</ strong > </ code > < span class =keybinding > Ctrl-K (Mac)</ span > </ dt >
784+ < dd > Emacs-style line killing. Deletes the part of the line after
785+ the cursor. If that consists only of whitespace, the newline at
786+ the end of the line is also deleted.</ dd >
787+
788+ < dt class =command id =command_deleteLine > < code > < strong > deleteLine</ strong > </ code > < span class =keybinding > Ctrl-D (PC), Cmd-D (Mac)</ span > </ dt >
789+ < dd > Deletes the whole line under the cursor, including newline at the end.</ dd >
790+
791+ < dt class =command id =command_delLineLeft > < code > < strong > delLineLeft</ strong > </ code > < span class =keybinding > Cmd-Backspace (Mac)</ span > </ dt >
792+ < dd > Delete the part of the line before the cursor.</ dd >
793+
794+ < dt class =command id =command_undo > < code > < strong > undo</ strong > </ code > < span class =keybinding > Ctrl-Z (PC), Cmd-Z (Mac)</ span > </ dt >
795+ < dd > Undo the last change.</ dd >
796+
797+ < dt class =command id =command_redo > < code > < strong > redo</ strong > </ code > < span class =keybinding > Ctrl-Y (PC), Shift-Cmd-Z (Mac), Cmd-Y (Mac)</ span > </ dt >
798+ < dd > Redo the last undone change.</ dd >
799+
800+ < dt class =command id =command_undoSelection > < code > < strong > undoSelection</ strong > </ code > < span class =keybinding > Ctrl-U (PC), Cmd-U (Mac)</ span > </ dt >
801+ < dd > Undo the last change to the selection, or if there are no
802+ selection-only changes at the top of the history, undo the last
803+ change.</ dd >
804+
805+ < dt class =command id =command_redoSelection > < code > < strong > redoSelection</ strong > </ code > < span class =keybinding > Alt-U (PC), Shift-Cmd-U (Mac)</ span > </ dt >
806+ < dd > Redo the last change to the selection, or the last text change if
807+ no selection changes remain.</ dd >
808+
809+ < dt class =command id =command_goDocStart > < code > < strong > goDocStart</ strong > </ code > < span class =keybinding > Ctrl-Up (PC), Cmd-Up (Mac)</ span > </ dt >
810+ < dd > Move the cursor to the start of the document.</ dd >
811+
812+ < dt class =command id =command_goDocEnd > < code > < strong > goDocEnd</ strong > </ code > < span class =keybinding > Ctrl-Down (PC), Cmd-End (Mac), Cmd-Down (Mac)</ span > </ dt >
813+ < dd > Move the cursor to the end of the document.</ dd >
814+
815+ < dt class =command id =command_goLineStart > < code > < strong > goLineStart</ strong > </ code > < span class =keybinding > Alt-Left (PC), Cmd-Left (Mac), Ctrl-A (Mac)</ span > </ dt >
816+ < dd > Move the cursor to the start of the line.</ dd >
817+
818+ < dt class =command id =command_goLineStartSmart > < code > < strong > goLineStartSmart</ strong > </ code > < span class =keybinding > Home</ span > </ dt >
819+ < dd > Move to the start of the text on the line, or if we are
820+ already there, to the actual start of the line (including
821+ whitespace).</ dd >
822+
823+ < dt class =command id =command_goLineEnd > < code > < strong > goLineEnd</ strong > </ code > < span class =keybinding > Alt-Right (PC), Cmd-Right (Mac), Ctrl-E (Mac)</ span > </ dt >
824+ < dd > Move the cursor to the end of the line.</ dd >
825+
826+ < dt class =command id =command_goLineLeft > < code > < strong > goLineLeft</ strong > </ code > </ dt >
827+ < dd > Move the cursor to the left side of the visual line it is on. If
828+ this line is wrapped, that may not be the start of the line.</ dd >
829+
830+ < dt class =command id =command_goLineRight > < code > < strong > goLineRight</ strong > </ code > </ dt >
831+ < dd > Move the cursor to the right side of the visual line it is on.</ dd >
832+
833+ < dt class =command id =command_goLineUp > < code > < strong > goLineUp</ strong > </ code > < span class =keybinding > Up, Ctrl-P (Mac)</ span > </ dt >
834+ < dd > Move the cursor up one line.</ dd >
835+
836+ < dt class =command id =command_goLineDown > < code > < strong > goLineDown</ strong > </ code > < span class =keybinding > Down, Ctrl-N (Mac)</ span > </ dt >
837+ < dd > Move down one line.</ dd >
838+
839+ < dt class =command id =command_goPageUp > < code > < strong > goPageUp</ strong > </ code > < span class =keybinding > PageUp, Shift-Ctrl-V (Mac)</ span > </ dt >
840+ < dd > Move the cursor up one screen, and scroll up by the same distance.</ dd >
841+
842+ < dt class =command id =command_goPageDown > < code > < strong > goPageDown</ strong > </ code > < span class =keybinding > PageDown, Ctrl-V (Mac)</ span > </ dt >
843+ < dd > Move the cursor down one screen, and scroll down by the same distance.</ dd >
844+
845+ < dt class =command id =command_goCharLeft > < code > < strong > goCharLeft</ strong > </ code > < span class =keybinding > Left, Ctrl-B (Mac)</ span > </ dt >
846+ < dd > Move the cursor one character left, going to the previous line
847+ when hitting the start of line.</ dd >
848+
849+ < dt class =command id =command_goCharRight > < code > < strong > goCharRight</ strong > </ code > < span class =keybinding > Right, Ctrl-F (Mac)</ span > </ dt >
850+ < dd > Move the cursor one character right, going to the next line
851+ when hitting the end of line.</ dd >
852+
853+ < dt class =command id =command_goColumnLeft > < code > < strong > goColumnLeft</ strong > </ code > </ dt >
854+ < dd > Move the cursor one character left, but don't cross line boundaries.</ dd >
855+
856+ < dt class =command id =command_goColumnRight > < code > < strong > goColumnRight</ strong > </ code > </ dt >
857+ < dd > Move the cursor one character right, don't cross line boundaries.</ dd >
858+
859+ < dt class =command id =command_goWordLeft > < code > < strong > goWordLeft</ strong > </ code > < span class =keybinding > Alt-B (Mac)</ span > </ dt >
860+ < dd > Move the cursor to the start of the previous word.</ dd >
861+
862+ < dt class =command id =command_goWordRight > < code > < strong > goWordRight</ strong > </ code > < span class =keybinding > Alt-F (Mac)</ span > </ dt >
863+ < dd > Move the cursor to the end of the next word.</ dd >
864+
865+ < dt class =command id =command_goGroupLeft > < code > < strong > goGroupLeft</ strong > </ code > < span class =keybinding > Ctrl-Left (PC), Alt-Left (Mac)</ span > </ dt >
866+ < dd > Move to the left of the group before the cursor. A group is
867+ a stretch of word characters, a stretch of punctuation
868+ characters, a newline, or a stretch of < em > more than one</ em >
869+ whitespace character.</ dd >
870+
871+ < dt class =command id =command_goGroupRight > < code > < strong > goGroupRight</ strong > </ code > < span class =keybinding > Ctrl-Right (PC), Alt-Right (Mac)</ span > </ dt >
872+ < dd > Move to the right of the group after the cursor
873+ (see < a href ="#command_goGroupLeft "> above</ a > ).</ dd >
874+
875+ < dt class =command id =command_delCharBefore > < code > < strong > delCharBefore</ strong > </ code > < span class =keybinding > Shift-Backspace, Ctrl-H (Mac)</ span > </ dt >
876+ < dd > Delete the character before the cursor.</ dd >
877+
878+ < dt class =command id =command_delCharAfter > < code > < strong > delCharAfter</ strong > </ code > < span class =keybinding > Delete, Ctrl-D (Mac)</ span > </ dt >
879+ < dd > Delete the character after the cursor.</ dd >
880+
881+ < dt class =command id =command_delWordBefore > < code > < strong > delWordBefore</ strong > </ code > < span class =keybinding > Alt-Backspace (Mac)</ span > </ dt >
882+ < dd > Delete up to the start of the word before the cursor.</ dd >
883+
884+ < dt class =command id =command_delWordAfter > < code > < strong > delWordAfter</ strong > </ code > < span class =keybinding > Alt-D (Mac)</ span > </ dt >
885+ < dd > Delete up to the end of the word after the cursor.</ dd >
886+
887+ < dt class =command id =command_delGroupBefore > < code > < strong > delGroupBefore</ strong > </ code > < span class =keybinding > Ctrl-Backspace (PC), Alt-Backspace (Mac)</ span > </ dt >
888+ < dd > Delete to the left of the < a href ="#command_goGroupLeft "> group</ a > before the cursor.</ dd >
889+
890+ < dt class =command id =command_delGroupAfter > < code > < strong > delGroupAfter</ strong > </ code > < span class =keybinding > Ctrl-Delete (PC), Ctrl-Alt-Backspace (Mac), Alt-Delete (Mac)</ span > </ dt >
891+ < dd > Delete to the start of the < a href ="#command_goGroupLeft "> group</ a > after the cursor.</ dd >
892+
893+ < dt class =command id =command_indentAuto > < code > < strong > indentAuto</ strong > </ code > < span class =keybinding > Shift-Tab</ span > </ dt >
894+ < dd > Auto-indent the current line or selection.</ dd >
895+
896+ < dt class =command id =command_indentMore > < code > < strong > indentMore</ strong > </ code > < span class =keybinding > Ctrl-] (PC), Cmd-] (Mac)</ span > </ dt >
897+ < dd > Indent the current line or selection by one < a href ="#option_indentUnit "> indent unit</ a > .</ dd >
898+
899+ < dt class =command id =command_indentLess > < code > < strong > indentLess</ strong > </ code > < span class =keybinding > Ctrl-[ (PC), Cmd-[ (Mac)</ span > </ dt >
900+ < dd > Dedent the current line or selection by one < a href ="#option_indentUnit "> indent unit</ a > .</ dd >
901+
902+ < dt class =command id =command_insertTab > < code > < strong > insertTab</ strong > </ code > </ dt >
903+ < dd > Insert a tab character at the cursor.</ dd >
904+
905+ < dt class =command id =command_insertSoftTab > < code > < strong > insertSoftTab</ strong > </ code > </ dt >
906+ < dd > Insert the amount of spaces that match the width a tab at
907+ the cursor position would have.</ dd >
908+
909+ < dt class =command id =command_defaultTab > < code > < strong > defaultTab</ strong > </ code > < span class =keybinding > Tab</ span > </ dt >
910+ < dd > If something is selected, indent it by
911+ one < a href ="#option_indentUnit "> indent unit</ a > . If nothing is
912+ selected, insert a tab character.</ dd >
913+
914+ < dt class =command id =command_transposeChars > < code > < strong > transposeChars</ strong > </ code > < span class =keybinding > Ctrl-T (Mac)</ span > </ dt >
915+ < dd > Swap the characters before and after the cursor.</ dd >
916+
917+ < dt class =command id =command_newlineAndIndent > < code > < strong > newlineAndIndent</ strong > </ code > < span class =keybinding > Enter</ span > </ dt >
918+ < dd > Insert a newline and auto-indent the new line.</ dd >
919+
920+ < dt class =command id =command_toggleOverwrite > < code > < strong > toggleOverwrite</ strong > </ code > < span class =keybinding > Insert</ span > </ dt >
921+ < dd > Flip the < a href ="#toggleOverwrite "> overwrite</ a > flag.</ dd >
922+
923+ < dt class =command id =command_save > < code > < strong > save</ strong > </ code > < span class =keybinding > Ctrl-S (PC), Cmd-S (Mac)</ span > </ dt >
924+ < dd > Not defined by the core library, only referred to in
925+ key maps. Intended to provide an easy way for user code to define
926+ a save command.</ dd >
927+
928+ < dt class =command id =command_find > < code > < strong > find</ strong > </ code > < span class =keybinding > Ctrl-F (PC), Cmd-F (Mac)</ span > </ dt >
929+ < dt class =command id =command_findNext > < code > < strong > findNext</ strong > </ code > < span class =keybinding > Ctrl-G (PC), Cmd-G (Mac)</ span > </ dt >
930+ < dt class =command id =command_findPrev > < code > < strong > findPrev</ strong > </ code > < span class =keybinding > Shift-Ctrl-G (PC), Shift-Cmd-G (Mac)</ span > </ dt >
931+ < dt class =command id =command_replace > < code > < strong > replace</ strong > </ code > < span class =keybinding > Shift-Ctrl-F (PC), Cmd-Alt-F (Mac)</ span > </ dt >
932+ < dt class =command id =command_replaceAll > < code > < strong > replaceAll</ strong > </ code > < span class =keybinding > Shift-Ctrl-R (PC), Shift-Cmd-Alt-F (Mac)</ span > </ dt >
933+ < dd > Not defined by the core library, but defined in
934+ the < a href ="#addon_search "> search addon</ a > (or custom client
935+ addons).</ dd >
936+
937+ </ dl >
938+
939+ </ section >
940+
941+ > > > > > > > 97b1153... Add insertSoftTab command
754942< section id =styling >
755943 < h2 > Customized Styling</ h2 >
756944
0 commit comments