简体   繁体   中英

Vim 7.4+ highlighting italics in black on macOS

On macOS Sierra, Vi(m) 7.4+ in Terminal.app and iTerm2 highlights emphasized and italicized markup in black. This includes *example* in Markdown files, and \\emph{example} in TeX files.

GUI MacVim properly italicizes this text.

Even running the barebones command vi -u NONE test.md +"syntax on" (where test.md contains *example* ) from Terminal.app, this bug still occurs.

At best, I would like to make iTerm2 recognize and italicize this text. At worst, I would like to at least stop highlighting the text in black.

Reading the source-code for vim indicates that it is capable of doing italics.

The fix for that would be a correct terminal description. Italics only became fashionable 4-5 years ago, and MacOS's copy of the ncurses terminal database is much older than that.

There was some recent discussion of iTerm2 on the ncurses mailing list, and an updated terminal description resulted:

#   Reconstructed via infocmp from file: /usr/local/ncurses/share/terminfo/i/iterm2
iTerm2.app|iterm2|terminal emulator for Mac OS X,
    am, bce, hs, mir, msgr, npc, xenl, xon,
    colors#0x100, cols#80, it#8, lines#24, pairs#0x7fff, wsl#50,
    acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
    bel=^G, blink@, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J,
    cnorm=\E[?25h, cr=\r, csr=\E[%i%p1%d;%p2%dr,
    cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\n,
    cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH,
    cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P,
    dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, dsl=\E]2;\007, ed=\E[J,
    el=\E[K, el1=\E[1K, enacs=\E(B\E)0,
    flash=\E[?5h$<200/>\E[?5l, fsl=^G, home=\E[H,
    hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@,
    il=\E[%p1%dL, il1=\E[L, ind=\n, kEND=\E[1;2F, kHOM=\E[1;2H,
    kLFT=\E[1;2D, kRIT=\E[1;2C, ka1@, ka3@, kb2@, kbs=^?, kc1@, kc3@,
    kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
    kdch1=\E[3~, kend=\EOF, kent@, kf1=\EOP, kf10=\E[21~,
    kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
    kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
    kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
    kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, kf3=\EOR,
    kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~,
    kf9=\E[20~, khome=\EOH, kind=\E[1;2B, knp=\E[6~, kpp=\E[5~,
    kri=\E[1;2A, op=\E[0m, rc=\E8, rev=\E[7m, ri=\EM,
    ritm=\E[23m, rmacs=^O, rmam=\E[?7l,
    rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>,
    rmso=\E[m, rmul=\E[m,
    rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
    setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
    setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
    sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
    sgr0=\E[m\017, sitm=\E[3m, smacs=^N, smam=\E[?7h,
    smcup=\E7\E[?47h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m,
    smul=\E[4m, tbc=\E[3g, tsl=\E]2;, u6=\E[%i%d;%dR, u7=\E[6n,
    u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,

To use that, you would save it to a file, and run tic to compile it (and set TERM to iterm2 , of course). iTerm2 mis-sets TERM to "xterm" by default, but that would be incorrect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM