# Zsh

## Install

Install Zsh.

```bash
brew install zsh
```

Install Oh My Zsh.

```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
```

Upgrade it.

```bash
upgrade_oh_my_zsh
```

Change theme

Edit the config file.

```bash
nano ~/.zshrc
```

### References

<https://github.com/robbyrussell/oh-my-zsh/issues/1906#issuecomment-252443982>

<https://www.freecodecamp.org/news/how-to-configure-your-macos-terminal-with-zsh-like-a-pro-c0ab3f3c1156/>

## Change theme.

```
#ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"
```

Reload the config.

```bash
source .zshrc
```

### References

<https://github.com/robbyrussell/oh-my-zsh/wiki/Themes>

## Install fonts

Run.

```
git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
```

Change your iTermr2 font to Meslo LG L for Powerline.

## Fixes

### Autocomplete

Put these two lines at the end of my `.zshrc`

```bash
autoload -Uz compinit
compinit
```

### Slow cd to git folder

```
git config --add oh-my-zsh.hide-status 1
git config --add oh-my-zsh.hide-dirty 1
```

## Shorten path

Edit your theme confi file.

```bash
cd ˜/.oh-my-zsh/themes/
vi agnoster.zsh-theme
```

Edit the file as follows.

```bash
prompt_dir() {
  #prompt_segment blue $CURRENT_FG '%~'
  prompt_segment blue $CURRENT_FG '%2~'
}
```

Apply changes.

```
source ˜/.zshrc
```

### Update ZSH after the change

```
cd ~/.oh-my-zsh
git stash
upgrade_oh_my_zsh
git stash pop
```

### References

<https://medium.com/@shandou/how-to-shorten-zsh-prompt-oh-my-zsh-14185f3e7ab7>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.devops.buzz/public/macos/zsh.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
