Friday, June 29, 2012

Re: How did I get two instances of vim?

On Jun 29, 2012, at 10:16 AM, Tim Gray wrote:

> You could use Activity Monitor to search for running or hung instances of vim if you are concerned, and (force) quit them from there.

Thanks, Tim. I found three. I forced all three to quit. When I started Vim back up and tried to load my session, I got the same error message, only this time referencing an instance named vim2. Only one shows in Activity Monitor.

> In my experience, starting up vim from scratch results in an instance called VIM. Starting up a second one creates an instance called VIM1. In MacVim, these instance (server) names are in the title bar of the vim window. Presumably your only MacVim window currently says 'VIM'. If you open up more OS X windows, not vim panes, windows, or tabs, but windows in the OS, you start a new instance. Do you have multiple windows that you opened with command-N or through the 'New Window' command in the File menu? If so, you have multiple vim instances running. Each OS X window in MacVim is it's own vim instance.

I have on occasion opened a second OS X window of vim with command-N. Don't recall having done so recently. [This problem just showed up this morning. Have never encountered it before.] I always quit vim with command-q. If there's a warning about buffers being open, I write my files and then use command-q again.

>> How do I get rid of the second instance?
>
> If it's still running somewhere in some window, just quit it. If it's not running anywhere and the message is the result of improper session cleanup, remove ~/.vim/sessions/default.vim.lock. Or just follow the instructions of what session told you to do:
>
>> Use :OpenSession! to override.

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.

I went to the folders for the documents in my session and deleted all the swap files. There were two instances of each vimwiki swap file. Two taskpaper files had four instances. One had three. I deleted them all.

I went back to Activity Monitor. Found three new instances of vim. Quit them. Started vim. Default session didn't load. Tried OpenSession. Got the warning about the session being locked by another instance of vim---vim1 again. Deleted "~/.vim/sessions/default.vim.lock" again.

Finally, I think I have only one instance of vim. The default session loads when I start up vim. I don't get repeated "swap file already exists" warnings.

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?

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? I've been assuming that if the default session has the files I want on startup, I wouldn't need to, that simply quitting vim, making sure all files are written before doing so, would be OK.

Thanks for the suggestions of things to do. Haven't fixed the problem, but at least I have some things to work with.

------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA
eeweir@bellsouth.net

"We do not inherit the earth from our ancestors,
we borrow it from our children."

- Chief Seattle.

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