Giter Site home page Giter Site logo

j2's Introduction

J2

A lazy brown programmer will jump over the directories quickly!

lumiknit's jump helper, the second edition.

preview

Features

  • Fuzzy finder for path
    • With fzf-like TUI
    • Find directory and cd/pushd/edit with less typing
  • Clone repository with less path-conflictions
  • Make tagged sandboxes
    • Which managed by date and random number
    • With README note

Installation

  • Run cargo install --git https://github.com/lumiknit/J2
  • Add configuration in shell profile, such as .bashrc or .zshrc

Example Configuration

# You may need to set HOME if not
export HOME=/Users/user

# Repository path, where cloned repositories are stored
export J2_REPOS_PATH="$HOME/repos"

# Root paths to fuzzy find and jump. Multiple paths are separated by colon.
export J2_FIND_BASE_PATHS="$HOME/repos:$HOME/workspace"

# ignore file path containing directories to ignore
# You can write this file as any other ignore file, such as .gitignore!
# export J2_IGNORE="$HOME/.J2_ignore"

# Path to jones (j-zone, sandbox).
export J2_JONES_PATH="$HOME/workspace/jones"

# Default editor to be used by J2
export J2_EDITOR="code"

# Initialize j2 functions
eval "$(j2 shell-init)"

Note that the above will override some commands such as J, j, j-, j--, j..

Usage

Find Path

To find some subdirectory in your J2_FIND_BASE_PATHS, run j2 find. See j2 find --help for more details.

Jump to Path

To jump to some subdirectory in your J2_FIND_BASE_PATHS, just run j <QUERY> (equivalent to J cd <QUERY>). It'll open a TUI to find a directory with the given query, and cd to the selected directory.

Instead of J cd, you can use

  • j! <QUERY> (equivalent to J edit <QUERY>): open editor
  • J pushd <QUERY>: push directory (See Pushd and Popd)

Note that this jump commands basically use j2 find command. You can use any other options for j2 find command!

Fuzzy finder shortcuts

  • Enter: Select the current item and quit
  • up/down, Ctrl-p/n, Alt-k/j: Select up/down items
  • left/right, Alt-h/l: Move cursor to the left/right
  • Ctrl-a/e, Home/End: Move cursor to the beginning/end
  • Esc, Ctrl-*: Quit without selecting

Clone Repository

To clone some repository, run J clone <URL> (equivalent to j2 clone <URL>). It'll create a directory in J2_REPOS_PATH and clone the repository. For example, J clone https://github.com/lumiknit/J2 will create $J2_REPOS_PATH/github.com/lumiknit/J2.

Jones

Jones (J-zone) are a kind of sandbox/playground. It is sorted by tags and date. For example, test-repo/2387-1231 means,

  • test-repo: a tag (or kind) of the sandbox
  • 2387-1231: Section.
    • 2387: date. 2023-08-07. Note that the month and day uses base-36.
    • 1231: random base-36 number to avoid confliction

Note that _ is used for empty tag.

There are commands to create and use jones:

  • J jone-new [<TAG>]: Create a new section of jone named with the given tag.
  • J jone-list: Show all jone tags.
  • J jone-sections [<TAG>]: Show all sections of jone with the given tag.
  • J jone-note [<TAG>]: Edit a note of jone with the given tag. The name of the note is README.md.

and shortcuts:

  • j--: Equivalent to J jone-new.
    • j--!: Run J jone-new and open editor in the new section.
  • j-: Cd to the latest section of jone with the given tag.
    • j-!: Open editor in the latest section.
  • j_: Equivalent to J jone-sections.
  • j.: Equivalent to J jone-note.

Example usages:

  • To manage a todo list,
    • If you want to create a new document, run j-- todo to create a new section of jone named todo.
    • To edit the document, just run j. todo and edit the note.
  • To create sandbox directory,
    • Run j-- s to create a new section.
    • Run j- s to move into the new sandbox.
    • Even if you move to another directory, you can move back to the sandbox by running j- s.
    • Run j_ s to show all sandboxes.

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.