Skip to content

Instantly share code, notes, and snippets.

@ravelll
Created November 9, 2014 07:22
Show Gist options
  • Save ravelll/a9bbe515df2de9ccd3b0 to your computer and use it in GitHub Desktop.
Save ravelll/a9bbe515df2de9ccd3b0 to your computer and use it in GitHub Desktop.
Vim Scouter
function! Scouter(file, ...)
let pat = '^\s*$\|^\s*"'
let lines = readfile(a:file)
if !a:0 || !a:1
let lines = split(substitute(join(lines, "\n"), '\n\s*\\', '', 'g'), "\n")
endif
return len(filter(lines,'v:val !~ pat'))
endfunction
command! -bar -bang -nargs=? -complete=file Scouter
\ echo Scouter(empty(<q-args>) ? $MYVIMRC : expand(<q-args>), <bang>0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment