35

Is it possible to auto unzip/zip *.gz files within vim?

steveyang
  • 9,178
  • 8
  • 54
  • 80

6 Answers6

35

My vim installation does this by default.

VIM - Vi IMproved 7.3 (2010 Aug 15) on OpenSUSE 12.1

Also, check this link: http://ubuntuforums.org/showthread.php?t=902668

Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106
Filip
  • 1,451
  • 1
  • 11
  • 19
16

zip/unzip cannot open *.gz files as far as I know.

Vim can open *.gz files with the help of gzip/gunzip like this

Its already discussed here on SO

How to open gzip text files in Gvim without unzipping?

Community
  • 1
  • 1
Pavan Manjunath
  • 27,404
  • 12
  • 99
  • 125
1

I have searched for this answer as well, specifically for Fedora.

So on Fedora, you need to install the package vim-enhanced:

sudo dnf install vim-enhanced

Now it is possible to just edit gzipped files like this:

vim my.log.gz 
0

try this, works for me - I am not sure if something extra needs to be installed on the server however:

zless filename.gz

Sunjalo
  • 189
  • 1
  • 6
0

vim will open .gz files when called from the command line. however, in executing :h iskeyword, vim attempts to open a tab and in this case it fails to read in the .gz associated with vim's options.

Athena
  • 3,200
  • 3
  • 27
  • 35
ovi
  • 21
  • 1
-1

This is what I did

  1. Unzip the .gz file --> gunzip YourFile.gz (This unzips the file and puts in the same directory)

  2. Then use vim to open it --> vim YourFile

Sandeep Amarnath
  • 5,463
  • 3
  • 33
  • 43