# Terminal Customization

## Hostname in Terminal

By default, the Terminal app will display your <username@hostname.local>.&#x20;

* We can change the hostname by going to **System Settings > General > About** but this still leaves `.local` appended within the Terminal
* So instead we can run this command `sudo scutil --set HostName <new_hostname>`

<figure><img src="/files/Pig4wXstzPZKqeMakWup" alt=""><figcaption></figcaption></figure>

***

## ZSH Shell

### Completion Features

{% code overflow="wrap" %}

```bash
# enable auto-completion for applicable apps installed with brew e.g., gh.
# https://docs.brew.sh/Shell-Completion
if type brew &>/dev/null
then
  FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"

  autoload -Uz compinit
  compinit
fi
```

{% endcode %}

```bash
# automatically capitalizes where needed e.g., `cd documents/` >> `cd Documents/`
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
```

***

### Auto-Suggestions

```sh
# add to ~/.zshrc
# enables suggestions based on previously used commands
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
```

<figure><img src="/files/SG8cF3PQ4LXUa6lWR4m9" alt=""><figcaption><p>hit left arrow key to use suggestion</p></figcaption></figure>

***

### AWS CLI

* [AWS docs](https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-completion.html#cli-command-completion-linux:~:text=source%20~/.bash_profile-,Enable%20command%20completion,-After%20confirming%20the)

```zsh
# add to ~/.zshrc
# enables command completion for aws cli (tab to complete)
# make sure path to aws_completer is correct
autoload bashcompinit && bashcompinit
autoload -Uz compinit && compinit
```

***

### Display Current Git Branch

```sh
# add to ~/.zsh
# updates shell colors, format, and displays git branch
parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
# color #s found here: https://misc.flogisoft.com/bash/tip_colors_and_formatting
COLOR_DEF='%f'
COLOR_USR='%F{243}'
COLOR_DIR='%F{197}'
COLOR_GIT='%F{39}'
NEWLINE=$'\n'
setopt PROMPT_SUBST
export PROMPT='${COLOR_USR}%n@%M ${COLOR_DIR}%d ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF}${NEWLINE}%% '
```

<figure><img src="/files/TnFw7lTuImwobKyflDhA" alt=""><figcaption><p>new colors and git branch in name</p></figcaption></figure>


---

# 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.techwithtyler.dev/operating-systems/macos/terminal-customization.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.
