freebsd-dev/usr.bin/more/default.morerc
Tim Vanderhoek 20d6e5fe6e Thorough revamp of how input commands are processed. This allows customization
of user keys (documentation pending).  The only key whose semantics have
changed is the capital 'N' key, which now performs a repeat-search in the
opposite direction (just like in vi).

This commit is a little bulkier than what I had originally planned.  I'm not
completely happy with the direction it went, but it's definately an
improvement, and the alternative is to continue becoming irrelevant compared
to GNU less.  (Does anyone even _use_ /usr/bin/more these days?)
1999-09-03 22:31:21 +00:00

135 lines
5.6 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#
# This is the default initialization file for more(1). To avoid any need to
# change the manpage or helpfile, almost all commands maintain their historical
# keymappings. Some additional twoggles may be added that will be left for
# the intrepid user to discover.
#
# This file is compiled directly into more; changing this file will not change
# the actual defaults (unless it is changed in the source directory and more
# is recompiled). The correct way to change the global defaults is by
# adding a /etc/dot.morerc global initialization file.
#
# If you use an ~/.morerc that is dependent on specific features of this
# default morerc, you should copy this default morerc to ~/.defmorerc so that
# possible future changes in this file do not cause problems for you. The
# ~/.defmorerc file will cause the compiled-in default morerc to be ignored.
#
# The default initialization file is compiled into more(1) so that more(1)
# will work and be usable even if the filesystem (and the location
# /usr/share/misc/default.morerc, where this would be stored if it was not
# compiled into more(1)) is missing or away without leave (chroot directory,
# fs crash, badly written rescue floppy, or any other reason).
#
# BUGS: a) There is no documentation.
# b) There is no "map" command.
#
# $FreeBSD$
#
# required -- initialize more(1)
deftog
#
# basic internal initialization
#
set lsthscr 1
# Add "set hkey_scroll true" to ~/.morerc to enable all the hjkl keys (but
# disabling h)elp).
set hkey_scroll false
set scr_scroll 0
# We have no way of resetting this on SIGWINCH as the old more A_H_SCROLL did
# It's probably just as well... (since resetting would lose the old value!)
# (Actually, we could emulate it from here if we really wanted to).
set half_scroll (${_sc_height} / 2)
# magic number indicating the value is not initialized
set savedhscroll 87382
macro 1 j 'forw_scroll ${number}'
macro 1 k 'back_scroll ${number}'
macro 1 \e[B 'forw_scroll ${number}'
macro 1 \e[A 'back_scroll ${number}'
macro 1 \n 'forw_scroll ${number}'
macro 1 \e[G 'forw (${_sc_height} * ${number})'
macro 1 \e[I 'back (${_sc_height} * ${number})'
set com_getscr 'condition (${number} != 0); \
set scr_scroll ${number}; \
condition (${number} == 0); \
set scr_scroll ${_sc_height}; \
condition true;'
macro 0 " " 'eval ${com_getscr}; forw ${scr_scroll};'
macro 0 f 'eval ${com_getscr}; forw ${scr_scroll};'
macro 0 "" 'eval ${com_getscr}; forw ${scr_scroll};'
macro 0 b 'eval ${com_getscr}; back ${scr_scroll};'
macro 0 "" 'eval ${com_getscr}; back ${scr_scroll};'
set com_sethalfscroll 'condition (${number} != 0); \
set half_scroll ${number}; \
condition true;'
macro 0 d 'eval ${com_sethalfscroll}; forw_scroll ${half_scroll}'
macro 0 "" 'eval ${com_sethalfscroll}; forw_scroll ${half_scroll}'
macro 0 u 'eval ${com_sethalfscroll}; back_scroll ${half_scroll}'
macro 0 "" 'eval ${com_sethalfscroll}; back_scroll ${half_scroll}'
set com_rscroll 'condition (${number} != 0); \
set lsthscr ${number}; \
condition true; \
rscroll ${lsthscr};'
set com_lscroll 'condition (${number} != 0); \
set lsthscr ${number}; \
condition true; \
lscroll ${lsthscr};'
# this little trick lets the user simply set hkey_scroll=true in their own
# ~/.morerc file to enable the 'l' and 'h' keys the way Bill meant them
macro 0 h 'condition ${hkey_scroll}; eval ${com_lscroll}; \
condition_! ${hkey_scroll}; help; \
condition true;'
macro 0 l 'condition ${hkey_scroll}; eval ${com_rscroll}; \
condition_! ${hkey_scroll}; error "key not enabled"; \
condition true;'
macro 0 :help 'help'
macro 0 \e[C 'eval ${com_rscroll}'
macro 0 \e[D 'eval ${com_lscroll}'
macro 0 \e[H 'condition (${_wraplines_n} && (${savedhscroll} != 87382)); \
rscroll 1; \
rscroll ${savedhscroll}; \
condition_toggle; \
set savedhscroll ${_curhscroll}; \
lscroll ${_curhscroll}; \
lscroll 1; \
condition true;'
macro 1 n 'research ${_ls_direction_n} ${number}'
macro 1 N 'research (${_ls_direction_n} + 1) ${number}'
macro 1 / 'magicasksearch forw ${number}'
macro 1 ? 'magicasksearch back ${number}'
macro 0 G 'condition (${number} == 0); goend; \
condition (${number} != 0); goline ${number}; \
condition true;'
macro 1 g 'goline ${number}'
macro 0 p 'gopercent ${number}'
macro 0 % 'gopercent ${number}'
macro 0 \e[F 'goend'
# Quote since it's technically an isspace() character
macro 0 " " 'repaint'
macro 0 r 'repaint'
macro 0 R 'flush'
macro 0 v 'edit'
macro 0 :e 'askfile'
macro 0 E 'askfile'
# The old keymaping for 'N'
#macro 1 N 'file next ${number}'
macro 1 :n 'file next ${number}'
macro 1 P 'file prev ${number}'
macro 1 :p 'file prev ${number}'
macro 0 :a 'file_list'
macro 0 m 'setmark ?'
macro 0 \' 'gomark ?'
macro 0 :t 'asktag'
macro 1 t 'nexttag ${number}'
macro 1 T 'prevtag ${number}'
macro 0 "" 'stat (${_stat_n} + 1)'
macro 0 = 'stat (${_stat_n} + 1)'
macro 0 q 'quit'
macro 0 :q 'quit'
macro 0 ZZ 'quit'
# This command intentionally disabled by default. The command parser is
# too baroque to expose hapless users to.
#macro 0 :: 'usercom'