summaryrefslogtreecommitdiffstats
path: root/vimrc
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-05-05 00:45:27 -0500
committerJesse Luehrs <doy@tozt.net>2009-05-05 00:45:27 -0500
commit84c676626277dd2fb7a36a33125623ff658f4223 (patch)
treebcf0b839085d598b6c3c8e2693f23f3db78c57e1 /vimrc
parent4732fa760eece0d4ee4bc2dbd4e8e4fe5f11fe2e (diff)
downloadconf-84c676626277dd2fb7a36a33125623ff658f4223.tar.gz
conf-84c676626277dd2fb7a36a33125623ff658f4223.zip
move skeleton code into a plugin
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc60
1 files changed, 12 insertions, 48 deletions
diff --git a/vimrc b/vimrc
index 6ebee1c..d163285 100644
--- a/vimrc
+++ b/vimrc
@@ -251,54 +251,6 @@ autocmd BufReadPost *
\ endif
" }}}
" Skeletons {{{
-function s:read_skeleton(pattern)
- set modifiable
- " the skeleton file should be a file in ~/.vim/skeletons that matches the
- " glob pattern of files that it should be loaded for
- let skeleton_file = glob("~/.vim/skeletons/".a:pattern)
- " read leaves a blank line at the top of the file
- exe "silent read ".skeleton_file." | normal ggdd"
- 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('$'), strpart(line, 1))
- normal G
- if remove_extra_line
- normal ggdd
- endif
- " lines not starting with a : will just be appended literally
- elseif line !~ '^:'
- call append(line('$'), line)
- normal G
- if remove_extra_line
- normal ggdd
- endif
- else
- exe line
- endif
- endfor
- redraw
-endfunction
-function s:skeleton(pattern)
- exe "autocmd BufNewFile ".a:pattern." silent call s:read_skeleton(\"".a:pattern."\")"
-endfunction
-call map([
- \'*.pl',
- \'*.pm',
- \'*.cpp',
- \'*.c',
- \'*.tex',
- \'*.t',
- \'Makefile',
- \'Makefile.PL'
-\], 's:skeleton(v:val)')
" }}}
" Auto +x {{{
au BufWritePost *.{sh,pl} silent exe "!chmod +x %"
@@ -552,4 +504,16 @@ let g:Foldtext_tex_enable = 1
let g:Foldtext_cpp_enable = 1
let g:Foldtext_perl_enable = 1
" }}}
+" Skeletons {{{
+let g:Skeleton_patterns = [
+ \'*.pl',
+ \'*.pm',
+ \'*.cpp',
+ \'*.c',
+ \'*.tex',
+ \'*.t',
+ \'Makefile',
+ \'Makefile.PL'
+\]
+" }}}
" }}}