Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Feature request: set extension for =( ) created file
On Sep 25, 8:17am, Sebastian Gniazdowski wrote:
}
} First thing that came to my mind is use of [], not () like Nikolay
} proposed, so e.g. vim =( cat ... )[java], although it also suffers
} from colliding with globbing, which is IMO a serious drawback.
Hmm ... maybe colliding with globbing is exactly what we need.
Consider (line breaks added for readability):
vim =(
git -C /home/user/github/proj.git cat-file blob 1e08920
)(e?'reply=($REPLY.java); ln $REPLY $reply'?)
This covers everything that's wanted except for the auto-removal of
the .java file; even "java" can be replaced by a $(git ls-tree ...)
to obtain the file extension.
So if we could replace "ln" with a builtin that implements "make
this link, but remove it when the current command context finishes"
we'd have a complete solution.
One step further to make it it's own glob qualifier (hardest part
may be coming up with what character to use) and we're set. In the
meantime,
alias vimtmp='() { { vim $1 } always { rm $1 } }'
And, good grief, I just realized this is another answer to FAQ #2.3.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author