- Upgrade it with: upgradeohmyzsh Customize your terminal's theme, fonts, colors, and more. To get the best out of zsh, you'll want to install some dependencies. Use a custom theme. Powerlevel10k is a popular theme for zsh. It emphasizes speed, flexibility, and out-of-the-box experience. Install Powerlevel10k for Oh My Zsh with.
- The configuration file for zsh is called.zshrc and lives in your home folder (/.zshrc). Oh My Zsh is an open source, community-driven framework for managing your zsh configuration. It comes with a bunch of features out of the box and improves your terminal experience. Install Oh My Zsh.
A protip by ducknorris about shell, zsh, mac os x, and iterm2. # Look in /.oh-my-zsh/themes/ # Optionally, if you set this to 'random', it'll load a. Dec 03, 2019 1. Install Oh My Zsh. If you only follow one of these tips, it needs to be this one. Oh My Zsh is a community-driven framework for managing your zsh configuration and comes bundled with thousands.
This post explains how to have posh-git prompt style in Oh My Zsh theme on Mac.
After 4 years of using Windows, I am coming back to using a Mac. And there are so many things in Windows I am missing already. One of these things is posh-git; I loved how in one glance to your prompt you know the status of your git repo: how many files changed, how many added, how many deleted, how many indexed… just love it!
Once I moved to Mac, I changed my shell to use zsh using Oh My Zsh due to the rich experience it brings to the terminal. I was delighted to see all these themes and plugins, and then started looking for a theme that provided the same information posh-git prompt provided. To my surprise, there was none! So I started my quest to see how I can change zsh, the theme, or the plugin to have such prompt.
Being lazy, I wanted change an existing theme I like with the least amount of investment. I looked in the documentation to see how I could do that, and found the customisation wiki page:
Should I override the theme?
Overriding the theme seemed to be the perfect solution, however, there were couple of drawbacks:
- When you override a theme, you override the theme, period! This means that if the author changes something after you have overridden it, you will not get these new changes.
- It was a little bit too much for me to grasp! When I looked at avit theme as an example, I had questions like what is PROMPT and PROMPT2? What are all these special characters? Where is the reference/documentation to all of these? Are they theme-specific, or are they part of zsh theme reference?
Remember I wanted to put the least amount of effort, and I surely didn’t want to learn the whole thing! But while looking into avit theme, one thing grasped my attention: there was a clear reference to what seemed to be like a function git_prompt_info. And I thought this should be it, if I could find where this function is and how to override it.
To my luck, it was mentioned as an example in the customisation wiki page as an example!
Override the internals it is!
Ok great, now I know that I can customise git_prompt_info Xvid codec download for mac. , all what I need is to mimic whatever posh-git does in that function!
So I hit google duckduckgo again on the hope that someone already did this, and oh my! I found that there is already a port of it on bash. That’s great, now what should I do? Replace the call of prompt_git_info in the theme with a call to __posh_git_ps1? Or should I call it from prompt_git_info? Since prompt_git_info is an internal lib function, it is probably used in many themes, thus it will make sense to just call __posh_git_pst from within. And to my good surprise, there is a GitHub issue in the posh-git-bash repo that discusses integrating with zsh, it’s even referenced in the main README.md file of the repo.
Initially I mistakenly called the __posh_git_ps1 function, but I soon realised that I need to print (echo) the git info just like prompt_git_info did rather than changing any variables, for that I should use the __posh_git_echo.
And thus I ended up with a file called emad-git-prompt.zsh under the path ~/.oh-my-zsh/custom with the content of posh-git-bash here, and at the end of the file I wrote the following code:
I hope this helps you 🙂
The era of .NET developers being constrained on using only Windows as a platform is gone. (At least for ASP.NET). That might be very cool to some, but also scary for others. Fear of change is true. Nevertheless, it's definitely time (if not yet) to get out of the comfort zone and get your feet wet. Being able to work with .NET on Linux/Mac is one of the points that makes me agree 100% with Nick Craver that .NET Core is the future.
After reading Scott Hanselman's blog post last week, I decided to setup WSL on my laptop. If you don't know what Windows Subsystem for Linux is (WSL from now on in this post), I recommend reading this before.
The TL;DR of that link is:
WSL lets developers run Linux environments -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a virtual machine.
While setting it up on my machine was very easy, I didn't want to stay with the boring Windows bash shell. Guys at work use Mac's with oh-my-zsh and boy that made me pretty jealous. It was not that straightforward to make it all work though. So hopefully, this post will help me and others in the future. Here's what we are going to do:
- Enable WSL on Windows 10
- Install zsh + oh-my-zsh
- Configure zsh and oh-my-zsh
- Change Themes and colors
- Adding Bash on Ubuntu task in ConEmu*
Enable WSL on Windows 10
This is pretty straightforward to set up, Just follow the instructions here to get Ubuntu running. After you are in, update the packages, by running:
sudo apt-get update
. When all is working, you can continue to the next step.Installing zsh
Open the Ubuntu app installed from the App Store. We will now install zsh:
After installing it, type
zsh
. zsh will ask you to choose some configuration. We will do this later on while installing oh-my-zsh
, so choose option 0
to create the config file and prevent this message to show again.Installing oh-my-zsh
Before all we need to have
git
installed:![For For](https://blog.wislay.com/wp-content/uploads/2015/12/oh-my-zsh-with-bullet-train-default.png)
Then, use
curl
to install oh-my-zsh:This will clone the repo and replace the existing
~/.zshrc
with a template from oh-my-zsh
.Configuring zsh/oh-my-zsh
First, we need to make sure
zsh
is executed by default for Bash on Ubuntu. This is not mandatory, but if not done you need to type zsh
every time. For this, edit the .bashrc
file with nano: nano ~/.bashrc
and paste this right after the first comments:Save it
Ctrl + shift X
and restart your Ubuntu shell. You should be on zsh by default now.Changing the Theme of oh-my-zsh
oh-my-zsh has several nice Themes. It's worth checking them out. For this tutorial, I'm going to use the awesome agnoster.
Edit the
~/.zshrc
again with nano: nano ~/.zshrc
:Save it and restart your Ubuntu shell again.
Now was the tricky part while I was doing this on my laptop. After installing the theme, I got a totally broken shell (as shown in the image), with weird fonts and missing icons. That was expected due to missing Powerline Fonts, but even after installing them on Ubuntu the Theme was still broken. I tried several things and couldn't make it work. Since we will run it with ConEmu, I didn't want to spend more time on it. The Ubuntu shell is very limited anyway so. not a big deal.
Installing missing Powerline Fonts
We need to install the Powerline fonts in our Windows to make the agnoster theme work. Follow these steps:
- Clone the powerline repository on Windows
- Open an admin PowerShell, navigate to the root of the repo and run this:
This will install all the fonts on your Windows. You might get an error from PowerShell blocking you from running the script. Check this out if it happens with you. Make sure to reverse the policy after.
Changing directory colors
The directory colors for zsh is awful. If you followed along, by now you should have an ugly yellow or dark blue background on folders when
ls/ll
. Luckily, we can change that by installing a Solarized Color Theme from here. Follow these steps:- Pick a theme from the GitHub repo (I'm using dircolors.ansi-dark since I use a dark shell).
- Download the file making sure to put it in the user's home:
Install Oh My Zsh
- Edit your
~/.zshrc
and paste this:
We have nice colors now :)
Setting Bash on Ubuntu task in ConEmu
Open ConEmu, and go to
Settings
. Navigate on the left-menu: Startup > Tasks
. There, click at the +
button at the bottom.- Add a name for the task. Anything will suffice. I used
bash::ubuntu
to group Ubuntu into the bash tasks. - On
Task parameters
choose an icon for the task. I picked the Ubuntu icon app that is buried under some very long path. but any .ico will work. You can leave it blank if you don't care. - For the
command
use this%windir%system32bash.exe ~ -cur_console:p
. This will start bash under the user home directory. Since we already configuredzsh
to run by default, this is enough.
Open the new task on ConEmu and.. Voalá!
Nice command look, lots of git shortcuts and much more productivity. Couldn't enjoy this more.
Additional links
Here are a few other things you might want to look:
Zsh Profile Mac
- oh-my-zsh cheatsheet: Lots of commands to improve your productivity
- Colors page on ConEmu: How to change ConEmu color scheme (If you liked mine, I'm using Solarized (Luke Maciak) with Meslo LG M DZ for Powerline console font)
- Understand why you're not supposed to touch Linux files using Windows apps: https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/
Oh My Zsh For Mac Windows 10
Would be cool to see what other things you use on your setup. Just let me know in the comments!