Skip to content

Commit

Permalink
patchy: auto-merge pull request helix-editor#11164
Browse files Browse the repository at this point in the history
`patchy` is a tool which makes it easy to declaratively manage personal forks by automatically merging pull requests.

Check it out here: https://github.com/NikitaRevenco/patchy
  • Loading branch information
Rock Boynton committed Jan 2, 2025
2 parents 958dcd0 + c5a06ef commit 0c2c30e
Show file tree
Hide file tree
Showing 10 changed files with 1,452 additions and 699 deletions.
30 changes: 30 additions & 0 deletions book/src/commands.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Commands

- [Typable commands](#typable-commands)
- [Using variables](#using-variables-in-typable-commands)
- [Static commands](#static-commands)

## Typable commands
Expand All @@ -9,6 +10,35 @@ Typable commands are used from command mode and may take arguments. Command mode

{{#include ./generated/typable-cmd.md}}


### Using variables in typable commands

Helix provides several variables that can be used when typing commands or creating custom shortcuts. These variables are listed below:

| Variable | Description |
| --- | --- |
| `%{basename}` or `%{b}` | The name and extension of the currently focused file. |
| `%{dirname}` or `%{d}` | The absolute path of the parent directory of the currently focused file. |
| `%{cwd}` | The absolute path of the current working directory of Helix. |
| `%{repo}` | The absolute path of the VCS repository helix is opened in. Fallback to `cwd` if not inside a VCS repository|
| `%{filename}` or `%{f}` | The absolute path of the currently focused file. |
| `%{filename:rel}` | The relative path of the file according to `cwd` (will give absolute path if the file is not a child of the current working directory) |
| `%{filename:repo_rel}` | The relative path of the file according to `repo` (will give absolute path if the file is not a child of the VCS directory or the cwd) |
| `%{ext}` | The extension of the current file |
| `%{lang}` | The language of the current file |
| `%{linenumber}` | The line number where the primary cursor is positioned. |
| `%{cursorcolumn}` | The position of the primary cursor inside the current line. |
| `%{selection}` | The text selected by the primary cursor. |
| `%sh{cmd}` | Executes `cmd` with the default shell and returns the command output, if any. |

#### Example

```toml
[keys.normal]
# Print blame info for the line where the main cursor is.
C-b = ":echo %sh{git blame -L %{linenumber} %{filename}}"
```

## Static Commands

Static commands take no arguments and can be bound to keys. Static commands can also be executed from the command picker (`<space>?`). The built-in static commands are:
Expand Down
1 change: 1 addition & 0 deletions book/src/generated/typable-cmd.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
| Name | Description |
| --- | --- |
| `:quit`, `:q` | Close the current view. |
| `:echo` | Print the processed input to the editor status |
| `:quit!`, `:q!` | Force close the current view, ignoring unsaved changes. |
| `:open`, `:o`, `:edit`, `:e` | Open a file from disk into the current view. |
| `:buffer-close`, `:bc`, `:bclose` | Close the current buffer. |
Expand Down
Loading

0 comments on commit 0c2c30e

Please sign in to comment.