I'm currently writing a plugin to quickly appends commented TODO:
codetags to the end of a line in any file type.
How can I make vim make use of it's commenstring
feature to append a comment that corresponds to the filetype?
I am currently entering those manually but I feel like there may be a more platform agnostic way to do this...
Here is what some of my maps look like right now:
" Markdown todo's
autocmd FileType markdown nnoremap <buffer> td o<Esc>o<Esc>O[comment]:<Space>#<Space>TODO:<Space>
autocmd FileType markdown nnoremap <buffer> TD 0/TODO:<Enter>kd2j
" Vim todo's
autocmd FileType vim nnoremap <buffer> td A<Space><Space>"TODO:<Space>
autocmd FileType vim nnoremap <buffer> TD 0/"TODO:<Enter>d$
" PHP todo's
autocmd FileType php nnoremap <buffer> td A<Space><Space>//TODO:<Space>
autocmd FileType php nnoremap <buffer> TD j0?//TODO:<Enter>d$
" Javascript todo's
autocmd FileType javascript nnoremap <buffer> td A<Space><Space>//TODO:<Space>
autocmd FileType javascript nnoremap <buffer> TD j0?//TODO:<Enter>d$
Thanks!