logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

lesskey.1 (10884B)


  1. '\" t
  2. .TH LESSKEY 1 "Version 643: 20 Jul 2023"
  3. .SH NAME
  4. lesskey \- customize key bindings for less
  5. .SH "SYNOPSIS (deprecated)"
  6. .B "lesskey [\-o output] [\-\-] [input]"
  7. .br
  8. .B "lesskey [\-\-output=output] [\-\-] [input]"
  9. .br
  10. .B "lesskey \-V"
  11. .br
  12. .B "lesskey \-\-version"
  13. .SH SCOPE
  14. This document describes the format of the
  15. .B lesskey
  16. source file, which is used by
  17. .B less
  18. version 582 and later.
  19. In previous versions of
  20. .BR less ,
  21. a separate program called
  22. .B lesskey
  23. was used to compile the
  24. .B lesskey
  25. source file into a format understood by
  26. .BR less .
  27. This compilation step is no longer required and the
  28. .B lesskey
  29. program is therefore deprecated, although the file format remains supported by
  30. .B less
  31. itself.
  32. .PP
  33. .SH DESCRIPTION
  34. A
  35. .B lesskey
  36. file specifies a set of key bindings and environment variables
  37. to be used by subsequent invocations of
  38. .BR less .
  39. .SH FILE FORMAT
  40. The input file consists of one or more
  41. .IR sections .
  42. Each section starts with a line that identifies the type of section.
  43. Possible sections are:
  44. .IP #command
  45. Customizes command key bindings.
  46. .IP #line-edit
  47. Customizes line-editing key bindings.
  48. .IP #env
  49. Defines environment variables.
  50. .PP
  51. Blank lines and lines which start with a hash mark (#) are ignored,
  52. except as noted below.
  53. .
  54. .SH "COMMAND SECTION"
  55. The command section begins with the line
  56. .sp
  57. #command
  58. .sp
  59. If the command section is the first section in the file,
  60. this line may be omitted.
  61. The command section consists of lines of the form:
  62. .sp
  63. \fIstring\fP <whitespace> \fIaction\fP [extra-string] <newline>
  64. .sp
  65. Whitespace is any sequence of one or more spaces and/or tabs.
  66. The \fIstring\fP is the command key(s) which invoke the action.
  67. The \fIstring\fP may be a single command key, or a sequence of up to 15 keys.
  68. The \fIaction\fP is the name of the less action, from the list below.
  69. The characters in the \fIstring\fP may appear literally, or be
  70. prefixed by a caret to indicate a control key.
  71. A backslash followed by one to three octal digits may be used to
  72. specify a character by its octal value.
  73. A backslash followed by certain characters specifies input
  74. characters as follows:
  75. .RS 5m
  76. .TS
  77. l l l.
  78. \eb BACKSPACE (0x08)
  79. \ee ESCAPE (0x1B)
  80. \en NEWLINE (0x0A)
  81. \er RETURN (0x0D)
  82. \et TAB (0x09)
  83. .TE
  84. .sp
  85. \ek followed by a single character represents the char(s) produced when one of these keys is pressed:
  86. .TS
  87. l l.
  88. \ekb BACKSPACE (the BACKSPACE key)
  89. \ekB ctrl-BACKSPACE
  90. \ekd DOWN ARROW
  91. \ekD PAGE DOWN
  92. \eke END
  93. \ekh HOME
  94. \eki INSERT
  95. \ekl LEFT ARROW
  96. \ekL ctrl-LEFT ARROW
  97. \ekr RIGHT ARROW
  98. \ekR ctrl-RIGHT ARROW
  99. \ekt BACKTAB
  100. \eku UP ARROW
  101. \ekU PAGE UP
  102. \ekx DELETE
  103. \ekX ctrl-DELETE
  104. \ek1 F1
  105. .TE
  106. .PP
  107. A backslash followed by any other character indicates that character is
  108. to be taken literally.
  109. Characters which must be preceded by backslash include
  110. caret, space, tab, hash mark and the backslash itself.
  111. .PP
  112. An action may be followed by an "extra" string.
  113. When such a command is entered while running
  114. .BR less ,
  115. the action is performed, and then the extra
  116. string is parsed, just as if it were typed in to
  117. .BR less .
  118. This feature can be used in certain cases to extend
  119. the functionality of a command.
  120. For example, see the "{" and ":t" commands in the example below.
  121. The extra string has a special meaning for the "quit" action:
  122. when
  123. .B less
  124. quits, the first character of the extra string is used as its exit status.
  125. .
  126. .SH EXAMPLE
  127. The following input file describes the set of
  128. default command keys used by
  129. .BR less .
  130. Documentation on each command can be found in the
  131. .less
  132. man page, under the key sequence which invokes the command.
  133. .sp
  134. .RS 5m
  135. .TS
  136. l l.
  137. #command
  138. \er forw-line
  139. \en forw-line
  140. e forw-line
  141. j forw-line
  142. \ekd forw-line
  143. ^E forw-line
  144. ^N forw-line
  145. k back-line
  146. y back-line
  147. ^Y back-line
  148. ^K back-line
  149. ^P back-line
  150. J forw-line-force
  151. K back-line-force
  152. Y back-line-force
  153. d forw-scroll
  154. ^D forw-scroll
  155. u back-scroll
  156. ^U back-scroll
  157. \e40 forw-screen
  158. f forw-screen
  159. ^F forw-screen
  160. ^V forw-screen
  161. \ekD forw-screen
  162. b back-screen
  163. ^B back-screen
  164. \eev back-screen
  165. \ekU back-screen
  166. z forw-window
  167. w back-window
  168. \ee\e40 forw-screen-force
  169. F forw-forever
  170. \eeF forw-until-hilite
  171. R repaint-flush
  172. r repaint
  173. ^R repaint
  174. ^L repaint
  175. \eeu undo-hilite
  176. \eeU clear-search
  177. g goto-line
  178. \ekh goto-line
  179. < goto-line
  180. \ee< goto-line
  181. p percent
  182. % percent
  183. \ee[ left-scroll
  184. \ee] right-scroll
  185. \ee( left-scroll
  186. \ee) right-scroll
  187. \ekl left-scroll
  188. \ekr right-scroll
  189. \ee{ no-scroll
  190. \ee} end-scroll
  191. { forw-bracket {}
  192. } back-bracket {}
  193. ( forw-bracket ()
  194. ) back-bracket ()
  195. [ forw-bracket []
  196. ] back-bracket []
  197. \ee^F forw-bracket
  198. \ee^B back-bracket
  199. G goto-end
  200. \ee> goto-end
  201. > goto-end
  202. \eke goto-end
  203. \eeG goto-end-buffered
  204. \&= status
  205. ^G status
  206. :f status
  207. / forw-search
  208. ? back-search
  209. \ee/ forw-search *
  210. \ee? back-search *
  211. n repeat-search
  212. \een repeat-search-all
  213. N reverse-search
  214. \eeN reverse-search-all
  215. & filter
  216. m set-mark
  217. M set-mark-bottom
  218. \eem clear-mark
  219. ' goto-mark
  220. ^X^X goto-mark
  221. E examine
  222. :e examine
  223. ^X^V examine
  224. :n next-file
  225. :p prev-file
  226. t next-tag
  227. T prev-tag
  228. :x index-file
  229. :d remove-file
  230. - toggle-option
  231. :t toggle-option t
  232. s toggle-option o
  233. ## Use a long option name by starting the
  234. ## extra string with ONE dash; eg:
  235. ## s toggle-option -log-file\en
  236. \&_ display-option
  237. | pipe
  238. v visual
  239. ! shell
  240. # pshell
  241. + firstcmd
  242. H help
  243. h help
  244. V version
  245. 0 digit
  246. 1 digit
  247. 2 digit
  248. 3 digit
  249. 4 digit
  250. 5 digit
  251. 6 digit
  252. 7 digit
  253. 8 digit
  254. 9 digit
  255. q quit
  256. Q quit
  257. :q quit
  258. :Q quit
  259. ZZ quit
  260. .TE
  261. .RE
  262. .sp
  263. .SH PRECEDENCE
  264. Commands specified by
  265. .B lesskey
  266. take precedence over the default commands.
  267. A default command key may be disabled by including it in the
  268. input file with the action "invalid".
  269. Alternatively, a key may be defined
  270. to do nothing by using the action "noaction".
  271. "noaction" is similar to "invalid", but
  272. .B less
  273. will give an error beep for an "invalid" command,
  274. but not for a "noaction" command.
  275. In addition, ALL default commands may be disabled by
  276. adding this control line to the input file:
  277. .sp
  278. #stop
  279. .sp
  280. This will cause all default commands to be ignored.
  281. The #stop line should be the last line in that section of the file.
  282. .PP
  283. Be aware that #stop can be dangerous.
  284. Since all default commands are disabled,
  285. you must provide sufficient commands before the #stop line
  286. to enable all necessary actions.
  287. For example, failure to provide a "quit" command can lead to frustration.
  288. .
  289. .SH "LINE EDITING SECTION"
  290. The line-editing section begins with the line:
  291. .sp
  292. #line-edit
  293. .sp
  294. This section specifies new key bindings for the line editing commands,
  295. in a manner similar to the way key bindings for
  296. ordinary commands are specified in the #command section.
  297. The line-editing section consists of a list of keys and actions,
  298. one per line as in the example below.
  299. .
  300. .SH EXAMPLE
  301. The following input file describes the set of
  302. default line-editing keys used by
  303. .BR less :
  304. .sp
  305. .RS 5m
  306. .TS
  307. l l.
  308. #line-edit
  309. \et forw-complete
  310. \e17 back-complete
  311. \ee\et back-complete
  312. ^L expand
  313. ^V literal
  314. ^A literal
  315. \eel right
  316. \ekr right
  317. \eeh left
  318. \ekl left
  319. \eeb word-left
  320. \ee\ekl word-left
  321. \eew word-right
  322. \ee\ekr word-right
  323. \eei insert
  324. \eex delete
  325. \ekx delete
  326. \eeX word-delete
  327. \eekx word-delete
  328. \ee\eb word-backspace
  329. \ee0 home
  330. \ekh home
  331. \ee$ end
  332. \eke end
  333. \eek up
  334. \eku up
  335. \eej down
  336. ^G abort
  337. .TE
  338. .RE
  339. .sp
  340. .
  341. .SH "LESS ENVIRONMENT VARIABLES"
  342. The environment variable section begins with the line
  343. .sp
  344. #env
  345. .sp
  346. Following this line is a list of environment variable assignments.
  347. Each line consists of an environment variable name, an equals sign (=)
  348. and the value to be assigned to the environment variable.
  349. White space before and after the equals sign is ignored.
  350. Variables assigned in this way are visible only to
  351. .BR less .
  352. If a variable is specified in the system environment and also in a
  353. lesskey file, the value in the lesskey file takes precedence.
  354. .
  355. .sp
  356. If the variable name is followed by += rather than =,
  357. the string is appended to the variable's existing value.
  358. This currently works only if any += lines immediately follow
  359. the same variable's original definition (with an = line),
  360. without any intervening definitions of other variables.
  361. It can append only to a variable defined earlier in the file;
  362. it cannot append to a variable in the system environment.
  363. The string is appended literally, without any extra whitespace added,
  364. so if whitespace is desired,
  365. it should be appended to the end of the preceding line.
  366. (It cannot be added to the beginning of the += string because space after
  367. the equals sign is ignored, as noted above.)
  368. .
  369. .SH CONDITIONAL CONFIGURATION
  370. If a line begins with #version followed by a relational operator and a version number,
  371. the remainder of the line is parsed if and only if the running version of
  372. .B less
  373. (or
  374. .BR lesskey )
  375. matches the operator.
  376. This can be helpful if a lesskey file is used by different versions of
  377. .BR less .
  378. .sp
  379. For example, suppose that a new command named 'sideways-search' is added in
  380. .B less
  381. version 777.
  382. Then the following line would assign the command to the Q key, but only in versions of
  383. .B less
  384. which support it. The line would be ignored by versions earlier than 777.
  385. .sp
  386. .nf
  387. #version >= 777 Q sideways-search
  388. .fi
  389. .sp
  390. These six operators are supported:
  391. .RS 5m
  392. .TS
  393. l l.
  394. > Greater than
  395. < Less than
  396. >= Greater than or equal to
  397. <= Less than or equal to
  398. = Equal to
  399. != Not equal to
  400. .TE
  401. .RE
  402. .sp
  403. The #version feature is not supported in
  404. .B less
  405. and
  406. .B lesskey
  407. before version 594.
  408. In those older versions, all #version lines are ignored.
  409. .
  410. .SH EXAMPLE
  411. The following input file sets the \-i and \-S options when
  412. .less
  413. is run and, on version 595 and higher, adds a \-\-color option.
  414. .sp
  415. .nf
  416. #env
  417. ## (Note that there must be a space at the end of the next line,
  418. ## to separate the --color option from the -S option.)
  419. LESS = \-i\ \-S\
  420. #version\ >=\ 595\ \ LESS\ +=\ \-\-color=Hkc
  421. .fi
  422. .
  423. .SH "SEE ALSO"
  424. .BR less (1)
  425. .
  426. .SH WARNINGS
  427. On MS-DOS and OS/2 systems, certain keys send a sequence of characters
  428. which start with a NUL character (0).
  429. This NUL character should be represented as \e340 in a lesskey file.
  430. .
  431. .SH COPYRIGHT
  432. Copyright (C) 1984-2023 Mark Nudelman
  433. .PP
  434. less is part of the GNU project and is free software.
  435. You can redistribute it and/or modify it
  436. under the terms of either
  437. (1) the GNU General Public License as published by
  438. the Free Software Foundation; or (2) the Less License.
  439. See the file README in the less distribution for more details
  440. regarding redistribution.
  441. You should have received a copy of the GNU General Public License
  442. along with the source for less; see the file COPYING.
  443. If not, write to the Free Software Foundation, 59 Temple Place,
  444. Suite 330, Boston, MA 02111-1307, USA.
  445. You should also have received a copy of the Less License;
  446. see the file LICENSE.
  447. .PP
  448. less is distributed in the hope that it will be useful, but
  449. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  450. or FITNESS FOR A PARTICULAR PURPOSE.
  451. See the GNU General Public License for more details.
  452. .
  453. .SH AUTHOR
  454. .
  455. Mark Nudelman
  456. .br
  457. Report bugs at https://github.com/gwsw/less/issues.