From f625ac71f155ce90b9248d05c3b5d613a1285c6c Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Thu, 22 Feb 2024 22:08:23 +0100 Subject: [PATCH] Update README.md --- README.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2c0dafc..e502e73 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: @@ -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).