Last week, I attended the SharePoint 2018 Conference in Las Vegas. There were a lot of cool announcements and demos. The SharePoint team rocks!
One of the cool things that I noticed which has nothing to do with SharePoint was that a lot of presenters who showed code had a really cool command prompt that showed the node module they were in, and their Git branch status in a pretty “boat chart”.
I had seen this many times before, but never realized how much easier it was to get a sense of what’s going on until I was watching someone else code on a big screen.
Of course, I set out to find and configure this awesome command-line on my workstation.
This article will show you how you too can install and configure this command line interface.
During Vesa‘s awesome session, I paid close attention to the title of his command line window. It said Cmder.
I had seen Cmder before; the article Set up your SPFx development environment mentions Cmder in the Optional Tools section.
But the version of Cmder I had installed didn’t have the fancy “boat chart” at the top that got my attention.
As it turns out, you need to download another custom prompt for Cmder that adds the Powerline (that’s the real name for the “boat chart”) at the top.
Here is how to install and configure Cmder with the Powerline command prompt:
Go to http://cmder.net/ and download either the Mini pack or the Full pack.
Unzip the package. Cmder is designed to be portable and to require no administrative privileges to run, so their instructions tell you to not install it in the Program Files folder (where you’ll need administrative privileges). I placed it in C:\Users\[myusername]\AppData\Local\cmder.
Open a command prompt in Administrative mode from the folder where you copied the Cmder files
From the command-prompt, type:
cmder /REGISTER ALL
If you get an Access Denied error, you probably forgot to run the command in Administrative mode. If you don’t know how to do that, type cmd from your Start menu, and right-click on Command Prompt and select Run as administrator.
Cmder should be installed. You can verify by opening a new File Explorer window and right-clicking on a folder. You should get a Cmder Here option.
Unfortunately, if you open Cmder with that command line, you don’t get the fancy Powerline.
Let’s fix that!
The Cmder Powerline custom prompt changes the Cmder prompt to include the following modifications:
To install the Cmder Powerline custom prompt:
That’s all you need to do.
If you want Cmder to show up in Visual Studio Code, follow these steps:
Launch Visual Studio Code.
From the File menu, select Preferences | Settings or use Ctrl-, (Control and comma). This will open your settings editor.
In the right-pane of the settings editor (the one that’s actually editable), insert the following JSON, just before the last } , making sure to replace the path to Cmder with the path where you installed it.
"terminal.external.windowsExec": "C:\\Users\\[myusername]\\AppData\\Local\\cmder\\Cmder.exe",
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.shellArgs.windows" : [
"/K",
"C:\\Users\\[myusername]\\AppData\\Local\\cmder\\vendor\\init.bat"
],
That’s all!
I hope that you’ll find Cmder and the custom Cmder Powerline command-prompt useful in your SPFx development endeavors.
I know I did!
Cmder.net lists more information about Cmder, including the super-powerful shortcut keys.
Amr Eldib is the brilliant mind behind the Cmder Powerline command-prompt.
Sahil Malik has detailed instructions (and a video!) to to integrate with Cmder Visual Studio Code.
In the previous revision of this article, I had forgotten to include the steps to copy the .lua files to the config folder. It works much better when you include all the steps, it turns out 🙂