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?

More than 1 year has passed since last update.

zshrc 個人的カスタマイズ

Last updated at Posted at 2023-06-15

Ubuntu環境でもzsh使いたい!
Macっていいよなぁ
そんな軽い思いから始まり、またまた備忘録的なsomething。

bashからzshへの切り替え(Mac用)

$ chsh -s /bin/zsh

zshのインストール

$ sudo apt-get install zsh

zshへの切り替え

$ which zsh

→ ここで出てきたPATHをコピー(多分こんな感じ→)/usr/bin/zsh

$ chsh
Changing the login shell for root
Enter the new value, or press ENTER for the default
    Login Shell [/bin/bash]: <PATHを貼り付ける>

これでとりあえず完了!
あとはすきに.zshrcをいじればOK!

bashの設定をzshに移行

もう二度とbashを使わない強い意志があればそのままファイルの名前を変えちゃえばOK。
でも、互換性などの問題があるから確認は必要。(要注意!)

$ cd
$ mv .bashrc .zshrc
$ mv .bash_profile .zprofile

.zshrcを環境に適応させる

$ source .zshrc

My.zshrc

ちまたでは「oh my zsh」っていうフレームワークを用いれば
幸せになるらしいですが、私はまだ導入はしてないので
気になった方がいればぜひ調べてみてください

以下、自分用

.zshrc
# 42Tokyo用
alias cc='cc -Wall -Werror -Wextra'

# utils (Mac用)
alias code='open -a /Applications/Visual\ Studio\ Code.app'

# utils
alias ...='cd ../..'
alias ....='cd ../../..'

# Git関連
alias g='git'
alias gl='git log'
alias gc='git clone'
alias ga='git add'
alias gcm='git commit -m'
alias gp='git push'
alias gs='git status'
alias gl='git log'

# alias
alias so='source'
alias sudo='sudo '
alias vi='vim'


# .zsh_history関連
setopt auto_cd
setopt share_history
setopt hist_ignore_dups
setopt hist_ignore_all_dups
setopt HIST_IGNORE_SPACE
SAVEHIST=10000
HISTSIZE=10000
HISTFILE=~/.zsh_history

# 入力ミスへの対応
setopt correct
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?