All Questions
116
questions
2
votes
2
answers
287
views
Turn off one flag of command and infinite recursion
Since it overwrites my history when used in multiple terminals, I want to turn off the functionality fc -W. Unfortunately I have a habit of typing it often.
I think it's not possible to make an alias,...
2
votes
2
answers
1k
views
Execute zsh alias when name contains a hyphen
A stock-standard zsh behaves as follows with an alias with a - in it, eg: a-a:
% zsh -f
svelte% alias a-a=date
svelte% a-a
Sun 19 Jul 2020 17:20:05 +07
My configuration has it behave as follows:
% ...
2
votes
2
answers
965
views
Why do I have to use this command twice to execute it?
I made an alias alias goto="cd $@ && source ~/.zshrc" and it works, but only if I execute it twice. Even after I execute it twice in one shell, and if I want to move to another dir, ...
2
votes
1
answer
806
views
alias ? not working in zsh
I was lead to believe that there were no differences between aliases in zsh and bash, however that appears to not be the case. I had an alias that would help me familiarize myself with the command ...
2
votes
2
answers
401
views
create an alias on ZSH but need to type it twice
I'm trying to create an alias on ZSH.
The aim of the alias is to activate a python virtualenv.
I've put a line in my .zshrc
alias SOU="source /home/andykw/.zshrc && source $(setopt ...
2
votes
1
answer
956
views
Aliases don't work in interactive zsh
I have a curious problem where my aliases are listed when I type alias, but they are not executable.
Here, I try to alias d to date:
% which alias
alias: shell built-in command
% alias d=/usr/bin/...
2
votes
1
answer
122
views
Cancel an option used in aliased command?
Suppose for example, the following implementation of ll:
alias ls="ls -F -G" # colourise and display dir,exec,etc. icons
alias ll="ls -l -h -o" # long-list, use KB,MB,etc. sizes, no ...
2
votes
2
answers
150
views
Create new set of aliases based on current set of aliases (eg. gst -> dst)?
I'm using git aliases from zsh plugins: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git
So it has git aliases like:
gst # git status
ga # git add
gc "commit" # git commit -v "...
2
votes
1
answer
658
views
Expand alias in ZSH history
I have the following alias in my zshrc
alias nif='nvim $(rg --files | fzf -m || echo +qa)'
Essentially, I use rg (ripgrep) to show all the files in the current directory and in sub directories. This ...
2
votes
1
answer
322
views
Possible to make zsh up-arrow history search detect aliases?
I have git aliased to g. Sometimes I use g, and sometimes I don't.
I might run git add file1 and later g add file2.
When I want to add file1 again, I might type g add in the zsh prompt, and then ...
2
votes
3
answers
3k
views
Executing zsh rehash after build
I have a build script that can change what binaries are in my $PATH (it doesn't edit $PATH itself, but it adds/deletes files to folders that are already in $PATH). zsh's autocompletion doesn't update ...
2
votes
1
answer
75
views
Alias + and - in zsh?
For years I've used + and - as aliases for pushd and popd in both csh and bash. I've finally given up on my Macs and want to switch to zsh but I haven't been able to find a way to make these aliases. ...
2
votes
2
answers
168
views
Forcing the expansion of a global alias in part of a word
I have a couple of scripts /tmp/foo/bar.sh and /tmp/foo/baz.sh, the look like this:
# /tmp/foo/bar.sh
alias -g __FILE__='${(%):-%x}'
alias -g __DIR__='${${(%):-%x}%/*}'
printf "sourcing %s\n" ...
2
votes
0
answers
45
views
Can't unalias then redefine as a function in the same conditional [duplicate]
Here is a simplified implementation of an issue in my bash/zsh aliases file:
alias foobar='echo bar' # this is out of my control
if true; then
unalias foobar
echo we got inside the conditional
...
2
votes
1
answer
375
views
Why is a daily .zshrc reload required using an alias containing $(date -u +%Y%m%d)? [closed]
Each morning I run the following command that tails a log file created daily:
ssh -t [email protected] tail -f development/abc/$(date -u +%Y%m%d).log
This works just fine and each morning the log ...