You'll never want to use cd again.

Related tags

Command-line ToolsJmp
Overview

Jmp

Description

Have you ever used the cd command? You'll never touch that outdated thing again when you try jmp. Navigate your filesystem with unprecedented speed, agility, and dexterity NEVER seen before. Become a truly unstoppable force on the command line.

Given a set of regular expressions, jmp will intelligently search through your files and cd you into your intended directory. Instead of cd /Users/gholmes/Projects/Diviner/core/ (what a waste of time and energy, am I right?), just input jmp D c to achieve the exact same results. Arguments can be regular expressions and can "guide" the search to a final prediction.

This tool is also very useful if you only remember part of the name of place you want to go to, as you can run jmp .+ .+ and then theres a good chance you'll end up in the right place. Thanks, regex!

Before After

Intallation

Have a working installation of Python 3. The script only leverages standard libraries so no need for a requirements.txt, pip install, or anything like that.


Clone this repo:

$ git clone https://github.com/gholmes829/Jmp.git


Without changing folders from the place you ran git clone, run

Jmp/jmp_wrapper.sh; \ echo "\nsource \"$(pwd)/Jmp/jmp_wrapper.sh\"" >> ">
$ echo -e "SCRIPT_DIR=\"$(pwd)/Jmp\"\n\n$(cat Jmp/jmp_wrapper.sh)" > Jmp/jmp_wrapper.sh; \
  echo "\nsource \"$(pwd)/Jmp/jmp_wrapper.sh\"" >> 
    

    

where is the path to your .bashrc, .zshrc, or whatever else you use that gets run upon opening a terminal.

These commands will set everything up so that you can always access jmp from the terminal.

Optionally, you can rename the jmp command to something else. Setting alias dc=jmp in your terminal config file will now let you run dc D c (from the example above), where dc is now cd's evil nemesis.

Basic Usage

Basic usage is as follows

$ jmp expr_1 expr_2 ...expr_n

where each expr_i is a Python-compatible regex string, which of course includes plain text searches if you don't want to use fancy regex. The algorithm will perform a breadth first search through the file system, attempting to sequentially match expressions with files it encounters. Once the last expression has been matched and popped off, your cwd will be changed to the target directory. By default without using regex, the algorithm attempts to match files starting with the expr. You can instead jump to files ending with an "query" with jmp .*query$.

If you find yourself not wanting to type out a directory's name every time, you can use aliases. You can modify aliases.json to include a key-value pair that transforms your input. For example, adding "cc": "EECS 665" to aliases.json would make it so jmp cc gets interpreted as jmp EECS\ 665. This allows for shorter commands that get you to where you want.

If you don't want to waste compute time on deep directories that you know don't contain anything useful, you can use the blacklist. Any blacklisted term will not be evaluated. For example, adding "Documents" into blacklist.json prevents us from searching for or inside of the documents folder. This allows for a faster experience.

Run the following to learn more about flags (-b, -f, -d, -l, -s, etc)

$ jmp -h

Flags enable you to specify type of file to search, limit max search depth, set search root path, silence output, and more.

Lastly, take note of function variations/ aliases jmpa (run jmp from root), jmpf (search only for files), and jmpd (search only for directories). Since a major point of jmp is for convenience and to save time, it would make sense to use jmpd rather than jmp -d.

Considerations

You may find yourself doing some experimentation to learn how to get the best use out of this tool. If you excessively shorten your expressions, it is very likely you'll end up in a lexically similiar location that is different from what you intended. Using multiple strategic expressions will conversely speed up the operation by narrowing the search space. Considering the absolute worst case in terms of convenience, we can see that jmp converges to cd as each expression could be the next folder that you would need to cd to (e.g. jmp Projects Diviner core vs cd Projects/Diviner/core).

In other words, jmp is at least as convenient as cd and has potential to be a lot, lot better. However, if you try to drop too much information, you may lose accuracy. Try to use the minimal number of expressions while still retaining substrings or patterns unique to your target location.

Advanced Customization

Take a look at jmp.py. The code is pretty succinct and modular, so it shouldn't be too hard to modify the constraints for searching, matching, or even the traversal algorithm itself.

Owner
Grant Holmes
Grant Holmes
Amazon Scraper: A command-line tool for scraping Amazon product data

Amazon Product Scraper: 2021 Description A command-line tool for scraping Amazon product data to CSV or JSON format(s). Requirements Python 3 pip3 Ins

49 Nov 15, 2021
Vsm - A manager for the under-utilized mksession command in vim

Vim Session Manager A manager for the under-utilized `mksession` command in vim

Matt Williams 3 Oct 12, 2022
Random scripts and other bits for interacting with the SpaceX Starlink user terminal hardware

starlink-grpc-tools This repository has a handful of tools for interacting with the gRPC service implemented on the Starlink user terminal (AKA "the d

270 Dec 29, 2022
🎄 Advent of Code command-line tool.

🎄 advent-cli advent-cli is a command-line tool for interacting with Advent of Code, specifically geared toward writing solutions in Python. It can be

Christian Ferguson 6 Dec 01, 2022
This is a CLI program which can help you generate your own QR Code.

Python-QR-code-generator This is a CLI program which can help you generate your own QR Code. Single.py This will allow you only to input a single mess

1 Dec 24, 2021
Centauro - a command line tool with some network management functionality

Centauro Ferramenta de rede O Centauro é uma ferramenta de linha de comando com

1 Jan 01, 2022
Generate an ASCII Art from keyword put in the cli

ascii-art-generator-cli Generate an ASCII Art from keyword put in the cli Install git clone https://github.com/Nathanlauga/ascii-art-generator-cli cd

Nathan Lauga 1 Nov 14, 2021
Darkdump - Search The Deep Web Straight From Your Terminal

Darkdump - Search The Deep Web Straight From Your Terminal About Darkdump Darkdump is a simple script written in Python3.9 in which it allows users to

Josh Schiavone 264 Dec 30, 2022
Enlighten Progress Bar is a console progress bar library for Python.

Overview Enlighten Progress Bar is a console progress bar library for Python. The main advantage of Enlighten is it allows writing to stdout and stder

Rockhopper Technologies 265 Dec 28, 2022
A tool to automatically convert old string literal formatting to f-strings

flynt - string formatting converter flynt is a command line tool to automatically convert a project's Python code from old "%-formatted" and .format(.

Elijah K 551 Jan 06, 2023
A simple automation script that logs into your kra account and files your taxes with one command

EASY_TAX A simple automation script that logs into your kra account and files your taxes with one command Currently works for Chrome users. Will creat

leon koech 13 Sep 23, 2021
A CLI based task manager tool which helps you track your daily task and activity.

CLI based task manager tool This is the simple CLI tool can be helpful in increasing your productivity. More like your todolist. It uses Postgresql as

ritik 1 Jan 19, 2022
TUIFIManager - A cross-platform terminal-based file manager

TUIFI Manager A cross-platform terminal-based file manager (and component), mean

142 Dec 26, 2022
texel - Command line interface for reading spreadsheets inside terminal

texel - Command line interface for reading spreadsheets inside terminal. Sometimes, you have to deal with spreadsheets. Those are sad times. Fortunate

128 Dec 19, 2022
A python script that enables a raspberry pi sd card through the CLI and automates the process of configuring network details and ssh.

This project is one script (wpa_helper.py) written in python that will allow for the user to automate the proccess of setting up a new boot disk and configuring ssh and network settings for the pi

Theo Kirby 6 Jun 24, 2021
Code for "Salient Deconvolutional Networks, Aravindh Mahendran, Andrea Vedaldi, ECCV 2016"

deconvnet_analysis Code for "Salient Deconvolutional Networks, Aravindh Mahendran, Andrea Vedaldi, ECCV 2016" Parts of this code Generate figures in t

Aravindh Mahendran 12 Jan 25, 2021
GoSearch for anything from your terminal

GoSearch for anything from your terminal Requirements pip install beautifulsoup4

Malik Mouhiidine 1 Oct 02, 2021
This is the public repo for the VS Code Extension AT&T i386/IA32 UIUC-ECE391 Syntax Highlighting

AT&T i386 IA32 UIUC ECE391 GCC Highlighter & Snippet & Linter This is the VS Code Extension for UIUC ECE 391, MIT 6.828, and all other AT&T-based i386

Jackgetup 1 Feb 05, 2022
AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

Rafael Torres 2 Dec 10, 2021
lfb (light file browser) is a terminal file browser

lfb (light file browser) is a terminal file browser. The whole program is a mess as of now. In the feature I will remove the need for external dependencies, tidy up the code, make an actual readme, a

2 Apr 09, 2022