|
| 1 | +[0m |
| 2 | + sless - a terminal sexp viewer |
| 3 | + |
| 4 | + [1mSUMMARY OF SLESS COMMANDS[0m |
| 5 | + |
| 6 | + Commands marked with * may be preceded by a number, [4mN[0m, which will |
| 7 | + repeatedly perform a command the given number of times. A key |
| 8 | + preceded by a caret indicates the Ctrl key; thus ^E is ctrl-E. |
| 9 | + |
| 10 | + Commands requiring multiple key-presses may be cancelled with the |
| 11 | + Escape key. |
| 12 | + |
| 13 | + q :q[uit] ^c Exit sless. |
| 14 | + |
| 15 | + F1 :h[elp] Show this help screen. |
| 16 | + |
| 17 | + ^z Suspend sless. |
| 18 | + |
| 19 | + [1mMOVING[0m |
| 20 | + |
| 21 | + j DownArrow * Move focus down one line (or [4mN[0m lines). |
| 22 | + ^n |
| 23 | + |
| 24 | + k UpArrow * Move focus up one line (or [4mN[0m lines). |
| 25 | + ^p |
| 26 | + |
| 27 | + h LeftArrow When focused on an expanded sexp, collapse it. Otherwise, |
| 28 | + move focus to the left of the focused node, or to a parent of |
| 29 | + the focused node. |
| 30 | + |
| 31 | + H Move focus to the left or to a parent of the focused node |
| 32 | + without collapsing the focused node. |
| 33 | + |
| 34 | + l RightArrow When focused on a collapsed sexp, expand it. Otherwise, |
| 35 | + move focus to the right of the focused node, or to a parent |
| 36 | + of the focused node. |
| 37 | + |
| 38 | + PageDown * Move down by one window (or [4mN[0m windows). |
| 39 | + PageUp * Move up by one window (or [4mN[0m windows). |
| 40 | + |
| 41 | + 0 Move to the focused node's first sibling. |
| 42 | + $ Move to the focused node's last sibling. |
| 43 | + |
| 44 | + Home Focus the first line in the document. |
| 45 | + End Focus the last line in the document. |
| 46 | + |
| 47 | + g * Focus the first line in the document. |
| 48 | + G * Focus the last line in the document, and tail the bottom of |
| 49 | + document if sless is still receiving input. |
| 50 | + |
| 51 | + If a count is given to either of these commands, focus that |
| 52 | + line number. If that line is not visible because a parent node |
| 53 | + is collapsed, focus the first preceding visible line. |
| 54 | + |
| 55 | + c * Shallowly collapse the focused node and all its siblings. |
| 56 | + C * Deeply collapse the focused node and all its siblings. |
| 57 | + e * Shallowly expand the focused node and all its siblings. |
| 58 | + E * Deeply expand the focused node and all its siblings. |
| 59 | + |
| 60 | + If a count is give to any of these commands, it will |
| 61 | + collapse/expand the focused node and all its siblings |
| 62 | + [4mN[0m levels to the given depth. |
| 63 | + |
| 64 | + [1mSCROLLING[0m |
| 65 | + |
| 66 | + ^e * Scroll down one line (or [4mN[0m lines). |
| 67 | + ^y * Scroll up one line (or [4mN[0m lines). |
| 68 | + |
| 69 | + ^d * Scroll down by half the height of the screen (or by [4mN[0m lines). |
| 70 | + ^u * Scroll up by half the height of the screen (or by [4mN[0m lines). |
| 71 | + |
| 72 | + For these commands, focus is also moved by the specified |
| 73 | + number of lines. If no count is specified, the number of |
| 74 | + lines to scroll is recalled from previous executions. |
| 75 | + |
| 76 | + zz Move the focused node to the center of the screen. |
| 77 | + zt Move the focused node to the top of the screen. |
| 78 | + zb Move the focused node to the bottom of the screen. |
| 79 | + |
| 80 | + [1mCOPYING AND PRINTING[0m |
| 81 | + |
| 82 | + You can copy various parts of the sexp file to your clipboard using |
| 83 | + any one of a set of commands starting with 'y'. |
| 84 | + |
| 85 | + yy Copy the currently focused sexp, pretty printed. When focused on |
| 86 | + record field, this will [4mnot[0m include the key. |
| 87 | + ym yY Copy the currently focused sexp, like yy, but on a single line, |
| 88 | + similar to [sexp print -machine], but with spaces separating atoms. |
| 89 | + Excludes comments. |
| 90 | + ya yA Copy the currently focused sexp and "all" its siblings either pretty |
| 91 | + printed like yy (ya), or on one line per node like ym (yA). |
| 92 | + |
| 93 | + ys When the currently focused value is an atom, copy the contents |
| 94 | + of the string, with all escape sequences unescaped. |
| 95 | + |
| 96 | + yk When focused on a record field, yank the key. |
| 97 | + |
| 98 | + yc When focused on a variant, yank the constructor. |
| 99 | + |
| 100 | + [1mSEARCH[0m |
| 101 | + |
| 102 | + sless supports full-text search over the input sexp. |
| 103 | + |
| 104 | + /pattern * Search forward for the given pattern (or its [4mN[0mth occurrence). |
| 105 | + ?pattern * Search backwards for the given pattern (or its [4mN[0mth occurrence). |
| 106 | + |
| 107 | + n * Move in the search direction to the next match (or forward |
| 108 | + [4mN[0m matches). |
| 109 | + N * Move in the opposite of the search direction to the previous |
| 110 | + match (or previous [4mN[0m matches). |
| 111 | + |
| 112 | + ^f * Move to the next match like n, but keeps the cursor in the same |
| 113 | + spot on screen and scrolls the viewport underneath it. |
| 114 | + ^g * Move to the previous match like N, but keeps the cursor in the |
| 115 | + same spot on screen and scrolls the viewport underneath it. |
| 116 | + |
| 117 | + Searching uses "smart case" by default. If the input pattern doesn't |
| 118 | + contain any capital letters, a case insensitive search will be |
| 119 | + performed. If there are any capital letters, it will be case sensitive. |
| 120 | + You can force a case-sensitive search by appending '/s' to your query. |
| 121 | + |
| 122 | + A trailing slash will be removed from a pattern; to search for a |
| 123 | + pattern ending in '/' (or '/s'), just add another '/' to the end. |
| 124 | + |
| 125 | + Search patterns are interpreted as mostly standard regular expressions. |
| 126 | + Because sexps contain endless parentheses, parenthese do *not* take on |
| 127 | + their usual meaning (grouping), and are instead interpreted literally. |
| 128 | + To search for a group, escape the parentheses with backslashes. |
| 129 | + |
| 130 | + /(1 2 3) matches the list: (1 2 3) |
| 131 | + /\(b|c|h\)at matches "bat", "cat", or "hat" |
| 132 | + |
| 133 | + For exhaustive documentation of the supported regular expression syntax, |
| 134 | + see the following documentation of the underlying regex engine: |
| 135 | + |
| 136 | + https://docs.rs/regex/latest/regex/index.html#syntax |
| 137 | + |
| 138 | + [1mSEARCH INPUT[0m |
| 139 | + |
| 140 | + The search is *not* performed over the original input, but over a "nicely" |
| 141 | + formatted version of the input sexp that is (usually) formatted on a |
| 142 | + single line. If the input contains multiple top-level sexps, each one will |
| 143 | + be on a separate line. |
| 144 | + |
| 145 | + Consider the following two ways to format an equivalent sexp: |
| 146 | + |
| 147 | + ((a 1)(b true)(c"x y z")) |
| 148 | + |
| 149 | + ((a 1) |
| 150 | + (b true) |
| 151 | + (c "x y z")) |
| 152 | + |
| 153 | + sless will create an internal representation formatted as follows: |
| 154 | + |
| 155 | + ((a 1) (b true) (c "x y z")) |
| 156 | + |
| 157 | + A sexp may be split across multiple lines in the internal representation |
| 158 | + if forced to do so due to line comments (e.g. "; this is a comment"). |
| 159 | + |
| 160 | + Searching will be performed over this internal representation so that |
| 161 | + patterns can include multiple elements without worrying about |
| 162 | + newlines or the exact input format. |
0 commit comments