Less

如何以更少的成本設置 hjkl?

  • December 22, 2012

less已經使用 j/k 進行垂直滾動,但沒有使用 h/l 進行水平滾動(在--ch模式下)。l 鍵無論如何都沒有綁定到任何東西,而 h 只是 H 的同義詞,所以我不會覆蓋任何重要的綁定。

如何使 h 和 l 水平滾動?

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".

它告訴我們使用lesskey生成的lesskey文件讀取man lesskey填充細節。您可以將以下內容放在 lesskey 輸入文件中(~/.lesskey預設情況下)

h left-scroll
l right-scroll

然後執行lesskey,它會~/.less為你生成一個輸出文件(預設)。

據我所知,您不能逐個字元地進行水平滾動。

引用自:https://unix.stackexchange.com/questions/59188