1
0
mirror of https://github.com/akelge/zsh synced 2025-08-17 14:58:50 +00:00

Initial import

This commit is contained in:
2008-10-09 16:15:16 +00:00
parent b68c98a6f5
commit 2475eced60
13 changed files with 814 additions and 0 deletions

55
vim/skeleton.vim Normal file
View File

@ -0,0 +1,55 @@
" TEMPLATE SYSTEM FOR VIM
"
" Preserve template files
augroup newfiles
" First we load templates for the file type
autocmd BufNewFile * ks|call OpenFile()|'s
" Update of "Last Modified" date on writing
autocmd BufWritePre,FileWritePre * ks|call LastMod()|'s
" Protect templates, removing write commands
autocmd BufRead,BufNewFile ~/.vim/templates/* au! newfiles
" Reload .vimrc, after modifications
autocmd BufWritePost ~/.vimrc so ~/.vimrc
if has("gui_running")
autocmd BufWritePost ~/.gvimrc so ~/.gvimrc
endif
" Set up python support
au FileType python source ~/.vim/addon/python.vim
augroup END
" Function to modify "Last Modified" date. Works on first 10 lines
function! LastMod()
if line("$") > 20
let l = 20
else
let l = line("$")
endif
execute "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " .
\ strftime("%d:%b:%Y %H:%M")
endfunction
" Function to open a file and set some defaults
function! OpenFile()
let s:filename=expand("<afile>")
let l:ext=fnamemodify(s:filename, ":e")
let l:skel = "~/.vim/templates/skeleton.".l:ext
if filereadable(fnamemodify(l:skel,":p"))
execute "0r" l:skel
let s:syn=input("Synopsis: ")
if line("$") > 20
let l = 20
else
let l = line("$")
endif
execute "1," . l . "g/First version: /s/First version: .*/First version: ".
\ strftime("%d:%b:%Y %H:%M")
execute "1," . l . "g/Synopsis: /s/Synopsis: .*/Synopsis: ".
\ s:syn
endif
endfunction