sled

Једноставни уређивач текста
git clone https://git.sr.ht/~strahinja/sled
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

sled.1.in (8426B)


      1 .\" This program is licensed under the terms of GNU GPL v3 or (at your option)
      2 .\" any later version. Copyright (C) 2022-2026  Страхиња Радић.
      3 .\" See the file LICENSE for exact copyright and license details.
      4 .\" File termbox.h is based on termbox2 TUI library, (c) 2021 termbox
      5 .\" developers, which is released under the terms of Expat license, see the file
      6 .\" LICENSE.termbox.
      7 .Dd %DATE%
      8 .Dt SLED 1
      9 .Os
     10 .Sh NAME
     11 .Nm sled
     12 .Nd Simple text editor
     13 .Sh SYNOPSIS
     14 .Nm
     15 .Fl h | \-help | Fl V | \-full\-version | Fl v | \-version
     16 .Nm
     17 .Op Fl B | Fl \-no\-backup
     18 .Op Fl b | Fl \-backup
     19 .Op Fl O | Fl \-no\-open\-binary
     20 .Op Fl o | Fl \-open\-binary
     21 .Ar filename
     22 .Sh DESCRIPTION
     23 .Nm
     24 is a simple text editor with a terminal UI.
     25 .Bl -tag -width Ds
     26 .It Fl B , \-no\-backup
     27 Disables backups.
     28 This option overrides the setting in
     29 .Pa config.h .
     30 .It Fl b , \-backup
     31 Enables backups.
     32 This option overrides the setting in
     33 .Pa config.h .
     34 .It Fl O , \-no\-open\-binary
     35 Disables opening of binary files (containing the NUL character).
     36 This option overrides the setting in
     37 .Pa config.h .
     38 .It Fl o , \-open\-binary
     39 Enables opening of binary files (containing the NUL character).
     40 This option overrides the setting in
     41 .Pa config.h .
     42 .It Fl h , \-help
     43 Show option summary.
     44 .It Fl V , \-full\-version
     45 Show full version information: like
     46 .Fl v ,
     47 followed by copyright notice and defines set in
     48 .Pa config.h .
     49 .It Fl v , \-version
     50 Show version information: program version and source git repository commit date.
     51 .El
     52 .Ss Modes
     53 .Nm
     54 has four modes of operation.
     55 .Bl -tag -width Ds
     56 .Tg Insert_mode
     57 .It Sy Insert mode
     58 The initial mode which is active on startup.
     59 It behaves like one would expect from a
     60 .Dq normal
     61 text editor: most
     62 characters are self-inserting, arrow keys and Backspace/Delete work as expected,
     63 and so on.
     64 .Tg Command_mode
     65 .It Sy Command mode
     66 Command mode behaves more like
     67 .Xr vi 1 :
     68 characters like \f[CR]h\fR, \f[CR]j\fR, \f[CR]k\fR, \f[CR]l\fR no longer insert
     69 themselves but execute commands (in this case movement commands).
     70 .Tg Overwrite_mode
     71 .It Sy Overwrite mode
     72 This is the same as insert mode, except that newly inserted characters replace
     73 the existing ones instead of being inserted among them.
     74 .Tg Selection_mode
     75 .It Sy Selection mode
     76 In this mode, moving around the file extends the selection, and most commands
     77 that alter text instead delete the selection and exit selection mode.
     78 .El
     79 .Pp
     80 .Nm
     81 additionally has three
     82 .Dq modal modes ,
     83 which are active as long a modal dialog is shown on screen.
     84 They are:
     85 .Sy help mode ,
     86 .Sy input mode
     87 and
     88 .Sy numerical input mode.
     89 .
     90 .Ss Global key bindings
     91 These are active in all modes, and are as follows:
     92 .Bl -column -offset Ds "Delete or C-D"
     93 .It Sy Key Ta Sy Action
     94 .It \f[CR]Esc\fR Ta Close dialog, clear error, cancel selection
     95 .It \f[CR]F1\fR Ta Show help dialog
     96 .It \f[CR]F2\fR Ta Toggle line numbers
     97 .It \f[CR]F3\fR Ta Go to next found match
     98 .It \f[CR]S-F3\fR Ta Go to previous found match
     99 .It \f[CR]F4\fR Ta Show search, then replace dialog
    100 .It \f[CR]F7\fR Ta Show only search dialog
    101 .It \f[CR]Home\fR or \f[CR]C-A\fR Ta Go to start of line
    102 .It \f[CR]PgUp\fR or \f[CR]C-B\fR Ta Go to previous page
    103 .It \f[CR]Backspace\fR Ta Erase character before cursor
    104 .It \f[CR]C-\e\fR Ta Toggle command mode
    105 .It \f[CR]C-C\fR Ta Yank to paste buffer
    106 .It \f[CR]Delete\fR or \f[CR]C-D\fR Ta Erase character under cursor
    107 .It \f[CR]End\fR or \f[CR]C-E\fR Ta Go to end of line
    108 .It \f[CR]Insert\fR Ta Toggle overwrite
    109 .It \f[CR]PgDown\fR or \f[CR]C-F\fR Ta Go to next page
    110 .It \f[CR]C-J\fR Ta Rewrap paragraph or selection
    111 .It \f[CR]C-K\fR Ta Erase to end of line
    112 .It \f[CR]C-L\fR Ta Show Go to line dialog
    113 .It \f[CR]C-N\fR Ta Go to next found match
    114 .It \f[CR]C-O\fR Ta Reread (reopen) file
    115 .It \f[CR]C-P\fR Ta Go to previous found match
    116 .It \f[CR]C-Q\fR Ta Quit
    117 .It \f[CR]C-R\fR Ta Go to previous word
    118 .It \f[CR]C-S\fR Ta Write (save) file
    119 .It \f[CR]C-Space\fR Ta Toggle selection mode
    120 .It \f[CR]C-T\fR Ta Go to next word
    121 .It \f[CR]C-U\fR Ta Erase to start of line
    122 .It \f[CR]C-V\fR Ta Paste from paste buffer
    123 .It \f[CR]C-X\fR Ta Cut to paste buffer
    124 .It \f[CR]C-Y\fR Ta Erase the entire current line
    125 .It \f[CR]C-Z\fR Ta Suspend
    126 .It \f[CR]C-W\fR Ta Erase previous word
    127 .El
    128 .
    129 .Ss Insert and overwrite mode key bindings
    130 In
    131 .Sx Insert mode
    132 and
    133 .Sx Overwrite mode ,
    134 characters are self\-inserting, and \f[CR]Enter\fR inserts new line.
    135 All the global keys apply to insert mode as well.
    136 Entering overwrite mode switches back to insert mode when the overwrite mode is
    137 toggled off, even when the overwrite mode was entered from the command mode.
    138 .
    139 .Ss Command mode key bindings
    140 In
    141 .Sx Command mode ,
    142 the following
    143 .Nm vi Ns \-like
    144 keys are in effect:
    145 .Bl -column -offset Ds "W"
    146 .It Sy Key Ta Sy Action
    147 .It \f[CR]/\fR Ta Show only search dialog
    148 .It \f[CR]\e\fR Ta Show search, then replace dialog
    149 .It \f[CR]:\fR Ta Show Go to line dialog
    150 .It \f[CR]0\fR Ta Go to start of line
    151 .It \f[CR]$\fR Ta Go to end of line
    152 .It \f[CR]d\fR Ta Erase the entire current line
    153 .It \f[CR]G\fR Ta Go to last line in the file
    154 .It \f[CR]g\fR Ta Go to first line in the file
    155 .It \f[CR]H\fR Ta Go to first line on the screen
    156 .It \f[CR]h\fR Ta Go to previous character
    157 .It \f[CR]J\fR Ta Join lines in selection/line and next line
    158 .It \f[CR]j\fR Ta Go to next line
    159 .It \f[CR]k\fR Ta Go to previous line
    160 .It \f[CR]L\fR Ta Go to last line on the screen
    161 .It \f[CR]l\fR Ta Go to next character
    162 .It \f[CR]M\fR Ta Go to middle line on the screen
    163 .It \f[CR]N\fR Ta Go to previous found match
    164 .It \f[CR]n\fR Ta Go to next found match
    165 .It \f[CR]P\fR Ta Paste from paste buffer
    166 .It \f[CR]q\fR Ta Quit
    167 .It \f[CR]R\fR Ta Toggle overwrite mode
    168 .It \f[CR]r\fR Ta Reread (reopen) file
    169 .It \f[CR]v\fR Ta Toggle selection mode
    170 .It \f[CR]W\fR Ta Go to previous word
    171 .It \f[CR]w\fR Ta Go to next word
    172 .It \f[CR]X\fR Ta Cut to paste buffer
    173 .It \f[CR]x\fR Ta Erase character under cursor
    174 .It \f[CR]y\fR Ta Yank to paste buffer
    175 .It \f[CR]Z\fR Ta Write (save) file
    176 .El
    177 .
    178 .Ss Selection mode key bindings
    179 If
    180 .Sx Selection mode
    181 was entered from insert mode (or insert mode is activated during selection
    182 mode), typing any self\-inserting character or activating key bindings which
    183 modify text, like \f[CR]Delete\fR or \f[CR]C-K\fR, will erase the selected text
    184 instead, and in the case of self\-inserting characters, insert the character in
    185 question, exiting the selection mode.
    186 .Pp
    187 Similar holds true when the selection mode is entered from the command mode or
    188 the command mode is activated during the selection mode, except that
    189 .Nm vi Ns \-like
    190 key bindings which modify text will have the effect on the selection.
    191 .
    192 .Ss Status line
    193 Status line is comprised of a number of segments, by default four.
    194 .Bl -bullet -width 1m
    195 .It
    196 The leftmost segment displays the current filename, with an asterisk
    197 (\f[CR]*\fR) if there are any unsaved changes.
    198 .It
    199 Second segment displays the current mode.
    200 .It
    201 Third segment displays the Unicode codepoint at the position of the cursor.
    202 .It
    203 Fourth segment displays the current position within the file, in the form
    204 .Dl [column]:[row] ([percentage of total lines]%)
    205 .It
    206 Fifth segment shows quick help.
    207 .El
    208 .
    209 .Sh EXIT STATUS
    210 .Ex -std
    211 .Pp
    212 For errors caused by the unsuccessful calls to libc functions setting
    213 .Va errno ,
    214 that value is returned as the exit status.
    215 Otherwise, the exit status is one of the following:
    216 .Bl -tag -width Ds -offset indent -compact
    217 .It Li 201
    218 No filename was given on the command line.
    219 .It Li 202
    220 File is a binary file and
    221 .Dv open_binary
    222 is set to zero.
    223 .It Li 203
    224 File is not a regular file.
    225 .It Li 204
    226 There has been a termbox error.
    227 .El
    228 .
    229 .Sh AUTHORS
    230 .An Strahinya Radich Aq Mt sr@strahinja.org ,
    231 2022\-2026
    232 .
    233 .Sh BUGS
    234 Bugs can be reported using the ticket tracker at:
    235 .Lk https://\:todo.sr.ht/\:~strahinja/\:sled
    236 .
    237 .Ss Known limitations
    238 .Bl -bullet -width 1m
    239 .It
    240 UTF-8 character set is assumed.
    241 .It
    242 RTL scripts are unsupported/problematic.
    243 CJK scripts should work better after v0.17, which introduced the use of
    244 .Xr wcwidth 3 .
    245 .It
    246 Only one file can be edited at a time, and no additional files can be loaded at
    247 runtime.
    248 This is a design decision.
    249 .It
    250 If backup creation is enabled
    251 .Pq Dv create_backups No in Pa config.h ,
    252 the directory of the edited file must be writable by the user to open the file.
    253 .It
    254 Opening binary files (containing NUL bytes) can lead to an incorrectly drawn
    255 display. 
    256 This was the reason for introducing the option
    257 .Dv open_binary ,
    258 by default set to zero.
    259 .El