Skip to content

Instantly share code, notes, and snippets.

@dahu
Created May 15, 2012 09:04
Show Gist options
  • Save dahu/2700225 to your computer and use it in GitHub Desktop.
Save dahu/2700225 to your computer and use it in GitHub Desktop.
generate header-file
" Creates a header file from the function declarations within the current C
" file.
" Barry Arthur, 2012 05 15
let header = expand('%:r') . '.h'
if filereadable(header)
echo "Header file " . header . " exists!"
finish
endif
silent exe "!touch " . header
g/^\w\+.\{-}(.\{-}).*{\s*$/ silent exe "silent . write >> " . header
exe "e " . header
%s/\s*{\s*$/;/
%s/\s*\w\+)/)/
%s/\s*\w\+,/,/g
%s/()/(void)/
redraw!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment