Skip to content

Latest commit

 

History

History
94 lines (65 loc) · 3.81 KB

README.md

File metadata and controls

94 lines (65 loc) · 3.81 KB

zsh

Introduction

This repository contains my personal configuration for zsh and oh-my-zsh, as well as a helper script to install and configure zsh. You can use this configuration as is, or as a starting point, using a different theme or adding other plugins.

Installation

Install and configure zsh with the provided installation script:

./setup_zsh.sh

If you have not installed it already, the script will also prompt you if you want to install terminator, a nice terminal emulator that has a split-screen functionality that allows you to have multiple terminals in one window.

Favourite features

Some of my personal favourites:

oh-my-zsh plugins

  • Ctrl + R - will search your history for the command you are typing

    • Alternative: if you start typing your command and use it will cycle through previous commands that match
  • Ctrl + T - will recursively search the current directory for the file you are typing

    • especially useful in combination with other commands like cd and python
  • agi - will install a package with sudo apt-get install

    • example: agi python3
    • also: agu for sudo apt-get update
  • fuck - will try to autocorrect the mistake in your previous command and prompt you with a solution. Some examples of mistakes:

    • if you made a type:, e.g. puthon
    • if you forgot to add a flag, e.g. rm <folder>
    • if you try to install the wrong package, e.g. pip3 install yaml or
    • if you forgot to add sudo
    • if you forgot to set the remote as upstream on your new branch when you push
    • and maybe more, just try and see
  • gcb - will create and checkout a new branch

    • example: gcb feature/cool-thing
    • also: gco for git checkout, so you can use gco - to check out your previous branch
    • also: gcmsg for git commit -m
  • google - will directly search what you type on that search engine, also works for StackOverflow and

    • example: google is pluto a planet
    • example: stackoverflow how to concatenate std::string and int c++
  • is_json - will return if a file is a valid json

    • example: is_json < my_file.json
  • jira branch - opens the JIRA ticket referenced in the branch name in your browser

    • For this to work you need to update the url in .jira-url to match your board.
    • also: jira new to create a new JIRA ticket and jira mine to view your JIRA tickets
  • z - tool to directly jump to any directory that you have visited before

    • example: z foo + Tab to directy jump to ~/super/nested/directory/with/folder/foo

custom

  • create_venv will create a virtual environment, activate it and install the requirements for that directory
  • activate will activate the default virtual environment (venv) for that directory
  • install_python <version> will install a certain python version for you (e.g. install_python 3.10)
  • update_python can be used to point the python3 command to a different version

other functionalities

  • auto completion for commands for different packages such as docker, git, helm, kubectl, minikube, poetry etc.
  • git-auto-fetch will automatically fetch the latest changes from the remote repository
  • interactive cd command that will show you the contents of the directory you are in
  • press Esc twice to clear to add sudo to your previous command

Troubleshooting

Switch between bash and zsh with the following commands:

bash
zsh

Change the default shell to zsh with the following commands:

chsh -s $(which zsh)

Run the following command to configure p10k theme if the shapes overlap or other issues occur:

p10k configure