Giter Site home page Giter Site logo

windows-zsh's Introduction

Installing ZSH on Git Bash for windows

Alt text

This guide will walk you through installing zsh with additional cool tools on windows.

You will get:

  • zsh shell (learn more)
  • oh-my-zsh (learn more)
  • powerlevel10k theme (learn more)
  • zsh auto-suggestions plugin (learn more)
  • zsh syntax-highlighting plugin (learn more)
  • fzf fuzzy finder (learn more)
  • adding this awesome terminal to Windows Terminal as a new profile, and optionally setting it as default.

And all that, running natively on windows, without WSL!

Note: this requires an additional 5GB of space on your hard drive, because we are installing Git for Windows SDK, which is a full build environment for Git for Windows.

Why not WSL?

WSL terminal is actually running on completely different VM. executing command on windows directories from WSL terminal would be very slow because of different protocols used for communication between WSL and windows. so for example, running npm install from WSL terminal on windows directory would take forever.. DONT DO IT!. see complete explanation npm on wsl extremely slow.

Steps

Manual installation

  1. Install Git for Windows SDK latest release. (you probably want the 64bit versions so the file should be named something like git-sdk-installer-1.0.8-64.7z.exe) this would takes few minutes and around 5GB of space.

  2. open the newly installed git sdk bash in <git-sdk-dir>/git-bash.exe (for example C:\Software\git-sdk-64\git-bash.exe). on first run, it is possible that few commands would run to setup the environment. wait for it to finish.

  3. Installing oh-my-zsh with p10k theme: in git sdk bash terminal,
    run the following commands:

    # install zsh
    # see https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH#arch-linux-or-manjaro
    pacman -S --noconfirm zsh
    
    # to fix common error when running zsh on git-sdk-bash: if you get error when opening "ERROR: this script is obsolete, please see git-completion."
    # see https://stackoverflow.com/a/69396005/10577976
    mkdir -p ~/.config/git/
    echo "" > ~/.config/git/git-prompt.sh
    
    # install oh-my-zsh
    # see https://ohmyz.sh/#install
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    
    # install powerlevel10k theme
    # see https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#oh-my-zsh
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
    # change the ZSH_THEME theme to powerlevel10k in the .zshrc file
    sed -i 's/^ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
    
    
    

    These command would install zsh, oh-my-zsh and powerlevel10k theme. These commands should work out of the box and this is safe to run them without any interventions, but if you get any errors, try to run the commands manually one by one.

  4. Installing zsh plugins: run the following commands:

    # install zsh auto-suggestions plugin
    # see https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    
    # install zsh syntax-highlighting plugin
    # see https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md#in-your-zshrc
    # note: this command is adjusted to clone to ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting instead of local dir like the docs suggest
    # this would add the plugin zsh-syntax-highlighting to oh-my-zsh plugins dir
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    # this would activate the plugin when zsh starts
    echo "source ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
  5. Installing fzf: run the following commands:

    # install fzf
    # see https://github.com/junegunn/fzf?tab=readme-ov-file#using-git
    git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
    ~/.fzf/install
  6. Configuring windows terminal

    • download these fonts and follow the instructions(not necessary but recommended).
    • add a new windows terminal profile with the following command line: C:\Software\git-sdk-64\msys2_shell.cmd -defterm -here -no-start -mingw64 -shell zsh
  7. open windows terminal. you will see zsh with p10k theme. it might ask you interactively to configure the theme. follow the instructions.

That's it! you now have a fully functional awesome zsh terminal on windows!

Automatic script installation

TODO: add working script (PRs are welcome)

first install Install Git for Windows SDK latest release manually. (you probably want the 64bit versions so the file should be named something like git-sdk-installer-1.0.8-64.7z.exe) this would takes few minutes and around 5GB of space.

then run the following command in git sdk bash terminal:

TODO: step 6. add windows terminal profile

windows-zsh's People

Contributors

eliav2 avatar

Stargazers

Amber avatar Michael Asistores avatar Chen Jiyang avatar Md Rubel Amin avatar  avatar Werapat Promwijit avatar Carlos Aguilar avatar Omer Faruk Oruc avatar Ulises Robles avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.