Skip to content

Instantly share code, notes, and snippets.

@darrik
Created June 22, 2012 00:23
Show Gist options
  • Save darrik/2969465 to your computer and use it in GitHub Desktop.
Save darrik/2969465 to your computer and use it in GitHub Desktop.
Vim with MzScheme function example
" Extremely simple, just appends whatever you feed strftime to the end of the current line.
" If one was so inclined one could make it smarter like being able to insert at current cursor position and such.
function! DarrikInsertDate()
mz << EOF
(define (vim-strftime fmt)
(bytes->string/utf-8 (vim-eval (string-append "strftime('" fmt "')"))))
(define (vim-get-current-line-contents)
(bytes->string/utf-8 (vim-get-buff-line (car (vim-get-cursor)))))
(vim-set-buff-line
(car (vim-get-cursor))
(string-append
(vim-get-current-line-contents)
(vim-strftime "%Y-%m-%d")))
EOF
endfunction
map <silent><Leader>id :call DarrikInsertDate()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment