104751Re: Opening compressed files without .gz extension
- Jun 3, 2009Unfortunately, that doesn't work, not sure exactly why.
This did work based on Reid's pointer, note the addtion of 'silent' in second line.
: autocmd BufReadPre,FileReadPre *.gzo set bin
: autocmd BufReadPost,FileReadPost *.gzo silent '[,']!gunzip
: autocmd BufReadPost,FileReadPost *.gzo set nobin
: autocmd BufReadPost,FileReadPost *.gzo execute ":doautocmd BufReadPost " . expand("%:r")
: autocmd BufWritePost,FileWritePost *.gzo !mv <afile> <afile>:r
: autocmd BufWritePost,FileWritePost *.gzo !gzip <afile>:r
: autocmd FileAppendPre *.gzo !gunzip <afile>
: autocmd FileAppendPre *.gzo !mv <afile>:r <afile>
: autocmd FileAppendPost *.gzo !mv <afile> <afile>:r
: autocmd FileAppendPost *.gzo !gzip <afile>:r
On Wed, Jun 03, 2009 at 04:08:50PM -0400, Matt Wozniski wrote:
> On Wed, Jun 3, 2009 at 1:21 PM, Keith Kaple wrote:
> > What is the easiest way to add a file extension so that vim sees it as a compressed file and uses the builtin ability to open compressed files?
> > I'm faced with a process that produces .gzo files (gzip format) that can be opened with 'zcat foo.gzo | vim -', but seems it would be cleaner to be able to "alias" any .gzo extension to be treated as a .gz, not sure how to do that..
> > Tried hacking gzip.vim plugin but couldn't get that to work. ??Any suggestions?
> Should have been a piece of cake to do it that way... Off the top of
> my head, this should do the trick:
> cp /usr/share/vim/vim72/plugin/gzip.vim ~/.vim/plugin
> sed -i 's/\.gz\>/.gz,.gzo/' ~/.vim/plugin/gzip.vim
> ie, just add .gzo after every file pattern matching .gz
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
- << Previous post in topic