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

Get the `pwd` in an `alias`?

Is there a way I can get the pwd in an alias in my .zshrc file? I'm trying to do something like the following: alias cleanup="rm -Rf `pwd`/{foo,bar,baz}" This worked fine in bash; pwd is always the directory I've cd'd into, however in zsh it seems…
Phillip B Oldham
  • 18,807
  • 20
  • 94
  • 134
13
votes
2 answers

Is it possible to bindkey Shift+Enter in zsh?

I'm starting to use zsh on macOS Sierra. I would like to have the following key mappings: Enter => accept-line Shift-Enter => accept-and-hold However, I can't seem to differentiate between the two. I'm only able to get Enter, and Esc-Enter, but…
Joseph Pecoraro
  • 2,858
  • 1
  • 20
  • 25
13
votes
4 answers

How do you share zsh history between multiple machines?

I have a setup I'm pretty happy with for sharing my configuration files between machines, but I find that I often want to search back in zsh (Ctrl + R) and I can't remember which machine I typed the command on. Ideally I'd like this to search a…
user221137
12
votes
1 answer

How does the matcher-list arguments work in zsh zstyle completion?

I'm trying to configure my ~/.zshrc so code completion on files/dirs work as I need it. I've found various ressources online on the zstyle completion syntax, and code example but some parts of it are still black magic to me. So far, here is where I…
pixelastic
  • 5,138
  • 6
  • 24
  • 29
12
votes
2 answers

Using ANSI escape sequences in zsh prompt

I'm trying to use ANSI escape sequences to set the color of my zsh prompt, but the escape character (\e) seems to be being escaped when displaying the prompt. Here's an example of what I'm running and the output I'm getting: > autoload promptinit &&…
robbiemc
  • 123
  • 1
  • 5
12
votes
5 answers

How does one locate a .zshrc file?

I used Homebrew to install Z shell (zsh) 5.0.7 on my Mac. For the life of me, .zshrc is nowhere to be found. It is not in ~. Is is not in /etc or /etc/zshrc as they suggest here: http://zshwiki.org/home/config/files Am I supposed to create it…
Ulysse
  • 123
  • 1
  • 1
  • 4
11
votes
1 answer

zsh issue : have the most recents files and 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 latest modified or create files and directories near to the prompt (sorted from the most recent up to the oldest ones). Here my current config in ~/.zshrc : # ZSH completion autoload…
user1773603
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…
11
votes
3 answers

git add auto-complete filename

I am working on a git project. Since I have a lot of folder deepness, I would like to improve my auto-completion to work with filenames and not only paths. Here is an example: $git status …
nsvir
  • 8,781
  • 10
  • 32
  • 47
11
votes
4 answers

How to make zsh search configuration in $XDG_CONFIG_HOME

Looking to make my ~ a cleaner place, I would like to move as much user configuration files into $XDG_CONFIG_HOME, which is ~/.config by default. So I would like to store all my zsh user files in $XDG_CONFIG_HOME/zsh/. So far already have this: % ls…
psychoslave
  • 2,783
  • 3
  • 27
  • 44
11
votes
1 answer

Vim use a variable interpolated within a String?

I have a .zshrc and .vimrc file In my .zshrc file I have syncfolder="$HOME/Google Drive/Dropbox" I now want to reference syncfolder within my .vimrc file, is this possible (if so, how)? Also, within my .vimrc file I'm sourcing lots of other files…
Integralist
  • 2,161
  • 1
  • 32
  • 50
11
votes
1 answer

ZSH RPROMPT weird spacing?

Here is my ZSH prompt theme function git_prompt_info() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" } PROMPT='$fg[yellow]%}⚡︎…
ahmedelgabri
  • 1,228
  • 3
  • 17
  • 30
11
votes
3 answers

Adding an alias for Sublime Text to zshrc

Just have a quick question on how to add an alias for SublimeText to my ZSH. I've been to their site where they tell you how to do it within bash, but I don't understand how to do it within ZSH. It has been killing me, I just want to open text files…
saltex
  • 133
  • 1
  • 1
  • 5
10
votes
3 answers

.zshenv:2: command not found: rbenv

When switching from bash to zsh, I looked up how to resolve an issue with my rbenv folder not being used correctly by zsh and found this: $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv $ echo 'eval "$(rbenv init -)"' >> ~/.zshenv $ echo…
ahrampy
  • 173
  • 2
  • 2
  • 9
10
votes
2 answers

zsh: unknown file attribute

I have the following function in my .zshrc which, in theory, allows me to write a commit message without needing quotation marks. cm(){ git commit -m "$@" } When I run it (cm foo bar), I get the following error: zsh: unknown file…
Marcel
  • 1,034
  • 1
  • 17
  • 35