This post is about set up efficient, beautiful theme emulator with oh-my-zsh.
Reference from: https://gist.github.com/kevin-smets/8568070
Install iTerm2
Install iTerm2 on Mac
https://www.iterm2.com/
Configure iTerm2
Solarized Dark is bad for some syntax highlighting, to import other themes,
download from there, zip file, you can uncompress and put the downloaded folder
to the user home directory, for example /Users/chengdol
:
https://iterm2colorschemes.com/
The theme I use is Chalk
, import Chalk.itermcolors
file(s) in the
scheme(s)
folder:
Additionally,go and set iTerm2:
1 | Preference -> |
This fix the mess-up issue when you scroll cursor inside Vim.
iTerm2 Tips
- Hotkeys, the floating terminal window setup:
Go to Preferences -> Keys -> Hotkey
and create a Dedicated Hotkey Window.
My customized hotkey is ctrl + shift + t
. Set the hotkey window profiles text
font the same as the default iTerm2 window, here I use MesloLGS NF
.
-
Locating the cursor in iTerm2 terminal:
command + /
. -
Send commands to mutliple panes in the same tab
shift + command + i
, disable use the same command. -
Go to split pane by direction:
command + shift + arrow key
. -
zsh cat command appends ‘%’ in line end if no newline at end.
Configure Oh My Zsh
Install ohmyz
on Mac.
Mac zsh is pre-installed, you can check by:
1 | zsh --version |
If not, install zsh first. Then install ohmyzsh:
1 | sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
Then install Powerlevel10k
theme, this theme is what exactly I need:
1 | git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k |
By default it uses robbyrussell
theme, you can see it from ~/.zshrc
file,
the theme files are located in ~/.oh-my-zsh/themes
folder.
1 | # Set name of the theme to load --- if set to "random", it will |
Next when you start a new terminal session, the Powerlevel10
configure wizard
will be launched to set your prompt pattern, it will automatically check and
install the font for you. When select encoding, choose Unicode
, otherwise no
icon will show.
If you want to reset the configuration, simply run:
1 | p10k configure |
Powerlevel10
project web page:
https://github.com/romkatv/powerlevel10k#extremely-customizable
Then set zsh
as the default shell` on Mac:
https://askubuntu.com/questions/131823/how-to-make-zsh-the-default-shell
1 | ## verify default shell is zsh or not |
After changing the theme, relaunch iTerm2.
~./zshrc
works the same as ~/.bashrc
for bash, append other alias here,
append following snippet in ~/.zshrc
:
1 | # Example aliases |
To list all shortcut in Zsh, run
1 | bindkey |
Reference:
Use cat
command to see what exactly the key will present is a good idea.
Visual Studio Code Terminal
To make the VSC build-in terminal good with ohmyz
theme, needs to add below
setting to User
VSC setting.json
file(open by shift + command + P
):
1 | { |
Then restart the VSC, the theme should be good.
Bash with Starship
Still using iTerm2, if you want to stick to Bash
shell, try this:
Starship: cross shell prompt. https://starship.rs/
Install by running:
1 | curl -fsSL https://starship.rs/install.sh | bash |
After install, append this line in ~/.bashrc
1 | eval "$(starship init bash)" |
My config file:
1 | mkdir -p ~/.config && touch ~/.config/starship.toml |
My current ~/.config/starship.toml
file:
1 | # Disable the newline at the start of the prompt |