Added ISO support
This commit is contained in:
parent
60d670fa6b
commit
327b4c34b7
|
@ -76,6 +76,37 @@ vim_configurable.customize {
|
||||||
autocmd BufWritePost,FileWritePost *.gpg u
|
autocmd BufWritePost,FileWritePost *.gpg u
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
" Manage ISO files
|
||||||
|
augroup iso
|
||||||
|
au!
|
||||||
|
|
||||||
|
" First make sure nothing is written to ~/.viminfo while editing an encrypted file.
|
||||||
|
autocmd BufReadPre,FileReadPre *.iso set viminfo=
|
||||||
|
" We don't want a swap file, as it writes unencrypted data to disk
|
||||||
|
autocmd BufReadPre,FileReadPre *.iso set noswapfile
|
||||||
|
" Switch to binary mode to read the encrypted file
|
||||||
|
autocmd BufReadPre,FileReadPre *.iso set bin
|
||||||
|
autocmd BufReadPre,FileReadPre *.iso let ch_save = &ch|set ch=2
|
||||||
|
autocmd BufReadPost,FileReadPost *.iso '[,']!gpg --decrypt 2> /dev/null
|
||||||
|
" Switch to normal mode for editing
|
||||||
|
autocmd BufReadPost,FileReadPost *.iso set nobin
|
||||||
|
autocmd BufReadPost,FileReadPost *.iso let &ch = ch_save|unlet ch_save
|
||||||
|
autocmd BufReadPost,FileReadPost *.iso execute ":doautocmd BufReadPost " . expand("%:r")
|
||||||
|
|
||||||
|
" Convert all text to encrypted text before writing
|
||||||
|
autocmd BufWritePre,FileWritePre *.iso '[,']!gpg --default-key=A4122FF3971B6865 --default-recipient-self -ae 2>/dev/null
|
||||||
|
" Undo the encryption so we are back in the normal text, directly
|
||||||
|
" after the file has been written.
|
||||||
|
autocmd BufWritePost,FileWritePost *.iso u
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" Use persistent history.
|
||||||
|
if !isdirectory("/tmp/.vim-undo-dir")
|
||||||
|
call mkdir("/tmp/.vim-undo-dir", "", 0700)
|
||||||
|
endif
|
||||||
|
set undodir=/tmp/.vim-undo-dir
|
||||||
|
set undofile
|
||||||
|
|
||||||
" My Markdown environment
|
" My Markdown environment
|
||||||
function! MarkdownSettings()
|
function! MarkdownSettings()
|
||||||
set textwidth=79
|
set textwidth=79
|
||||||
|
|
Loading…
Reference in a new issue