1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mac環境構築(Alacritty + Zinit + Starship)

Posted at

Macの環境構築をしたのでメモ。

環境

  • MacBook Pro M2(2023)
  • MacOS Sequoia 15.1

Homebrewインストール

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Alacrittyインストール

brew install --cask alacritty

~/.config/alacritty/alacritty.tomlファイルを作成

~/.config/alacritty/alacritty.toml
live_config_reload = true

[window]
dimensions = { columns = 200, lines = 60 }
padding = { x = 8, y = 4 }
opacity = 0.85

[cursor]
style = "Beam"

[scrolling]
history = 100000
multiplier = 3

[font]
normal = { family = "Hack Nerd Font", style = "Regular" }
bold = { family = "Hack Nerd Font", style = "Bold" }
italic = { family = "Hack Nerd Font", style = "Italic" }
bold_italic = { family = "Hack Nerd Font", style = "Bold Italic" }
size = 14.0
offset = { x = 0, y = 2 }

Zinitインストール

bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
zinit self-update

~/.zshrcを編集

~/.zshrc
# ----------------------------
# basic
# ----------------------------
# コマンド履歴の管理
HISTFILE=~/.zsh_history
export HISTSIZE=1000
export SAVEHIST=10000

# ----------------------------
# Added by Zinit's installer
# ----------------------------
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
    print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
    command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
    command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
        print -P "%F{33} %F{34}Installation successful.%f%b" || \
        print -P "%F{160} The clone has failed.%f%b"
fi

source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit

# ----------------------------
# Zinit plugins
# ----------------------------
# Load the pure theme, with zsh-async library that's bundled with it.
zinit ice pick"async.zsh" src"pure.zsh"
zinit light sindresorhus/pure
# シンタックスハイライト
zinit light zsh-users/zsh-syntax-highlighting
# 入力補完
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-completions
# コマンド履歴を検索
zinit light zdharma/history-search-multi-word

# ----------------------------
# alias
# ----------------------------
alias g="git"
alias gb="git branch"
alias gs="git switch"
alias gco="git checkout"
alias gcmsg="git commit -m"
alias gl="git pull"
alias gp="git push"

フォントインストール

starshipで必要なフォントをインストールする

brew install --cask font-hack-nerd-font

Starshipインストール

curl -sS https://starship.rs/install.sh | sh

~/.zshrcの最後に以下を追記する

# ----------------------------
# Starship
# ----------------------------
eval "$(starship init zsh)"

プリセットを使って見た目を変更する

Pastel Powerlineを使いたい場合は以下のコマンドを実行

starship preset pastel-powerline -o ~/.config/starship.toml

VSCodeのフォント設定

VSCodeのターミナルでアイコンが表示されるように設定する。

VSCodeでsettings.jsonを開いて以下を設定する。

settings.json
 "terminal.integrated.fontFamily": "Hack Nerd Font"

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?