0

I am trying to setup my neovim with the operator mono. I am running neovim in iterm2, so I have used the profile preferences to select the Operator font, and that is more or less working.

However I would rather use my vimrc to specify the font for neovim. So my first question is whether that is possible?

Partly, I'd like to do that because I would like to take advantage of the Operator fonts special italics. Normally, I'd activate those for comments in my vimrc like so:

highlight Comment gui=italic
highlight Comment cterm=italic
highlight htmlArg gui=italic
highlight htmlArg cterm=italic

However, these don't seem to work with neovim. So my second question is: how do I activate Operator italic font for commented out code in neovim.

Thanks!

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
fraxture
  • 5,113
  • 4
  • 43
  • 83

1 Answers1

4

AFAIK, terminal vim/neovim use the font-family that's specified in your terminal emulator preferences. So no, you can't specify the font family in your vimrc.

To get italic comments, create a xterm-256color-italic.terminfo anywhere on your computer with these contents:

 # A xterm-256color based TERMINFO that adds the escape sequences for italic.
xterm-256color-italic|xterm with 256 colors and italic,
  sitm=\E[3m, ritm=\E[23m,
  use=xterm-256color,

then do tic xterm-256color-italic.terminfo (from the same location as the file). This will create a new TERMINFO to be added to the TERM database.

Now, to setup iterm2 to use this terminfo, set Report Terminal Type under Terminal tab of your iterm profile to the value xterm-256color-italic (type it manually as it might not show up on the dropdown menu.

enter image description here

If you relaunch iterm2, you should have italic comments now with highlight Comment cterm=italic on your vimrc. Verify this with

 echo `tput sitm`italics`tput ritm` 

source: https://alexpearce.me/2014/05/italics-in-iterm2-vim-tmux/#tmux-21-and-above

nabn
  • 2,324
  • 24
  • 26
  • only thing is now for reasons that i don't completely understand, when i start and then ssh into one of my vagrants, I'm getting an error on the command line: "open terminal failed: missing or unsuitable terminal: xterm-256color-italic". and many basic things like the backspace key aren't working. – fraxture Aug 18 '16 at 15:40
  • no worries. it's not ideal, but for the moment, i'm seeing if i can do the same installation of the terminfo into the vagrant guest. – fraxture Aug 18 '16 at 15:46