zsh-users
 help / color / mirror / code / Atom feed
* Re: global aliases substituting *within* a path
@ 2012-05-18 13:08 Ronald Fischer
  2012-05-21 17:54 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Ronald Fischer @ 2012-05-18 13:08 UTC (permalink / raw)
  To: zsh-users; +Cc: valodim

> echo a/f/b/b/x<TAB>

Doesn't help here, for two reason:

(1) At least in my version of zsh (4.3.12), this would not expand the
interim directories (f,b,b). Instead I have to write them out explicitly
(foo/bar/baz), i.e. this is exactly what I wanted to avoid.

(2) Even if I could do TAB completion on directories within the path,
this is not what I'm looking for, because it is still cumbersome to
type.

:-(

Ronald
-- 
Ronald Fischer <ronaldf@eml.cc>
+  If a packet hits a pocket on a socket on a port, 
+  and the bus is interrupted and the interrupt's not caught,
+  then the socket packet pocket has an error to report.
+		(cited after Peter van der Linden)


^ permalink raw reply	[flat|nested] 6+ messages in thread
* global aliases substituting *within* a path
@ 2012-05-16 11:43 Ronald Fischer
  2012-05-16 12:17 ` Valodim Skywalker
  2012-05-16 12:40 ` Manuel Presnitz
  0 siblings, 2 replies; 6+ messages in thread
From: Ronald Fischer @ 2012-05-16 11:43 UTC (permalink / raw)
  To: zsh-users

I have a set of directory structures like this:

aaa/foo/bar/baz/xxx
bbb/foo/bar/baz/yyy
ccc/foo/bar/baz/zzz
etc.

I'm looking for a way to make typing easier on the command line, in
order to not have to type foo/bar/baz all the time.

Of course I can achieve this by setting a shell variable in my .zshrc:

X=foo/bar/baz

Then I can do for instance

  ls aaa/$X/xxx

Now I recently learned about global aliases, which permit alias
substitution to be done within the command line, and I thought that I
maybe could use this. Here was my (failed) attempt:

alias -g X=foo/bar/baz

# Does NOT work at hoped
ls aaa/X/xxx

X is not substituted, because it is not a word on its own (not
surrounded by spaces).

My question: For my problem, do I have to stick with my original
solution (shell variable), or is it a way to do it with aliases, or is
there maybe an even more clever way to achieve my goal?

Ronald
-- 
Ronald Fischer <ronaldf@eml.cc>
+  If a packet hits a pocket on a socket on a port, 
+  and the bus is interrupted and the interrupt's not caught,
+  then the socket packet pocket has an error to report.
+		(cited after Peter van der Linden)


^ permalink raw reply	[flat|nested] 6+ messages in thread
* global aliases substituting *within* a path
@ 2012-05-16 11:41 Ronald of Steiermark
  0 siblings, 0 replies; 6+ messages in thread
From: Ronald of Steiermark @ 2012-05-16 11:41 UTC (permalink / raw)
  To: zsh-users

I have a set of directory structures like this:

aaa/foo/bar/baz/xxx
bbb/foo/bar/baz/yyy
ccc/foo/bar/baz/zzz
etc.

I'm looking for a way to make typing easier on the command line, in
order to not have to type foo/bar/baz all the time.

Of course I can achieve this by setting a shell variable in my .zshrc:

X=foo/bar/baz

Then I can do for instance

  ls aaa/$X/xxx

Now I recently learned about global aliases, which permit alias
substitution to be done within the command line, and I thought that I
maybe could use this. Here was my (failed) attempt:

alias -g X=foo/bar/baz

# Does NOT work at hoped
ls aaa/X/xxx

X is not substituted, because it is not a word on its own (not
surrounded by spaces).

My question: For my problem, do I have to stick with my original
solution (shell variable), or is it a way to do it with aliases, or is
there maybe an even more clever way to achieve my goal?

Ronald
-- 
Ronald Fischer <austria_rules@yepmail.net>

There are 10 types of people in the world: those who understand binary and those who don't.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-21 17:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-18 13:08 global aliases substituting *within* a path Ronald Fischer
2012-05-21 17:54 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2012-05-16 11:43 Ronald Fischer
2012-05-16 12:17 ` Valodim Skywalker
2012-05-16 12:40 ` Manuel Presnitz
2012-05-16 11:41 Ronald of Steiermark

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