tmux手册页搜索突出显示 [英] tmux man-page search highlighting
问题描述
例如,当我在 tmux
会话中搜索 man ls
时,搜索字符串不会t会以突出显示的形式出现-该页面跳下来,使得搜索字符串如预期那样位于缓冲区的第一行,但未突出显示。
When I search in, for example, man ls
while in a tmux
session, the search strings don't appear highlighted - the page jumps down so that the search string is on the top line of the buffer, as expected, but it's not highlighted.
在同一外壳中而不在 tmux
会话中执行相同的操作会导致突出显示搜索字符串。
Doing the same thing in the same shell while not in a tmux
session results in highlighted search strings.
我不知道从哪里着手解决这个问题。任何提示表示赞赏。
I have no idea where to start looking to solve this. Any hints are appreciated.
推荐答案
修复了该问题。问题在于屏幕
$ TERM
处理斜体的方式。从 tmux
常见问题解答:
Fixed it. The problem is to do with the way that the screen
$TERM
handles italics. From the tmux
FAQ:
vim显示反向视频而非斜体,而较少显示斜体
(或仅显示常规文本)而非反向。怎么了?
vim displays reverse video instead of italics, while less displays italics (or just regular text) instead of reverse. What's wrong?
这完全符合我的问题。 man
使用的 $ PAGER
默认为 less
-基本上, man
使用 less
来显示手册页的内容。就我而言, less
不是突出显示文本,只是显示常规文本。
This matches my problem exactly. The $PAGER
used by man
is less
by default - basically, man
uses less
to show the contents of the manual pages. In my case, less
wasn't highlighting text, just showing regular text.
发生这种情况的原因:
屏幕的terminfo描述缺少斜体模式,并且在
位置具有突出模式,但是使用了urxvt用于斜体的相同转义序列。
意味着寻找斜体的应用程序(如vim)将找不到它,并且可能
会扭转其位置,而要求
脱颖而出的应用程序(如更少)将以斜体结尾
Screen's terminfo description lacks italics mode and has standout mode in its place, but using the same escape sequence that urxvt uses for italics. This means applications (like vim) looking for italics will not find it and might turn to reverse in its place, while applications (like less) asking for standout will end up with italics instead of reverse.
解决方案是为<创建一个新的 terminfo
文件code> tmux ,这表明它支持斜体。 (在撰写本文时) tmux
常见问题的底部非常概述了该解决方案。
The solution is to make a new terminfo
file for tmux
, which lets it know that italics are supported. The solution's outlined in the (at time of writing) very, very bottom of the tmux
FAQ.
在创建新的 terminfo
文件后,在 tmux
中: Cb:源文件/absolute/path/to/.tmux.conf
(来自此SuperUser问题)-该应该使 tmux
重新加载 .tmux.conf
文件。但是,这对我不起作用,并且更改仅在重新启动 tmux
服务器(关闭所有 tmux
)后应用会话,然后重新打开它们)。
After creating the new terminfo
file, in tmux
: C-b :source-file /absolute/path/to/.tmux.conf
(from this SuperUser question) - this should make tmux
reload the .tmux.conf
file. However, this didn't work for me, and the changes only applied after restarting the tmux
server (close all tmux
sessions, then re-open them).
这篇关于tmux手册页搜索突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!