-
-
Save kevin-smets/8568070 to your computer and use it in GitHub Desktop.
brew install --cask iterm2
Or, if you do not have homebrew (you should ;)): Download and install iTerm2
iTerm2 has better color fidelity than the built in Terminal, so your themes will look better.
Get the iTerm color settings
- Solarized Dark theme (patched version to fix the bright black value)
- Solarized Light theme
- More themes @ iterm2colorschemes
Just save it somewhere and open the file(s). The color settings will be imported into iTerm2. Apply them in iTerm through iTerm → preferences → profiles → colors → load presets. You can create a different profile other than Default
if you wish to do so.
More info here: https://github.com/robbyrussell/oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
When the installation is done, edit ~/.zshrc
and set ZSH_THEME="agnoster"
for the default look. Or better yet, go for Powerlevel10k.
Why Powerlevel10k? Well, because it's a drop-in replacement for Powerlevel9k, just a lot faster to render your prompt. ls
feels fast again!
So if you prefer the Powerlevel10k look with added info such as exit codes and timestamps on the right, run:
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
Then edit your ~/.zshrc
and set ZSH_THEME="powerlevel10k/powerlevel10k"
. Once you do so, when you start a new terminal session, the Powerlevel10 configure wizard will be launched to set your prompt, beware, there are many many options!
Powerlevel10k offers a whole lot more and is extremely configurable, best is to check its project page.
If you want to trigger the configuration wizard immediately, simply run p10k configure
to discover all options, which are plentiful.
If you did not go with Powerlevel10k or you want another font, read on:
- Source Code Pro
- Source Code Pro + Font Awesome, this one is needed if you want the icons from Font Awesome as shown in the screenshot for Powerlevel10k.
- Others @ powerline fonts
Open the downloaded font and press "Install Font".
Set this font in iTerm2 (iTerm → Preferences → Profiles → Text → Font), in the dropdown select the desired Font. You will see it change on the fly.
Restart iTerm2 for all changes to take effect.
Things like
- auto suggestions
- word jumping with arrow keys / natural text editing
- syntax highlighting
- visual studio code config
can be found in the section below.
Just follow these steps: https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh
If the auto suggestions do not appear to show, it could be a problem with your color scheme. Under "iTerm → Preferences → Profiles → Colors tab", check the value of Black Bright, that is the color your auto suggestions will have. It will be displayed on top of the Background color. If there is not enough contrast between the two, you won't see the suggestions even if they're actually there..
By default, word jumps (option + → or ←) and word deletions (option + backspace) do not work. To enable these, go to "iTerm → Preferences → Profiles → Keys → Key mappings → Presets... → Natural Text Editing → Boom! Head explodes"
Clone the repository:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Activate the plugin in ~/.zshrc
:
plugins=( [plugins...] zsh-syntax-highlighting)
Restart iTerm2 for all changes to take effect.
Installing a patched font will mess up the integrated terminal in VS Code unless you use the proper settings. You'll need to go to settings (CMD + ,) and add or edit the following values:
- for Source Code Pro + Font Awesome:
"terminal.integrated.fontFamily": "'SourceCodePro+Powerline+Awesome Regular'"
. The single quotes are important! Restart VS Code after the config change. - for Source Code Pro:
"terminal.integrated.fontFamily": "Source Code Pro for Powerline"
- for Meslo:
"terminal.integrated.fontFamily": "Meslo LG M for Powerline"
- for other fonts you'll need to check the font name in Font Book. You can right click on them on select "Show in Finder" to get the exact name.
You can also set the fontsize e.g.: "terminal.integrated.fontSize": 14
@amiamitswe Run p10k configure
. When it asks whether you want to enable transient prompt, answer No. It's a good feature by the way.
@romkatv Thanks a lot !
zsh: command not found:
What I did to solve this
Open the .bash_profile, copied the export PATH=...
and pasted in the .zshrc file.
it's still not clear to me how I could fix this icon problems. i have downloaded the fonts and set them to it.
~/research on sidod +10 !8 ?199
what s +10, !8, and ?199 and more importantly, how I can fix it?
@monajalal Not sure if others response still not clear, but the "?, !..etc" are not meant to be icons, they are actually a (plus sign, question mark..etc), with different meanings for each.
So based on the link shared to you and your screenshot:
+10 = you have 10 staged changes
!8 = you have 8 unstaged changes
?199 = you have 199 untracked files
If I do a git banch
or git diff
it opens a vi type screen which has to be exited by :q. Is there any way I can get it listed in the same screen?
@shant0602 , I'm not sure I've got your issue, but if I do, you can change pager for your repository, for example to cat with command: git config core.pager cat
. Also you can do it globally for all repositories with --global
option
@mxnmike fixed it in the readme, you can now find it under "... - Keys - Key mappings - Presets..."
Does anyone know if it's possible for the iTerm colour settings to override the terminal prompt segment colours defined by the powerlevel10k
theme in ~/.p10k.zsh
? The ZSH theme's colours seem to take priority over iTerm's colours.
Thanks @romkatv!
For the color of ZSH AUTO SUGGEST, you can edit your ~/.zshrc and change/add the variable:
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=5'
(fg stands for Foreground and you can test the value that fits your eyes)
plugins=( [plugins...] zsh-syntax-highlighting)
did not work for me. I have to specify the full plugins for it to work. In my case plugins=( git zsh-syntax-highlighting)
Super thanks
Hello everyone,
When I do ls command, some folders are highlighted, anyone know why?
Thanks
Found any solution to this?
@joban-jit Add this at the bottom of ~/.zshrc
:
zmodload zsh/terminfo
export LS_COLORS='fi=00:mi=00:mh=00:ln=01;36:or=01;31:di=01;34:ow=04;01;34:st=34:tw=04;34:'
LS_COLORS+='pi=01;33:so=01;33:do=01;33:bd=01;33:cd=01;33:su=01;35:sg=01;35:ca=01;35:ex=01;32'
if (( terminfo[colors] >= 256 )); then
LS_COLORS+=':no=38;5;248'
else
LS_COLORS+=':no=1;30'
fi
export TREE_COLORS=${LS_COLORS//04;}
export LSCOLORS='ExGxDxDxCxDxDxFxFxexEx'
Are you getting this when you click on ~/.p10k.zsh
? Don't click on it. Instead, open a text editor and open that file in the text editor.
it happens when i open it on text editor
open ~/.p10k.zsh then this window prompts
open ~/.p10k.zsh then this window prompts
Don't execute open ~/.p10k.zsh
. Instead, start a text editor and open this file from it.
If you are having trouble with this, it may not be good idea to attempt to customize your prompt.
The link to the font Source Code Pro + Font Awesome is broken, could you please add the correct link.
Thanks!
Bravo! 👏
It seems like the solarized dark theme is available in iterm2 by default. Is that correct?
🥷 Excellent @kevin-smets
On my screen, whenever I press enter it shows > rather than the path itself.
I want when I press enter it shows the result after the path URL, and then a new path URL will appear to take the next command.