A lazy brown programmer will jump over the directories quickly!
lumiknit's jump helper, the second edition.
- 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
- Run
cargo install --git https://github.com/lumiknit/J2 - Add configuration in shell profile, such as
.bashrc,.zshrcor$profile
# 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..
Since PowerShell does not support eval,
you should insert the script from j2 shell-init manually.
Add-Content $PROFILE $(j2 shell-init pwsh)to add the script to your profile- Or create a file
Add-Content "<path_to_script>" $(j2 shell-init pwsh)and import it in your profile such asAdd-Content $PROFILE ". <path_to_script>"
Then, add the following configuration to your profile:
# You may need to set HOME if not
$env:HOME = "/Users/user"
# Repository path, where cloned repositories are stored
$env:J2_REPOS_PATH = "$env:HOME/repos"
# Root paths to fuzzy find and jump. Multiple paths are separated by semicolon.
$env:J2_FIND_BASE_PATHS = "$env:HOME/repos;$env:HOME/workspace"
# ignore file path containing directories to ignore
# You can write this file as any other ignore file, such as .gitignore!
# $env:J2_IGNORE = "$env:HOME/.J2_ignore"
# Path to jones (j-zone, sandbox).
$env:J2_JONES_PATH = "$env:HOME/workspace/jones"
# Default editor to be used by J2
$env:J2_EDITOR = "code"To find some subdirectory in your J2_FIND_BASE_PATHS, run j2 find. See j2 find --help for more details.
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 toJ edit <QUERY>): open editorJ 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!
Enter: Select the current item and quitup/down,Ctrl-p/n,Alt-k/j: Select up/down itemsleft/right,Alt-h/l: Move cursor to the left/rightCtrl-a/e,Home/End: Move cursor to the beginning/endEsc,Ctrl-*: Quit without selecting
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 (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 sandbox2387-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 isREADME.md.
and shortcuts:
j--: Equivalent toJ jone-new.j--!: RunJ jone-newand 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 toJ jone-sections.j.: Equivalent toJ jone-note.
Example usages:
- To manage a todo list,
- If you want to create a new document, run
j-- todoto create a new section of jone namedtodo. - To edit the document, just run
j. todoand edit the note.
- If you want to create a new document, run
- To create sandbox directory,
- Run
j-- sto create a new section. - Run
j- sto 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_ sto show all sandboxes.
- Run
