0

I am trying to have a better visualization while editing Markdown file in vim, I try to visualize the italic and bold text. However, I found the bold italic text work, while the italic itself doesn't work. It happens outside and insde tmux. I have try use another font, while the italic text itself still not display properly. I don't why the bold italic text can work.

Version of OS, Vim and Terminal emulator:

MacOS : 12.6
Vim : 9.0
Alacritty : 0.11.0

inside alacritty.yml:

font:
  normal:
    family: Menlo 
  size: 14.0

Inside .vimrc:

set background=dark
if !has('gui_running') && &term =~ '^\%(screen\|tmux\)'
  let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
syntax on
set termguicolors
colorscheme onedark

Inside .tmux.conf:

set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"

The terminal emulator does support italic:

Screenshot of italic test

Screenshot of the issue in markdown file:

Bold and italic text in vim


Here is the lines in ~/.vim/colors/onedark.vim that related to markdown italic highlight. enter image description here

2
  • I have to agree with the answer below; the issue isn't that Vim + Alacritty + Tmux don't support italic, it's that the markdown syntax isn't applying italics correctly in _Italic text_.
    – D. Ben Knoble
    Mar 24 at 13:35
  • Answers do not belong as edits to questions. Please post an answer below.
    – D. Ben Knoble
    Mar 24 at 15:46

2 Answers 2

0

It looks like your italic text shouldn't be blue to begin with, so I would investigate why this is the case.

You should probably start by identifying the actual highlight group used for _Italic text_.

  1. Execute this command:

    :command! SS echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
    
  2. Execute :SS with the cursor on _Italic text_.

    It should echo something like this:

    ['markdownItalic']
    

Report back with the actual output.

1
  • Thank you for suggestion, I have followed the command you provide, it echos ['mkdNonListItemBlock', 'htmlItalic'] instead of ['markdownItalic'], the color is blue because I have use colorscheme for it, I will add this to the question also. I will also try to change the highlight group of ['mkdNonListItemBlock', 'htmlItalic'] to see if any change apply. Mar 24 at 13:46
0

I have find a solution. Add highlight group to each items I want it in italic in the color scheme soruce file:

highlight foo cterm=italic

It seems like my color scheme cannot handle with italic text, which require me to add those lines manually. The color scheme I am using are onedark for Vim.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.