Nvim config as is right now. Minimal config below.
Self Checks
[x] I'm using the latest lualine.
[x] I didn't find the issue in existing issues or PRs.
How to reproduce the problem
Open up neovim in your terminal, try to update with :Lazy update and look at the error.
Expected behaviour
Plugins are updated without an issue.
Actual behaviour
I get the following error:
Error executing vim.schedule lua callback: ...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:429: Error executing lua: ...cal/share/nvim/lazy/lualine.nvim/lua/lu
aline_require.lua:31: attempt to index field 'loaded' (a nil value)
stack traceback:
...cal/share/nvim/lazy/lualine.nvim/lua/lualine_require.lua:31: in function 'require'
...l/share/nvim/lazy/lualine.nvim/lua/lualine/highlight.lua:40: in function 'get_mode_suffix'
...l/share/nvim/lazy/lualine.nvim/lua/lualine/highlight.lua:246: in function 'append_mode'
...l/share/nvim/lazy/lualine.nvim/lua/lualine/highlight.lua:436: in function 'format_highlight'
...are/nvim/lazy/lualine.nvim/lua/lualine/utils/section.lua:18: in function 'draw_section'
...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:170: in function 'statusline'
...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:298: in function <...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:279>
[C]: in function 'nvim_win_call'
...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:429: in function 'refresh'
...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:353: in function <...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:352>
stack traceback:
[C]: in function 'nvim_win_call'
...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:429: in function 'refresh'
...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:353: in function <...ttio/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:352>
call plug#begin("/home/mattio/.config/test_01_nvim/test/.local/share/nvim/plugged")
" Your plugins go here like
Plug 'nvim-lualine/lualine.nvim'
call plug#end()
" Your Viml part of config goes here
" colorscheme onedark
-- Always display the status line
vim.o.laststatus = 3
-- Enables syntax highlighting
vim.cmd('syntax enable')
-- Required to keep multiple buffers open multiple buffers
vim.o.hidden = true
-- Display long lines as just one line
vim.o.wrap = false
-- The encoding displayed
vim.o.encoding = 'utf-8'
-- Makes popup menu smaller
vim.o.pumheight = 10
-- The encoding written to file
vim.o.fileencoding = 'utf-8'
-- Show the cursor position all the time
vim.o.ruler = true
-- More space for displaying messages
vim.o.cmdheight = 1
-- Treat dash separated words as a word text object
--vim.o.iskeyword = vim.o.iskeyword .. '-'
-- Enable your mouse
vim.o.mouse = 'a'
-- Horizontal splits will automatically be below
vim.o.splitbelow = true
-- Vertical splits will automatically be to the right
vim.o.splitright = true
-- Support 256 colors
--vim.o.t_Co = 256
-- So that I can see ` conceal level in markdown files
vim.o.conceallevel = 0
-- Insert 2 spaces for a tab
vim.o.tabstop = 2
-- Change the number of space characters inserted for indentation
vim.o.shiftwidth = 2
-- Makes tabbing smarter will realize you have 2 vs 4
vim.o.smarttab = true
-- Converts tabs to spaces
vim.o.expandtab = true
-- Makes indenting smart
vim.o.smartindent = true
-- Good auto indent
vim.o.autoindent = true
-- Status line configuration
vim.o.statusline = '%m %F %m%y %{&fileencoding?&fileencoding:&encoding}%T %=%(C:%c L:%l %P%)'
-- Line numbers
vim.o.number = true
-- Enable highlighting of the current line
vim.o.cursorline = true
-- Tell Neovim what the background color looks like
vim.o.background = 'dark'
-- Always show tabs
vim.o.showtabline = 3
-- We don't need to see things like -- INSERT -- anymore
vim.o.showmode = false
-- This is recommended by coc
vim.o.backup = false
-- This is recommended by coc
vim.o.writebackup = false
-- Faster completion
vim.o.updatetime = 300
-- By default timeoutlen is 1000 ms
vim.o.timeoutlen = 500
-- Stop newline continuation of comments
vim.o.formatoptions = vim.o.formatoptions:gsub("[cro]", "")
-- Copy paste between Neovim and everything else
vim.o.clipboard = 'unnamedplus'
-- Your working directory will always be the same as your working directory
vim.o.autochdir = true
-- Enable reading .exrc files
vim.o.exrc = true
vim.o.cmdwinheight = 1
vim.o.wildmenu = true
--vim.o.nolist = true
vim.o.wildmode = 'longest:full,full'
vim.o.secure = true
vim.o.relativenumber = true
vim.o.colorcolumn = '110'
vim.o.smartcase = true
vim.o.swapfile = false
vim.o.undofile = true
vim.o.incsearch = true
-- Highlight ColorColumn background
vim.cmd('highlight ColorColumn ctermbg=gray')
-- Auto source when writing to init.vim; alternatively, you can run :source $MYVIMRC
vim.api.nvim_exec([[
augroup auto_source
autocmd!
autocmd BufWritePost $MYVIMRC source %
augroup END
]], false)
-- You can't stop me
vim.api.nvim_set_keymap('c', 'w!!', 'w !doas tee %', { noremap = true, silent = true })
-- Header files would be recognized as cpp
vim.api.nvim_exec([[
augroup project
autocmd!
autocmd BufRead,BufNewFile *.h,*.c set filetype=c
augroup END
]], false)
-- Set markdown fenced languages
vim.g.markdown_fenced_languages = {'typescript', 'c', 'python', 'cpp'}
lua << END
-- Your lua part of config goes here
require'lualine'.setup {
-- Eviline config for lualine
-- Author: shadmansaleh
-- Credit: glepnir
local lualine = require('lualine')
-- Color table for highlights
-- stylua: ignore
local colors = {
bg = '#1a1a1a',
fg = '#fbf1c7',
yellow = '#c4b392',
cyan = '#98acc8',
darkblue = '#9e96b6',
green = '#b6b696',
orange = '#cdab89',
violet = '#9e96b6',
magenta = '#b696b1',
blue = '#98acc8',
red = '#d49191',
}
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = '',
section_separators = '',
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline
normal = { c = { fg = colors.fg, bg = colors.bg } },
inactive = { c = { fg = colors.fg, bg = colors.bg } },
},
},
sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
-- These will be filled later
lualine_c = {},
lualine_x = {},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
}
-- Inserts a component in lualine_c at left section
local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
-- Inserts a component in lualine_x ot right section
local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
ins_left {
function()
return '▊'
end,
color = { fg = colors.blue }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don't need space before this
}
ins_left {
-- mode component BSD bsd
function()
return ''
-- return ''
end,
color = function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.red,
i = colors.green,
v = colors.blue,
[''] = colors.blue,
V = colors.blue,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
t = colors.red,
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
ins_left {
-- filesize component
'filesize',
cond = conditions.buffer_not_empty,
}
ins_left {
'filename',
cond = conditions.buffer_not_empty,
color = { fg = colors.magenta, gui = 'bold' },
}
ins_left { 'location' }
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
ins_left {
'diagnostics',
sources = { 'nvim_diagnostic' },
symbols = { error = ' ', warn = ' ', info = ' ' },
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan },
},
}
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2
ins_left {
function()
return '%='
end,
}
--ins_left {
-- Lsp server name .
--function()
--local msg = 'No Active Lsp'
--local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
--local clients = vim.lsp.get_active_clients()
--if next(clients) == nil then
--return msg
--end
--for _, client in ipairs(clients) do
--local filetypes = client.config.filetypes
--if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
--return client.name
--end
--end
--return msg
--end,
--icon = ' LSP:',
--color = { fg = '#ffffff', gui = 'bold' },
--}
-- Add components to right sections
ins_right {
'o:encoding', -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'fileformat',
fmt = string.upper,
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'branch',
icon = '',
color = { fg = colors.violet, gui = 'bold' },
}
ins_right {
'diff',
-- Is it me or the symbol for modified us really weird
symbols = { added = ' ', modified = '◆ ', removed = ' ' },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
cond = conditions.hide_in_width,
}
ins_right {
function()
return '▊'
end,
color = { fg = colors.blue },
padding = { left = 1 },
}
-- Now don't forget to initialize lualine
lualine.setup(config)
}
END
Nvim config as is right now. Minimal config below.
Self Checks
How to reproduce the problem
Open up
neovim
in your terminal, try to update with:Lazy update
and look at the error.Expected behaviour
Plugins are updated without an issue.
Actual behaviour
I get the following error:
Minimal config to reproduce the issue
Configuration used for lualine . It's the default config for evil lualine
Additional information