leditrc.5 (34158B)
1 .Dd October 6, 2023 2 .Dt LEDITRC 5 3 .Os 4 .Sh NAME 5 .Nm leditrc 6 .Nd configuration file for 7 .Xr ledit 1 8 .Sh DESCRIPTION 9 .Nm 10 is the configuration file for the text editor 11 .Xr ledit 1 , 12 which can be used to configure the theme and key bindings used. 13 .Pp 14 The description of the format given here is terrible, so it's 15 probably more useful to look at the example config provided in 16 .Pa leditrc.example . 17 .Pp 18 The parser recognizes four different types of structures: 19 strings, lists, statements, and assignments. 20 .Pp 21 A string is simply any sequence of characters surrounded by double quotes. 22 Double quotes must be backslash-escaped. 23 If a string does not contain any whitespace or the special 24 characters 25 .Sq \&" , 26 .Sq { , 27 .Sq } , 28 or 29 .Sq = , 30 the double quotes are not required. 31 .Pp 32 A statement is a sequence of strings, separated by whitespace and 33 all on the same line. 34 .Pp 35 An assignment is of the form 36 .Aq identifier 37 = 38 .Aq structure , 39 where 40 .Aq identifier 41 is a string and 42 .Aq structure 43 is a string or a list. 44 .Pp 45 A list is a sequence of assignments and/or statements that is 46 enclosed by curly braces. 47 The assignments/statements must be separated by newlines. 48 .Pp 49 The configuration file consists of several top-level assignments 50 which are described in the following sections. 51 .Sh BASIC CONCEPTS 52 Some terminology should probably be explained in order to understand the 53 rest of this manual. 54 .Bl -tag -width Ds 55 .It Ar word 56 Whatever Pango defines a word to be. 57 This probably uses Unicode semantics (UAX #29), but I'm not entirely sure. 58 .It Ar bigword 59 A sequence of non-whitespace characters. 60 .It Ar character 61 A Unicode character. 62 Note that, when used as an argument (for instance when setting a mark), 63 .Ar character 64 can mean pretty much any string, as long as it is given to the program 65 in one event. 66 Yes, this is inconsistent and confusing. 67 .It Ar grapheme 68 As defined by Unicode (UAX #29). 69 A grapheme may be composed of multiple Unicode characters. 70 The cursor is only allowed to be at valid grapheme boundaries, but 71 some operations work with characters, while others work with graphemes. 72 .It Ar paste buffer 73 When text is deleted or explicitly copied (yanked), it is written to the 74 paste buffer so that it can be pasted later. 75 The paste buffer is either character or line based, depending on whether 76 the deletion/copying operation was line or character based. 77 If a character based paste buffer is pasted, the text is inserted right 78 at the cursor position. 79 When it is line based, the text is inserted after the line. 80 .It Ar softline/hardline 81 A hardline is an actual line separated from the other lines by a newline 82 character. 83 A softline is a displayed line, but might only be part of a 84 hardline if the text is wrapped. 85 .Xr ledit 1 86 can be in hardline or softline mode. 87 Some commands change their behavior depending on this mode, for instance 88 to move the cursor down a certain number of softlines instead of hardlines. 89 .El 90 .Sh THEME 91 The theme may be configured by assigning 92 .Ar theme 93 to a list of assignments, each of which sets one of the following 94 possible properties. 95 Colors are given in the form #RRGGBB, where the 96 .Sq # 97 is optional (mainly because 98 .Sq # 99 also starts comments in the configuration file format). 100 .Bl -tag -width Ds 101 .It Ar text-font 102 Font used for all text. 103 Default: Monospace 104 .It Ar text-size 105 Text size (in points or whatever pango uses). 106 Default: 12 107 .It Ar text-fg 108 Text color in main editing area. 109 Default: #000000 110 .It Ar text-bg 111 Background color in main editing area. 112 Default: #FFFFFF 113 .It Ar cursor-fg 114 Color of text under cursor. 115 Default: #FFFFFF 116 .It Ar cursor-bg 117 Color of text cursor. 118 Default: #000000 119 .It Ar selection-fg 120 Color of selected text. 121 Default: #FFFFFF 122 .It Ar selection-bg 123 Color of selection. 124 Default: #000000 125 .It Ar bar-fg 126 Color of text in status bar/line editor. 127 Default: #000000 128 .It Ar bar-bg 129 Background color of status bar/line editor. 130 Default: #CCCCCC 131 .It Ar bar-cursor 132 Color of text cursor in line editor. 133 Default: #000000 134 .It Ar bar-fmt 135 Format string for the bottom bar. 136 The following substitutions are performed: 137 .Bl -tag -width Ds 138 .It %% 139 The character 140 .Ql % 141 itself. 142 .It %l 143 The current line index of the cursor (1-indexed). 144 .It %b 145 The current byte index of the cursor (1-indexed). 146 Note that this is really only the raw byte position. 147 There currently is no way to get the unicode character position in the format string. 148 .It %k 149 The current keyboard layout used for mapping keys. 150 .It %m 151 The current mode. 152 .It %h 153 The current hardline/softline mode. 154 .It %s 155 A separator. 156 The remaining space is divided equally between all separators. 157 .El 158 .Pp 159 Default: %k%s%l,%b%s%m|%h 160 .It Ar scrollbar-width 161 Width of scrollbar in pixels. 162 Default: 10 163 .It Ar scrollbar-step 164 Number of pixels scrolled with each scroll event. 165 Default: 20 166 .It Ar scrollbar-bg 167 Background color of scrollbar. 168 Default: #CCCCCC 169 .It Ar scrollbar-fg 170 Color of scrollbar handle. 171 Default: #000000 172 .It Ar highlight-search 173 Whether entire words should be highlighted when searching or replacing with confirmation (true/false). 174 Note that the mode is automatically switched to visual when this is set and a word needs to be highlighted. 175 This is a bit weird, but in order to keep everything a bit more consistent, selections are curently 176 only allowed in visual mode. 177 Default: false 178 .It Ar extra-line-spacing 179 Extra space between each line (in pixels). 180 Note that this is very rudimentary at the moment. 181 In particular, selections covering multiple lines do not highlight the extra space. 182 Default: 0 183 .El 184 .Sh BINDINGS 185 The key bindings may be configured by assigning 186 .Ar bindings 187 to a list of the following assignments. 188 .Bl -tag -width Ds 189 .It Ar language 190 .Pp 191 This is the language string for the key layout, as given by XKB. 192 .It Ar basic-keys 193 .Pp 194 This is a list of statements of the form 195 .Pp 196 .Sy bind 197 .Aq func_name 198 .Op Sy keysym Aq keysym 199 .Op Sy text Aq text 200 .Op Sy catchall 201 .Op Sy modes Aq modes 202 .Op Sy mods Aq mods 203 .Pp 204 .Sy keysym 205 is the symbolic description for a key, 206 .Sy text 207 is the text corresponding to a key. 208 .Sy catchall 209 is a catchall for any key which can for instance be used to insert text. 210 Note that a key binding containing 211 .Sy catchall 212 should always be at the end of the list so it does not prevent 213 any other key bindings from being used. 214 .Pp 215 Exactly one of 216 .Sy text , 217 .Sy keysym , 218 and 219 .Sy catchall 220 must be specified. 221 See 222 .Sx KEYSYMS 223 for a list of all currently supported keysyms. 224 .Pp 225 .Sy mods 226 specifies modifier keys. 227 The current options are 228 .Ar shift , 229 .Ar control , 230 .Ar mod1 , 231 .Ar mod3 , 232 .Ar mod4 , 233 .Ar mod5 , 234 and 235 .Ar any . 236 .Ar mod1 237 is usually Alt, 238 .Ar mod4 239 is usually the super key. 240 Note that 241 .Ar mod2 242 and 243 .Ar lock 244 are missing because these are usually numlock and caps lock, respectively, 245 which would mess up the key bindings because they would all need to optionally 246 include these. 247 This key handling is currently a bit of a mess because it isn't really clear 248 which modifier keys should be ignored and which shouldn't. 249 As an additional bit of weirdness, 250 .Ar control 251 is currently masked out before obtaining the text or symbolic name corresponding 252 to a key because it can cause issues in certain cases (XKB tries to be 253 .Dq smart 254 and map some keys back to the default language, but that completely messes 255 up all the key handling that 256 .Xr ledit 1 257 does). 258 Oh, one more thing - for keys that are specified with text instead of a keysym, 259 .Ar shift 260 is masked out of the current modifier state before checking if it matches the 261 configured state because it is usually included implicitly in the text. 262 Please let me know if you have any ideas how to make the key handling a bit nicer. 263 .Pp 264 .Sy modes 265 specifies the allowed modes and can be a combination of 266 .Ar normal , 267 .Ar visual , 268 and 269 .Ar insert . 270 .Pp 271 Multiple mods or modes can be given by joining them with 272 .Sq | . 273 .Pp 274 .Aq func_name 275 may be one of the following functions. 276 The possible modes are listed beside the function names. 277 If 278 .Ar num 279 is listed beside the function name, this means that the function supports 280 key repetition (the number can be constructed with the 281 .Ar push 282 functions). 283 If 284 .Ar char 285 is listed beside the function name, this means that a character must be 286 typed immediately after calling the function (this is used e.g. to get a 287 character when setting a mark). 288 .Pp 289 Functions that overwrite the paste buffer usually only do that in normal 290 and visual mode. 291 It isn't entirely clear what the best behavior here would be. 292 .Bl -tag -width Ds 293 .It Ar append-after-cursor Op normal, visual, insert 294 Move the cursor after the current character and enter insert mode. 295 .It Ar append-after-eol Op normal, visual, insert 296 Move the cursor to the end of the current line and enter insert mode. 297 This function modifies its behavior in softline mode. 298 .It Ar append-line-above Op normal, visual, insert 299 Insert a line before the current line, move the cursor to it, and enter insert mode. 300 This function modifies its behavior in softline mode. 301 Note that even in softline mode, a hardline is inserted, but the 302 insertion position may be different. 303 This may not be entirely logical, but I'm not sure what would be more 304 logical. 305 .It Ar append-line-below Op normal, visual, insert 306 Insert a line after the current line, move the cursor to it, and enter insert mode. 307 This function modifies its behavior in softline mode. 308 Note that even in softline mode, a hardline is inserted, but the 309 insertion position may be different. 310 This may not be entirely logical, but I'm not sure what would be more 311 logical. 312 .It Ar change Oo normal, visual, insert Oc Oo num Oc 313 In normal and insert mode, delete the text from the current 314 position until the position given by the next motion command 315 and enter insert mode (or just stay in insert mode). 316 In visual mode, delete the selected text and enter insert mode. 317 .Ar num 318 is used to influence the next motion command. 319 .Ar change 320 itself can also be used as the motion command, in which case the 321 given number of lines is deleted. 322 When that is the case, the behavior is modified in softline mode. 323 .It Ar change-to-eol Op normal 324 Delete the text from the current position until the end of the line 325 and enter insert mode. 326 This function modifies its behavior in softline mode. 327 .It Ar clipboard-copy Op normal, visual, insert 328 Copy the last text that was selected to the clipboard. 329 Note: Due to the way this is currently implemented, text can be copied 330 even if it isn't selected anymore, as long as nothing else has been 331 selected in the meantime. 332 I haven't decided yet if this is a feature or a bug. 333 .It Ar clipboard-paste Op normal, visual, insert 334 Paste the clipboard contents at the current position. 335 In visual mode, the current selection is first deleted. 336 Note: The selection deletion and clipboard insertion are currently 337 registered as two independent undo operations, so undo/redo will only 338 undo/redo one of them at a time. 339 This is a bug, but it is difficult to fix due to the bad design decisions 340 made during the development of 341 .Xr ledit 1 . 342 .It Ar cursor-down Oo normal, visual, insert Oc Oo num Oc 343 Move the cursor 344 .Ar num 345 lines down. 346 In visual mode, the selection is changed. 347 This function modifies its behavior in softline mode. 348 .It Ar cursor-left Oo normal, visual, insert Oc Oo num Oc 349 Move the cursor 350 .Ar num 351 positions to the left, but only on the same line. 352 In visual mode, the selection is changed. 353 Note that the movement is visual, i.e. it will actually move logically 354 forwards in right-to-left text. 355 .It Ar cursor-right Oo normal, visual, insert Oc Oo num Oc 356 Move the cursor 357 .Ar num 358 positions to the right, but only on the same line. 359 In visual mode, the selection is changed. 360 Note that the movement is visual, i.e. it will actually move logically 361 backwards in right-to-left text. 362 .It Ar cursor-to-beginning Op normal, visual, insert 363 Move the cursor to the beginning of the current line. 364 In visual mode, the selection is changed. 365 This function modifies its behavior in softline mode. 366 See also 367 .Ar key-0 368 .It Ar cursor-to-first-non-whitespace Op normal, visual, insert 369 Move the cursor to the first non-whitespace character on the current line. 370 In visual mode, the selection is changed. 371 This function modifies its behavior in softline mode. 372 .It Ar cursor-up Oo normal, visual, insert Oc Oo num Oc 373 Move the cursor 374 .Ar num 375 lines up. 376 In visual mode, the selection is changed. 377 This function modifies its behavior in softline mode. 378 .It Ar delete Oo normal, visual, insert Oc Oo num Oc 379 In normal or insert mode, delete the text from the current position 380 until the position given by the next motion command. 381 In visual mode, delete the selected text. 382 .Ar num 383 is used to influence the next motion command. 384 .Ar delete 385 itself can also be used as the motion command, in which case the 386 given number of lines is deleted. 387 When that is the case, the behavior is modified in softline mode. 388 .It Ar delete-chars-backwards Oo normal, insert Oc Oo num Oc 389 Delete 390 .Ar num 391 unicode characters before the cursor, but at most up to the 392 beginning of the current line. 393 .It Ar delete-chars-backwards-multiline Oo normal, insert Oc Oo num Oc 394 Delete 395 .Ar num 396 unicode characters before the cursor, possibly going onto 397 a previous line (the newline counts as one character). 398 .It Ar delete-chars-forwards Oo normal, insert Oc Oo num Oc 399 Delete 400 .Ar num 401 unicode characters after the cursor, but at most up to the 402 end of the current line. 403 .It Ar delete-chars-forwards-multiline Op normal, insert 404 Delete 405 .Ar num 406 unicode characters before the cursor, possibly going onto 407 another line (the newline counts as one character). 408 .It Ar delete-graphemes-backwards Oo normal, insert Oc Oo num Oc 409 Delete 410 .Ar num 411 unicode graphemes before the cursor, but at most up to the 412 beginning of the current line. 413 .It Ar delete-graphemes-backwards-multiline Oo normal, insert Oc Oo num Oc 414 Delete 415 .Ar num 416 unicode graphemes before the cursor, possibly going onto 417 a previous line (the newline counts as one grapheme). 418 .It Ar delete-graphemes-forwards Oo normal, insert Oc Oo num Oc 419 Delete 420 .Ar num 421 unicode graphemes after the cursor, but at most up to the 422 end of the current line. 423 .It Ar delete-graphemes-forwards-multiline Oo normal, insert Oc Oo num Oc 424 Delete 425 .Ar num 426 unicode graphemes after the cursor, possibly going onto 427 another line (the newline counts as one grapheme). 428 .It Ar delete-to-eol Op normal, insert 429 Delete everything from the current position to the end of the line. 430 This function modifies its behavior in softline mode. 431 .It Ar enter-commandedit Op normal, visual, insert 432 Open the line editor for typing commands. 433 In visual mode, the selection range is automatically pasted into the line editor 434 so commands can be performed on it. 435 .It Ar enter-insert Op normal, visual 436 Enter insert mode. 437 .It Ar enter-searchedit-backwards Op normal, insert, visual 438 Open the line editor for searching backwards. 439 Note that no regex is currently supported. 440 .It Ar enter-searchedit-forwards Op normal, insert, visual 441 Open the line editor for searching forwards. 442 Note that no regex is currently supported. 443 .It Ar enter-visual Op normal, insert 444 Enter visual mode. 445 .It Ar return-to-normal Op normal, visual, insert 446 Return to normal mode. 447 If already in normal mode, discard all stored previous keys 448 (e.g. key repetition). 449 .It Ar find-char-backwards Oo normal, visual, insert Oc Oo num Oc Oo char Oc 450 Move cursor backward 451 .Ar num 452 times to the character given by 453 .Ar char . 454 Note that all the 455 .Ar find-* 456 functions are weird because the behavior changes slightly depending on the mode 457 they are called in and whether they are used as a motion command for another 458 command like 459 .Ar delete . 460 This behavior is approximately copied from vi and/or vim. 461 .It Ar find-char-forwards Oo normal, visual, insert Oc Oo num Oc Oo char Oc 462 Move cursor forward 463 .Ar num 464 times to the character given by 465 .Ar char . 466 The caveat mentioned for 467 .Ar find-char-backwards 468 also applies. 469 .It Ar find-next-char-backwards Oo normal, visual, insert Oc Oo num Oc Oo char Oc 470 Move cursor backward 471 .Ar num 472 times to the position after the character given by 473 .Ar char . 474 The caveat mentioned for 475 .Ar find-char-backwards 476 also applies. 477 .It Ar find-next-char-forwards Oo normal, visual, insert Oc Oo num Oc Oo char Oc 478 Move cursor forward 479 .Ar num 480 times to the position before the character given by 481 .Ar char . 482 The caveat mentioned for 483 .Ar find-char-backwards 484 also applies. 485 .It Ar insert-at-beginning Op normal 486 Move cursor to the beginning of the line and enter insert mode. 487 This function changes its behavior in softline mode. 488 .It Ar insert-text Op insert 489 Insert the typed text at the current cursor position. 490 .It Ar join-lines Oo normal, insert Oc Oo num Oc 491 Join the current line with the next 492 .Ar num 493 lines. 494 Whitespace at the beginning of the joined lines is deleted, but it 495 is ensured that there is always at least a space between two joined 496 lines. 497 Note that this function always works on hard lines, regardless 498 of the current mode. 499 .It Ar jump-to-mark Oo normal, visual, insert Oc Oo char Oc 500 Jump to the mark given by 501 .Ar char . 502 In visual mode, the selection end is moved to the position of the mark. 503 .It Ar key-0 Op normal, visual, insert 504 This is a special function to handle the usual vi behavior of using 505 the key 0 both for moving to the beginning of the line and for adding 506 the digit 0 to the end of the current key repetition number. 507 If there was no previous key or the previous key expects a motion 508 command, 509 .Ar cursor-to-beginning 510 is called. 511 If the previous key was a number (i.e. one of the 512 .Ar push 513 commands), 514 .Ar push-0 515 is called. 516 .It Ar insert-mark Oo normal, visual, insert Oc Oo char Oc 517 Insert a mark 518 .Ar char 519 with the current position. 520 .It Ar move-to-eol Op normal, visual, insert 521 Move to the end of the current line. 522 In visual mode, the selection end is moved as well. 523 This function modifies its behavior in softline mode. 524 .It Ar move-to-line Oo normal, visual, insert Oc Oo num Oc 525 Move to line number 526 .Ar num . 527 If 528 .Ar num 529 is not give, move to the last line in the buffer. 530 In visual mode, the selection end is moved as well. 531 .It Ar next-bigword Oo normal, visual, insert Oc Oo num Oc 532 Move forward 533 .Ar num 534 bigwords. 535 In visual mode, the selection is modified as well. 536 .It Ar next-bigword-end Oo normal, visual, insert Oc Oo num Oc 537 Move forward 538 .Ar num 539 end-of-bigwords. 540 In visual mode, the selection is modified as well. 541 .It Ar next-word Oo normal, visual, insert Oc Oo num Oc 542 Move forward 543 .Ar num 544 words. 545 In visual mode, the selection is modified as well. 546 .It Ar next-word-end Oo normal, visual, insert Oc Oo num Oc 547 Move forward 548 .Ar num 549 end-of-words. 550 In visual mode, the selection is modified as well. 551 .It Ar paste-buffer Op normal, insert 552 Paste text from the paste buffer after the current cursor position if the buffer 553 is character-based and after the current line if it is line-based. 554 Note that this does take into account the hard line/soft line mode, but it behaves 555 a bit weirdly when in soft line mode - it inserts the text after the current soft 556 line but adds newlines on both sides. 557 This behavior may be changed in the future if it turns out there's a more logical 558 behavior for soft line mode. 559 .It Ar paste-buffer-backwards Op normal, insert 560 Paste text from the paste buffer before the current cursor position if the buffer 561 is character-based and before the current line if it is line-based. 562 The quirk for 563 .Ar paste-buffer 564 applies here as well. 565 .It Ar previous-bigword Oo normal, visual, insert Oc Oo num Oc 566 Move backward 567 .Ar num 568 bigwords. 569 In visual mode, the selection is modified as well. 570 .It Ar previous-word Oo normal, visual, insert Oc Oo num Oc 571 Move backward 572 .Ar num 573 words. 574 In visual mode, the selection is modified as well. 575 .It Ar push-0 Op normal, visual, insert 576 Add the digit 0 to the end of the current key repetition number. 577 See also 578 .Ar key-0 579 .It Ar push-1 Op normal, visual, insert 580 Add the digit 1 to the end of the current key repetition number. 581 .It Ar push-2 Op normal, visual, insert 582 Add the digit 2 to the end of the current key repetition number. 583 .It Ar push-3 Op normal, visual, insert 584 Add the digit 3 to the end of the current key repetition number. 585 .It Ar push-4 Op normal, visual, insert 586 Add the digit 4 to the end of the current key repetition number. 587 .It Ar push-5 Op normal, visual, insert 588 Add the digit 5 to the end of the current key repetition number. 589 .It Ar push-6 Op normal, visual, insert 590 Add the digit 6 to the end of the current key repetition number. 591 .It Ar push-7 Op normal, visual, insert 592 Add the digit 7 to the end of the current key repetition number. 593 .It Ar push-8 Op normal, visual, insert 594 Add the digit 8 to the end of the current key repetition number. 595 .It Ar push-9 Op normal, visual, insert 596 Add the digit 9 to the end of the current key repetition number. 597 .It Ar redo Oo normal, insert Oc Oo num Oc 598 Redo 599 .Ar num 600 operations. 601 Note that this changes depending on the mode. 602 All operations performed in insert mode are considered as one 603 operation when performing redo in normal mode. 604 .It Ar repeat-command Oo normal Oc Oo num Oc 605 Repeat the previous command 606 .Ar num 607 times. 608 .Pp 609 !!!!!!!!!!!!! NOTE/FIXME: This is broken currently. 610 In vi, everything done during insert mode is considered to be one 611 operation, so it counts as one command when using repeat-command. 612 However, since a lot of commands here now work in insert mode as well, 613 that doesn't make much sense anymore. 614 Most of the commands discard the previous key information because that's 615 what should happen in normal mode, and it is not clear what the logical 616 action would be in insert mode. 617 .It Ar replace Oo normal Oc Oo char Oc 618 Replace the character under the cursor with 619 .Ar char . 620 .It Ar break-line Op normal, insert 621 Break the line at the current position, i.e. insert a newline character. 622 .It Ar screen-down Oo normal, insert Oc Oo num Oc 623 Scroll 624 .Ar num 625 screens down. 626 .It Ar screen-up Oo normal, insert Oc Oo num Oc 627 Scroll 628 .Ar num 629 screens up. 630 .It Ar scroll-lines-down Oo normal, insert Oc Oo num Oc 631 Move 632 .Ar num 633 lines down. 634 If 635 .Ar count 636 is not given, scroll down the number of lines specified by the last 637 .Ar screen-down 638 or 639 .Ar screen-up 640 command. 641 If this is the first such command, scroll down half a screen. 642 Note that this command works with soft lines, regardless of the current mode. 643 .It Ar scroll-lines-up Oo normal, insert Oc Oo num Oc 644 Move 645 .Ar num 646 lines up. 647 If 648 .Ar count 649 is not given, scroll up the number of lines specified by the last 650 .Ar screen-down 651 or 652 .Ar screen-up 653 command. 654 If this is the first such command, scroll up half a screen. 655 Note that this command works with soft lines, regardless of the current mode. 656 .It Ar scroll-with-cursor-down Oo normal, insert Oc Oo num Oc 657 Move 658 .Ar num 659 lines down, attempting to leave the cursor in its current line and character position. 660 Note that this command works with soft lines, regardless of the current mode. 661 .It Ar scroll-with-cursor-up Oo normal, insert Oc Oo num Oc 662 Move 663 .Ar num 664 lines up, attempting to leave the cursor in its current line and character position. 665 Note that this command works with soft lines, regardless of the current mode. 666 .It Ar search-next Op normal, insert, visual 667 Move to the next search result. 668 .It Ar search-previous Op normal, insert, visual 669 Move to the previous search result. 670 .It Ar show-line Op normal, visual, insert 671 Show the current file name, whether the buffer has been modified since the last 672 write, and current line number. 673 .It Ar switch-selection-end Op visual 674 Switch the end of the selection that can be moved. 675 .It Ar toggle-hard-line-based Op normal, visual, insert 676 Toggle the line mode between hardline and softline. 677 .It Ar uppercase Op normal, insert 678 .It Ar lowercase Op normal, insert 679 Replace the character at the current cursor position with the uppercase/lowercase version if it exists. 680 If utf8proc support is not enabled, this will use the standard C library functions 681 .Fn toupper 682 and 683 .Fn tolower , 684 so it will not work with most Unicode characters. 685 Note that even with utf8proc, it will not work in all cases because some characters require 686 more complex handling (e.g. characters that require multiple characters when converted to 687 uppercase), which is not supported. 688 .It Ar undo Oo normal, insert Oc Oo num Oc 689 Undo 690 .Ar num 691 operations. 692 Note that this changes depending on the mode. 693 All operations performed in insert mode are considered as one 694 operation when performing undo in normal mode. 695 .It Ar yank Oo normal, visual, insert Oc Oo num Oc 696 In normal or insert mode, yank (copy to the paste buffer) the text from 697 the current position until the position given by the next motion command. 698 In visual mode, yank the selected text. 699 .Ar num 700 is used to influence the next motion command. 701 .Ar yank 702 itself can also be used as the motion command, in which case the 703 given number of lines is yanked. 704 When that is the case, the behavior is modified in softline mode. 705 .It Ar yank-lines Oo normal, insert Oc Oo num Oc 706 Yank (copy to the paste buffer) 707 .Ar num 708 lines. 709 This function modifies its behavior in softline mode. 710 .El 711 .Pp 712 Note: There are still a lot of weird parts when using functions in 713 modes that they weren't originally designed for (e.g. a lot of them 714 were only made for normal mode but now also work in insert mode). 715 The behavior is not set in stone yet and will probably still change 716 quite a bit based on any feedback I receive. 717 .It Ar command-keys 718 .Pp 719 This is the same as 720 .Ar basic-keys , 721 except that 722 .Sy modes 723 must be a combination of 724 .Ar substitute , 725 .Ar edit , 726 .Ar edit-search , 727 and 728 .Ar edit-search-backwards . 729 .Pp 730 .Ar substitute 731 is the mode while performing a substitution with confirmation. 732 .Ar edit 733 is the mode while typing a command in the line editor. 734 .Ar edit-search 735 is the mode while typing a forwards search in the line editor. 736 .Ar edit-search-backwards 737 is the mode while typing a backwards search in the line editor. 738 .Pp 739 The possible functions are given in the following list, with 740 the allowed modes listed beside each function. 741 .Bl -tag -width Ds 742 .It Ar edit-backspace Op edit, edit-search, edit-search-backwards 743 Delete one unicode character before the cursor. 744 .It Ar edit-cursor-left Op edit, edit-search, edit-search-backwards 745 Move the cursor one to the left. 746 .It Ar edit-cursor-right Op edit, edit-search, edit-search-backwards 747 Move the cursor one to the right. 748 .It Ar edit-cursor-to-beginning Op edit, edit-search, edit-search-backwards 749 Move the cursor to the beginning of the line. 750 .It Ar edit-cursor-to-end Op edit, edit-search, edit-search-backwards 751 Move the cursor to the end of the line. 752 .It Ar edit-delete Op edit, edit-search, edit-search-backwards 753 Delete one unicode character after the cursor. 754 .It Ar edit-discard Op edit, edit-search, edit-search-backwards 755 Exit the line editor and cancel the search or command. 756 .It Ar edit-insert-text Op edit, edit-search, edit-search-backwards 757 Insert the typed text in the line editor at the current cursor position. 758 .It Ar edit-next-command Op edit 759 Move forwards through the command history. 760 .It Ar edit-next-search Op edit-search, edit-search-backwards 761 Move forwards through the search history. 762 .It Ar edit-previous-command Op edit 763 Move backwards through the command history. 764 .It Ar edit-previous-search Op edit-search, edit-search-backwards 765 Move backwards through the search history. 766 .It Ar edit-submit Op edit 767 Submit the command. 768 .It Ar edit-submit-backwards-search Op edit-search-backwards 769 Submit the search. 770 .It Ar edit-submit-search Op edit-search 771 Submit the search. 772 .It Ar substitute-no Op substitute 773 Reject the current substitution. 774 .It Ar substitute-no-all Op substitute 775 Reject the current substitution and all further ones. 776 .It Ar substitute-yes Op substitute 777 Confirm the current substitution. 778 .It Ar substitute-yes-all Op substitute 779 Confirm the current substitution and all further ones. 780 .El 781 .Pp 782 Note that the bindings for the substitution commands are also displayed 783 on screen during the substitution. 784 However, only the default English bindings are shown because anything 785 else would require work (and might look very weird if the mapping 786 includes characters like diacritics that can't be displayed properly 787 on their own). 788 .It Ar commands 789 .Pp 790 This is a list of statements of the form 791 .Pp 792 .Sy bind 793 .Aq func_name 794 .Aq text 795 .Pp 796 Note that the terminology is currently a bit inconsistent. 797 Sometimes, 798 .Dq commands 799 refers to the key commands, sometimes to the commands 800 written in the line editor, which are documented in this section. 801 .Pp 802 Also note that the commands which take filenames currently use the entire rest of 803 the line as the filename instead of doing any string parsing. 804 This may be changed in the future. 805 .Pp 806 The possible functions are given in the following list, together with 807 the calling convention when calling them with the configured bindings. 808 .Pp 809 .Bl -tag -width Ds -compact 810 .It Cm write 811 .It Xo 812 .Sm off 813 .Aq binding-text 814 .Op \&! 815 .Sm on 816 .Op Ar filename 817 .Xc 818 Write the buffer to 819 .Op Ar filename , 820 or, if no filename is given, to the file the buffer was read from. 821 If 822 .Sq \&! 823 is specified, the file will be attempted to be written to even if there 824 is something blocking it (e.g. the modified date of the file is newer 825 than it was when it was opened). 826 .Pp 827 .It Cm quit 828 .It Xo 829 .Sm off 830 .Aq binding-text 831 .Op \&! 832 .Sm on 833 .Xc 834 Quit. 835 If 836 .Sq \&! 837 is specified, quit even when there are unsaved changes. 838 .Pp 839 .It Cm write-quit 840 .It Xo 841 .Sm off 842 .Aq binding-text 843 .Op \&! 844 .Sm on 845 .Op Ar filename 846 .Xc 847 Write and quit afterwards. 848 The 849 .Sq \&! 850 is interpreted as for normal writing. 851 .Pp 852 .It Cm substitute 853 .It Xo 854 .Sm off 855 .Op Ar range 856 .Aq binding-text 857 .Cm / Ar pattern Cm / Ar replace Cm / 858 .Op Ar options 859 .Sm on 860 .Xc 861 Substitute 862 .Ar pattern 863 with 864 .Ar replace 865 in the given line range. 866 .Pp 867 Instead of 868 .Sq / , 869 any other unicode character may be used. 870 The first unicode character after 871 .Aq binding-text 872 is used as the delimiter. 873 .Pp 874 If no range is given, substitution is only performed on the current line. 875 Note that no regex is currently supported. 876 .Pp 877 The range consists of two line numbers separated by a comma or the special value 878 .Sq % , 879 which refers to the entire file. 880 The following special values are possible instead of writing a line number directly: 881 .Bl -tag -width Ds 882 .It Cm $ 883 The last line in the file. 884 .It Xo 885 .Sm off 886 .Cm ' Aq Cm mark 887 .Sm on 888 .Xc 889 The line of the previously set mark 890 .Aq Cm mark . 891 Note that even though marks can theoretically be any string of characters, 892 they are only allowed to be one unicode character if they are used in a range. 893 The special values 894 .Cm < 895 and 896 .Cm > 897 are possible, which refer to the first and last line, respectively, in the 898 current selection. 899 .It Cm \&. 900 The current line. 901 .El 902 .Pp 903 The 904 .Ar options 905 may be a combination of the following: 906 .Bl -tag -width Ds 907 .It Cm g 908 Perform substitution for all occurrences in the given lines instead of just 909 the first one on each line. 910 .It Cm c 911 Confirm each substitution before performing it. 912 .El 913 .Pp 914 .It Cm create-view 915 .It Aq binding-text 916 Open a new view. 917 Each view is a window that shows the text in the current buffer, 918 which is synced between the views. 919 .It Cm close-view 920 .It Xo 921 .Sm off 922 .Aq binding-text 923 .Op \&! 924 .Sm on 925 .Xc 926 Close a view. 927 If 928 .Sq \&! 929 is given, close the view even it is the last one and there are unsaved changes. 930 .El 931 .El 932 .Pp 933 If the 934 .Ar bindings 935 configuration or any part of it is left out, the 936 default is used. 937 There are some more specific rules, but I'm too lazy to explain them right now. 938 It is actually possible to overwrite just the default language without 939 changing the bindings, but why would you want to do that? 940 .Sh LANGUAGE MAPPINGS 941 A language mapping defines a mapping for the text associated with each 942 key or command so the bindings still work with other keyboard layouts. 943 Language mappings may be defined by assigning 944 .Ar language-mapping 945 to a list of the following assignments, once for each language. 946 Note that any definition of 947 .Ar language-mapping 948 must come after 949 .Ar bindings . 950 .Bl -tag -width Ds 951 .It Ar language 952 .Pp 953 This is the language string for the key layout, as in 954 .Ar bindings . 955 .It Ar key-mapping 956 .Pp 957 This is a list of statements of the form 958 .Pp 959 .Sy map 960 .Aq foreign 961 .Aq native 962 .Pp 963 where 964 .Aq foreign 965 is the key text in the new language mapping and 966 .Aq native 967 is the key text given in 968 .Ar bindings . 969 .It Ar command-mapping 970 .Pp 971 This is the same as 972 .Ar key-mapping , 973 but for the commands. 974 Note that only the commands themselves are mapped, but the arguments are left alone. 975 I don't think it makes much sense to try to map those as well - really the only 976 reason for mapping commands is so that it is possible to save and quit with a 977 different keyboard layout. 978 If someone has a good idea for making other commands properly usable with other 979 keyboard mappings, I might consider it, though. 980 .El 981 .Sh KEYSYMS 982 These are the currently supported keysyms. 983 I don't know what a lot of these are supposed to be, they were just 984 copied from the list in the X header files. 985 Let me know if there are any others I should add. 986 .Bl -tag -width Ds 987 .It Ar General keys 988 .Pp 989 .Ar backspace 990 .Ar begin 991 .Ar break 992 .Ar cancel 993 .Ar clear 994 .Ar delete 995 .Ar down 996 .Ar end 997 .Ar escape 998 .Ar execute 999 .Ar find 1000 .Ar help 1001 .Ar home 1002 .Ar insert 1003 .Ar left 1004 .Ar linefeed 1005 .Ar menu 1006 .Ar mode-switch 1007 .Ar next 1008 .Ar num-lock 1009 .Ar page-down 1010 .Ar page-up 1011 .Ar pause 1012 .Ar print 1013 .Ar prior 1014 .Ar redo 1015 .Ar return 1016 .Ar right 1017 .Ar script-switch 1018 .Ar scroll-lock 1019 .Ar select 1020 .Ar space 1021 .Ar sysreq 1022 .Ar tab 1023 .Ar up 1024 .Ar undo 1025 .It Ar Function keys 1026 .Pp 1027 .Ar f1 1028 .Ar f2 1029 .Ar f3 1030 .Ar f4 1031 .Ar f5 1032 .Ar f6 1033 .Ar f7 1034 .Ar f8 1035 .Ar f9 1036 .Ar f10 1037 .Ar f11 1038 .Ar f12 1039 .Ar f13 1040 .Ar f14 1041 .Ar f15 1042 .Ar f16 1043 .Ar f17 1044 .Ar f18 1045 .Ar f19 1046 .Ar f20 1047 .Ar f21 1048 .Ar f22 1049 .Ar f23 1050 .Ar f24 1051 .Ar f25 1052 .Ar f26 1053 .Ar f27 1054 .Ar f28 1055 .Ar f29 1056 .Ar f30 1057 .Ar f31 1058 .Ar f32 1059 .Ar f33 1060 .Ar f34 1061 .Ar f35 1062 .It Ar Keypad keys 1063 .Pp 1064 .Ar kp-0 1065 .Ar kp-1 1066 .Ar kp-2 1067 .Ar kp-3 1068 .Ar kp-4 1069 .Ar kp-5 1070 .Ar kp-6 1071 .Ar kp-7 1072 .Ar kp-8 1073 .Ar kp-9 1074 .Ar kp-add 1075 .Ar kp-begin 1076 .Ar kp-decimal 1077 .Ar kp-delete 1078 .Ar kp-divide 1079 .Ar kp-down 1080 .Ar kp-end 1081 .Ar kp-enter 1082 .Ar kp-equal 1083 .Ar kp-f1 1084 .Ar kp-f2 1085 .Ar kp-f3 1086 .Ar kp-f4 1087 .Ar kp-home 1088 .Ar kp-insert 1089 .Ar kp-left 1090 .Ar kp-multiply 1091 .Ar kp-next 1092 .Ar kp-page-down 1093 .Ar kp-page-up 1094 .Ar kp-prior 1095 .Ar kp-right 1096 .Ar kp-separator 1097 .Ar kp-space 1098 .Ar kp-subtract 1099 .Ar kp-tab 1100 .Ar kp-up 1101 .It Ar Weird keys that I don't know 1102 .Pp 1103 .Ar l1 1104 .Ar l2 1105 .Ar l3 1106 .Ar l4 1107 .Ar l5 1108 .Ar l6 1109 .Ar l7 1110 .Ar l8 1111 .Ar l9 1112 .Ar l10 1113 .Ar r1 1114 .Ar r2 1115 .Ar r3 1116 .Ar r4 1117 .Ar r5 1118 .Ar r6 1119 .Ar r7 1120 .Ar r8 1121 .Ar r9 1122 .Ar r10 1123 .Ar r11 1124 .Ar r12 1125 .Ar r13 1126 .Ar r14 1127 .Ar r15 1128 .El 1129 .Sh EXAMPLES 1130 See the example configuration file 1131 .Pa leditrc.example . 1132 .Sh SEE ALSO 1133 .Xr ledit 1 1134 .Sh AUTHORS 1135 .An lumidify Aq Mt nobody@lumidify.org