Giter VIP home page Giter VIP logo

mastering-zsh's Introduction

If you're already using zsh or want to start this tutorial will help you understand how zsh works and how you can customize it to your needs.

We won't go into every feature of zsh (read the man pages for that). Did you know zsh has a built in ftp client and calendar? Instead we will focus on functions of zsh that improve your productivity and help you get more out of your shell.

We also will not be using any frameworks to customize the shell. You're free to use oh-my-zsh, prezto, or many other options. They help you get started fast but they don't help you understand zsh and some of its more advanced features.

We will assume you are already familiar with basic command line usage. How to run a command, how to set a variable, what command history is, etc.

This documentation will build on the basics to show you advanced usage, customizations, and practical examples to make you better.

Table of Contents

mastering-zsh's People

Contributors

jjasghar avatar juliawong avatar lindsayhill avatar mattmc3 avatar mbelsky avatar nvictor avatar rothgar avatar tammersaleh avatar tylerauerbeck avatar vrandezo avatar zbintliff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mastering-zsh's Issues

Initial Config menu

When I installed and ran zsh the first time, it pulled up a really handy menu that walked me through some of the toggles I could flip on and off. Most of the things made sense, but there were some parts of the auto-completion (which is a sub-menu, it seems) regarding the various options for globbing, expansion, etc that weren't entirely clear to me.

Maybe an overview of that "initial setup" and comparison of the options (e.g. what they actually look like in action) would be handy?

Add some useful keyboard bindings

Hi Justin, create work here!

As discussed on Twitter, here are some shortcuts I use regularly in zsh that made my life easier. Note that not all of them apply (i.e. work) depending on the zsh binding mode, e.g. default, emacs/vi, etc. What I am describing here is out of the box UX with zsh (my env is oh-my-zsh on OSX).

search/replace a command from history

Say you executed the following command:

$ echo "Hi, I love BASH"

Using zsh's history search & replace functionality, one can easily change a string (or character, etc.):

$ !!:s/BASH/ZSH <TAB>

This will change BASH to ZSH. Additional functionality:

  • use gs instead of s to replace multiple occurrences
  • !! is the last command executed; but you can also use !-2 to get the second last (i.e. !-n n-last) command
  • if you want to undo a replacement (or any substitution) use CTRL+_ (underscore, that is SHIFT+ -)

get --help faster with zsh

Say you want to see all CLI flags for brew upgrade. Instead of brew upgrade --debug or searching man pages, it's as easy as:

$ brew upgrade --<TAB>

Kill processes faster

Instead of killing a process by finding its PID first, why not use zsh?

# kill a Google Chrome process by just typing the first characters
$ kill Goo<TAB>

Edit that super long command in <your favorite editor>

Say you have this crazy long command and need to replace one character in the middle of the line. What you want is to open your favorite $EDITOR and just do it. Well, zsh got you covered:

$ curl -s -i -k -d '{"texxt":"hello world"}' https://some.server.com

You want to fix this texxt typo, so while you have this line in your terminal just press CTRL-X-E (more precisely CTRL-X followed by CTRL-E). This will open the line in your $EDITOR, where you can make the change, save it (eg :wq in vi) and you will return to your terminal where you can then execute the command.

Stash the current command line

Say you would like to clear the screen before executing the command you already typed in your prompt. But you don't want to erase that long line. So instead of commenting out the line, copy & pasting it back and forth, why not use zsh to stash it :) ?

# this is the line we would like to stash
$ curl -s -i -k -d '{"texxt":"hello world"}' https://some.server.com

While you're in the prompt, just hit ESC-q. Then type the intermediate command you want to execute, e.g. clear (the screen). And after that, zsh will restore the stashed command.

Installation?

Without using oh-my-zsh or another framework, what's the recommend way to install zsh?

I'm digging through stuff online and http://zsh.sourceforge.net and can't seem to find a recommended way to install it.
Should I rely on my OS distro's available pacakge(s) to install it? Maybe I'm just become so accustomed to those crazy curl | sudo bash directions seemingly everywhere that installing things from OS packages has become a bit foreign ๐Ÿ˜†

Links Formatting

There are some issues with the formatting of the links in hooks.md and functions.md

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.