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!
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! 馃帀
Most helpful comment
Yeah, seems I should have read the docs. Leaving here the correct config for future reference. Thanks!