RE: a question about 'diff' setting
> -Original Message- > From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 29, 2006 2:53 PM > To: vim@vim.org > Subject: a question about 'diff' setting ... > Can anyone explain why and what I should do to avoid > this (other than remembering to run :diffoff before closing, > or doing a :bufdo diffoff later). I keep this in my vimrc: if v:version >= 602 command! -bar -bang Nodiff wincmd l only set nodiff noscrollbind scrollopt-=hor wrap foldcolumn=0 virtualedit= else command! -bar Nodiff exe 'wincmd l' only set nodiff noscrollbind wrap foldcolumn=0 scrollopt-=hor virtualedit= let g:diff_msg_shown = 0 endif I think Gary Johnson came up with it initially. Try that to see if it works. The command! lines are on 1 line only. Dave
Re: a question about 'diff' setting
The documentation says the 'diff' setting is local to window, so closing the windows show cancel the setting out, but when I try the below sequence on two related files say, x.old and x.new, it seems otherwise. Vim seems to keep the 'diff' information around in the same way it keeps marks in a given file. Until it's unloaded, it still seems to remember it. Using :bw seems to obliterate the file so that the next time it is loaded you don't have 'diff' set. I agree that the docs saying that 'diff' is per-window seems a bit misleading, as it seems to be per-buffer. Just my $0.02 observation... -tim
Re: a question about 'diff' setting
On 6/29/06, Hari Krishna Dara <[EMAIL PROTECTED]> wrote: When I am done with the vimdiff mode, I normally just close the windows or switch to other files. The problem is that Vim seems to remember that those buffers participate in the diff mode I just do :bw twice when I want to normally edit somthing in the vim that was started as vimdiff, if that's what you ask. Yakov
Re: a question about 'diff' setting
Hi David, On 6/29/06, David Fishburn <[EMAIL PROTECTED]> wrote: > -Original Message- > From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 29, 2006 2:53 PM > To: vim@vim.org > Subject: a question about 'diff' setting ... > Can anyone explain why and what I should do to avoid > this (other than remembering to run :diffoff before closing, > or doing a :bufdo diffoff later). I keep this in my vimrc: if v:version >= 602 command! -bar -bang Nodiff wincmd l only set nodiff noscrollbind scrollopt-=hor wrap foldcolumn=0 virtualedit= else command! -bar Nodiff exe 'wincmd l' only set nodiff noscrollbind wrap foldcolumn=0 scrollopt-=hor virtualedit= let g:diff_msg_shown = 0 endif I think Gary Johnson came up with it initially. Try that to see if it works. The command! lines are on 1 line only. Starting with Vim7, you don't need the above user-defined command. Instead you can use one of the following commands: :diffoff :diffoff! - Yegappan
RE: a question about 'diff' setting
On Thu, 29 Jun 2006 at 2:59pm, David Fishburn wrote: > > > > -Original Message- > > From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] > > Sent: Thursday, June 29, 2006 2:53 PM > > To: vim@vim.org > > Subject: a question about 'diff' setting > ... > > Can anyone explain why and what I should do to avoid > > this (other than remembering to run :diffoff before closing, > > or doing a :bufdo diffoff later). > > > I keep this in my vimrc: > if v:version >= 602 > command! -bar -bang Nodiff wincmd l only set nodiff > noscrollbind scrollopt-=hor wrap foldcolumn=0 virtualedit= > else > command! -bar Nodiff exe 'wincmd l' only set nodiff > noscrollbind wrap foldcolumn=0 scrollopt-=hor virtualedit= let > g:diff_msg_shown = 0 > endif > > I think Gary Johnson came up with it initially. > > Try that to see if it works. The command! lines are on 1 line only. > > Dave I use a version of this command myself, but the point is you have to remember to use it before closing them. I often use two unnamed buffers to diff and copy paste text from else where (say sql results) to diff. When I close them without running my command, and later discover this problem, I have to hunt around for the unnamed buffers that are silently participating in the diff and get rid off them. There may be other aspects in the way I work that get me into this diff problem, but I haven't analyzed all. -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: a question about 'diff' setting
On Thu, 29 Jun 2006 at 2:07pm, Tim Chase wrote: > > The documentation says the 'diff' setting is local to window, so closing > > the windows show cancel the setting out, but when I try the below > > sequence on two related files say, x.old and x.new, it seems otherwise. > > Vim seems to keep the 'diff' information around in the same way > it keeps marks in a given file. Until it's unloaded, it still > seems to remember it. Using :bw seems to obliterate the file so > that the next time it is loaded you don't have 'diff' set. > > I agree that the docs saying that 'diff' is per-window seems a > bit misleading, as it seems to be per-buffer. > > Just my $0.02 observation... > > -tim I first though the same way, that 'diff' is probably a buffer local setting (instead or in addition to being window local), and so tried to search for buffers with 'diff' value "1" using getbufvar(), but this interestingly returns "1" only when you are in the window for that buffer. What I mean is, say a buffer 600 has 'diff' set. If you are in a window containing a different buffer, and call getbufvar(600, '&diff'), you get "0", but if you are in the window that has buffer 600 visible, you get "1". This obviously means you will never get "1" for a buffer that is not currently visible in any window, so a loop to find the buffer will not work. -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com