Skip to main content

All Questions

Tagged with
1 vote
2 answers
1k views

/etc/zshrc is not applied when log in

I have no idea why having aliases that are applied to all interactive terminal (i.e., my user account and sudo) is so difficult. Most web search result were about BASH, but my shell is ZSH (Manjaro ...
Damn Vegetables's user avatar
1 vote
3 answers
3k views

How do I make an alias for a command with sudo

I want to add two aliases, so one executes a command when non sudo, and the other executes a command when sudo, like this: alias v = 'nvim' alias 'sudo v' = 'sudo -E nvim ' I also have set alias sudo=...
Ramita's user avatar
  • 11
1 vote
1 answer
170 views

How to send output to next input line?

This my snippet alias hst="history 1 -1 | cut -c 8- | uniq | fzf ". when I run hst The output is $ ~ hst (the output from hst) $ This is what I want $ ~ hst $ (the output from hst) Example ...
Jamm Utkarsh's user avatar
2 votes
2 answers
956 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, ...
Leo1807's user avatar
  • 23
1 vote
2 answers
189 views

Make alias from existing alias

I have 2 separate files, which are both sourced from my .zshrc, one of them (the first one) is defining this alias: alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' problem is that ...
ItsDrike's user avatar
  • 123
3 votes
1 answer
41 views

On using $hash_array[$(global_alias)]

Identical code works on one system, fails on another: % zsh --version zsh 5.0.7 (x86_64-pc-linux-gnu) % typeset -A frobozz % alias -g foo='echo xyz' % frobozz[$(foo)]=9 % echo ${(kv)frobozz} xyz 9 % ...
kjo's user avatar
  • 15.6k
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" ...
kjo's user avatar
  • 15.6k
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 ...
Joseph Garvin's user avatar