Set Up a Shell Python Development Environment From Scratch— Part 1, Zsh & Vim Configuration.

Ennio Maldonado
Jan 20 · 10 min read

This will be a 2 part series in which we will setup a development environment for Python done 100% in the shell terminal using zsh and vim for the IDE, and pyenv with pip-tools for managing virtual environments for your projects.

  1. Preliminaries: Linux distro, why use the shell instead on an IDE?
  2. The shell: Installing and Configuring Zsh, Oh-My-Zsh and Powerlevel10k
  3. The text Editor: Vim and plugins for python dev
  1. Preliminaries: Linux distro, why use the terminal instead on an IDE?

Disclaimer: The following lines is just me ranting on why I believe you should use Vim, you can skip ahead for the actual set up.

So why bother?, why should you spend hours learning this ancient tools (Vim was originally released on 1991) when there are many shiny newer choices like Atom, PyCharm or VS Code?. Certainly those are good “IDE’s” some people prefer one over the other for various reasons, and they are good for what they were designed to do, the problems start when you need to step out of the typical working space and need very specific functionality that’s when things become less than ideal.

The problem is that if you want to improve the experience on an IDE the only way is to add an extension, and if that is not available you need to write the extension yourself, in Vim if something is missing you can just write a script on the .vimrc file and that’s it, of course you can also add a plugin that most likely there is someone who already solved the issue and there is code available for you to modify to your needs, so whether that is a function that highlights specifics areas of the code that are relevant for you, or automating commenting and documenting your code, no matter what you want to do, Vim is fully scriptable for whatever use case you might have.

An additional plus is that Vim lives within the shell, because of that it is faster than anything else, it does not need to load any GUI or connect to any network, it just works. Vim is fully integrated with the shell and can run commands to and from the shell, because of that you never have to leave the terminal, even more you can just stop clicking on things and focus on writing code.

Finally because Vim lives within the shell is it available in ALL the Linux based cloud services available today, AWS, Azure, GCP, so the next time you SSH to your EC2 instance on AWS you will feel right at home and Vim will be there for you, unlike other options.

Note: My Linux distribution of choice is currently Pop-OS, based on Ubuntu which is based on Debian, this is only relevant because each Linux distribution has its own package manager (see link for more information on that) so I will use apt-get to install all the packages and you should use the package manager of your system, if you are a Mac user you most definitely want to use Brew, and if you are on Windows, you should consider a dualboot, or the WSL.

2. The shell: Installing and Configuring Zsh, Oh-My-Zsh and Powerlevel10k

Most UNIX based OS’s come preinstalled with a shell and more often than not that shell is Bash (Bourne-again shell), Bash is excellent but in order to be able to extend it and implement some cool plugins we will be using Zsh instead, which is basically speaking Bash extended.

Installation on Debian based distros:

Always update the repositories before installing anything to avoid installing outdated packages (note that the symbol means that the code must be executed within a shell session):

 sudo apt-get update

Then do:

❯ sudo apt install zsh

Cool now we need to set Zsh as the default shell:

 chsh -s $(which zsh)

Finally to apply the changes you need to log out of the current session (Ctrl + Alt + Del on Ubuntu and derivatives).

After login back in when you start a terminal session you will be inside of Zsh.

The next step is to add personalization and features to our shiny new shell, for doing that we will use a framework called Oh-My-Zsh to add superpowers to the shell in a few steps:

First check if you have curl installed by doing:

❯ which curl

If the output is a string like /usr/bin/curl then you are good to go otherwise install curl by doing:

❯ sudo apt install curl

In order to install Oh-My-Zsh, we need to download a shell script (*.sh files), from their webpage and execute it using sh, Oh-My-Zsh already provides a one-liner command to both download this file and install Oh-My-Zsh in a single step.

Simply copy and execute this command:

 sh -c "$(curl -fsSL"

This will automatically install Oh-My-Zsh with the theme from Robby Russell the guy behind this awesome framework.

There is a ton of functionality added just with that last step, for instance helpful alias, for example, instead of doing:

❯ cd Dir/Sub-dir
❯ cd ..
❯ cd ~

To change directory, go up one directory and go back to home directory respectively, you can just do:

❯ Dir/Sub-dir
❯ ..
❯ ~

One last little trick is that you can type d and execute, this will give you a list of recent directories to jump directly by just typing the corresponding number and executing it in the shell.

Ok, now we will add some customization with a theme that can be made to look almost like any other theme out there, and you can further customize it to adapt it to your needs, it is powerlevel10k.

To make p10k work first you need to install the recommended fonts:

After installing the fonts change in your terminal the default font to MesloLGS NF Regular.

Then install the theme by executing the following command:

 git clone --depth=1 ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

This last command will git clone the files to Oh-My-Zsh custom folder, The theme should automatically prompt you start configuring it, here is a matter of choice what you want to choose, follow the prompts until you are happy with the result, in case you want to change something or if you don’t the prompt at all, execute the following command to launch the configuration wizard manually:

❯ p10k configure

After configuring the theme, this is how my terminal looks like:

Zsh + Ph-My-Zsh + Powerlevel10k — How it looks for me.

Additionally if you want the same look that I have on your system you can just replace your local copy of the “.p10k.config” with my file from github on this link.

+. Bonus content

Zsh has a bazillion plugins to extend its functionality. I will leave here the ones that I use and how to install them.

In order to install the plugins, you need to download the files from the corresponding github repo and add the plugin name into your .zshrc file, find a line that looks lite this:


Then add the name of the plugin you installed without removing the other plugins names, for example, my .zshrc plugin line looks like this:

plugins=(git fzf k zsh-syntax-highlighting zsh-autosuggestions)
  • zsh-syntax-highlighting: This package provides syntax highlighting for the shell zsh. It enables highlighting of commands whilst they are typed at a zsh prompt into an interactive terminal. This helps in reviewing commands before running them, particularly in catching syntax errors.

Installation for Oh-My-Zsh:

❯ git clone ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Remember to add to your .zshrc

Installation for Oh-My-Zsh:

❯ git clone ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Remember to add to your .zshrc

Were the three dots means your other plugins.

  • git: The git plugin provides many aliases and a few useful functions. Comes with Oh-My-Zsh no installation needed, just make sure it is on your .zshrc file.
  • k: k is a zsh script / plugin to make directory listings more readable, adding a bit of colour and some git status information on files and directories.

Installation for Oh-My-Zsh:

❯ git clone $ZSH_CUSTOM/plugins/k

Remember to add to your .zshrc

  • fzf: A general-purpose command-line fuzzy finder. It’s an interactive Unix filter for command-line that can be used with any list; files, command history, processes, host-names, bookmarks, git commits, etc.

Installation on Linux:

 sudo apt install fzf

Then add it to your .zshrc this will find the plugin no matter where it is installed and make sure it works on Zsh.

And that’s it for this terminal side of things, let me know in the comments what you think, and share your awesome looking terminal with the world!!.

3. The text Editor: Vim and plugins for python dev

Nos it’s time to take a look at the text editor, this where you we will doing the actual coding, and following a similar principle as the terminal since we are going to spend a lot of time in it, we want to look and behave the way we want.

So first thing first, lets install vim, now by default most UNIX systems come preinstalled with Vi (Visual) and then Vim is Vi Improved.


 sudo apt install vim

Next we want to make sure that Vim is the default text editor for the terminal

for this we have to do:

sudo update-alternatives --config editor

This will launch a prompt to select the editor you want

similar to this one:

sudo update-alternatives --config editor
There are 5 choices for the alternative editor (providing /usr/bin/editor).

Selection Path Priority Status
* 0 /bin/nano 40 auto mode
1 /bin/ed -100 manual mode
2 /bin/nano 40 manual mode
3 /usr/bin/vim.basic 30 manual mode
4 /usr/bin/vim.tiny 15 manual mode
5 /usr/bin/vscodium 0 manual mode

Press <enter> to keep the current choice[*], or type selection number:

Type the number where vim.basic appears, vim.tiny is a stripped version and does not have all the functionality.

Next we will install plugins to augment the functionality of Vim and to make it a good place to write python code. In order to do that it is helpful (although optional) to use a plugin framework (similar thing we did with Oh-My-Zsh for Zsh), the one I currently use is vim-plug by junegunn, but there is also Vundle and Pathogen, which are also popular.

To install vim-plug do:

❯ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \

This will download the files and put them in the auto-load directory by doing this we can automate the installation process for the plugins.

Then we need to create/edit a .vimrc file in the home directory, (remember you can go to home by typing and executing ~) and adding the following script on the top:

" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs

" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif

What this does is to tell Vim to check using vim-plug if there are any new plugins in the list of plugins, and if there are, to install them automatically, so all you need to do, is add the plugins you want to the list and voila, it’s done.

Then to install plugins all you need to do add them to the list, what this means is to put the plugins between the two calls to plug-vim as shown below:

"Above here are the code you just pasted in the last step
call plug#begin('~/.vim/plugged')

" Make sure you use single quotes
" Examples of plugins installations below
Plug 'junegunn/vim-easy-align'

Plug ''

Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'

" Initialize plugin system
call plug#end()
"Below go the Vim scripts for even further configuration

Below is a list of all the plugins I am currently using:

And that’s it!!, congratulations for getting all the way here, it was a long guide but now you have a development environment all set up and ready to start coding for python directly in the terminal.

This is how it looks like for me:

Vim configuration

In the next post we will install and configure Python, and key packages to manage virtual environments, working within virtual environments in all your projects, is a good practice to avoid over populating and potentially corrupting your python system installation.

The Startup

Get smarter at building your thing. Join The Startup’s +787K followers.

By The Startup

Get smarter at building your thing. Subscribe to receive The Startup's top 10 most read stories — delivered straight into your inbox, once a week. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +787K followers.

Ennio Maldonado

Written by

Ennio is a curiosity driven and taco’s eating engineer. Originally from mexico and currently living in sunny Barcelona, he enjoys science and technology.

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +787K followers.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium