Skip to content

Instantly share code, notes, and snippets.

@bounceme
Last active February 11, 2017 20:32
Show Gist options
  • Save bounceme/72aa91b4f2a473818d93384b7fff3bd4 to your computer and use it in GitHub Desktop.
Save bounceme/72aa91b4f2a473818d93384b7fff3bd4 to your computer and use it in GitHub Desktop.
function! g:FilterQf(ob)
let [cc,bnr] = [[],bufnr('%')]
let shm = &shortmess
set shortmess+=A
for i in a:ob
silent! exe 'hide keepalt keepjumps b ' . get(i,'bufnr')
let [ln,cl] = [get(i,'lnum'),get(i,'col')]
if synIDattr(synID(ln, cl ? cl : matchend(getline(ln),'^\s*\S'),0),'name')
\ !~? 'string\|regex\|comment'
call add(cc,deepcopy(i))
endif
endfor
silent! exe 'keepalt keepjumps b ' . bnr
let &shm = shm
return cc
endfunction
command! QfSyn call setqflist(g:FilterQf(getqflist()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment