From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Richard Hartmann <richih.mailinglist@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: Substituting grep (and other) output to open files in Vim
Date: Tue, 10 May 2011 11:26:31 -0400 (EDT) [thread overview]
Message-ID: <alpine.LNX.2.01.1105101119570.28316@hp> (raw)
In-Reply-To: <BANLkTik+65NedRoVNJMgj9+Oma_XDmz8dA@mail.gmail.com>
On Tue, 10 May 2011, Richard Hartmann wrote:
> Hi all,
>
> I would like to be able to do the following, but I am stuck. Every
> pair of lines is what I would execute and what it would be transferred
> to. I am assuming that every file "name" (i.e. including colons etc) I
> am running Vim on does not exist. If it exists, it should be opened
> instead of magic happening. "foo" exists while "foo:" etc do not.
>
> vim foo:
> vim foo
>
> vim foo:bar
> vim foo
>
> vim foo:123
> vim foo +123
>
> vim foo:123:
> vim foo +123
>
> vim foo:123:bar
> vim foo +123
>
> Ideally, the same would happen for vimdiff. And yes, vimdiff heeds
> only one +n and the last one on the command line wins. That's fine.
>
>
> I am pretty sure this is trivial to do in zsh, but as I said I am at a
> loss as to how..
I'm at a loss as to "why". :-)
What's the actual problem you're trying to solve? These don't seem like
things you would want to type, so it looks like you're joining a bunch
of parameters with colons only to want to separate them out to separate
arguments later. If you keep them in an array in the first place, you
don't have this problem. And maybe it'd be easier to get what you want.
e.g. (without handling the ':bar' portion since I don't know what it
would be)
vimargs=( vim )
(( $+file )) && vimargs+=( $file )
(( $+line )) && vimargs+=( +$line )
$vimargs
--
Best,
Ben
next prev parent reply other threads:[~2011-05-10 15:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-10 13:46 Richard Hartmann
2011-05-10 14:12 ` Mikael Magnusson
2011-05-10 14:14 ` Jérémie Roquet
2011-05-10 18:16 ` Richard Hartmann
2011-05-11 1:00 ` Wayne Davison
2011-05-27 15:09 ` Richard Hartmann
2011-05-27 22:00 ` Wayne Davison
2011-05-28 11:51 ` Richard Hartmann
2011-05-10 15:26 ` Benjamin R. Haskell [this message]
2011-05-10 17:37 ` Mikael Magnusson
2011-05-10 18:16 ` Richard Hartmann
2011-05-10 18:58 ` Benjamin R. Haskell
2011-05-10 22:27 ` Richard Hartmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.01.1105101119570.28316@hp \
--to=zsh@benizi.com \
--cc=richih.mailinglist@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).