Yakov Lerner wrote:
On 7/17/06, Fabien Meghazi <[EMAIL PROTECTED]> wrote:
> FYI, I just made a vim tip with the solution to your
> question: http://www.vim.org/tips/tip.php?tip_id=1285
> with credit to your nice example of :E command.
Thanks all for your response.
Yakov, my :E command does not open the file in the current tab if the
buffer is empty, it always open a new tab. I'm still trying to find a
solution for that.
Ah, I didn't pay enough attention to the contents of your E command.
The E command that checks for buffer-is-empty and opens new tab if buffer
is not empty will, I think, be:
command! -nargs=* -complete=file E if expand('%')=='' && line('$')==1
&& getline(1)=='' :tabnew <args> | else | :edit <args> | endif
(That's one long line)
Does this work for you ?
Yakov
Yakov, haven't you got the "if" and "else" switched around? I think the
above will open the file in the current tab *unless* the buffer is
empty, not *only if* the buffer is empty.
Best regards,
Tony.