0

I am using Vim with airline for many years. Today I decided to test NeoVim. While in Vim the airline with my Nerd Font works great, in NeoVim it seems to ignore the Nerd Font. NeoVim doesn't display any kind of symbols or edges/arrows at all.

I tried to copy the airline settings from vim to neovim as follows (adapted for lazy as package manager):

{
    "vim-airline/vim-airline",
    lazy = false,
    dependencies = {
        "vim-airline/vim-airline-themes"
    },
    config = function()
        -- airline
        vim.cmd("let g:airline_powerline_fonts = 1")
        vim.cmd("let g:airline_theme='dark'")
        vim.cmd("let g:airline#extensions#whitespace#enabled=0")
        vim.cmd("let g:airline#extensions#wordcount#enabled=0")
        vim.cmd("let g:airline#extensions#syntastic#enabled=1")
        vim.cmd("let g:airline_section_c=''")
        vim.cmd("let g:airline_skip_empty_sections = 1")

        -- tabline configuration
        vim.cmd("let g:airline#extensions#tabline#enabled=1")
        vim.cmd("let g:airline#extensions#tabline#show_splits=0")
        vim.cmd("let g:airline#extensions#tabline#show_buffers=0")
        vim.cmd("let g:airline#extensions#tabline#show_tabs=1")
        vim.cmd("let g:airline#extensions#tabline#exclude_preview=1")
        vim.cmd("let g:airline#extensions#tabline#show_tab_nr=1")
        vim.cmd("let g:airline#extensions#tabline#tab_nr_type=1")
        vim.cmd("let g:airline#extensions#tabline#show_tab_type=1")
        vim.cmd("let g:airline#extensions#tabline#fnamemod=':t'")
        vim.cmd("let g:airline#extensions#tabline#fnamecollapse=1")
        vim.cmd("let g:airline#extensions#tabline#buffer_min_count=0")
        vim.cmd("let g:airline#extensions#tabline#show_close_button=0")
        -- removes leading "tabs>"
        vim.cmd("let airline#extensions#tabline#tabs_label = ''")
    end
}

(I also tried swapping the plugin and dependency order of vim-airline and vim-airline-themes - doesn't change anything)

Vim and NeoVim are running in a stack consisting of zsh, tmux, alacritty. Alacritty uses the following font setting:

# Font configuration (changes require restart)
font:
  # The normal (roman) font face to use.
  # UbuntuMono Nerd Font Bold 19
  normal:
    family: UbuntuMono Nerd Font
    style: Bold

  # The bold font face
  bold:
    family: UbuntuMono Nerd Font
    style: Bold

  # The italic font face
  italic:
    family: UbuntuMono Nerd Font
    style: Bold Italic

  # Point size of the font
  #size: 18.5
  size: 13.5

  # Offset is the extra space around each character. offset.y can be thought of
  # as modifying the linespacing, and offset.x as modifying the letter spacing.
  offset:
    x: 1
    y: 0

  # Glyph offset determines the locations of the glyphs within their cells with
  # the default being at the bottom. Increase the x offset to move the glyph to
  # the right, increase the y offset to move the glyph upward.
  glyph_offset:
    x: 0
    y: 0

  # OS X only: use thin stroke font rendering. Thin strokes are suitable
  # for retina displays, but for non-retina you probably want this set to
  # false.
  # use_thin_strokes: true

As information in Vim the settings looked as follows:

" airline
let g:airline_powerline_fonts = 1
" let g:airline_theme='murmur'
let g:airline_theme='dark'
let g:airline#extensions#whitespace#enabled=0
let g:airline#extensions#wordcount#enabled=0
let g:airline#extensions#syntastic#enabled=1
let g:airline_section_c=''
" let g:airline_section_x=''
let g:airline_skip_empty_sections = 1

" tabline configuration
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#show_splits=0
let g:airline#extensions#tabline#show_buffers=0
let g:airline#extensions#tabline#show_tabs=1
let g:airline#extensions#tabline#exclude_preview=1
let g:airline#extensions#tabline#show_tab_nr=1
let g:airline#extensions#tabline#tab_nr_type=1
let g:airline#extensions#tabline#show_tab_type=1
let g:airline#extensions#tabline#fnamemod=':t'
let g:airline#extensions#tabline#fnamecollapse=1
let g:airline#extensions#tabline#buffer_min_count=0
let g:airline#extensions#tabline#show_close_button=0
" removes leading "tabs>"
let airline#extensions#tabline#tabs_label = ''

How to fix the Depiction in NeoVim?

4
  • 1
    Do you have vim-devicons installed? Is it installed before vim-airline? Apr 5, 2023 at 11:47
  • Already found the problem - took me about an hour (even so I just asked the question) - I had to outsource the settings (not loading them within lazy. I can't tell the reason only that NeoVim and Lazy ignored the settings before. (No, I don't have and use devicons but everything works now.) Should I delete the question?
    – baxbear
    Apr 5, 2023 at 11:51
  • 1
    Maybe could you post your solution for others. In two days you'll be allowed to accept it in order to let the question rest :-) Apr 5, 2023 at 12:14
  • 1
    Thanks for the feedback :-) Apr 5, 2023 at 12:14

2 Answers 2

0

I noticed that the configuration of airline has to be done independent of the plugin loading block in Lazy.

It seems not to matter at all whether I load both plugins (vim-airline and vim-airline-themes) independently or in dependency of each other. Furthermore, the order seems also irrelevant.

1
  • Thanks for the answer. Maybe you could provide your configuration (both airline.lua and init.lua) to make more clear to the others :-) Apr 5, 2023 at 13:07
0

I was able to get the configurations for airline to be properly applied with lazy.nvim by using init = instead of config =, e.g.

local function airline_config()
    vim.g["airline#extensions#tabline#enabled"] = true
    vim.g["airline#extensions#tabline#show_buffers"] = true  -- Show buffers
    vim.g["airline#extensions#tabline#tab_nr_type"] = 1  -- Show tab numbers
    vim.g["airline#extensions#tabline#buffer_min_count"] = 2  -- Hide tabline when there is only one buffer

    vim.g.airline_powerline_fonts = true
    vim.g.airline_theme = "zenburn"
end

require("lazy").setup({
    {
        "vim-airline/vim-airline",
        init = airline_config,
        dependencies = {
            "vim-airline/vim-airline-themes",
        }
    },
})

With init it works as expected, while with config powerline fonts don't load, for example.

Your Answer

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

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