/vital-Neon

Highlight text dynamically

Primary LanguageVim scriptOtherNOASSERTION

vital-Neon logo

A vital module to highlight text dynamically.

Requirements

Usage

Blink text that matches a specified pattern

let s:blink_flow = [
      \   ['DiffDelete', 300],
      \   ['NONE', 300],
      \ ]
call s:Neon.add(s:blink_flow, '\[\zs[^]]*\ze\],', {'repeat': -1})

demo-blink

Create a mapping that glows the cursor line

highlight MyGlow1 ctermbg=236 guibg=#161821
highlight MyGlow2 ctermbg=237 guibg=#222428
highlight MyGlow3 ctermbg=238 guibg=#2e3130
highlight MyGlow4 ctermbg=239 guibg=#393d37
highlight MyGlow5 ctermbg=240 guibg=#45493e
let s:glow_flow = [
      \   ['MyGlow1', 200],
      \   ['MyGlow2', 200],
      \   ['MyGlow3', 200],
      \   ['MyGlow4', 200],
      \   ['MyGlow5', -1],
      \ ]
function s:glow_cursorline() abort
  let cursorlnum = line('.')
  call s:Neon.add(s:glow_flow, [cursorlnum])
endfunction
nnoremap <F7> <Cmd>call <SID>glow_cursorline()<CR>

demo-glow

Create a mapping that flashes the lines indented by = operator

highlight MyFlash1 ctermbg=240 guibg=#384851
highlight MyFlash2 ctermbg=239 guibg=#303c45
highlight MyFlash3 ctermbg=238 guibg=#273039
highlight MyFlash4 ctermbg=237 guibg=#1f242d
highlight MyFlash5 ctermbg=236 guibg=#161821
let s:flash_flow = [
      \   ['MyFlash1', 50],
      \   ['MyFlash2', 50],
      \   ['MyFlash3', 50],
      \   ['MyFlash4', 50],
      \   ['MyFlash5', 50],
      \ ]
function s:set_operatorfunc() abort
  let &operatorfunc = get(funcref('s:hl_indent'), 'name')
  return ''
endfunction
function s:hl_indent(_) abort
  normal! =g']
  call s:Neon.add(s:flash_flow, range(line("'["), line("']")))
endfunction
nnoremap <expr> = <SID>set_operatorfunc() .. 'g@'
xnoremap <expr> = <SID>set_operatorfunc() .. 'g@'

demo-flash

License

NYSL Version 0.9982