/jj

quick to jump & quick to edit

Primary LanguageGo

jj

screenshot

Feature

  • similar & forked from gof (thanks mattn)
  • but simplified it & extended just for independent open2edit open2cd & fun?
  • and bug fix & feat extend or at least jj should be a more quick/cool name 😄

Installation

  • go get github.com/Shane-XB-Qian/jj (or just download the bin jj from this repo).
  • please think to write alias jj='jj || if [ $? -eq 6 ]; then $(cat "$HOME/.jj_tmp_fs"); fi' into your .bashrc.

Usage

$ jj
  • Run jj and emit ctrl-o, then start to edit (open2edit) with vim, whatever it was a file or dir.
  • Run jj and emit <enter>, then start to edit (open2edit) with vim if it was a file, or would quit but cd to that dir (open2cd) if it was a dir.
  • fuzzy if to 'fuzzy' filter -can be switched -when in jj -by ctrl-r.
  • dirOnly if to display/show dir only -can be switched -when in jj -by ctrl-f.
  • mruHist if to display/show MRU hist -can be switched -when in jj -by ctrl-v.
  • curOnly if to display/show cur only -can be switched -when in jj -by ctrl-\.
  • cur only means only show fs under cur path -or 'cwd' (if set 'root dir')

  • cur only is higher priority than mru hist when if both switched to true.

  • Tips: Use tab to complete dir.

  • Note: mruHist stored abs path.

  • Use ctrl-z if to multi-select, and/but to open2cd only the last one.

Options

Option Description
-f Fuzzy match
-w Init with dir only on
-c Init with cur only on
-m Init with mru hist on
-d [path] Specify root directory
  • check -h for detail.

Keyboard shortcuts

Key Description
CTRL-K,CTRL-P,ARROW-UP Move-up line -or wrap to bottom
CTRL-J,CTRL-N,ARROW-DOWN Move-down line -or wrap to top
CTRL-G Move-down line -to bottom
CTRL-A,HOME Go to head of prompt
CTRL-E,END Go to trail of prompt
ARROW-LEFT Move-left cursor
ARROW-RIGHT Move-right cursor
CTRL-O Edit the selected file/dir
CTRL-I,TAB Complete dir
CTRL-Y Echo cur item to input
CTRL-T Toggle view header/trailing of lines
CTRL-L Redraw
CTRL-U Clear prompt
CTRL-W Remove backward word (sep by '/')
CTRL-H,BS Remove backward character
DEL Delete character on the cursor
CTRL-Z Toggle selection
CTRL-R Toggle fuzzy option
CTRL-F Toggle dirOnly option
CTRL-\ Toggle curOnly option
CTRL-V Toggle mruHist option
Enter Decide : open2edit / open2cd
CTRL-D,CTRL-C,ESC Cancel

License

MIT

Author

  • Yasuhiro Matsumoto (mattn) made gof.
  • Shane.XB.Qian is simplifying gof to jj.

Note

  • mostly just a play to myself: only tested with linux/bash and edit default with vim.
  • to simple cases should be just fine: quick to jump/edit & have more fun with bash 😄