Created
June 22, 2012 00:23
-
-
Save darrik/2969465 to your computer and use it in GitHub Desktop.
Vim with MzScheme function example
This file contains hidden or 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
" 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