---
# System prepended metadata

title: Personalizing your Terminal
tags: [Git, Terminal, Tutorials, Windows]

---

###### tags: `Git` `Terminal` `Tutorials` `Windows`

# Personalizing your Terminal
---
---

## Windows
---
### Bash
-

### CMD
-

## Mac
---
By default all Mac's come with a pretty good terminal so not a whole lot needs to be done.  However by default it does not show you if you are currently in a repository or enough of your folder path.  Windows users do see these things.  So lets add them to our terminal

1. 1st, in the current terminal regardless of current location type cd and hit enter
2. You should now see something like: 
    - `~/`
3. If you type pwd you should see something like:
    -`/Users/<your user name>` 
4. Now type open .zshrc and hit enter and a txt doc should open
    a. There are some devices where open will not work.  The .zshrc file is by default a hidden file and located at the root (~) where you are now.  If you unhide hidden files in the finder (cmmd + shift + . will unhide when using the finder) you should see this file. 
    b. However again some devices this is not always auto created so simply create one.
5. From here we can do a lot.

### Setting your default folder
- Hate going cd till you get to the folder you always store all your code in.  Open up that .zshrc file and change where by default your terminal will open up too.
- Add the following to the bottom of that file

```
cd ~/coding/
```
- Yup thats it... just that.  For my computer that is where I store all my coding projects. If I were to type pwd in the terminal this is what I would see
    - `/Users/Irish/coding/`
- Now save your file.  Close all open terminals and then reopen. You should now be at the folder you told it to start at.

### Adding Folder path
- By default Windows computers show the full folder path in the terminal. Mac's do not. So lets fix that.
```
export PS1='Melissa@\iMac:'
```
- Save file, close all terminals and open a new one.  Now it should show you

### Adding the ability to see the git branch


1. In the current terminal regardless of current location type cd and hit enter
2. You should now see something like ~/  and that is it.  if you do pwd here you should see /Users/<your user name>
3. now type open .zshrc and hit enter and a txt doc should open
4. for seeing all the folders enter the following code:
    autoload -Uz vcs_info
    zstyle ':vcs_info:*' enable git svn
    zstyle ':vcs_info:git*' formats "- (%b) "
    precmd() {
        vcs_info
    }
    setopt prompt_subst
    prompt='HoneyBee@iMac 🐝: %~/ ${vcs_info_msg_0_}> '
5. Just change that last line to be your name@Mac: or what ever you want that part to say
6. Next you will want to type open .bash_profile and add the following code:
    # Git Branch
    parse_git_branch() {
        git branch 2> /dev/null | sed -e '/^[^]/d' -e 's/ (.*)/ (\1)/' 
    }  

    #export PS1="\u@\h \W[\033[32m]$(parse_git_branch)[\033[00m] $ "  

    # Folder Color  export PS1="[\033[36m]\u[\033[m]@[\033[32m]\h:[\033[33;1m]\w[\033[m][\033[32m]$(parse_git_branch)[\033[00m]$ " 
    export CLICOLOR=1 
    export LSCOLORS=ExFxBxDxCxegedabagacad 


    alias ls='ls -GFh' 
    echo "set completion-ignore-case On" >> ~/.inputrc  

7. save both these files.  close and open back up the terminal
8. in the upper corner of the mac click the terminal (like where you would save a file) and click preferences
9. under the general tab in the middle where it states shell opens with click the second option and put /bin/zsh
10. close this window and the terminal and reopen and it should now have what you typed on line 12 above listed showing.  if you add any functions or the alias that are in the files make sure after you save you open a new terminal to test. 

    
    export PATH=${PATH}:/usr/local/mysql/bin


alias back='cd ~/coding/'
alias dojoipy='cd ~/coding/work/CodingDojo/instruction/python'
alias dojoiwf='cd ~/coding/work/CodingDojo/instruction/webFun'
alias knowledge='cd ~/coding/work/KnowledgeHut'
alias endHut='cd ~/coding/work/KnowledgeHut/weekend'
alias dayHut='cd ~/coding/work/KnowledgeHut/weekday'
alias cfa='cd ~/coding/business/CFA/'
alias services='cd ~/coding/business/_services/'
alias dragons='cd ~/coding/business/dragonsedge/'
alias djangoEnv='source ~/coding/environments/generalEnv/bin/activate'
alias py='python3'
alias rundjango='py manage.py runserver'
alias makemigrations='py manage.py makemigrations'
alias migrate='py manage.py migrate'
alias createsuperuser='py manage.py createsuperuser'
alias pipenv='python3 -m pipenv'
alias installflask='pipenv install flask PyMySQL flask-bcrypt'
alias flaskEnv='pipenv shell'
alias runflask='py server.py'


mkDjango () {
    mkdir $1
    cd $1
    django-admin startproject $1 .
    py manage.py startapp $1App
}
runMigrate () {
    makemigrations
    migrate
}
startFlask () {
    installflask
    flaskEnv
}
mkFlask () {
    mkdir app
    mkdir app/config app/controllers app/models app/static app/templates
    mkdir app/static/css app/static/js app/static/images
    touch app/controllers/public.py app/controllers/private.py app/models/user.py app/templates/index.html app/templates/menu.html app/templates/dashboard.html
    touch app/static/css/styles.less app/static/js/scripts.js
}

autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
zstyle ':vcs_info:git*' formats "- (%b) "
precmd() {
    vcs_info
}
setopt prompt_subst
prompt='HoneyBee@iMac 🐝: %~/ ${vcs_info_msg_0_}> '
cd ~/coding/