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
0
votes
1 answer

Substitute a file extension in a zsh alias

I'm trying to create an alias for cwebp to run from zsh that converts an input image file, to an output image file of the same name, but with the .webp file extension: # in .zshrc alias cwebphoto='cwebp -preset "photo" -short -noalpha $1 -o…
s4l4x
  • 148
  • 6
0
votes
2 answers

Zsh completion for global aliases

Is there a way to get tab completion for global aliases in zsh? Defined as: % alias -g zshplugins=~/.zshplugins % nvim zshpl[tab] would not tab complete. I use global aliases mainly to not have to enter the path to a file nor restrict myself to a…
simohamed
  • 61
  • 1
  • 4
0
votes
1 answer

Zsh alias to launch Sublime Text with the current directory opened

I'm using zsh and trying to create a shortcut, stt, so I can open a folder in sublime text. I've currently added an alias that I found on a website, but it only opens a blank sublime, with no files from my folder. I'm not sure what I need to…
b.herring
  • 563
  • 2
  • 18
0
votes
1 answer

Can zsh `else` reserved keyword command be aliased and the lexem itself be repurposed as `fi` keyword command?

Following ZSH: Call in-built function from zsh function that uses the same name and Run a command that is shadowed by an alias, it might be expected that a command keyword equivalent of what builtin and command are doing for their respective…
psychoslave
  • 2,783
  • 3
  • 27
  • 44
0
votes
1 answer

Can zsh buildtins be aliased?

Reading What's the difference between shell builtin and shell keyword? I wondered how much I could alias stuff in the shell. So for example instead of writing string_with_spaces='some spaces here' if [ -n $string_with_spaces ]; then echo "The…
psychoslave
  • 2,783
  • 3
  • 27
  • 44
0
votes
1 answer

Unexpected zsh global alias expansion

EDIT: The example works in pure zsh. My installation with prezto won't work. Seems like a bug in prezto. I tried to alias sponge as SP in zsh. But the result is pretty surprising. Without global alias: ❯ echo xxx >! xxx ❯ cat xxx | sponge xxx ❯ cat…
Hugh Wang
  • 1
  • 2
0
votes
1 answer

Use of nested ternary expression in .zshrc prompt configuration

what is wrong with my RPS1 expression RPS1='%(t.[Ding!].%(t30.[Dong!].[%T]))' Explanation: I want to get [Ding!] if it is 11am, [Dong!] if it is 11:30am and if both is not true just normal time like [11:33]. But what is wrong? Tanks
dvonessen
  • 177
  • 1
  • 8
0
votes
1 answer

Quotes became invalid in .zshrc file

In my .zshrc file, if I add alias vii=“mvim -v” or alias vii=‘mvim -v’ After I used command vii, the terminal displayed: zsh: command not found: “mvim or zsh: command not found: ‘mvim If I put alias vii=mvim -v Then, commandvii works as mvim…
Sean Li
  • 13
  • 1
  • 4
0
votes
1 answer

trying to get a two bash functions with piping and optional args working

I have two things, one is a function the other is an alias and they don't quite work right. The first is for tailing logs but only showing the first 3 lines by finding the important part of the log you're looking for and then showing the next two…
Thermatix
  • 2,757
  • 21
  • 51
0
votes
1 answer

Call a user defined function/alias with arguments in ZSH shell

I am using zsh for my shell and I have the following function defined in my ~/.zshrc to run custom commands inside my vagrant VM. vt() { pushd ~/dev/vvv vagrant ssh -c $@ popd } So to run the xdebug_on command inside my vagrant VM, I…
Sudar
  • 18,954
  • 30
  • 85
  • 131
-1
votes
1 answer

How can I permanently remove an added alias from zsh (MacOS Terminal)?

I'm using MacOS and had the issue that my Terminal didn't react to the 'python' command, so I tried out what was recommended here (manually adding an alias to zsh with echo "alias python=/usr/bin/python3" >> ~/.zshrc). Turned out this wasn't the…
bs90
  • 1
  • 2
-1
votes
1 answer

Function creates a folder but do not cd into the folder if it exists

Following is the function I have added in the .zshrc configuration file to create a Notes folder if it does not exist and if the folder exists it has to cd to that folder. function mnotes(){ if [ ! -d ~/Desktop/Notes ];then mkdir…
Santhosh Pai
  • 1
  • 1
  • 1
-1
votes
1 answer

How do I pass a variable to a bash alias easier nmap scanning? (Function, alias, script…?)

Been poking around for a bit trying to find a straight answer but VScode keeps giving me grief when checking the syntax and the alias doesn't seem to work. I often switch between networks with devices that aren't easily discoverable and their IP…
JWhiteUX
  • 47
  • 9
-1
votes
1 answer

Zsh Alias | Mac OS - No such file or directory but exists

I'm trying to create an alias to activate any given Venv by typing activate [name of Venv]. What I've done: activate (){ directory = "~/Programming/path-to-venvs/$1" cd $directory source "bin/activate" } When I try to run it, if I…
451
  • 1
  • 3
1
2