Questions tagged [zshrc]

The .zshrc file is the configuration file for zsh.

Zsh is a feature rich shell, with many of the features of bash, tsch, csh, and ksh. The .zshrc file is the configuration file for that shell, and it allows zsh to be configured to the user's needs.

616 questions
3
votes
3 answers

Removing hostname in zsh by changing .zshrc

I would like to remove the hostname (I think that's what it is?) which is printed after @ on each line of the zsh terminal. At the moment at the start of every line I have: name@names-MacBook-Pro ~ % I would like it to be: name ~ % I tried making a…
6135105654
  • 202
  • 2
  • 5
  • 13
3
votes
1 answer

How to show git user in terminal (oh-my-zsh)

I'm having a blast with oh-my-zsh and enjoying the spaceship prompt. Just like it is showing my git branch and status - how can I make it show my current git user right next to that? (The reason for asking is because I'm doing pair coding and it…
Norfeldt
  • 8,272
  • 23
  • 96
  • 152
3
votes
1 answer

Insecure completion-dependent directories detected when try to source using python script

I write the script: with open("./aa.zsh", "wr") as f: f.write("#!/bin/zsh\n") f.write("chmod -R 755 ~/.oh-my-zsh\n") f.write("source {}\n".format(path)) os.chmod("./aa.zsh", 0o777) subprocess.call(['./aa.zsh']) I also tried…
Afik Friedberg
  • 332
  • 2
  • 8
3
votes
1 answer

compadd failure during optparse-applicative zsh completion script

So I'm not exactly sure whether this is something wrong with optparse-applicative's script or if I'm using it wrong. In the optparse-applicative readme, it states that programs are made available with automatic completion scripts, with options for…
Anrothan
  • 500
  • 5
  • 13
3
votes
1 answer

How to customize the look of currently selected(highlighted) completion in zsh?

Main question I would like to add powerline characters at the start and at the end of the selected completion, like this: Started the completion menu by inserting c and pressing the TAB key. Moved right in the completion menu by pressing the…
Iskustvo
  • 335
  • 1
  • 13
3
votes
0 answers

How to inherit tab-completion from a subcommand to a function in zsh

I have a function that is basically a wrapper around a tmux subcommand: function tma() { tmux attach-session -t $1 || tmux new-session -s $1 } I would like zsh to autocomplete with any open sessions that may exists as it currently does if I…
3
votes
0 answers

zsh profile not working on Iterm2

I have installed oh-my-zsh and Iterm2 but when I change my theme to Agnoster nothing changes. Here's my .zshrc file: export ZSH=/Users/{username}/.oh-my-zsh ZSH_THEME="agnoster" plugins=( git ) source $ZSH/oh-my-zsh.sh But my Iterm2 terminal…
grpcMe
  • 1,367
  • 5
  • 15
  • 28
3
votes
2 answers

zsh alias to remove all docker containers returns command not found

I have this alias in my .zshrc file: alias rmcons="docker rm -f $(docker ps -aq)" But after trying to execute it, it removes only one container and then it prints $rmcons ef8197f147fb zsh: command not found: c2ea2673f9e4 zsh: command not found:…
alohamaloha
  • 147
  • 1
  • 12
3
votes
3 answers

zsh: get filename of the script that called a function

Inside a function, how can I get the file name of whatever script called that function? Via prompt expansion, %x provides the name of the file that defines the function. %N provides the function name. How do I get the name of the file that called…
mgiuffrida
  • 3,299
  • 1
  • 26
  • 27
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
3
votes
3 answers

Zsh alias not working as in bash

I use this alias in my .bashrc but doesn't seem to work in zsh using .zshrc. Other aliases I use are working fine so I know the .zshrc is sourcing other aliases. alias rubydev3="cd ~/code/ruby/rails/rails3projects/" This is the error…
Joe Ryan
  • 793
  • 1
  • 7
  • 6
3
votes
1 answer

Multiline prompt formatting incorrectly due to date command in zsh

I have the following in my .zshrc: setopt PROMPT_SUBST precmd(){ echo"" LEFT="$fg[cyan]$USERNAME@$HOST $fg[green]$PWD" RIGHT="$fg[yellow]$(date +%I:%M\ %P)" RIGHTWIDTH=$(($COLUMNS-${#LEFT})) echo $LEFT${(l:$RIGHTWIDTH:)RIGHT} } PROMPT="$…
Lord_Zane 55
  • 63
  • 10
3
votes
1 answer

How can I move the cursor after a Zsh abbreviation?

I'm using this excellent script in my .zshrc file to accomplish zsh abbreviations: http://zshwiki.org/home/examples/zleiab The above works great. Here's my question: How can I modify these abbreviations or the script to have the cursor end up in…
Jamis Charles
  • 5,827
  • 8
  • 32
  • 42
3
votes
1 answer

Trouble installing prezto

I was a oh-my-zsh user but decided to switch to prezto. I followed the steps on their github page: https://github.com/sorin-ionescu/prezto Uninstalled oh-my-zsh, git cloned prezto. Not sure whether I understand step 3 clearly but now I do have…
clwen
  • 20,004
  • 31
  • 77
  • 94
3
votes
1 answer

Terminal errors on-load zsh ("...command not found: ^M")

I am changing over from oh-my-zsh to prezto. And now have run into the following error every time I open a terminal window: /Users/jasenlew/.zshenv:7: command not found: ^M /Users/jasenlew/.zshenv:13: parse error near…
jasenlew
  • 443
  • 1
  • 6
  • 7