Created
July 6, 2011 02:48
-
-
Save hayajo/1066442 to your computer and use it in GitHub Desktop.
open_junk_file - vim
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
" Open junk file | |
" via. http://vim-users.jp/2010/11/hack181/ | |
command! -nargs=0 JunkFile call s:open_junk_file() | |
function! s:open_junk_file() | |
if !exists('g:junk_file_basedir') | |
let g:junk_file_basedir = $HOME . '/.vim_junk' | |
endif | |
let l:junk_file_dir = g:junk_file_basedir . strftime('/%Y/%m') | |
if !isdirectory(l:junk_file_dir) | |
call mkdir(l:junk_file_dir, 'p') | |
endif | |
let l:filename = input('Junk Code: ', l:junk_file_dir . strftime('/%Y-%m-%d-%H%M%S.')) | |
if l:filename != '' | |
execute 'edit ' . l:filename | |
endif | |
endfunction | |
let g:junk_file_basedir=$HOME."/doc/junk" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment