Created
April 4, 2012 02:30
-
-
Save dahu/2297202 to your computer and use it in GitHub Desktop.
Update Timestamp on BufWrite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Update a timestamp on BufWrite | |
" Barry Arthur, 2012 04 04 | |
function! UpdateTimestamp() | |
let old_pos = getpos('.') | |
let old_search = histget("search", -1) | |
g/^# \d\{4}-\d\d-\d\d \d\d:\d\d: \.0 +\d\{4} \/\s*sputnick/s/^.\{-}\/\s*sputnick\s*$/\="# " . strftime('%F %H:%M: .0 %z') . " \/ sputnick"/ | |
exe "normal /".old_search | |
call setpos('.', old_pos) | |
endfunction | |
au BufWrite * call UpdateTimestamp() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment