Tùy biến Terminal bằng oh-my-zsh & powerlevel10k


Bước 0: cài đặt zsh (tương tự bash shell)

sudo apt-get update && sudo apt install zsh

Bước 1: cài đặt oh-my-zsh

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

Bước 2: cài đặt powerlevel10k (lưu ý là nếu bạn không biết gì thì nên bỏ qua bước 2, và chỉ làm bước 3, 4. Lý do là vì bước 4.1 sẽ cài đặt cho bạn bước 2 luôn rồi. Còn nếu bạn không thích cài antigen (ở bước 3) thì có thể làm bước 2. Sau đõ gõ “p10k configure” và làm theo hướng dẫn là được)

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-sh/custom}/themes/powerlevel10k

Bước 3: cài đặt antigen

curl -L git.io/antigen > antigen.zsh
(mình lưu thẳng vào chỗ ~/.oh-my-zsh luôn cho tiện)

Bước 4: Cấu hình antigen và Cài đặt thêm plugins (optional nhé)

4.1 Tạo file ~/.antigenrc và thêm cái này vào

# Load oh-my-zsh library.
antigen use oh-my-zsh

# Load bundles from the default repo (oh-my-zsh).
antigen bundle git 
antigen bundle command-not-found
antigen bundle docker

# Load bundles from external repos.
antigen bundle zsh-users/zsh-completions
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-history-substring-search

# Select theme.
antigen theme romkatv/powerlevel10k

# Tell Antigen that you're done.
antigen apply

4.2 Cấu hình ~/.zshrc (để kích hoạt antigen)

source ~/.oh-my-zsh/antigen.zsh
antigen init ~/.antigenrc

4.3 Đổi ColorScheme cho đẹp
MacOSX: lysyi3m/macos-terminal-themes
Xshell: netsarang/Xshell-ColorScheme
(bên dưới mình dùng scheme Dracula_Reborn nhé)

Thành quả: (lưu ý bạn phải thoát ra và vào lại shell nhé)

MACOSX

Xshell trên Windows, khi ssh vào Linux server có cài đặt các gói bên trên (bước 1 2 3)

~~~~~~~~một số thông tin thêm (đọc cho biết) ~~~~~~~~~~~

  • shell: bash, zsh, etc.
  • theme: agnoster, gentoo, etc.
  • plugin manager (khỏi phải git clone tay): antigen

Links:

  • https://ohmyz.sh/
  • https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md
  • https://github.com/zsh-users/antigen
  • https://levelup.gitconnected.com/zsh-antigen-oh-my-zsh-a-beautiful-powerful-robust-shell-ca5873821671

Lỗi font ở theme Agnoster: cài https://github.com/powerline/fonts

  • À klq, khi bạn dùng conda mà không init được thì nhớ thêm tên shell vào sau đít (conda init zsh chẳng hạn)

~~~

Cái zsh cho Linux/MacOS, còn Windows thì

oh-my-posh –> A prompt theming engine for Powershell

Facebook Comments
,

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x