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

4
ftdetect/bind.vim Normal file
View File

@ -0,0 +1,4 @@
" Bind zone file
autocmd BufNewFile,BufRead *.domain setf bindzone
autocmd BufNewFile,BufRead *.zone setf bindzone
autocmd BufNewFile,BufRead *.priv setf bindzone

6
ftdetect/mako.vim Normal file
View File

@ -0,0 +1,6 @@
" Mako
augroup mako
autocmd BufRead,BufNewFile *.mako set ft=mako
autocmd BufWinEnter *.mako set ft=mako
autocmd FileType mako set textwidth=0
augroup end

6
ftdetect/plist.vim Normal file
View File

@ -0,0 +1,6 @@
autocmd BufReadPre,FileReadPre *.plist setf plist
autocmd FileType plist set binary syntax=xml
autocmd BufReadPost *.plist call MyBinaryPlistReadPost()
autocmd FileReadPost *.plist call MyBinaryPlistReadPost() | let b:saveAsBinaryPlist = 0
autocmd BufWritePre,FileWritePre *.plist call MyBinaryPlistWritePre()
autocmd BufWritePost,FileWritePost *.plist call MyBinaryPlistWritePost()

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

66
vimrc
View File

@ -370,36 +370,6 @@ if has("autocmd")
" If doing a diff. Upon writing changes to file, automatically update the differences
autocmd BufWritePost * if &diff == 1 | diffupdate | endif
" Mako
autocmd! BufRead,BufNewFile *.mako setfiletype mako
autocmd BufWinEnter *.mako setfiletype mako
autocmd FileType mako set textwidth=0
" Python
autocmd FileType python set textwidth=79
autocmd FileType python set omnifunc=pythoncomplete#Complete
" Plist
autocmd BufReadPre,FileReadPre *.plist setf plist
autocmd FileType plist set binary syntax=xml
autocmd BufReadPost *.plist call MyBinaryPlistReadPost()
autocmd FileReadPost *.plist call MyBinaryPlistReadPost() | let b:saveAsBinaryPlist = 0
autocmd BufWritePre,FileWritePre *.plist call MyBinaryPlistWritePre()
autocmd BufWritePost,FileWritePost *.plist call MyBinaryPlistWritePost()
" Plain text
autocmd BufNewFile,BufRead *.txt setf text
autocmd FileType text set textwidth=78 printfont=:h10
" Javascript
autocmd FileType javascript set sw=4 ts=4 sts=4 smarttab expandtab
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
" Bind zone file
autocmd BufNewFile,BufRead *.domain setf bindzone
autocmd BufNewFile,BufRead *.zone setf bindzone
"
" Reload .vimrc, after modifications
autocmd BufWritePost ~/.vimrc so ~/.vimrc
autocmd BufWritePost ~/.vim/vimrc so ~/.vim/vimrc
@ -408,42 +378,6 @@ if has("autocmd")
autocmd BufWritePost ~/.vim/gvimrc so ~/.vim/gvimrc
endif
" 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
endif
""" iTerm 2 Custom cursor shape