chrisbra / Recover.vim

A Plugin to show a diff, whenever recovering a buffer
http://www.vim.org/scripts/script.php?script_id=3068
248 stars 25 forks source link

request to avoid 'sleep' #30

Closed justinmk closed 10 years ago

justinmk commented 10 years ago

On Windows, this line:

https://github.com/chrisbra/Recover.vim/blob/6efd69403d3abc342d0cdd429f85d1d335ee2528/autoload/recover.vim#L171

Takes 3 seconds. (though if I execute that command in cmd.exe it's less than 1 second)

I'm not sure how to make it faster, but it would reduce the pain if one didn't also need to wait another 2 seconds here:

https://github.com/chrisbra/Recover.vim/blob/master/autoload/recover.vim#L225

Would you consider removing that sleep 2 call? The message "Found SwapFile, opening file readonly!" is written to the :mes log already, and the user made the choice so presumably doesn't need a 2-second notification of that choice immediately after.

chrisbra commented 10 years ago

Hi Justin!

On Di, 19 Aug 2014, Justin M. Keyes wrote:

On Windows, this line:

https://github.com/chrisbra/Recover.vim/blob/6efd69403d3abc342d0cdd429f85d1d335ee2528/autoload/recover.vim#L171

Takes 3 seconds. (though if I execute that command in cmd.exe it's less than 1 second)

I'm not sure how to make it faster, but it would reduce the pain if one didn't also need to wait another 2 seconds here:

https://github.com/chrisbra/Recover.vim/blob/master/autoload/recover.vim#L225

Would you consider removing that sleep 2 call? The message "Found SwapFile, opening file readonly!" is written to the :mes log already, and the user made the choice so presumably doesn't need a 2-second notification of that choice immediately after.

Let's try this and see if someone complains ;)

Best,

Christian

Ich war der beste, den ich jemals hatte. -- Woody Allen (eigentlich: Woody Stewart)

justinmk commented 10 years ago

Thanks!

justinmk commented 10 years ago

On Windows, this line:

https://github.com/chrisbra/Recover.vim/blob/6efd69403d3abc342d0cdd429f85d1d335ee2528/autoload/recover.vim#L171

Takes 3 seconds. (though if I execute that command in cmd.exe it's less than 1 second)

That was with set noshelltemp. After set shelltemp, the command takes only 1.2 seconds:

    1   0.000419   0.000400     let cmd = printf("vim -u NONE -N %s -r %s -c \":w %s|:q!\" %s diff %s %s", (s:isWin() ? '' : '-es'), (s:isWin() ? fnamemodify(v:swapname, ':p:8') : shellescape(v:swapname)), tfile, (s:isWin() ? '&' : '&&'), bufname, tfile)
    1   1.220848   0.002491     call system(cmd)

Guess I will go back to set shelltemp on Windows...