From 7d1a33013e22396cfa62857db818f2cb756ea0ad Mon Sep 17 00:00:00 2001 From: katherine Date: Tue, 17 Oct 2017 00:48:29 -0700 Subject: implement simple filetype templates for vim will probably expand on this more later --- .vimrc | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index b9a2e4a..927d0b2 100644 --- a/.vimrc +++ b/.vimrc @@ -9,7 +9,7 @@ endif set nocompatible filetype off -set rtp+=~/.vim/bundle/Vundle.vim +execute 'set rtp+=' . split(&rtp, ',')[0] . '/bundle/Vundle.vim' call vundle#begin() Plugin 'gmarik/Vundle.vim' @@ -252,6 +252,28 @@ autocmd FileType text call Settings_text() autocmd FileType vim call Settings_vim() autocmd FileType zsh call Settings_shell() +"command for reading filetype skeletons +function! Settings_skel_read() + if line('$') != 1 || col('$') != 1 + " echoh ErrorMsg + " echo "err: cannot load skeleton: buffer is not empty" + " echoh None + return 1 + end + 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" + redraw! +endfunction +autocmd FileType * call Settings_skel_read() + +""write mode" for markup-type formats function! Settings_sub_wmodetoggle() if &fo =~ 'a' setlocal formatoptions-=a -- cgit v1.2.3