A few weeks back a few folks in the NetDevOps Live! Webex Teams Room were talking about source-code editors — how we got started, what text editing tool we started with, what we are using today — with a little of the why we use these (spoiler alert, its mostly personal preference). We all started on a similar path with VIM, and it is a great tool! VIM allows you to be efficient by forcing you to only use the keyboard, but we discovered that all of us had moved away from VIM. We still would use it for quick fixes and edit’s, or when we had logged into a remote machine/device and no source-code editor s installed. Bottom line, you always need to know VIM (or Nano), even the very basics.
The general consensus in our chat was that we had all moved on to a source-code editor. (Funny enough we all tried Sublime Text first, then Atom both of these are great editors and personally I ran some good mileage on both.) As fate would have it, we discovered all of us had moved to VScode. Others in the chat had done this way before me. I was a newbie, and some great insight and sharing was done between us on how we each set up our VScode environments.
Setting up my VSCode
First things first, I wanted a dark theme. (When your Twitter name is @bigevilbeard, having a dark mode on everything and dark theming is … well, it just fits. I went with “Material Theme” darker, it’s a quick install via the VScode Marketplace.
The next must-have for me was indent-rainbow. This extension colorizes the indentation in front of your text alternating four different colors on each step, it is helpful in writing code for Python. Having spent a few hours (OK days sometimes) troubleshooting/debugging code only to find out I had a space in the wrong place, has made me a fan of this feature.
Along the same thread, VSCode provides a way to automate the deletion of trailing spaces by using the Trim Trailing Whitespace command. (Depending on your settings, it may be more handy to just highlight them and/or delete them by hand, at any time.) This plug-in provides just that, and a lot of options to fine-tune the way you want to decimate trailing spaces.
Finally, one of the big reasons I moved to VSCode was the terminal. Before, I was using the native terminal/Python repl on my MacBook, but on demos and webinars for DevNet I found this was not the best visually.
I am using bpython too, bpython is a fancy interface to the Python interpreter for Linux, BSD, OS X, and Windows (with some work). bpython is released under the MIT License. It has the following ‘special’ features:
- In-line syntax highlighting
- Readline-like autocomplete with suggestions displayed as you type
- Expected parameter list for any Python function
- “Rewind” function to pop the last line of code from memory and re-evaluate
- Send the code you’ve entered off to a pastebin
- Save the code you’ve entered to a file
- Python 3 support
I was able to color the terminal too, which makes this really pop when doing demos and webinars. This took me a few minutes to work out, but this was really worth the time. To do this, first head over to https://glitchbone.github.io/vscode-base16-term/#/ and select your terminal color. Search for “workbench: color customizations” and open the settings.json file. Then Edit or Paste your configuration under workbench.colorCustomizations.
I am scratching the surface here, there are loads of cool extensions to make your development life easier. If you know any super extensions, please comment them below. In the next blog, I will be exploring how we can review and manage pull requests in GitHub with VSCode.
- DevNet Networking Dev Center
- DevNet Network Automation Exchange
- DevNet certifications exam topics and study materials
We’d love to hear what you think. Ask a question or leave a comment below.
And stay connected with Cisco DevNet on social!
Visit the new Developer Video Channel