Support snippet templates and add help snippets
Add `autocmd` to automatically expand the `_template` snippet on the `BufNewFile` event, if the expansion fails because the `_template` snippet does not exist for the current `filetype` undo the changes. Do the same thing when the `filetype` changes to `help`, since these are `text` files to begin with the first `autocmd` has no effect.
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
augroup benieAugroup
|
||||
" Clear all autocmd's in this group
|
||||
autocmd!
|
||||
|
||||
" Reopening a file at last curson position
|
||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
|
||||
\ | exe "normal! g'\"" | endif
|
||||
|
||||
" Highlight conflict markers in any filefile
|
||||
au FileType * :call matchadd('Todo', '^\(<<<<<<<\||||||||\|=======\|>>>>>>>\)\s\ze.*$')
|
||||
" Highlight conflict markers in any filetype
|
||||
au FileType * call matchadd('Todo', '^\(<<<<<<<\||||||||\|=======\|>>>>>>>\)\s\ze.*$')
|
||||
|
||||
" Read template into buffer and send line 1 to the black hold register
|
||||
" Read template into buffer then send line 1 to the black hold register
|
||||
au BufNewFile todo.md read ~/.vim/templates/skeleton.todo.md | 1delete _
|
||||
" Attempt to expand snippet named `_template` if it exists
|
||||
au BufNewFile * silent! call snippet#template()
|
||||
" Do the same when filetype changes to help
|
||||
au FileType help silent! call snippet#template()
|
||||
augroup END
|
||||
|
||||
Reference in New Issue
Block a user