Thursday, October 27, 2011

Re: Tracing Vim into a log file.

Indeed the strange behavior I face with Vim is when I edit *.log files ;
I can remove the autocmd for *.bin, *.bqy it will have no effect unfortunatly on the bug.
 
I'm under Windows XP, Vim 7.2
 
Can try to upgrade Vim 7.3 to see if it still occurs.
 
Once again thank you for your help.
 
Eddine.

2011/10/27 Benjamin R. Haskell <vim@benizi.com>
On Thu, 27 Oct 2011, Eddine wrote:

Ben

this is my _vimrc file:

[...]


" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif

Should be non-problematic.


" vim -b : edit binary using xxd-format!
augroup Binary
au!
au BufReadPre *.bin *.bqy let &bin=1
au BufReadPost *.bin *.bqy if &bin | %!xxd
au BufReadPost *.bin *.bqy set ft=xxd | endif
au BufWritePre *.bin *.bqy if &bin | %!xxd -r
au BufWritePre *.bin *.bqy endif
au BufWritePost *.bin *.bqy if &bin | %!xxd
au BufWritePost *.bin *.bqy set nomod | endif
augroup END

All of those lines are wrong:

1. Should have commas between the patterns:

       au {event} {pat},{pat} {command}

E.g.:


       au BufReadPre *.bin *.bqy let &bin=1

Must be:

       au BufReadPre *.bin,*.bqy let &bin=1

(better, make it local):

       au BufReadPre *.bin,*.bqy let &l:bin=1

(shorter, but equivalently: [setl = setlocal])

       au BufReadPre *.bin,*.bqy setl bin


2. You can't split the command between two autocmds the way you have.


       au BufWritePre *.bin *.bqy if &bin | %!xxd -r
       au BufWritePre *.bin *.bqy endif

Needs to be (along with correction #1):

       au BufWritePre *.bin,*.bqy if &bin | %!xxd -r | endif



What I have noticed is that it occurs on that java log file that are being written while edited, and on where I often do string search.

Do your *.bin files change while you're editing them?  Maybe you're hitting those malformed autocmds.  Unfortunately, otherwise, nothing jumps out at me.  You're under Windows?  What version?  What version of Vim?


--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment