Well, if I open the same file that I already opened in another terminal, then it shows me the PID of the Vim process and a question about removing the lock file.
What I normally do is kill the PID, and then open the file again and tell Vim to remove the lock file.
This can be automated. But even better would be to allow me to take over the session in case there were any unsaved changes.
Comments
What specifically do you need fixed?
Well, if I open the same file that I already opened in another terminal, then it shows me the PID of the Vim process and a question about removing the lock file.
What I normally do is kill the PID, and then open the file again and tell Vim to remove the lock file.
This can be automated. But even better would be to allow me to take over the session in case there were any unsaved changes.
There's the built-in `packadd editexisting` to take care of that; On Unix https://github.com/gioele/vim-autoswap could be more convenient.
Thanks, but these only seem to work with graphical versions of Vim. Also, if you suspend your Vim session, these seem to stop working.
Try these work-arounds:
- either adding to your `:help vimrc`
if has('clientserver') && empty(v:servername) try call remote_startserver('VIM-' . getpid()) catch '^Vim\%((\a\+)\)\=:E\%(941\|240\)' endtry endif
- or, at least on Unix, calling vim by, say `$HOME/bin/vim` with `$HOME/bin` in `$PATH` and launching
/usr/bin/vim --servername vim -u ~/.vim/vimrc "$@"