On 2017-02-06, Gary Johnson wrote:
> On 2017-02-06, Charles E Campbell wrote:
> > Neil Watson wrote:
> > > Greetings,
> > >
> > > The other day I was editing a remote file via scp when my client machine
> > > crashed. Had the file been local there would have been a swap file to recover
> > > unsaved changes. Is it possible to have local swap file for a remote file?
> > >
> > There should be a local swap file; right now I don't have scp available
> > for me to test, although I plan on getting my laptop and desktop to
> > start playing together sometime (got to figure my way around the
> > security firewalls, etc). It might be in /tmp.
>
> I just tried a couple of experiments, editing an existing remote
> file using scp.
>
> $ vim scp://hostname/hello.txt
> :swapname
> No swap file
>
> Netrw is v162h.
>
> $ vim -N -u NORC scp://hostname/hello.txt
> :swapname
> No swap file
> :verbose set swapfile?
> noswapfile
> Last set from /usr/share/vim/vim80/autoload/netrw.vim
>
> Netrw is v156.
>
> There are several places in autoload/netrw.vim where :nowapfile
> appears. I didn't try to find out which was being executed or why.
Poking around some more, I found a number of instances of "setl
noswf" conditioned on g:netrw_use_noswf and found that
g:netrw_use_noswf was 1, which the netrw help says is the default.
So I started vim as
$ vim --cmd 'let g:netrw_use_noswf=0' scp://hostname/hello.txt
and voilà! Now :swapname shows the swap file name. Of course,
g:netrw_use_noswf could also be assigned in one's ~/vimrc file,
perhaps conditioned on the value of % or argv().
I still don't know why netrw does that that for files accessed over
scp, but at least there's now a workaround, and maybe a clue to help
Chip find the real solution.
Regards,
Gary
--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment