Skip to content

Instantly share code, notes, and snippets.

" Parse current buffer :syntax for hl names that link to hl-groups
function! activewin#syntax#Parse()
redir => l:buf_syntax
silent exec 'syntax'
redir END
let l:group_keys = []
let l:hl_pattern = '^\w\+\(\_.*links to\)\@='
call substitute(l:buf_syntax, l:hl_pattern, '\=add(l:group_keys, submatch(0))', 'g')
echom string(l:group_keys)
@sunjon
sunjon / better_inc_search.vim
Last active May 26, 2017 13:57
Tab through partial HLS
" Tab to cycle through instances of partially complete search pattern {{{
set wildcharm=<Tab>
cnoremap <expr> <Tab> BetterIncSearch('tab')
cnoremap <expr> <S-Tab> BetterIncSearch('stab')
" better incremental search
function! BetterIncSearch(key) abort
if getcmdtype() ==# '/' || getcmdtype() ==# '?'
if (a:key ==# 'tab' && v:searchforward) || (a:key ==# 'stab' && !v:searchforward)
return "\<CR>/\<C-r>/"