Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
anki-code committed Feb 22, 2024
1 parent 084991b commit f625ac7
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ xpip install xontrib-jump-to-dir

## Usage

Init:
```xsh
# Check that you're using sqlite history in ~/.xonshrc
$XONSH_HISTORY_BACKEND = 'sqlite'

xontrib load jump_to_dir

```
Jump to directory by path:
```xsh
mkdir -p /tmp/hello /tmp/world
cd /tmp/hello
echo 1
Expand All @@ -36,9 +38,16 @@ cd /tmp/world
echo 1
cd /

j # Jump to most frequent directory i.e. `/tmp/hello/` because 3 `echo` commands were executed
j wor # Jump to directory with `*wor*` in path i.e. `/tmp/world/`
j t he # Jump to directory with `*t*he*` in path i.e. `/tmp/hello/`
j # Jump to most frequent directory i.e. `/tmp/hello/` because 3 `echo` commands were executed.
j wor # Jump to directory with `*wor*` in path i.e. `/tmp/world/`.
j t he # Jump to directory with `*t*he*` in path i.e. `/tmp/hello/`.
```
Jump to directory by command:
```xsh
cd /tmp
echo 112233
cd /
jc 22 # Jump to the directory where `*22*` command executed i.e. `/tmp`.
```

Custom shortcut:
Expand All @@ -54,6 +63,10 @@ The history database has the commands you run and the directory where you was. T

If you want to add fallback functionality to jump to any directory by partial path in case of zero result in history database (e.g. `j o lo bi` will jump to `/opt/local/bin`) feel free to create PR.

## Environment variables

* `XONTRIB_JUMP_TO_DIR_WARNING` - show warnings from xontrib. Default `True`.

## Credits

This package was created with [xontrib template](https://github.com/xonsh/xontrib-template).

0 comments on commit f625ac7

Please sign in to comment.