Questions tagged [zsh-alias]

Questions about aliasing in the zsh Unix shell.

Questions about aliasing in the Unix shell.

Links

zsh aliasing on SourceForge

29 questions
11
votes
1 answer

Recommended method for reloading `.zshrc`? (`source` VS `exec`?)

Most people seem to recommend using source for reloading .zshrc. Why? First I tried out source ~/.zshrc. But it resulted in a compinit error (at reload, not for new shell instances at first .zshrc load). My reload alias is now: alias…
3
votes
2 answers

Handling "?" character passed to ZSH function

I'm having problem with setting up simple function in ZSH. I want to make function which downloads only mp3 file from youtube. I used youtube-dl and i want to make simple function to make that easy for me ytmp3(){ youtube-dl -x --audio-format mp3…
penumbra
  • 125
  • 1
  • 8
1
vote
2 answers

Bash Alias with ternary?

Still dipping my toes in bash coding and trying to crate a 1 liner alias to: if 'perms' is entered w/out a parameter, it does a stat -c '%a - %n' * else if 'perms' is entered with a parameter it does stat -c '%a - %n' Goal is if no…
J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
1
vote
1 answer

Can't refresh my .zshrc file because of npm

I try to refresh my .zshrc file by: $ source .zshrc but I get weird errors from npm (I don't know the connection to npm on this situation) about looking for package.json file inside my root user folder. I don't why the source command trigger…
omri tal
  • 98
  • 8
1
vote
1 answer

Zsh function sublime open folder and directory

I'm trying to write a zsh function for open files or folders from terminal. function osub () { if [[ -z $@ ]]; then /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl $@ else /Applications/Sublime\…
1
vote
2 answers

Alias executed recursively on OSX

I'm using oh-my-zsh a have the following alias in .zshrc: alias composer="php -d memory_limit=-1 $(which composer)" I get the following output: $ composer Could not open input file: composer: And for: $ which composer composer: aliased to php -d…
michalzuber
  • 5,079
  • 2
  • 28
  • 29
1
vote
1 answer

Create shell alias with semi-colon character

I've noticed that I have a tendency to mistype ls as ;s, so I decided that I should just create an alias so that instead of throwing an error, it just runs the command I mean. However, knowing that the semi-colon character has a meaning in shell…
Damon Swayn
  • 1,326
  • 2
  • 16
  • 36
1
vote
1 answer

How can I create a bash or zsh alias for git commit, git pull, git push and pull on a remote server?

If I type the following into Terminal I can accomplish everything I want: git commit -am "my commit message" ; git pull ; git push ; ssh user@server 'cd /path/to/git/repo/ ; git pull ; exit' I'd like to create the same as an alias in my ~/.zshrc.…
Ryan
  • 14,682
  • 32
  • 106
  • 179
1
vote
2 answers

zsh alias taking a list of subdirectories as arguments

My goal is to type client air tab and complete the list of clients i have within my ~/clients directory. Since hopefully my client list will grow i don't want to hardcode alias commands anymore but use client that will handle the cd…
pjammer
  • 9,489
  • 5
  • 46
  • 56
0
votes
0 answers

Is there a ways for zsh completion to ignore multiple command prefixes?

I'm trying to add zsh completions for some aliases which are prefixed by a command and some args. More specifically, I have some commands which are aliased to an envchain ENV_NAME prefix. For example: alias brew='envchain homebrew-credentials brew'…
Calin Don
  • 865
  • 2
  • 11
  • 19
0
votes
3 answers

When I use a terminal or zsh I can't run commands, And this is what appears: /dev/fd/14:18: command not found: compdef

When I use a terminal or zsh I can't run commands, And this is what appears: # /dev/fd/14:18: command not found: compdef # Does anyone know how to reset the terminal to normal mode? I tried to solve it and the only thing that got my terminal…
0
votes
1 answer

Why do I need to run my zsh alias twice to assign vcs_info to a variable?

I'm trying to create a zsh alias pog that force-pushes a local branch to a non-existent remote branch of the same name, creating it in the process. While I've been able to get this to work -- sort of -- it requires me to run the alias function twice…
Chris Perry
  • 6,666
  • 3
  • 11
  • 21
0
votes
1 answer

zsh issue : have the most recents files or directories near to the prompt and suggested most recent files or directories

On MacOS Big Sur 11.3, here is my .zshrc. I would like to get the newest files or directories near to the prompt (sorted from the most recent up to the oldest ones). For the moment, I make test with the following command alias of ls : The issue is…
user1773603
0
votes
2 answers

How do I access the last command from a zsh function?

I'd like to do something like this: function invim () { vim $(!!) } However when I run it, it says: invim:1: command not found: !! I assume this is because !! is an interactive shell expansion not available in noninteractive scripts/functions. In…
ijustlovemath
  • 703
  • 10
  • 21
0
votes
0 answers

Curly brace expansion: from tcsh to zsh

In ~/.tcshrc, I have the following aliases: alias trash 'echo ./*{~,.bak,.save} ./.*{~,.bak,.save} ./#*#' alias trashit 'rm -f ./*{~,.bak,.save} ./.*{~,.bak,.save} ./#*#' How can I implement the same in zsh? The curly brace expansion seems…
h q
  • 1,168
  • 2
  • 10
  • 23
1
2