[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Vim @ bzip2



Hi all there!
During reading the bzip2 thread, because there is no bzip2 
support (at least until bzip2 is integrated in gzip),
I added folowing in vimrc:

augroup bzip2
  " Remove all bzip2 autocommands
  au!

  " Enable editing of bzipped files
  "       read: set binary mode before reading the file
  "             uncompress text in buffer after reading
  "      write: compress file after writing
  "     append: uncompress file, append, compress file
  autocmd BufReadPre,FileReadPre        *.bz2 set bin
  autocmd BufReadPost,FileReadPost      *.bz2 set cmdheight=2|'[,']!bunzip2
  autocmd BufReadPost,FileReadPost      *.bz2 set cmdheight=1 nobin|execute ":doautocmd BufReadPost " . %:r

  autocmd BufWritePost,FileWritePost    *.bz2 !mv <afile> <afile>:r
  autocmd BufWritePost,FileWritePost    *.bz2 !bzip2 <afile>:r

  autocmd FileAppendPre                 *.bz2 !bunzip2 <afile>
  autocmd FileAppendPre                 *.bz2 !mv <afile>:r <afile>
  autocmd FileAppendPost                *.bz2 !mv <afile> <afile>:r
  autocmd FileAppendPost                *.bz2 !bzip2 -9 --repetitive-best <afile>:r
augroup END

So I'm posting it here so anyone can use it and eventually include it into distribution. Patching less in this style is IMHO also good thing, will the maintainer do this?


P.S. Is something wrong with this:
 
       *.tar.gz|*.tgz|*.tar.Z)
            tar tzvf $1 ;;

        *.gz|*.Z|*.z)
            gzip -dc $1 ;;

+        *.tar.bz2|*.tbz2)
+            tar tIvf $1 ;;
+
+        *.bz2)
+            if [ -x /usr/bin/bunzip2]; then bunzip2 -c $1; else echo "No bunzip2 available"; fi ;;
+
        *.tar)
            tar tvf $1 ;;

in /usr/bin/lessfile, or is error in something else (prints compressed garbage on bzipped files)

Ax
-- 
        Vaclav Hula
        ax@atrey.karlin.mff.cuni.cz
        http://atrey.karlin.mff.cuni.cz/~ax


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: