본문 바로가기
OS/Mac OSX

[Mac] Shell Configuration (feat. zsh)

by llHoYall 2020. 9. 25.

I used to use bash, zsh, and fish all before.

I chose the zsh, because it can be easily customized and prettier than bash.

In addition, it can also be used like fish by adding features with plugins.

Let's fun together with the zsh!!

Installation

$ brew install zsh

If you don't have the Homebrew, you have to install it now!!!

2020/09/23 - [OS/Mac OSX] - [Mac] Homebrew

 

Let's install oh-my-zsh to make awesome your zsh

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

 

Now, install some useful plugins.

$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

This plugin predicts and suggests the command you want to enter.

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

This plugin colors the command.

Configuration

zsh configuration is saved in the ~/.zshrc file.

Please open and edit it.

Theme

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="hoya"

Select the theme.

I made my own theme when I first settled in zsh and have been using it until now.

You can choose any preset theme or even random!!

Plugin

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
    #git
    zsh-syntax-highlighting
    zsh-autosuggestions
)

git is the default plugin, but I don't use it, because I use my own configuration for git.

Set the plugins that we installed above.

If you use any other plugins, just add it.

Let me share the plugins I used before.

fasd, fzf, tmux, tmuxinator, virtualenv

Global Variables

export EDITOR='nvim'

export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"

I use the neovim as a default editor. So I set it.

And I use nvm as well, so I also set it.

Aliasing

Let me share some of my aliasings.

alias ll="ls -ahlF"

alias gaa="git add --all"
alias gcmm!="git commit --amend"
alias glg="git log --oneline --graph -50"

Refer to my aliasing, and try to make yours.

Etc

Disabling the display of virtual environments at Prompt

VIRTUAL_ENV_DISABLE_PROMPT="true"

'OS > Mac OSX' 카테고리의 다른 글

[Mac] Tip: Resolving xcrun error  (0) 2021.04.03
[Mac] Configuration for Development  (0) 2020.09.26
[Mac] Change Colors of ls Command  (0) 2020.09.25
[Mac] Terminal Configuration with iTerm2  (0) 2020.09.24
[Mac] Homebrew  (0) 2020.09.23

댓글