N
N
nihi1ist2021-12-22 09:08:48
vim
nihi1ist, 2021-12-22 09:08:48

Error in neovim hardline config, how to solve?

I want to try the nvim-hardline plugin . But when I add the config:

config
lua require('hardline').setup {
\  bufferline = false,  -- enable bufferline
\  bufferline_settings = {
\    exclude_terminal = false,  -- don't show terminal buffers in bufferline
\    show_index = false,        -- show buffer indexes (not the actual buffer numbers) in bufferline
\  },
\  theme = 'default',   -- change theme
\  sections = {         -- define sections
\    {class = 'mode', item = require('hardline.parts.mode').get_item},
\    {class = 'high', item = require('hardline.parts.git').get_item, hide = 100},
\    {class = 'med', item = require('hardline.parts.filename').get_item},
\    '%<',
\    {class = 'med', item = '%='},
\    {class = 'low', item = require('hardline.parts.wordcount').get_item, hide = 100},
\    {class = 'error', item = require('hardline.parts.lsp').get_error},
\    {class = 'warning', item = require('hardline.parts.lsp').get_warning},
\    {class = 'warning', item = require('hardline.parts.whitespace').get_item},
\    {class = 'high', item = require('hardline.parts.filetype').get_item, hide = 80},
\    {class = 'mode', item = require('hardline.parts.line').get_item},
\  },
\}

I get an error:
Error text:
Обнаружена ошибка при обработке /home/nihi1ist/.config/nvim/init.vim:
строка   93:
E5104: Error while creating lua chunk: [string "<VimL compiled string>"]:1: unexpected symbol near '<eof>'
Нажмите ENTER или введите команду для продолжения

Tell me what I'm doing wrong? And how to remove this error?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nihi1ist, 2021-12-23
@nihi1ist

It worked like this:

config
lua << EOF
require('hardline').setup {
  bufferline = false,  -- enable bufferline
  bufferline_settings = {
    exclude_terminal = false,  -- don't show terminal buffers in bufferline
    show_index = false,        -- show buffer indexes (not the actual buffer numbers) in bufferline
  },
  theme = 'default',   -- change theme
  sections = {         -- define sections
    {class = 'mode', item = require('hardline.parts.mode').get_item},
    {class = 'high', item = require('hardline.parts.git').get_item, hide = 100},
    {class = 'med', item = require('hardline.parts.filename').get_item},
    '%<',
    {class = 'med', item = '%='},
    {class = 'low', item = require('hardline.parts.wordcount').get_item, hide = 100},
    {class = 'error', item = require('hardline.parts.lsp').get_error},
    {class = 'warning', item = require('hardline.parts.lsp').get_warning},
    {class = 'warning', item = require('hardline.parts.whitespace').get_item},
    {class = 'high', item = require('hardline.parts.filetype').get_item, hide = 80},
    {class = 'mode', item = require('hardline.parts.line').get_item},
  },
}
EOF

D
dollar, 2021-12-22
@dollar

The error says that the creation of the "lua chunk" failed, because everything seemed to be going well, the syntax was recognized, but suddenly the file ended, and something was missing near the end of the file. This is usually reported when the number of brackets does not match (missing somewhere, or extra at the end).
Any editor with syntax highlighting that can automatically recognize blocks (those between brackets) will help you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question