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

debianized vim



Setup: Woody/testing

After installing vim with apt-get, I find that the debianizations that
have been done cause sections of my .vimrc, built up over time on
several different platforms to be unusable.

I don't really know exactly what these do, some are borrowed from
.vimrcs of others more knowledgable than I.

The debian install seems to have pre-empted local vimrcs by changing
the way vim is installed, compared to how a source build would work.

Debians method of keeping all helpfiles in gzipped format seems to be
the source of my problem, but just gunzipping them doesn't solve it.
Apparently somekind of pointers are contained in a `tags file', that
isn't really named in this exerpt from /etc/vim/vimrc:
  " Debian uses compressed helpfiles. We must inform vim that the main
  " helpfiles is compressed. Other helpfiles are stated in the tags-file.
  set helpfile=$VIMRUNTIME/doc/help.txt.gz

I don't remember how to regenerate it, so that I can gunzip the
helpfiles, retagify, and then be able to use my old code that allows
writing to gzip files.

Some thing in this code cause a mess with debians setup.  The
helpfiles when accessed in the normal way inside vim with :h <subject>
give this warning and then appear in binary.

   Error detected while processing function GZIP_read:
   line    3:
   E21: Cannot make changes, 'modifiable' is off
   E434: Can't find tag pattern
When I hit `enter' the file appears in binary format.

Maybe my code can just be edited somehow so there is no conflict.
Otherwise I'd like to gunzip the helpfiles and redo the tags stuff.

========================================

Conflicting code:
 augroup gzip
  " Remove all gzip autocommands
  au!

  " Enable editing of gzipped files
  " set binary mode before reading the file
  autocmd BufReadPre,FileReadPre	*.gz,*.bz2 set bin
  autocmd BufReadPost,FileReadPost	*.gz call GZIP_read("gunzip")
  autocmd BufReadPost,FileReadPost	*.bz2 call GZIP_read("bunzip2")
  autocmd BufWritePost,FileWritePost	*.gz call GZIP_write("gzip")
  autocmd BufWritePost,FileWritePost	*.bz2 call GZIP_write("bzip2")
  autocmd FileAppendPre			*.gz call GZIP_appre("gunzip")
  autocmd FileAppendPre			*.bz2 call GZIP_appre("bunzip2")
  autocmd FileAppendPost		*.gz call GZIP_write("gzip")
  autocmd FileAppendPost		*.bz2 call GZIP_write("bzip2")

  " After reading compressed file: Uncompress text in buffer with "cmd"
  fun! GZIP_read(cmd)
    let ch_save = &ch
    set ch=2
    execute "'[,']!" . a:cmd
    set nobin
    let &ch = ch_save
    execute ":doautocmd BufReadPost " . expand("%:r")
  endfun

  " After writing compressed file: Compress written file with "cmd"
  fun! GZIP_write(cmd)
    if rename(expand("<afile>"), expand("<afile>:r")) == 0
      execute "!" . a:cmd . " <afile>:r"
    endif
  endfun

  " Before appending to compressed file: Uncompress file with "cmd"
  fun! GZIP_appre(cmd)
    execute "!" . a:cmd . " <afile>"
    call rename(expand("<afile>:r"), expand("<afile>"))
  endfun
augroup END





Reply to: