Re: [PATCH] Set the buffer to be modified after recovery (was: Save recovered file with ZZ?)

2010-04-26 Fir de Conversatie Tom Sorensen
On Tue, Apr 20, 2010 at 6:09 PM, Christian Brabandt cbli...@256bit.org wrote:
 Hi Tom!

 On Sa, 17 Apr 2010, Tom Sorensen wrote:

 It also works differently on different platforms. I played around with
 a similar plugin (SwapExists.vim) that James wrote (iirc) about 6
 months ago and could not get it to work consistently on both Windows
 and Linux. I didn't even try for AIX, Solaris, or the other platforms
 I have access to.

 Where can I find that plugin?

http://github.com/godlygeek/vim-files/blob/master/plugin/SwapExistsDiff.vim

It was written by Matt Wozniski, not James. The issues I had with it
were that it would not perform correctly on both Windows and Linux. As
I recall (based on my log searches) it would do nothing the first time
you edited the file, but execute the second time. Some issue with the
BufWinEnter's executing out of the defined order. That was what I
found last June, and I stopped messing with it shortly after.

Tom

-- 
You received this message from the vim_dev 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

Subscription settings: http://groups.google.com/group/vim_dev/subscribe?hl=en


Re: [PATCH] Set the buffer to be modified after recovery (was: Save recovered file with ZZ?)

2010-04-26 Fir de Conversatie Matt Wozniski
On Mon, Apr 26, 2010 at 11:14 AM, Tom Sorensen wrote:
 It was written by Matt Wozniski, not James. The issues I had with it
 were that it would not perform correctly on both Windows and Linux. As
 I recall (based on my log searches) it would do nothing the first time
 you edited the file, but execute the second time. Some issue with the
 BufWinEnter's executing out of the defined order. That was what I
 found last June, and I stopped messing with it shortly after.

I've also found it to not work quite right on Solaris - the only
platform it seemed to work well enough on was Linux.  I'd be
interested to find out if the feedkeys-based approach works more
reliably.

~Matt

-- 
You received this message from the vim_dev 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

Subscription settings: http://groups.google.com/group/vim_dev/subscribe?hl=en


Re: [PATCH] Set the buffer to be modified after recovery (was: Save recovered file with ZZ?)

2010-04-20 Fir de Conversatie Christian Brabandt
Hi Tom!

On Sa, 17 Apr 2010, Tom Sorensen wrote:

 On Sat, Apr 17, 2010 at 4:31 PM, Christian Brabandt cbli...@256bit.org 
 wrote:
  Would the attached plugin be helpful? It uses the SwapExists autocommand
  to create a diff buffer. Using the SwapExists autocommand works
  differently it seems, therefore the plugin uses feedkeys() extensively.
 
 It also works differently on different platforms. I played around with
 a similar plugin (SwapExists.vim) that James wrote (iirc) about 6
 months ago and could not get it to work consistently on both Windows
 and Linux. I didn't even try for AIX, Solaris, or the other platforms
 I have access to.

Where can I find that plugin?

 I eventually gave up on getting it to work sanely, as did everyone
 else on the IRC channel to my knowledge.
 
 If this one is better, then I'd be happy to have it. Or even have
 similar integrated into vim directly -- I see little point in vim
 asking about recovery, etc. if it can detect that the file is
 unchanged from a content perspective.

I uploaded my version 
http://www.vim.org/scripts/script.php?script_id=3068

(but this is a rough version, but should work on Windows and Linux)

regards,
Christian

-- 
You received this message from the vim_dev 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

Subscription settings: http://groups.google.com/group/vim_dev/subscribe?hl=en


Re: [PATCH] Set the buffer to be modified after recovery (was: Save recovered file with ZZ?)

2010-04-17 Fir de Conversatie Christian Brabandt
Hi James!

On Fr, 16 Apr 2010, James Vega wrote:

 IMO, that way would be performing automatic diffing of the recovered
 buffer with the on-disk file.  If anything short of that is done, then
 the current behavior should be maintained.

Would the attached plugin be helpful? It uses the SwapExists autocommand 
to create a diff buffer. Using the SwapExists autocommand works 
differently it seems, therefore the plugin uses feedkeys() extensively.

regards,
Christian
-- 
Mann: Es ist doch immer wieder erstaunlich, daß die hübschesten
  Mädchen die größten Idioten heiraten.
Frau: Liebling. Das ist das schönste Kompliment seit Jahren. 

-- 
You received this message from the vim_dev 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

Subscription settings: http://groups.google.com/group/vim_dev/subscribe?hl=en
 Vim plugin for diffing when swap file was found
 Maintainer: Christian Brabandt c...@256bit.org
 Last Change: 2010-04-17
 Last Version: 0.2

 Exit quickly when:{{{
 - this plugin was already loaded
 - when 'compatible' is set
if exists(b:loaded_recover) || cp
  finish
endif
let b:loaded_recover = 1}}}

fu! sidRecover(on)
if a:on
call sidModifySTL()
if !exists(s:old_vsc)
let s:old_vsc = v:swapchoice
endif
augroup Swap
au!
au SwapExists * :let v:swapchoice='r'|:let g:diff_file=1|exe au 
BufReadPost  expand('afile')  :call sidDiffRecoveredFile()
augroup END
else
augroup Swap
au!
augroup end
if exists(s:old_vsc)
let v:swapchoice=s:old_vsc
endif
call sidResetSTL()
let g:diff_file=0
endif
endfu

fu! sidDiffRecoveredFile()
if exists(g:diff_file)  g:diff_file==1
 For some reason, this only works with feedkeys.
 I am not sure  why.
call feedkeys(:diffthis\n, t)
call feedkeys(:setl modified\n, t)
call feedkeys(:let b:mod='recovered version'\n, t)
call feedkeys(:noa vert new\n, t)
call feedkeys(:0r #\n, t)
call feedkeys(:f!  . escape(expand(afile), ) . \\ (on-disk\\ 
version)\n, t)
call feedkeys(:diffthis\n, t)
call feedkeys(:set bt=nowrite\n, t)
call feedkeys(:let b:mod='unmodified version on-disk'\n, t)
call feedkeys(:redraw!\n, t)
call feedkeys(:echo 'Found Swapfile, showing diff!'\n, t)
unlet g:diff_file
 Delete Autocommand
call sidRecover(0)
endif
endfu

fu! sidEchoMsg(msg)
echohl WarningMsg
echomsg a:msg
echohl Normal
endfu

fu! sidModifySTL()
:let s:ostl=stl
:let stl=substitute(stl, '%f', \\0 %{exists('b:mod')?('['.b:mod.']') : 
''}, 'g')
endfu

fu! sidResetSTL()
if exists(s:ostl)
let stl=s:ostl
endif
endfu

call sidRecover(0)
call sidRecover(1)

com! RecoverPluginEnable :call sidRecover(1)
com! RecoverPluginDisable :call sidRecover(0)


Re: [PATCH] Set the buffer to be modified after recovery (was: Save recovered file with ZZ?)

2010-04-17 Fir de Conversatie Tom Sorensen
On Sat, Apr 17, 2010 at 4:31 PM, Christian Brabandt cbli...@256bit.org wrote:
 Would the attached plugin be helpful? It uses the SwapExists autocommand
 to create a diff buffer. Using the SwapExists autocommand works
 differently it seems, therefore the plugin uses feedkeys() extensively.

It also works differently on different platforms. I played around with
a similar plugin (SwapExists.vim) that James wrote (iirc) about 6
months ago and could not get it to work consistently on both Windows
and Linux. I didn't even try for AIX, Solaris, or the other platforms
I have access to.

I eventually gave up on getting it to work sanely, as did everyone
else on the IRC channel to my knowledge.

If this one is better, then I'd be happy to have it. Or even have
similar integrated into vim directly -- I see little point in vim
asking about recovery, etc. if it can detect that the file is
unchanged from a content perspective.

Tom

-- 
You received this message from the vim_dev 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

Subscription settings: http://groups.google.com/group/vim_dev/subscribe?hl=en