Skip to content

Instantly share code, notes, and snippets.

@sunjon
Created May 30, 2017 11:39
Show Gist options
  • Save sunjon/26068c984fff1c428133539d7fa1a229 to your computer and use it in GitHub Desktop.
Save sunjon/26068c984fff1c428133539d7fa1a229 to your computer and use it in GitHub Desktop.
vim regex
" 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)
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment