Skip to content

Instantly share code, notes, and snippets.

@dhulihan
Created July 20, 2017 16:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhulihan/3f06cd639edb6a147d5a685fe658a132 to your computer and use it in GitHub Desktop.
Save dhulihan/3f06cd639edb6a147d5a685fe658a132 to your computer and use it in GitHub Desktop.
Print markdown header in vim
" Author: Dave Hulihan
" Purpose: Prints cute markdown header at the top
" of the file, based on filename.
" Print filename header in markdown
function! MarkdownHeader()
let @a = "#"
put! a
put %
normal ggJ
s/\.md$//
normal jdd
endfunction
" map function
command! MarkdownHeader call MarkdownHeader()
" call this on new buffers ending in .md
autocmd BufNewFile *.md MarkdownHeader
@dhulihan
Copy link
Author

vim-markdown-header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment