AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
To enable it, add the following lines to your. For details, check this User's Guide.Ĭommand completion is enabled by default with Oh My Zsh. There's usually expansion and command completion. For simplification, I call it Tab completion, but under the hood, more than one thing is happening. Zsh's powerful completion system is one of its hallmarks. This is just one of the features enabled by zsh's powerful Tab completion system. Type the first letters of the directory names and TAB to use it: $ pwd Now you can type d to see the first ten items in the list and the number to switch to it: $ dįinally, zsh automatically expands directory names with Tab completion. For example: $ pwdĬombine these with aliases to make it even easier to navigate: d='dirs -v | head -10' Switch to any directory in this list by typing ~# where # is the number of the directory in the list. Zsh keeps the history of directories you visited so you can quickly switch to any of them. Just type the directory name, and zsh switches to it: $ pwd With these options set, you don't need to type cd to change directories. These features are enabled with Oh My Zsh, but you can enable them by using this command: setopt autocd autopushd \ pushdignoredups Zsh makes this easier by providing some useful directory navigation features. When you're using the command line, navigating across different directories is one of the most common tasks. Next, let's see how zsh helps to navigate the filesystem. 6 rgerardi rgerardi 4096 Aug 24 14:51 Downloads 5 rgerardi rgerardi 4096 Aug 7 14:08 Documentsĭrwxr-xr-x. To use this alias, type G anywhere you would type the piped command: $ ls -l G doĭrwxr-xr-x. This is very useful to replace common filenames or piped commands. Now if you type any file name ending with yml or yaml in the command line, zsh opens that file using vim: $ playbook.ymlĪ global alias enables you to create an alias that is expanded anywhere in the command line, not just at the beginning. Oh My Zsh configures several useful aliases by default, including aliases to navigate directories and replacements for common commands with additional options such as: ls='ls -color=tty' Defining aliases for your most-used commands saves you a lot of typing. Clever aliasesĪliases are very useful in zsh. Here's a list of plugins I use in my Fedora workstation: git golang fedora docker oc sudo vi-mode virtualenvwrapper 2. There are plugins available for many programming languages, packaging systems, and other tools you commonly use on the command line. Gbda='git branch -no-color -merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' Gdt='git diff-tree -no-commit-id -name-only -r' For example, enabling the Git plugin gives you access to a number of useful aliases, such as: $ alias | grep -i git | sort -R | head -10 In addition to themes, Oh My Zsh bundles tons of useful plugins for zsh. Here's an example of Powerlevel9k, my theme of choice: Having this information at a glance saves you from typing the equivalent commands to obtain it, and it's a cool look. By default, it enables some sensible zsh configuration options and it comes loaded with hundreds of themes and plugins.Ī theme makes you more productive as it adds useful information to your prompt, such as the status of your Git repository or Python virtualenv in use. There are many available, but the most popular is Oh My Zsh. The quickest way to get started using themes and plugins is to use a zsh configuration framework. A theme is a predefined prompt configuration, while a plugin is a set of useful aliases and functions that make it easier to use a specific command or programming language. Through the years, the open source community has developed countless themes and plugins for zsh. In this article, I'll present five tips to make you more productive using the command line with zsh. It would be impossible to cover all the options of zsh here there are literally hundreds of pages documenting its many features. It has similarities to other shells in the sh (Bourne shell) family, such as as bash and ksh, but it provides many advanced features and powerful command line editing options, such as enhanced Tab completion. The Z shell known as zsh is a shell for Linux/Unix-like operating systems.
0 Comments
Read More
Leave a Reply. |