Lightline.vim: component_type setting ignored?

Created on 19 Jul 2016  路  3Comments  路  Source: itchyny/lightline.vim

Hi, I use neovim and have this in my init.vim:

let g:lightline = {
\ 'colorscheme': 'solarized',
\ 'active': {
\   'left': [ [ 'mode', 'paste' ],
\             [ 'tabs_spaces', 'readonly', 'filename', 'modified' ] ],
\   'right': [ [ 'lineinfo' ],
\              [ 'percent' ],
\              [ 'fileformat', 'fileencoding', 'filetype', 'neomake' ] ],
\ },
\ 'component': {
\   'tabs_spaces': '%{(&expandtab?"spaces":"tabs").":".&tabstop}',
\ },
\ 'component_function': {
\   'neomake': 'neomake#statusline#LoclistStatus',
\ },
\ 'component_type': {
\   'paste': 'warning',
\   'neomake': 'error',
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '|', 'right': '|' }
\}

Specifically, I added this bit:

\ 'component_type': {
\   'paste': 'warning',
\   'neomake': 'error',
\ },

because I would like to show those components in orange and red. However, this setting seems to have no effect. Perhaps I misunderstood the purpose of component_type?

Thanks!

configuration question

Most helpful comment

Yeah, seems I should have read the docs. Leaving here the correct config for future reference. Thanks!

let g:lightline = {
\ 'colorscheme': 'solarized',
\ 'active': {
\   'left': [ [ 'mode', 'paste' ],
\             [ 'tabs_spaces', 'readonly', 'filename', 'modified' ] ],
\   'right': [ [ 'lineinfo' ],
\              [ 'percent' ],
\              [ 'fileformat', 'fileencoding', 'filetype', 'neomake' ] ],
\ },
\ 'component_expand': {
\   'paste': 'LightlinePaste',
\   'neomake': 'LightlineNeomake',
\ },
\ 'component': {
\   'tabs_spaces': '%{(&expandtab?"spaces":"tabs").":".&tabstop}',
\ },
\ 'component_type': {
\   'paste': 'warning',
\   'neomake': 'error',
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '|', 'right': '|' }
\}

function LightlinePaste()
    return '%{&paste?"PASTE":""}'
endfunction

function LightlineNeomake()
    return '%{neomake#statusline#LoclistStatus()}'
endfunction

All 3 comments

The document (:h component_type) says that it is A dictionary to specify the types for components in g:lightline.component_expand. There are three types of component: component, component_function and component_expand. The paste component belongs to component (if not configured) and your neomake component belongs to component_function, so they do not have relations to component_type.

Yeah, seems I should have read the docs. Leaving here the correct config for future reference. Thanks!

let g:lightline = {
\ 'colorscheme': 'solarized',
\ 'active': {
\   'left': [ [ 'mode', 'paste' ],
\             [ 'tabs_spaces', 'readonly', 'filename', 'modified' ] ],
\   'right': [ [ 'lineinfo' ],
\              [ 'percent' ],
\              [ 'fileformat', 'fileencoding', 'filetype', 'neomake' ] ],
\ },
\ 'component_expand': {
\   'paste': 'LightlinePaste',
\   'neomake': 'LightlineNeomake',
\ },
\ 'component': {
\   'tabs_spaces': '%{(&expandtab?"spaces":"tabs").":".&tabstop}',
\ },
\ 'component_type': {
\   'paste': 'warning',
\   'neomake': 'error',
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '|', 'right': '|' }
\}

function LightlinePaste()
    return '%{&paste?"PASTE":""}'
endfunction

function LightlineNeomake()
    return '%{neomake#statusline#LoclistStatus()}'
endfunction

@dessaya Thanks for sharing the final, working conf. Saved me plenty of time, and works like a charm! 馃帀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Char-Aznable picture Char-Aznable  路  4Comments

dongsibo picture dongsibo  路  4Comments

codepushr picture codepushr  路  3Comments

yunlingz picture yunlingz  路  4Comments

JIAKanghao picture JIAKanghao  路  4Comments