Created
October 24, 2017 02:11
-
-
Save igemnace/6b0fa07ca4f649a10f1ec555f37cf7ec to your computer and use it in GitHub Desktop.
Example for filetype-specific template replacement. Nice to go in your vimrc, or in $VIM/after/plugin/template-lite.vim.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! TemplateReplace() abort | |
if expand('%') =~ glob2regpat('*.js') | |
" do JS-specific replacement | |
elseif expand('%') =~ glob2regpat('*.sh') | |
" do sh-specific replacement | |
endif | |
endfunction | |
augroup TemplateLite | |
autocmd! | |
autocmd User TemplateLoad call TemplateReplace() | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment