Skip to content

Instantly share code, notes, and snippets.

@iamFIREcracker
Last active February 13, 2022 18:46
Show Gist options
  • Save iamFIREcracker/7ada8ebf64d11a63e36bee4cea6a51f0 to your computer and use it in GitHub Desktop.
Save iamFIREcracker/7ada8ebf64d11a63e36bee4cea6a51f0 to your computer and use it in GitHub Desktop.

Revisions

  1. iamFIREcracker revised this gist Feb 13, 2022. No changes.
  2. iamFIREcracker renamed this gist Feb 13, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. iamFIREcracker created this gist Feb 13, 2022.
    28 changes: 28 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    augroup vlime_hilight_curr_expr
    autocmd!

    if empty(prop_type_get('lisp_curr_expr'))
    call prop_type_add('lisp_curr_expr', {'highlight': 'LispCurrExpr'})
    endif
    hi link LispCurrExpr MatchParen

    function! s:HilightCurrExpr() abort
    call prop_remove({'type': 'lisp_curr_expr', 'all': v:true})

    let expr = vlime#ui#CurExpr(1)
    if expr[0] == '' || expr[1][0] == 0
    return
    endif

    let [line1, col1] = expr[1]
    let [line2, col2] = expr[2]
    let l:options = {
    \ 'type': 'lisp_curr_expr',
    \ 'end_lnum': line2,
    \ 'end_col': col2,
    \ }
    call prop_add(line1, col1, l:options)
    endfunction

    autocmd CursorMoved,CursorMovedI <buffer> call s:HilightCurrExpr()
    augroup end