Vim automatically expands .gz
files when I open them up, which is great. However, it doesn't reccognize .GZ
(upper case) in the same way. Unfortunately I cannot change the file extensions of the files I'm working with for various reasons. Is there a realatively simple way to register with VIM that .GZ
are the same as .gz
files?
Put this into your .vimrc :
augroup gzip
au BufReadPre *.GZ setlocal bin
au BufRead *.GZ call gzip#read("gzip -dn")
au BufWritePost *.GZ call gzip#write("gzip")
au FileAppendPost *.GZ call gzip#write("gzip")
au FileAppendPre *.GZ call gzip#appre("gzip -dn")
au FileReadPost *.GZ call gzip#read("gzip -dn")
au FileReadPre *.GZ setlocal bin
au FileWritePost *.GZ call gzip#write("gzip")
augroup END
If you want to know what autocmds were already activated for gz files you could have done:
:redir @x
:au
:redir END
"xp
/\.gz
This shows that gzip-related autocmds are in the gzip group. Then :au gzip
gives a more compact list.
Reference:
:help :autocmd
:help :augroup
Original autocmds are in plugin/gzip.vim in your vim runtime. You can tell that with :verbose au gzip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With