Skip to main content

All Questions

Tagged with
4 votes
1 answer
3k views

How to declare some aliases dynamically in zsh?

I would like to declare a few shortcut commands to switch between my various coding projects, so I have come up with the following script. projects=$(ls -d ~/Workspace/*/) prefix="/Users/myuser/...
le-doude's user avatar
  • 143
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))}' ...
HappyFace's user avatar
  • 1,620
4 votes
1 answer
302 views

Tab complete global alias names not at the beginning of a line

I have a bunch of aliases like this alias -g foo=cmd1 alias -g faz=cmd2 alias -g fam=cmd3 At the shell (I'm using zsh) I want to be able to type echo fa<TAB> and be prompted for faz or fam ...
Justin Garrison's user avatar
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 ...
JJD's user avatar
  • 587
3 votes
2 answers
1k views

How to create hyphen alias for zsh?

I am using zsh and oh-my-zsh on Ubuntu. To change into the recent directory in the past there was an alias set to - which is the same as cd -. Somehow the alias disappeared at my machine. This might ...
JJD's user avatar
  • 587
3 votes
2 answers
856 views

Making an alias which maps arguments to the middle of the command

I want to alias killapp X to pidof X | xargs kill or kill `pidof X`, but I can't think of a way to do this with just an alias on killapp. How could I do this so I don't have to do killapp X` ?
aaazalea's user avatar
  • 193
3 votes
1 answer
2k views

Using heredoc in zsh aliases

I would like to use heredoc in a zsh alias, for example: alias runthing="cd ~; date << HERE date HERE" However every time I run this alias, the shell acts as if I have not terminated the ...
Brian Hamill's user avatar
3 votes
3 answers
423 views

How to alias a command with '

I wanted to make an alias turn caps lock off: python -c 'from ctypes import *; X11 = cdll.LoadLibrary("libX11.so.6"); display = X11.XOpenDisplay(None); X11.XkbLockModifiers(display, c_uint(0x0100), ...
jinawee's user avatar
  • 187
3 votes
2 answers
944 views

How to create an alias that launches zathura with tabbed

So tabbed outputs it's xid when you run it. How could I put this into an alias dynamically? I'm looking to do something like: alias zathura = tabbed -c zathura -e ${tabbed Xid goes here} & disown
vimdiesel's user avatar
3 votes
1 answer
4k views

How to pipe into zsh with alias expansion?

I'm trying to run a line from history by piping it into zsh with: cat ~/.zsh_history | cut -d ';' -f 2 | sk --tac | zsh This works if the line I pick interactively with sk is a command that is ...
agentofuser's user avatar
3 votes
1 answer
294 views

How can I use !! in zsh alias

I am trying to create an alias that builds upon my previous command. Say I run ag foo After looking at the list I want to be able to use those results in vim so I do vim -q<(!! --vimgrep) The ...
chrisortman's user avatar
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
748 views

How to add an alias for 'git add **/'

I can't seem to add an alias for git add **/ I think those two asterisks is causing an issue, or it could be that forward slash. How do I solve this? So far I have tried alias ga='git add **/' When ...
Faraz Durrani's user avatar
2 votes
1 answer
361 views

Alias piping into awk

I am trying to create an ll with awk pipe alias. I am trying to escape the apostrophes using the following answers. alias lh= `ll -h | awk {'print $9, \"-\" ,$5, \"-\", $8, \"...
zerberus's user avatar
2 votes
1 answer
1k views

zsh alias with arguements

I have an alias for neovim-qt thus defined: gvim='nvim-qt --geometry 500x320 --' This allows me to call gvim foo.py ook.py and have a QT window running neovim with two tabs, one for each file. ...
Sardathrion - against SE abuse's user avatar

15 30 50 per page
1 2
3
4 5
8