summaryrefslogtreecommitdiffstats
path: root/vimrc
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-01-03 23:57:46 -0500
committerdoy <doy@tozt.net>2009-01-03 23:57:46 -0500
commitafd34b3778238b62afd646218f829f02bbb1ae43 (patch)
tree0502300f049819c07ed4564ca901c9d67057ab5f /vimrc
parente88fb2fb48e30ce66140294c40e5272e6a779cf5 (diff)
downloadconf-afd34b3778238b62afd646218f829f02bbb1ae43.tar.gz
conf-afd34b3778238b62afd646218f829f02bbb1ae43.zip
handle skeleton files in a more correct (but also more ugly, sigh) way
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc20
1 files changed, 14 insertions, 6 deletions
diff --git a/vimrc b/vimrc
index 1b76169..d68c33f 100644
--- a/vimrc
+++ b/vimrc
@@ -252,20 +252,28 @@ function s:read_skeleton(pattern)
let lines = getline(1, "$")
normal ggdG
for line in lines
+ " sigh... this is *so* dumb
+ let remove_extra_line = 0
+ if line('$') == 1 && col('$') == 1
+ let remove_extra_line = 1
+ endif
" lines starting with :: will start with a literal :
if line =~ '^::'
- call append(line('$') - 1, strpart(line, 1))
+ call append(line('$'), strpart(line, 1))
+ if remove_extra_line
+ normal ggdd
+ endif
" lines not starting with a : will just be appended literally
elseif line !~ '^:'
- call append(line('$') - 1, line)
+ call append(line('$'), line)
+ if remove_extra_line
+ normal ggdd
+ endif
else
exe line
endif
endfor
- " remove the last extra newline we added
- let pos = getpos('.')
- normal Gdd
- call setpos('.', pos)
+ redraw
endfunction
function s:skeleton(pattern)
exe "autocmd BufNewFile ".a:pattern." silent call s:read_skeleton(\"".a:pattern."\")"