Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial cheat repo support #258

Merged
merged 30 commits into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
325 changes: 324 additions & 1 deletion Cargo.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "navi"
version = "2.0.11"
version = "2.1.0"
authors = ["Denis Isidoro <[email protected]>"]
edition = "2018"

Expand All @@ -12,4 +12,7 @@ structopt = "0.3"
termion = "1.5.5"
raw_tty = "0.1.0"
lazy_static = "1.4.0"
dirs = "2.0.0"
terminal_size = "0.1.10"
git2 = "0.10.0"
walkdir = "2"
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,17 @@ You can use **navi** as a widget to your shell. This way, your history is correc
In order to use it, add this line to your `.bashrc`-like file:
```sh
# bash
source "$(navi widget bash)"
source <(navi widget bash)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super versed in bash/zsh/fish/rust, but I couldn't find the reason in the code that required this change.

AFAIK source needs a path to, well, source in the current shell.
This, if I understand it correctly, reads from the given file and passes it as the stdin for source, which might work but I think is unnecessary.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the command returned a path to a shell script. Now it prints the content of the shell script.


# zsh
source "$(navi widget zsh)"
source <(navi widget zsh)

# fish
source (navi widget fish)
navi widget fish | source
```

By default, `Ctrl+G` is assigned to launching **navi**. If you want to change the keybinding, replace the argument of `bind` or `bindkey` in [the widget file](https://github.com/denisidoro/navi/search?q=filename%3Anavi.plugin.*&unscoped_q=filename%3Anavi.plugin.*).

If you want a widget for other shells, please upvote [this issue](https://github.com/denisidoro/navi/issues/37).

### More options

Please refer to `navi --help` for more details.
Expand All @@ -130,7 +128,7 @@ export NAVI_PATH="/folder/with/cheats:/another/folder"

### Submitting cheatsheets

Feel free to fork this project and open a PR for me to include your contributions.
Feel free to open a PR on https://github.com/denisidoro/cheats for me to include your contributions.

Cheatsheet syntax
-----------------
Expand All @@ -139,7 +137,7 @@ Cheatsheets are described in `.cheat` files.

### Syntax overview

- lines starting with `%` determine the start of a new cheatsheet. They should contain tags which will be added to any command in a given file;
- lines starting with `%` determine the start of a new cheatsheet and should contain tags;
- lines starting with `#` should be descriptions of commands;
- lines starting with `;` are ignored. You can use them for metacomments;
- lines starting with `$` should contain commands that generate a list of possible values for a given argument;
Expand All @@ -159,7 +157,7 @@ It's irrelevant how many files are used to store cheatsheets. They can be all in

Commands may be multiline:
```sh
# This will output foo\nyes
# This will output "foo\nyes"
echo foo
true \
&& echo yes \
Expand Down
27 changes: 0 additions & 27 deletions cheats/android.cheat

This file was deleted.

55 changes: 0 additions & 55 deletions cheats/apt.cheat

This file was deleted.

36 changes: 0 additions & 36 deletions cheats/brew.cheat

This file was deleted.

130 changes: 0 additions & 130 deletions cheats/cf.cheat

This file was deleted.

24 changes: 0 additions & 24 deletions cheats/compression.cheat

This file was deleted.

7 changes: 0 additions & 7 deletions cheats/crontab.cheat

This file was deleted.

Loading