diff options
author | doy <doy@tozt.net> | 2009-01-03 23:57:46 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-01-03 23:57:46 -0500 |
commit | afd34b3778238b62afd646218f829f02bbb1ae43 (patch) | |
tree | 0502300f049819c07ed4564ca901c9d67057ab5f /vimrc | |
parent | e88fb2fb48e30ce66140294c40e5272e6a779cf5 (diff) | |
download | conf-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-- | vimrc | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -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."\")" |