How to personalize the shell for developers - my custom setup
Tags: shell, bash, productivity, programming
Published: 2022-12-18 20:04:04

Hi, This post has been written to create a beautiful and useful custom operating system shell setup for developers, data scientists or everyone who want to have unusual linux,*nix or macos shell. This is completely simple guide for installation of shell setup for best efficiency.    

## install zsh and ohmyzsh

```shell
 ## for Debian/Ubuntu
sudo apt-get install zsh

## for RHEL/Centos/Fedora
sudo yum install zsh
## for only Fedora 
sudo dnf install zsh
 

## for arch
sudo pacman install zsh
## for mac
brew install zsh
```
The package manager installed the shell on the system.

to install ohmyzsh latest version:

```shell
#using curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#or using wget
sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

```
**ohmyzsh** installed under the __/home/user__ directory as hidden. You can see the folder __.oh-my-zsh__ and **.zshrc** config files. ohmyzsh will change zsh config file contents.     

## change the theme

Open **.zshrc*** config file with nano or vim and change themes:
```shell
nano ~/.zshrc
#or
vim ~./zshrc 
```
```editorconfig
ZSH_THEME="fino-time"
```

You can find different themes from the[ pages]([Themes · ohmyzsh/ohmyzsh Wiki · GitHub](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes))

## install custom plugins

### zsh-autosuggestion

```shell
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
```

### zsh-syntax-highlighting

```shell
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
```

### zsh-autocomplete

```shell
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git $ZSH_CUSTOM/plugins/zsh-autocomplete
```
And add these to plugins tuple in **.zshrc**

```editorconfig
plugins = ( git
            sudo
            zsh-autosuggestions 
            zsh-syntax-highlighting 
            zsh-autocomplete
            )
```
## install pyenv for python version control
Pyenv is a tool which can manage python environment and versions. It's very useful tool for all types developers.
To installation the tools: 

```shell
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
```
and to define environment variables:  
(for zsh)
```shell
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
```
after that:
```shell
exec "$SHELL"
```
To create python virtual-environments, virtualenv plugin installation is required.
```shell
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
```  

### Usage
You can install many of python, conda versions with this tools easily. You can check [github repositories](https://github.com/pyenv/pyenv.git) for more information. 

```shell
## install a python environment
pyenv install 3.8.5 
## create a virtual environment
pyenv virtualenv 3.8.5 myenv
```
after create a virtual-environment, it's usable with this command.

```shell
pyenv activate myenv
(myenv)$  
```