On Tue, 2007-08-21 at 09:05 -0300, Ben Armstrong wrote:
> I need to tell Cream to open a new file using --remote-send because
> otherwise if I specify a file to open on the command line, my open
> hook doesn't get executed. When the wrapper detects that Cream is
> not yet running, it produces this command:
> >ruby cream.rb test.rb
> START C:\Vim\vim71\gvim.exe --servername CREAM "+let
> $CREAM_FILE_OPEN=\"C:/test.rb\"" "<C-U>"
> The "<C-U>" prevents Vim from opening a file when it starts up.
As opposed to turning off Preferences > Last File Restore?
> In cream-user.vim, I have a test for $CREAM_FILE_OPEN after all
> other settings are loaded. If it is set, the file is opened using
> Cream_file_open(). This works.
> When Cream is already running, the wrapper produces this command:
> >ruby cream.rb test.rb
> START C:\Vim\vim71\gvim.exe --servername CREAM --remote-send
> "<C-O>:call Cream_file_open(\"C:/test.rb\")<CR>"
> The wrapper is sending exactly the keystrokes I would type to open a
> file without using the menu. When I hand type in Cream the
> keystrokes specified as the argument to --remote-send, the file open
> works without creating an extra buffer. But when I send the
> keystrokes via --remote-send, an empty (Untitled) buffer is created
> in addition to a new buffer for the newly opened file.
I think this may be Vim working in the background. All sorts of unamed
buffers are created in practice, Cream can usually delete them or
avoid creating new ones via various autocmds. But when you pass an
argument in from an outside application, Vim acts before Cream and we
get a slightly dis-organized environment. Window > Tabs > Refresh Tabs
should usually fix this. Also, see if you can verify if the actual
buffer count/name is different or it is just the position within a
> If I have tabbed documents turned off, I am positioned in the extra
> buffer, so I have to switch to the new file buffer before I can
> start editing. If I have tabbed documents turned on, the tab for the
> empty buffer is created between the previous tab and the new tab,
> and the focus is on the file I told cream to open, which is slightly
> less annoying, but still problematic. I can't begin to imagine
> what's going on here. Any hints for debugging?
The code for all this is in cream-lib-win-tab-buf.vim, but you want to
make sure you understand what is happening in cream-autocmd. When
moving between tabs or windows, the logic is pretty simple, but when a
buffer is created or deleted, Cream has to go through a lot of hoops
to make sure everything has been managed.
Steve Hall [ digitect dancingpaper com ]
:: Cream... usability for Vim