szymro
szymro

Reputation: 13

Configuring vim lightline

I've got plug itchyny/lightline.vim and it's work fine. I would like to reconfigure my status line and add same fields e.g. spell. When I copy from help this code into my .vimrc to add e.g. spell fields,

let g:lightline.active = { 
\ 'left': [ [ 'mode', 'paste' ],
\           [ 'readonly', 'filename', 'modified' ] ],
\ 'right': [ [ 'lineinfo' ],
\            [ 'percent' ], 
\            [ 'fileformat', 'fileencoding', 'filetype' ] ] }

VIM gives me a error:
E121: Undefined variable: g:lightline

Could someone help

Upvotes: 1

Views: 1716

Answers (1)

Matt
Matt

Reputation: 15186

You can't address a field within dictionary if the dictionary doesn't exist yet. For this reason the docs suggest something like this:

let g:lightline = {
    'active': {
        ...
    }
    ...
}

Or, alternatively, you can create an empty dict and then set its fields like this:

let g:lightline = {}
let g:lightline.active = { ... }

Upvotes: 1

Related Questions