github.com/aretext/aretext@v1.3.0/docs/edit.md (about)

     1  Edit
     2  ====
     3  
     4  This guide describes commands you can use to edit a document efficiently using vim key bindings. It assumes you are familiar with the commands described in the [Quickstart](quickstart.md).
     5  
     6  Insert and append
     7  -----------------
     8  
     9  In normal mode, type "i" to enter insert mode at the current cursor position. To insert at the position *after* the cursor, type "a" (short for "append") instead.
    10  
    11  To insert at the *start* of the line, type "I". To append after the *end* of the line, type "A".
    12  
    13  From insert mode, you can return to normal mode by pressing the escape key.
    14  
    15  Delete
    16  ------
    17  
    18  To delete a single character in normal mode, type "x". (In insert mode, you can use the backspace key instead.)
    19  
    20  To delete a line, type "dd" in normal mode. To delete from the cursor to the end of the line, type "D".
    21  
    22  There are many delete commands of the form "d<motion>", where <motion> is one of the cursor movement commands described in [Navigation](navigation.md):
    23  
    24  -	"d$" deletes from the cursor to the end of the line, because "$" means "move the cursor to the end of the line".
    25  -	"diw" (which means "delete inner word") deletes the current word under the cursor.
    26  -	"daw" (which means "delete a word") deletes the current word under the cursor and any trailing whitespace.
    27  -	"dh" deletes one character to the left, and "dl" deletes one character to the right.
    28  -	"dj" deletes the current and previous lines, and "dk" deletes the current and next line.
    29  -	"dt\{char\}" deletes up to, but not including, the next matching character on the current line.
    30  
    31  Replace
    32  -------
    33  
    34  To replace the character under the cursor, type "r" in normal mode, then type the new character.
    35  
    36  Change
    37  ------
    38  
    39  In aretext, "change" means to delete some text then enter insert mode. This is useful for quickly changing a word or line.
    40  
    41  To change the current word under the cursor in normal mode, type "ciw" ("change inner word").
    42  
    43  To change the current word under the cursor and trailing whitespace in normal mode, type "caw" ("change a word").
    44  
    45  Put and yank
    46  ------------
    47  
    48  When you delete text, aretext copies it to a hidden buffer. You can then insert the deleted text after the cursor by typing "p" (short for "put") in normal mode. Alternatively, you can type "P" to insert the text before the cursor.
    49  
    50  You can copy a line into the buffer by typing "yy" (short for "yank") in normal mode.
    51  
    52  If you want to copy/paste using your system's clipboard, you will need to add custom menu commands (see [Custom Menu Commands](custom-menu-commands.md) for instructions).
    53  
    54  Inserting and joining lines
    55  ---------------------------
    56  
    57  To start a new line below the cursor and enter insert mode, type "o".
    58  
    59  To start a new line above the cursor and enter insert mode, type "O".
    60  
    61  To join the current line with the line below, type "J".
    62  
    63  Indenting and outdenting
    64  ------------------------
    65  
    66  To indent the current line, type ">>".
    67  
    68  To outdent the current line, type "\<<".
    69  
    70  Toggle case
    71  -----------
    72  
    73  To change the character under the cursor from uppercase to lowercase, or vice versa, type "~".
    74  
    75  Selection (visual mode)
    76  -----------------------
    77  
    78  To start a selection, type "v" (short for "visual mode"). You can use the same cursor motions as in normal mode to move the end of the selection.
    79  
    80  To select entire lines (instead of individual characters), type "V".
    81  
    82  You can use the following commands to modify the selected text:
    83  
    84  -	"x" and "d" both delete the selection.
    85  -	"c" (short for "change") deletes the selection and enters insert mode.
    86  -	"~" toggles the case of the selection.
    87  -	">" indents the selection.
    88  -	"<" outdents the selection.
    89  -	"y" (short for "yank") copies the selection.
    90  
    91  To clear the selection and return to normal mode, press the escape key.
    92  
    93  Undo and redo
    94  -------------
    95  
    96  To undo the last edit, type "u" (short for "undo") in normal mode.
    97  
    98  To redo the last edit, press Ctrl-r (short for "redo") in normal mode.
    99  
   100  Aretext clears the undo history whenever a document is loaded or reloaded.
   101  
   102  Repeat last action
   103  ------------------
   104  
   105  To repeat the last action, type "." in normal mode. This is useful for avoiding repetitive typing.
   106  
   107  Record and replay a macro
   108  -------------------------
   109  
   110  To repeat a sequence of commands, you can record a macro.
   111  
   112  1.	In normal mode, type ":" to open the command menu.
   113  2.	Search for and select "start/stop recording macro" to begin recording a macro.
   114  3.	Edit the document. Any changes you make will be recorded in the macro.
   115  4.	In the command menu, select "start/stop recording macro" again to stop recording the macro.
   116  
   117  To replay the recorded macro, select "replay macro" in the command menu.
   118  
   119  Once you have replayed a macro, you can repeat it using the "." (repeat last action) command in normal mode.