1
0
mirror of https://github.com/akelge/vim synced 2025-08-16 07:48:35 +00:00

Started cleaning up bloat

This commit is contained in:
Andrea Mistrali
2016-05-14 11:05:57 +02:00
parent 23ffeab69c
commit b68e9ace83
8 changed files with 59 additions and 66 deletions

34
ftplugin/gpg.vim Normal file
View File

@ -0,0 +1,34 @@
" Transparent editing of gpg encrypted files.
augroup encrypted
au!
" First make sure nothing is written to ~/.viminfo while editing
" an encrypted file.
autocmd BufReadPre,FileReadPre *.gpg,*.asc set viminfo=
" We don't want a swap file, as it writes unencrypted data to disk
autocmd BufReadPre,FileReadPre *.gpg,*.asc set noswapfile
" Switch to binary mode to read the encrypted file
autocmd BufReadPre,FileReadPre *.gpg,*.asc set bin
autocmd BufReadPre,FileReadPre *.gpg,*.asc let ch_save = &ch|set ch=2
autocmd BufReadPre,FileReadPre *.gpg,*.asc let shsave=&sh
autocmd BufReadPre,FileReadPre *.gpg,*.asc let &sh='sh'
autocmd BufReadPre,FileReadPre *.gpg,*.asc let ch_save = &ch|set ch=2
autocmd BufReadPost,FileReadPost *.gpg,*.asc '[,']!gpg2 --decrypt --default-recipient-self 2> /dev/null
autocmd BufReadPost,FileReadPost *.gpg,*.asc let &sh=shsave
" Switch to normal mode for editing
autocmd BufReadPost,FileReadPost *.gpg,*.asc set nobin
autocmd BufReadPost,FileReadPost *.gpg,*.asc let &ch = ch_save|unlet ch_save
autocmd BufReadPost,FileReadPost *.gpg,*.asc execute ":doautocmd BufReadPost " . expand("%:r")
" Convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.gpg,*.asc set bin
autocmd BufWritePre,FileWritePre *.gpg,*.asc let shsave=&sh
autocmd BufWritePre,FileWritePre *.gpg,*.asc let &sh='sh'
" GPG Binary
autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg2 --encrypt --default-recipient-self 2>/dev/null
" GPG Ascii armor
autocmd BufWritePre,FileWritePre *.asc '[,']!gpg2 --armor --encrypt --default-recipient-self 2>/dev/null
autocmd BufWritePre,FileWritePre *.gpg,*.asc let &sh=shsave
" Undo the encryption so we are back in the normal text, directly
" after the file has been written.
autocmd BufWritePost,FileWritePost *.gpg,*.asc silent u
autocmd BufWritePost,FileWritePost *.gpg,*.asc set nobin
augroup END

3
ftplugin/javascript.vim Normal file
View File

@ -0,0 +1,3 @@
" Javascript
autocmd FileType javascript set sw=4 ts=4 sts=4 smarttab expandtab
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS

3
ftplugin/python.vim Normal file
View File

@ -0,0 +1,3 @@
" Python
autocmd FileType python set textwidth=79
autocmd FileType python set omnifunc=pythoncomplete#Complete

3
ftplugin/text.vim Normal file
View File

@ -0,0 +1,3 @@
" Plain text
" autocmd BufNewFile,BufRead *.txt setf text
autocmd FileType text set textwidth=78 printfont=:h10