tmux man-page search highlighting in Cygwin/Mintty

Wed 14 January 2015 / In categories Dev Tools

Cygwin, tmux

Inspired by the question tmux-man-page-search-highlighting on StackOverflow, I found the solution for this problem from tmux faq, but I applied it with a little tweak (The original solution will cause coloring problems in ls output for my Cygwin/Mintty).

Make sure you have ncurses package installed in Cygwin!

$ mkdir $HOME/.terminfo/
$ screen_terminfo="screen-256color"
$ infocmp "$screen_terminfo" | sed \
          -e 's/^screen[^|]*|[^,]*,/screen-256color|screen-256color with italics support,/' \
          -e 's/%?%p1%t;3%/%?%p1%t;7%/' \
          -e 's/smso=[^,]*,/smso=\\E[7m,/' \
          -e 's/rmso=[^,]*,/rmso=\\E[27m,/' \
          -e '$s/$/ sitm=\\E[3m, ritm=\\E[23m,/' > /tmp/screen.terminfo
$ tic -o $HOME/.terminfo /tmp/screen.terminfo

The result can be found at .terminfo/73/screen-256color

The final step is to set the default-terminal to screen-256color in your .tmux.conf

set -g default-terminal screen-256color

Cheers.

Load Disqus Comments