Skip to content

Commit

Permalink
update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pythops committed Jan 23, 2024
1 parent 0310a74 commit deac2b4
Showing 1 changed file with 99 additions and 33 deletions.
132 changes: 99 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
- Syntax highlights
- Chat history
- Save chats to files
- Vim keybinding (partial support for now)
- Vim keybinding (most common ops)
- Copy text from/to clipboard

<br>

Expand All @@ -25,21 +26,21 @@ Only **ChatGPT** is supported for the moment. But I'm planning to support more m

<br>

## 🔌 Installation
## 🚀 Installation

### Binary releases
### 📥 Binary releases

You can download the prebuilt binaries from the [release page](https://github.com/pythops/tenere/releases)
You can download the pre-built binaries from the [release page](https://github.com/pythops/tenere/releases)

### crates.io
### 📦 crates.io

`tenere` can be installed from [crates.io](https://crates.io/crates/tenere)

```shell
cargo install tenere
```

### Build from source
### ⚒️ Build from source

To build from the source, you need [Rust](https://www.rust-lang.org/) compiler and
[Cargo package manager](https://doc.rust-lang.org/cargo/).
Expand All @@ -52,14 +53,13 @@ cargo build --release

This will produce an executable file at `target/release/tenere` that you can copy to a directory in your `$PATH`.

### Brew
### 🍺Brew

On macOS, you can use brew:

```bash
brew tap pythops/tenere
brew install tenere

```

<br>
Expand All @@ -81,7 +81,6 @@ Here are the available general settings:
```toml
archive_file_name = "tenere.archive"
model = "chatgpt"

```

### Key bindings
Expand All @@ -98,6 +97,8 @@ new_chat = 'n'
save_chat = 's'
```

⚠️ To avoid overlapping with vim key bindings, you need to use `ctrl` + `key` except for help `?`.

## Chatgpt

To use Tenere's chat functionality, you'll need to provide an API key for OpenAI. There are two ways to do this:
Expand All @@ -117,60 +118,125 @@ model = "gpt-3.5-turbo"
url = "https://api.openai.com/v1/chat/completions"
```

The default model is set to `gpt-3.5-turbo`. check out the [OpenAI documentation](https://platform.openai.com/docs/models/gpt-3-5) for more info.
The default model is set to `gpt-3.5-turbo`. Check out the [OpenAI documentation](https://platform.openai.com/docs/models/gpt-3-5) for more info.

## 🚀 Usage
<br>

There are two modes like vim: `Normal` and `Insert`.
## ⌨️ Key bindings

#### Insert mode
### Global

These are the default key bindings regardless of the focused block.

`ctrl + n`: Start a new chat and save the previous one in history.

`ctrl + s`: Save the current chat or chat history (history pop-up should be visible first) to `tenere.archive` file in the current directory.

`Tab`: Switch the focus.

`j` or `Down arrow key`: Scroll down

`k` or `Up arrow key`: Scroll up

`ctrl + h` : Show chat history. Press `Esc` to dismiss it.

To enter `Insert` mode, You press `i`. Once you're in, you can use:
`ctrl + t` : Stop the stream response

`q` or `ctrl + c`: Quit the app

`?`: Show the help pop-up. Press `Esc` to dismiss it

### Prompt

There are 3 modes like vim: `Normal`, `Visual` and `Insert`.

#### Insert mode

`Esc`: to switch back to Normal mode.

`Enter`: to create a new line
`Enter`: to create a new line.

`Backspace`: to remove the previous character
`Backspace`: to remove the previous character.

#### Normal mode

When you launch [tenere](), it's in `Normal` mode by default. In this mode, you can use:

`Enter`: to submit the prompt

`dd`: to clear the prompt.
<br>

`h or Left`: Move the cursor backward by one char.

`j or Down`: Move the cursor down.

`k or Up`: Move the cursor up.

`l or Right`: Move the cursor forward by one char.

`w`: Move the cursor right by one word.

`b`: Move the cursor backward by one word.

`0`: Move the cursor to the start of the line.

`$`: Move the cursor to the end of the line.

`G`: Go to th end.

`gg`: Go to the top.

`n`: Start a new chat and save the previous one in history.
<br>

`a`: Insert after the cursor.

`A`: Insert at the end of the line.

`i`: Insert before the cursor.

`s`: Save the current chat or chat history (history popup should be visible first) to `tenere.archive` file in the current directory.
`I`: Insert at the beginning of the line.

`Tab`: to switch the focus.
`o`: Append a new line below the current line.

`O`: Append a new line above the current line.

<br>

`j` or `Down arrow key`: to scroll down
`x`: Delete one char under to the cursor.

`k` or `Up arrow key`: to scroll up
`dd`: Cut the current line

`h` : Show chat history
`D`: Delete the current line and

`t` : Stop the stream response
`dw`: Delete the word next to the cursor.

`q`: to quit the app
`db`: Delete the word on the left of the cursor.

`?`: to show the help pop-up. You can dismiss it with `Esc`
`d0`: Delete from the cursor to the beginning of the line.

`d$`: Delete from the cursor to the end of the line.

<br>

## 🛠️ Built with
`C`: Change to the end of the line.

`cc`: Change the current line.

`c0`: Change from the cursor to the beginning of the line.

`c$`: Change from the cursor to the end of the line.

`cw`: Change the next word.

`cb`: Change the word on the left of the cursor.

<br>

`u`: Undo

`p`: Paste

#### Visual mode

- [ratatui](https://github.com/tui-rs-revival/ratatui)
- [crossterm](https://github.com/crossterm-rs/crossterm)
- [reqwest](https://github.com/seanmonstar/reqwest)
- [clap](https://github.com/clap-rs/clap)
`y`: Yank the selected text

<br>

Expand Down

0 comments on commit deac2b4

Please sign in to comment.