如何设置hjkl?

Ann*_*nna 10 less

less已经使用 j/k 进行垂直滚动,但没有使用 h/l 进行水平滚动(在--ch模式下)。l 键无论如何都没有绑定到任何东西,h 只是 H 的同义词,所以我不会覆盖任何重要的绑定。

如何使 h 和 l 水平滚动?

Sha*_*off 8

man less 告诉我们以下内容:

You  may  define your own less commands by using the program lesskey
(1) to create a lesskey file.  This file specifies a set of  command
keys  and  an  action  associated  with  each key.  You may also use
lesskey to change the line-editing keys (see LINE EDITING),  and  to
set  environment  variables.  If the environment variable LESSKEY is
set, less uses that as the name of  the  lesskey  file.   Otherwise,
less  looks  in  a  standard  place  for  the  lesskey file: On Unix
systems, less looks for a lesskey file called "$HOME/.less".
Run Code Online (Sandbox Code Playgroud)

它告诉我们使用lesskey生成的lesskey 文件读取man lesskey填充细节。您可以将以下内容放在 lesskey 输入文件中(~/.lesskey默认情况下)

h left-scroll
l right-scroll
Run Code Online (Sandbox Code Playgroud)

然后运行lesskey,它将~/.less为您生成一个输出文件(默认情况下)。

据我所知,您不能逐个字符地进行水平滚动。