Giter VIP home page Giter VIP logo

z-pushd's Introduction

z

z lets you quickly navigate the file system in PowerShell based on your cd command history. It's a port of the z bash shell script.. Install it from the official PowerShell gallery.

Goals

Since June 2013 I have poured many hours building, tweaking and refining this script to work efficiently with PowerShell. It saves me a great deal of time navigating the file system, which is where I spent a lot of my time and has given me a great opportunity to learn PowerShell at a deeper level. There are no unit tests yet (I'll get around to it one day), but I wrote the script to save me time and learn PowerShell.

The goal is quite simple, save time typing out the fully qualified path names of frecently accessed directories. It's stable and fast. Enjoy!

ExampleUsage

Examples

Once installed, cd in to a few directories

cd foo

cd HKLM:\software\Microsoft\Office

cd 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files'

Based on the examples above, try executing some of these commands.

z foo				cd to most frecent folder matching foo

z temp				cd to most frecent folder matching `Temporary ASP.NET Files`

z foo -o r			cd to highest ranked folder matching foo

z foo -o f			cd to highest frecency folder matching foo

z foo -o t			cd to the most recently accessed folder matching foo

z -l foo			list all dirs matching regex foo

z -l				list all entries

z office			cd to most frecent folder matching office in drive HKLM (The registry)

z -x				remove the current directory from the datafile

z -clean			delete inaccessible paths from the datafile

z c:\windows			go to c:\windows and log in the datafile (works with any valid path)

z c<TAB>			expand entries in the datafile which match 'c'

Limitations

Below is a list of features which have not yet been ported from the original z bash script...yet.

  • Specifying two separate regex's and matching on both, i.e. z foo bar
  • Does not have the ability to restrict searches to sub-directories of the current directory

Added sugar

  • Tab completion support (will not currently work if you have PowerTab installed)

  • Works with registry paths such as HKLM\Software\.... and NetBIOS paths such as \\server\share.

  • Executing pushd will record the current directory for use with z.

Planned Features

See the issue listing

PowerShell installation

The easy way using PowerShellGet

For those with Windows 10 and above, you can issue a Install-Module z -AllowClobber command.

For those with Windows Vista or 7 who are using PowerShell version 3 or 4, you'll need to install PackageManagement first before executing Install-Module z -AllowClobber.

See the module listing in the official PowerShell gallery

Once complete, run the command Import-Module z-pushd. For ease of use I recommend placing this command in your PowerShell startup profile. Typically $PROFILE.

The hard way

Download the z-pushd.psm1 file and save it to your PowerShell module directory. The default location for this is $env:USERPROFILE\Documents\WindowsPowerShell\Modules (relative to your Documents folder). You can also extract it to another directory listed in your $env:PSModulePath. The full installation path should be $env:USERPROFILE\Documents\WindowsPowerShell\Modules\z-pushd\z-pushd.psm1.

Assuming you want z to be available in every PowerShell session, open your profile script located at $PROFILE and add the following line.

Import-Module z-pushd

If the file Microsoft.PowerShell_profile.ps1 does not exist, you can simply create it and it will be executed the next time a PowerShell session starts.

Running z

Once the module is installed and has been imported in to your session you can start jumping around. Remember, you need to build up the DB of directories first so be sure to cd around your file system. You can also use z as an alternative to the cd command.

z-pushd's People

Contributors

aeosynth avatar badmotorfinger avatar baskerville avatar daniel-liuzzi avatar enlik avatar jandedobbeleer avatar joejag avatar joshdick avatar letuanhai avatar marcinsmialek avatar matthiasgoergens avatar nmeum avatar ntsuji avatar punassuming avatar rupa avatar simonheimlicher avatar sjetha-pason avatar smitranic avatar wekempf 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.