Skip to content

Instantly share code, notes, and snippets.

@koturn
Last active August 29, 2015 14:25
Show Gist options
  • Save koturn/3ec928f84651d5de669c to your computer and use it in GitHub Desktop.
Save koturn/3ec928f84651d5de669c to your computer and use it in GitHub Desktop.
編集中のファイルを(ほぼ)二度と読めなくするコマンド
" Joke!
if has('cryptv')
function! s:destroy_file(has_bang) abort
if !filereadable(expand('%:p'))
echoerr 'Current buffer is not write out to file'
return
endif
if !a:has_bang
echoerr "Must to add '!' to destroy this file"
return
endif
let cursor = getpos('.')
normal! ggg?G
call setpos('.', cursor)
let &l:key = sha256(reltimestr(reltime()))
write
bwipeout
endfunction
command! -bar -bang DestroyFile call s:destroy_file(<bang>0)
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment