From 58d628a8e88547eb5282e75c44a39613bedc474e Mon Sep 17 00:00:00 2001 From: katherine Date: Tue, 17 Oct 2017 01:33:34 -0700 Subject: clean and comment skeleton loading --- .vimrc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index 927d0b2..b5a3eae 100644 --- a/.vimrc +++ b/.vimrc @@ -254,21 +254,17 @@ autocmd FileType zsh call Settings_shell() "command for reading filetype skeletons function! Settings_skel_read() + "is the buffer not empty? if line('$') != 1 || col('$') != 1 - " echoh ErrorMsg - " echo "err: cannot load skeleton: buffer is not empty" - " echoh None return 1 end + "is there no template? if filereadable(split(&rtp, ',')[0] . "/skel/" . &ft) == 0 - " echoh ErrorMsg - " echo "err: cannot load skeleton: no skeleton found for filetype '" . &ft . "'" - " echoh None return 1 end - let l:fname = split(&rtp, ',')[0] . "/skel/" . &ft - execute 'r ' . l:fname - execute "normal ggJ/%START%\cc" + execute 'r ' . split(&rtp, ',')[0] . "/skel/" . &ft + "move cursor to START + execute "normal ggJ/%START%\:%s/%START%//g\" redraw! endfunction autocmd FileType * call Settings_skel_read() -- cgit v1.2.3