Friday, June 29, 2012

Re: How did I get two instances of vim?

On Jun 29, 2012 at 11:08 AM -0400, Eric Weir wrote:
>When I do this, I get a "swap file already exists" *every* time I load
>a file---no matter how many times I load it. Even after I've written
>the file. I tried deleting "~/.vim/sessions/default.vim.lock." That at
>least got the session to load when vim is started up, but I get the
>"swap file already exists" warning with it too. Again, *every* time I
>open the file. Even after writing it.

Well, if you don't remove the swap file, then you should get that
warning every time. Note, this isn't a session.vim issue, this is just
a vim issue. You have swap files sitting around. You get warnings when
you try to open a file and there is a swap file for it already. Vim
makes swap files when you open a file. It's supposed to remove them
when you close a buffer. If the buffer hasn't been closed properly (vim
crashes, you lose power, or something else), then the swap file doesn't
get deleted and you get warned the next time you open that file. "Hey,
there's a swap file here, do you want to edit it?" Another common
reason to get that warning is if you start editing a file that is
already open by another instance of vim.

The question is why is why do you have swap files sitting around?

>I quite vim and restart it. It opens as vim1 again! The default session
>doesn't load I look at the Activity Monitor and there are two instances
>of vim again! What the hell is going on?

The processes in Activity Monitor are not necessarily all separate
instances of Vim. When I start up MacVim, I get one process named
MacVim and two named Vim. Opening up a new instance (VIM1), gives me
one extra process named Vim in Activity Monitor.

I didn't bring up Activity Monitor as a way for you to count Vim
instances. It was a way to make sure that you could have nothing
related to vim running. Quit Vim. Then check Activity Monitor for
anything called vim in there. If you've quit all instances of vim,
there shouldn't be anything there related to vim. Then you can start
from a clean slate.

>I'm wondering if the way I've been using vim-session is part of, or all
>of, the problem. Do I need to close the session before quitting vim?

That would make sense to me. I'm not sure if the lock file is cleaned
up if you don't close the session. I've not looked at the code to
check. I also don't particularly care because I just use :CloseSession
when I'm done.

You seem to think all of your problems are always from whatever plugin
you are running. I would look into why a newly started MacVim instance
is starting as VIM1 and not VIM. I don't think that's a session thing.
I also don't think it's a session thing that you have swap files
scattered about. That sounds like something related to improper shut
down to me.

If you completely quit vim and restart it, you should have a vim server
running with the name VIM (on MacVim at least). If it's something else,
like VIM1, something funny is going on - Vim must seem to think instance
VIM is occupied. This isn't a session thing (most likely).

--
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

No comments:

Post a Comment