Friday, June 22, 2012

Re: Can vim be made to start with selected files already open?

On 2012-06-22, Eric Weir wrote:
> On Jun 22, 2012, at 6:10 AM, Eric Weir wrote:
>
> > I'm gonna go ahead and give it a try. My be back here for further instructions.
>
> This is what I created.
>
> command All :args ~/documents/taskpaper/writing.taskpaper, ~/documents/taskpaper/work.taskpaper,
> ~/documents/taskpaper/mine.taskpaper, ~/vimwiki/index.wiki <bar> All
>
> Originally I named the command 'su' [startup]. It didn't take
> that. I changed to 'all'. To avoid having to enter an uppercase
> 'A'. That didn't work.

The names of user-defined commands must begin with an upper-case
letter. See

:help user-cmd-ambiguous

Another problem is that you are using commas to separate file names.
The names should be separated by only spaces, no commas.

Another problem is that you are attempting to execute the same
command again at the end with "<bar> All". I don't know what you
intended, but that should be "<bar> tab all" to open all the
arguments in individual tabs.

> I had a '-p' in there to try to get the files to open in tabs. It
> seemed to be taking that as part of a path. I deleted it.

The "-p" works when invoking vim from the shell command line, not
when executing ex commands on Vim's command line.

> In its present form I get this error message:
>
> When I run it I get these error messages.
>
> "~/documents/taskpaper/writing.taskpaper," [New File]
> Error detected while processing /Applications/MacVim.app/Contents/Resources/vim/run
> time/scripts.vim:
> line 1:
> "~/documents/taskpaper/writing.taskpaper," [New File]

Vim saw the comma as part of the file name.

> Error detected while processing BufNewFile Auto commands for "*":
> E169: Command too recursive
> Error detected while processing BufEnter Auto commands for "*":
> E169: Command too recursive

The command was recursive because it ended with another execution of
itself. That is, the command was "All" and it ended with "<bar>
All".

This command should work:

command All :args ~/documents/taskpaper/writing.taskpaper ~/documents/taskpaper/work.taskpaper ~/documents/taskpaper/mine.taskpaper ~/vimwiki/index.wiki <bar> tab all

You can give it some name other than All but it must begin with an
upper-case letter. There are ways to force Vim to accept lower-case
user-command names, but that will just add complication to the
solution.

Regards,
Gary

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