NeoRoot.lua icon indicating copy to clipboard operation
NeoRoot.lua copied to clipboard

Feat. Request: Mode indicator.

Open nyngwang opened this issue 3 years ago • 1 comments

As title. An eye-catching emoji will be great, and it should be configured via setup.

nyngwang avatar Jan 28 '22 04:01 nyngwang

If you add this in neo-root.lua

function M.getMode()
    return CUR_MODE
end

you can fetch the state with require'neo-root'.getMode() and use this in your vim setup as you use eg. for lightline

let s:NeoRootGetMode = luaeval("require'neo-root'.getMode")
function NeoRootMode()
	if s:NeoRootGetMode() == 1 
		return "🐒"
	else
		return "🌳"
	endif
endfunction

" status line configuration
let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ],
      \             [ 'readonly', 'filename', 'modified', 'neoroot' ] ],
	  \  'right': [
	  \	            [ 'percent' ],
	  \             [ 'fileformat', 'fileencoding', 'filetype' ] ] },
      \ 'component_function': {
	  \   'neoroot': 'NeoRootMode'
      \ },
      \ }

Adding this function or a similar should be easier and more flexible than any status line shenanigans.

JBenda avatar Jan 28 '22 11:01 JBenda