All Questions
16
questions
101
votes
7
answers
37k
views
How to use `which` on an aliased command?
Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance,
alias vim='vim -X'
alias grep='grep -E'
alias ls='ls -G'
The problem is ...
29
votes
3
answers
30k
views
Escaping quotes in zsh alias
Following on from this question about stripping newlines out of text, I want to turn this into a zsh alias as follows:
alias striplines=' awk " /^$/ {print \"\n\"; } /./ {printf( \" %s \",$0);}"'
I'...
50
votes
5
answers
47k
views
Is it possible to include file in config file of zsh? How?
I'd like to have a file eg. f with only zsh aliases (pureness reasons). Then I'd like to include f file in my .zshrc file, so that the aliases defined in f are visible in .zshrc.
Is it possible?
If ...
14
votes
3
answers
8k
views
Resolve all aliases in a zsh command line
I have nested aliases and I want to resolve all of them before executing the command. How do I do that?
If there is a function that is not bound to any keys then M-x foobar is fine for me too. I ...
3
votes
1
answer
5k
views
How to create an alias for two Git commands that use a parameter? [duplicate]
I regularly have to delete a local and remote Git branch. Therefore, I run the following commands:
$ git branch -d feature-branch
$ git push --delete origin feature-branch
Since I mostly execute ...
1
vote
2
answers
399
views
zsh: alias or shell function to only echo its command line, including shell control characters
Using zsh, I'd like to create an alias or a shell function that operates as follows:
I want this alias or shell function to echo its command line without honoring any shell control characters such as &...
37
votes
2
answers
79k
views
How to reset a shell environment?
This issue has been bugging me for a while, and although I've thought I've found my answer through EnvWatcher, unfortunately it only works on Bash. And I use zsh.
I would like to replicate the things ...
29
votes
2
answers
5k
views
How to make the zsh "correct" functionality remember my spell-correction decisions
I have enabled correction (I wouldn't call it autocorrection specifically because of this issue) in zsh by enabling setopt correct in my .zshrc.
Now, when I type dtae in a terminal, I get:
dtae ...
25
votes
1
answer
5k
views
how to find file defining an alias
I am having a problem I'm not sure how to get around.
Somehwhere on my system, I have an alias defined as such:
alias subl=\''/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'\'
I ...
12
votes
5
answers
1k
views
How can I "stack" shell aliases?
In my .profile (sourced in sh emulation mode from my .zshrc) I have the following snippet:
if [ -f /usr/bin/pacmatic ]; then
alias pacman=pacmatic
fi
# Colorized Pacman output
alias pacman="...
7
votes
5
answers
6k
views
Get the expansion of an alias (in both bash and zsh)
I want to get the expansion of an alias.
For example, if I have:
alias g=hub
alias cdh='cd $HOME'
I want to have:
expand_alias g == hub
expand_alias cdh == cd $HOME
The tricky thing is that the two ...
6
votes
1
answer
3k
views
What's the intended use case for COMPLETE_ALIASES in zsh?
For some months now, I have had setopt completealiases in my .zshrc. I haven't the faintest idea why I added it - most other things have comments or can be understood from neighbouring settings. ...
4
votes
1
answer
363
views
How can I alias a history expansion in zsh?
I want this to work (it needs extendedglob and histsubstpattern):
alias ri='^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}'
But it doesn't:
$ alias sss='^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}' ...
4
votes
3
answers
8k
views
zsh alias being overridden somehow
I'm on a system running OS X 10.8.5.
I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon ...
0
votes
2
answers
135
views
Using dir var in an alias?
I have a directory variable and function as follows:
coding_dir="~/Documents/coding"
function f() { cd $1 && ls -a ; }
And I want to create an alias as follows:
alias rnd="f $coding_dir/...
0
votes
1
answer
333
views
What is the best way for storing and versioning his aliases/functions/symlinks?
actually I have these lines (exemplary) in my .zshrc file:
. ${TOOLS_HOME}/cli/.cli_base
. ${TOOLS_HOME}/cli/.cli_functions
. ${TOOLS_HOME}/cli/.cli_symlinks
This works fine so far. My only problem ...