ZSH Gem #21: Completion of abbreviated filenames

Posted by | Comments (0) | Trackbacks (0)

Yesterday I told you about how to use the full potential of the cd command. Today I want to go one step further and show you how you can reduce the number of characters to type even more.

As I've already shown you several times throughout this series, ZSH is very capable of completing things when hitting the TAB key. Today I'll show you two more features concerning completion of abbreviated or incomplete pathnames.

Read more…

ZSH Gem #20: Changing directories the pro's way

Posted by | Comments (3) | Trackbacks (0)

I guess, the cd command is the most often neglected command. Nobody really cares about what this command can do, but in fact, ZSH has added some magic to it, which makes it worth a more thorough look.

I told you about AUTO_CD before, a shorthand syntax for the cd command. But that's not the only thing ZSH has done to cd.

Read more…

ZSH Gem #19: Global aliases

Posted by | Comments (2) | Trackbacks (0)

I guess each shell implementation knows something like aliases. With aliases you can give commands different names which might be more convenient for you. That's nothing new, but ZSH has a feature called global aliases.

Read more…

ZSH Gem #18: Regexp search and replace on parameters

Posted by | Comments (0) | Trackbacks (0)

In ZSH you can easily perform regexp search and replace operations on shell parameters. The only function you need for this is regexp-replace.

Regexp search and replace can be very useful when writing shell scripts which need to process input data, directory names, process trees etc. You assign the string which you need to work on to a parameter and then run the replace function on it.

Read more…

ZSH Gem #17: Changing directories with auto_cd

Posted by | Comment (1) | Trackbacks (0)

This is probably the shortest tip of this series. I only want to show you a ZSH-specific shorthand for changing directories.

The ZSH option AUTO_CD makes it possible to change directories by just writing their names without using cd. This might be interesting for those of you who always want to type as few characters as possible.

Read more…

ZSH Gem #16: Command arguments completion

Posted by | Comments (4) | Trackbacks (0)

ZSH has lots of great expansion and auto completion features and I have shown you many of them. One more completion feature I want to show you is command arguments completion. With this completion of command line parameters you can auto complete the arguments of your command line tools. Many completion definitions are already included in ZSH, many more can be installed via your package manager.

Read more…

ZSH Gem #15: Shared history

Posted by | Comments (0) | Trackback (1)

If one thing annoys me then it's when the shell history doesn't handle multiple simultaneous shell sessions properly. Once you close a shell instance, its complete history is written to the history file. And when you close the second instance, it writes its whole history in one go, too. The result is that I have to go through all history entries of the second instance to come to the last entry of the first one (if they're not already deleted because the history of the second shell was longer than the maximum history size or because the shell is configured to replace the whole history instead of appending new entries).

Read more…

ZSH Gem #14: Anonymous functions

Posted by | Comments (2) | Trackbacks (0)

I hope, you're familiar with parameter scopes, i.e. local and global variables. Global variables are visible in all contexts including subshells, functions and what not. Local variables are only visible in the current scope (e.g. a function).

Read more…

ZSH Gem #13: Parameter expansion

Posted by | Comments (0) | Trackbacks (0)

Today I want to show you some examples of parameter expansion or parameter substitution as it is called in Bash. I've already used parameter expansion a few times in this series but now I want to show you how it works (at least some basics, I don't want to report the whole manual here).

Read more…

ZSH Gem #12: Autoloading functions

Posted by | Comments (4) | Trackbacks (0)

Have you ever wondered why ZSH provides so many features but is still so fast? That's because of its autoloading mechanism. Functions can be marked as empty so they aren't loaded before they are executed the first time. This saves a lot of memory and much processing power.

Read more…

   (Page 2 of 7, totaling 65 entries)
Design and Code Copyright © 2010-2017 Janek Bevendorff Content on this site is published under the terms of the GNU Free Documentation License (GFDL). You may redistribute content only in compliance with these terms. tweetbackcheck