aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkatherine <shmibs@shmibbles.me>2017-10-17 01:33:34 -0700
committerkatherine <shmibs@shmibbles.me>2017-10-17 01:33:34 -0700
commit58d628a8e88547eb5282e75c44a39613bedc474e (patch)
tree0b93a9dbe0c33f01bd72e9e074ffb48a4d7af9d3
parent74404b9e30a4b0f0554a6107bc955aa04afafaa0 (diff)
downloaddotfiles-58d628a8e88547eb5282e75c44a39613bedc474e.tar.gz
clean and comment skeleton loading
-rw-r--r--.vimrc14
1 files changed, 5 insertions, 9 deletions
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%\<CR>cc"
+ execute 'r ' . split(&rtp, ',')[0] . "/skel/" . &ft
+ "move cursor to START
+ execute "normal ggJ/%START%\<CR>:%s/%START%//g\<CR>"
redraw!
endfunction
autocmd FileType * call Settings_skel_read()