Giter Site home page Giter Site logo

zabb's Introduction

zabb

License: MIT

zabb - a zsh plugin for finding z abbreviations

Command

I love the z command. It lets me quickly jump to my favorite directories by typing very few keys. But - sometimes I give in to my OCD and pause to wonder: how few keys can I get away with?

I can experiment, try different short versions. But this is hit-and-miss, and ironically, it can mess with the ranking and change what abbreviations can be used.

Presenting the solution: zabb

zabb is a command that tries to figure out the shortest memorable abbreviation of a directory that is usable by z to unambiguously jump to that directory.

By default, only abbreviations that start the same way as the directory name are returned.

USAGE:
  zabb [<DIRECTORY>]

ARGS:
  <DIRECTORY>
      Directory to find z abbrevs for. If none is given, it defaults to the current working directory

FLAGS:
  -s or --shortest
      Allow abbreviations even if they do not start the same way as the directory name. (This will often find shorter abbreviations, but they may be less easy to remember)
  -a or --all
      List all (contiguous) abbreviations (implies -s)
  -1 or --one-letter
      List which directories each single-letter abbreviations in the alphabet will result in
  -h or --help
      Print help

Examples

~ > ls -d Do*
Documents Downloads
~ > zabb Downloads
d
~ > z d
~/Downloads > cd
~ > zabb Documents
doc
~ > z doc
~/Documents > cd
~ > zabb -s Documents
u
m
e
~ > z u
~ /Documents> cd
~ > zabb -a Documents
u
m
e
t
oc
cu
um
[...]

Non-contiguous, i.e. space-separated, abbreviations are not looked for. So, in some fairly rare circumstances, the shortest abbreviations may not be found.

Currently zabb mainly supports the zoxide implementation of z. It works ok with z.lua, fasd and z, but may not find the shortest abbreviations for those. It may work for other implementations if they support the z -e command. I welcome PRs to expand zabb to other implementations.

Installation

zinit

This plugin is designed as a zinit module, but it's also compatible with other zsh plugin managers.

You can use Turbo Mode to load zabb:

zinit ice wait'1' lucid
zinit light mellbourn/zabb

License

The MIT License (MIT)

Copyright (c) 2021 Klas Mellbourn

zabb's People

Contributors

mellbourn 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

Watchers

 avatar  avatar  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.