diff options
author | katherine <shmibs@shmibbles.me> | 2017-10-17 00:48:29 -0700 |
---|---|---|
committer | katherine <shmibs@shmibbles.me> | 2017-10-17 00:48:29 -0700 |
commit | 7d1a33013e22396cfa62857db818f2cb756ea0ad (patch) | |
tree | 6f484e942b396e977df8111040a8ea89a1378a4b /.vimrc | |
parent | 60d12c13e01032b9de4d1b3855a58dff6122c654 (diff) | |
download | dotfiles-7d1a33013e22396cfa62857db818f2cb756ea0ad.tar.gz |
implement simple filetype templates for vim
will probably expand on this more later
Diffstat (limited to '.vimrc')
-rw-r--r-- | .vimrc | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -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%\<CR>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 |