forked from Mirrors/helix
Merge branch 'master' of https://github.com/helix-editor/helix into tree_explore
commit
d1e6a21016
@ -1,5 +1,5 @@
|
|||||||
# Commands
|
# Commands
|
||||||
|
|
||||||
Command mode can be activated by pressing `:`, similar to Vim. Built-in commands:
|
Command mode can be activated by pressing `:`. The built-in commands are:
|
||||||
|
|
||||||
{{#include ./generated/typable-cmd.md}}
|
{{#include ./generated/typable-cmd.md}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Guides
|
# Guides
|
||||||
|
|
||||||
This section contains guides for adding new language server configurations,
|
This section contains guides for adding new language server configurations,
|
||||||
tree-sitter grammars, textobject queries, etc.
|
tree-sitter grammars, textobject queries, and other similar items.
|
||||||
|
@ -1,45 +1,52 @@
|
|||||||
# Adding languages
|
# Adding new languages to Helix
|
||||||
|
|
||||||
|
In order to add a new language to Helix, you will need to follow the steps
|
||||||
|
below.
|
||||||
|
|
||||||
## Language configuration
|
## Language configuration
|
||||||
|
|
||||||
To add a new language, you need to add a `[[language]]` entry to the
|
1. Add a new `[[language]]` entry in the `languages.toml` file and provide the
|
||||||
`languages.toml` (see the [language configuration section]).
|
necessary configuration for the new language. For more information on
|
||||||
|
language configuration, refer to the
|
||||||
|
[language configuration section](../languages.md) of the documentation.
|
||||||
|
2. If you are adding a new language or updating an existing language server
|
||||||
|
configuration, run the command `cargo xtask docgen` to update the
|
||||||
|
[Language Support](../lang-support.md) documentation.
|
||||||
|
|
||||||
When adding a new language or Language Server configuration for an existing
|
> 💡 If you are adding a new Language Server configuration, make sure to update
|
||||||
language, run `cargo xtask docgen` to add the new configuration to the
|
> the
|
||||||
[Language Support][lang-support] docs before creating a pull request.
|
> [Language Server Wiki](https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers)
|
||||||
When adding a Language Server configuration, be sure to update the
|
> with the installation instructions.
|
||||||
[Language Server Wiki][install-lsp-wiki] with installation notes.
|
|
||||||
|
|
||||||
## Grammar configuration
|
## Grammar configuration
|
||||||
|
|
||||||
If a tree-sitter grammar is available for the language, add a new `[[grammar]]`
|
1. If a tree-sitter grammar is available for the new language, add a new
|
||||||
entry to `languages.toml`.
|
`[[grammar]]` entry to the `languages.toml` file.
|
||||||
|
2. If you are testing the grammar locally, you can use the `source.path` key
|
||||||
You may use the `source.path` key rather than `source.git` with an absolute path
|
with an absolute path to the grammar. However, before submitting a pull
|
||||||
to a locally available grammar for testing, but switch to `source.git` before
|
request, make sure to switch to using `source.git`.
|
||||||
submitting a pull request.
|
|
||||||
|
|
||||||
## Queries
|
## Queries
|
||||||
|
|
||||||
For a language to have syntax-highlighting and indentation among
|
1. In order to provide syntax highlighting and indentation for the new language,
|
||||||
other things, you have to add queries. Add a directory for your
|
you will need to add queries.
|
||||||
language with the path `runtime/queries/<name>/`. The tree-sitter
|
2. Create a new directory for the language with the path
|
||||||
[website](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#queries)
|
`runtime/queries/<name>/`.
|
||||||
gives more info on how to write queries.
|
3. Refer to the
|
||||||
|
[tree-sitter website](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#queries)
|
||||||
> NOTE: When evaluating queries, the first matching query takes
|
for more information on writing queries.
|
||||||
precedence, which is different from other editors like Neovim where
|
|
||||||
the last matching query supersedes the ones before it. See
|
> 💡 In Helix, the first matching query takes precedence when evaluating
|
||||||
[this issue][neovim-query-precedence] for an example.
|
> queries, which is different from other editors such as Neovim where the last
|
||||||
|
> matching query supersedes the ones before it. See
|
||||||
## Common Issues
|
> [this issue](https://github.com/helix-editor/helix/pull/1170#issuecomment-997294090)
|
||||||
|
> for an example.
|
||||||
- If you get errors when running after switching branches, you may have to update the tree-sitter grammars. Run `hx --grammar fetch` to fetch the grammars and `hx --grammar build` to build any out-of-date grammars.
|
|
||||||
|
## Common issues
|
||||||
- If a parser is segfaulting or you want to remove the parser, make sure to remove the compiled parser in `runtime/grammar/<name>.so`
|
|
||||||
|
- If you encounter errors when running Helix after switching branches, you may
|
||||||
[language configuration section]: ../languages.md
|
need to update the tree-sitter grammars. Run the command `hx --grammar fetch`
|
||||||
[neovim-query-precedence]: https://github.com/helix-editor/helix/pull/1170#issuecomment-997294090
|
to fetch the grammars and `hx --grammar build` to build any out-of-date
|
||||||
[install-lsp-wiki]: https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers
|
grammars.
|
||||||
[lang-support]: ../lang-support.md
|
- If a parser is causing a segfault, or you want to remove it, make sure to
|
||||||
|
remove the compiled parser located at `runtime/grammars/<name>.so`.
|
||||||
|
@ -1,180 +1,223 @@
|
|||||||
# Installation
|
# Installing Helix
|
||||||
|
|
||||||
We provide pre-built binaries on the [GitHub Releases page](https://github.com/helix-editor/helix/releases).
|
<!--toc:start-->
|
||||||
|
- [Pre-built binaries](#pre-built-binaries)
|
||||||
|
- [Linux, macOS, Windows and OpenBSD packaging status](#linux-macos-windows-and-openbsd-packaging-status)
|
||||||
|
- [Linux](#linux)
|
||||||
|
- [Ubuntu](#ubuntu)
|
||||||
|
- [Fedora/RHEL](#fedorarhel)
|
||||||
|
- [Arch Linux community](#arch-linux-community)
|
||||||
|
- [NixOS](#nixos)
|
||||||
|
- [macOS](#macos)
|
||||||
|
- [Homebrew Core](#homebrew-core)
|
||||||
|
- [Windows](#windows)
|
||||||
|
- [Scoop](#scoop)
|
||||||
|
- [Chocolatey](#chocolatey)
|
||||||
|
- [MSYS2](#msys2)
|
||||||
|
- [Building from source](#building-from-source)
|
||||||
|
- [Configuring Helix's runtime files](#configuring-helixs-runtime-files)
|
||||||
|
- [Validating the installation](#validating-the-installation)
|
||||||
|
- [Configure the desktop shortcut](#configure-the-desktop-shortcut)
|
||||||
|
<!--toc:end-->
|
||||||
|
|
||||||
|
To install Helix, follow the instructions specific to your operating system.
|
||||||
|
Note that:
|
||||||
|
|
||||||
|
- To get the latest nightly version of Helix, you need to
|
||||||
|
[build from source](#building-from-source).
|
||||||
|
|
||||||
|
- To take full advantage of Helix, install the language servers for your
|
||||||
|
preferred programming languages. See the
|
||||||
|
[wiki](https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers)
|
||||||
|
for instructions.
|
||||||
|
|
||||||
|
## Pre-built binaries
|
||||||
|
|
||||||
|
Download pre-built binaries from the
|
||||||
|
[GitHub Releases page](https://github.com/helix-editor/helix/releases). Add the binary to your system's `$PATH` to use it from the command
|
||||||
|
line.
|
||||||
|
|
||||||
|
## Linux, macOS, Windows and OpenBSD packaging status
|
||||||
|
|
||||||
|
Helix is available for Linux, macOS and Windows via the official repositories listed below.
|
||||||
|
|
||||||
[![Packaging status](https://repology.org/badge/vertical-allrepos/helix.svg)](https://repology.org/project/helix/versions)
|
[![Packaging status](https://repology.org/badge/vertical-allrepos/helix.svg)](https://repology.org/project/helix/versions)
|
||||||
|
|
||||||
## OSX
|
|
||||||
|
|
||||||
Helix is available in homebrew-core:
|
|
||||||
|
|
||||||
```
|
|
||||||
brew install helix
|
|
||||||
```
|
|
||||||
|
|
||||||
## Linux
|
## Linux
|
||||||
|
|
||||||
### NixOS
|
The following third party repositories are available:
|
||||||
|
|
||||||
A [flake](https://nixos.wiki/wiki/Flakes) containing the package is available in
|
|
||||||
the project root. The flake can also be used to spin up a reproducible development
|
|
||||||
shell for working on Helix with `nix develop`.
|
|
||||||
|
|
||||||
Flake outputs are cached for each push to master using
|
|
||||||
[Cachix](https://www.cachix.org/). The flake is configured to
|
|
||||||
automatically make use of this cache assuming the user accepts
|
|
||||||
the new settings on first use.
|
|
||||||
|
|
||||||
If you are using a version of Nix without flakes enabled you can
|
|
||||||
[install Cachix cli](https://docs.cachix.org/installation); `cachix use helix` will
|
|
||||||
configure Nix to use cached outputs when possible.
|
|
||||||
|
|
||||||
### Arch Linux
|
### Ubuntu
|
||||||
|
|
||||||
Releases are available in the `community` repository.
|
Helix is available via [Maveonair's PPA](https://launchpad.net/~maveonair/+archive/ubuntu/helix-editor):
|
||||||
|
|
||||||
A [helix-git](https://aur.archlinux.org/packages/helix-git/) package is also available on the AUR, which builds the master branch.
|
```sh
|
||||||
|
sudo add-apt-repository ppa:maveonair/helix-editor
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install helix
|
||||||
|
```
|
||||||
|
|
||||||
### Fedora Linux
|
### Fedora/RHEL
|
||||||
|
|
||||||
You can install the COPR package for Helix via
|
Helix is available via `copr`:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
sudo dnf copr enable varlad/helix
|
sudo dnf copr enable varlad/helix
|
||||||
sudo dnf install helix
|
sudo dnf install helix
|
||||||
```
|
```
|
||||||
|
|
||||||
### Void Linux
|
### Arch Linux community
|
||||||
|
|
||||||
|
Releases are available in the `community` repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo pacman -S helix
|
||||||
```
|
```
|
||||||
sudo xbps-install helix
|
Additionally, a [helix-git](https://aur.archlinux.org/packages/helix-git/) package is available
|
||||||
```
|
in the AUR, which builds the master branch.
|
||||||
|
|
||||||
## Windows
|
### NixOS
|
||||||
|
|
||||||
Helix can be installed using [Scoop](https://scoop.sh/), [Chocolatey](https://chocolatey.org/)
|
Helix is available as a [flake](https://nixos.wiki/wiki/Flakes) in the project
|
||||||
or [MSYS2](https://msys2.org/).
|
root. Use `nix develop` to spin up a reproducible development shell. Outputs are
|
||||||
|
cached for each push to master using [Cachix](https://www.cachix.org/). The
|
||||||
|
flake is configured to automatically make use of this cache assuming the user
|
||||||
|
accepts the new settings on first use.
|
||||||
|
|
||||||
**Scoop:**
|
If you are using a version of Nix without flakes enabled,
|
||||||
|
[install Cachix CLI](https://docs.cachix.org/installation) and use
|
||||||
|
`cachix use helix` to configure Nix to use cached outputs when possible.
|
||||||
|
|
||||||
```
|
## macOS
|
||||||
scoop install helix
|
|
||||||
```
|
|
||||||
|
|
||||||
**Chocolatey:**
|
### Homebrew Core
|
||||||
|
|
||||||
```
|
```sh
|
||||||
choco install helix
|
brew install helix
|
||||||
```
|
```
|
||||||
|
|
||||||
**MSYS2:**
|
## Windows
|
||||||
|
|
||||||
Choose the [proper command](https://www.msys2.org/docs/package-naming/) for your system from below:
|
Install on Windows using [Scoop](https://scoop.sh/), [Chocolatey](https://chocolatey.org/)
|
||||||
|
or [MSYS2](https://msys2.org/).
|
||||||
|
|
||||||
- For 32 bit Windows 7 or above:
|
### Scoop
|
||||||
|
|
||||||
```
|
```sh
|
||||||
pacman -S mingw-w64-i686-helix
|
scoop install helix
|
||||||
```
|
```
|
||||||
|
|
||||||
- For 64 bit Windows 7 or above:
|
### Chocolatey
|
||||||
|
|
||||||
```
|
```sh
|
||||||
pacman -S mingw-w64-x86_64-helix
|
choco install helix
|
||||||
```
|
```
|
||||||
|
|
||||||
- For 64 bit Windows 8.1 or above:
|
### MSYS2
|
||||||
|
|
||||||
```
|
For 64-bit Windows 8.1 or above:
|
||||||
|
|
||||||
|
```sh
|
||||||
pacman -S mingw-w64-ucrt-x86_64-helix
|
pacman -S mingw-w64-ucrt-x86_64-helix
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build from source
|
## Building from source
|
||||||
|
|
||||||
```
|
Clone the repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
git clone https://github.com/helix-editor/helix
|
git clone https://github.com/helix-editor/helix
|
||||||
cd helix
|
cd helix
|
||||||
cargo install --path helix-term --locked
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install the `hx` binary to `$HOME/.cargo/bin` and build tree-sitter grammars in `./runtime/grammars`.
|
Compile from source:
|
||||||
|
|
||||||
If you are using the musl-libc instead of glibc the following environment variable must be set during the build
|
|
||||||
to ensure tree sitter grammars can be loaded correctly:
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo install --path helix-term --locked
|
||||||
```
|
```
|
||||||
RUSTFLAGS="-C target-feature=-crt-static"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Helix also needs its runtime files so make sure to copy/symlink the `runtime/` directory into the
|
This command will create the `hx` executable and construct the tree-sitter
|
||||||
config directory (for example `~/.config/helix/runtime` on Linux/macOS). This location can be overridden
|
grammars either in the `runtime` folder, or in the folder specified in `HELIX_RUNTIME`
|
||||||
via the `HELIX_RUNTIME` environment variable.
|
(as described below). To build the tree-sitter grammars requires a c++ compiler to be installed, for example `gcc-c++`.
|
||||||
|
|
||||||
| OS | Command |
|
> 💡 If you are using the musl-libc instead of glibc the following environment variable must be set during the build
|
||||||
| -------------------- | ------------------------------------------------ |
|
> to ensure tree-sitter grammars can be loaded correctly:
|
||||||
| Windows (Cmd) | `xcopy /e /i runtime %AppData%\helix\runtime` |
|
>
|
||||||
| Windows (PowerShell) | `xcopy /e /i runtime $Env:AppData\helix\runtime` |
|
> ```sh
|
||||||
| Linux / macOS | `ln -s $PWD/runtime ~/.config/helix/runtime` |
|
> RUSTFLAGS="-C target-feature=-crt-static"
|
||||||
|
> ```
|
||||||
|
|
||||||
Starting with Windows Vista you can also create symbolic links on Windows. Note that this requires
|
> 💡 Tree-sitter grammars can be fetched and compiled if not pre-packaged. Fetch
|
||||||
elevated privileges - i.e. PowerShell or Cmd must be run as administrator.
|
> grammars with `hx --grammar fetch` (requires `git`) and compile them with
|
||||||
|
> `hx --grammar build` (requires a C++ compiler).
|
||||||
|
|
||||||
**PowerShell:**
|
### Configuring Helix's runtime files
|
||||||
|
|
||||||
```powershell
|
- **Linux and macOS**
|
||||||
New-Item -ItemType Junction -Target "runtime" -Path "$Env:AppData\helix\runtime"
|
|
||||||
```
|
|
||||||
Note: "runtime" must be the absolute path to the runtime directory.
|
|
||||||
|
|
||||||
**Cmd:**
|
Either set the `HELIX_RUNTIME` environment variable to point to the runtime files and add it to your `~/.bashrc` or equivalent:
|
||||||
|
|
||||||
```cmd
|
```sh
|
||||||
cd %appdata%\helix
|
HELIX_RUNTIME=/home/user-name/src/helix/runtime
|
||||||
mklink /D runtime "<helix-repo>\runtime"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The runtime location can be overridden via the `HELIX_RUNTIME` environment variable.
|
Or, create a symlink in `~/.config/helix` that links to the source code directory:
|
||||||
|
|
||||||
> NOTE: if `HELIX_RUNTIME` is set prior to calling `cargo install --path helix-term --locked`,
|
```sh
|
||||||
> tree-sitter grammars will be built in `$HELIX_RUNTIME/grammars`.
|
ln -s $PWD/runtime ~/.config/helix/runtime
|
||||||
|
```
|
||||||
|
|
||||||
If you plan on keeping the repo locally, an alternative to copying/symlinking
|
- **Windows**
|
||||||
runtime files is to set `HELIX_RUNTIME=/path/to/helix/runtime`
|
|
||||||
(`HELIX_RUNTIME=$PWD/runtime` if you're in the helix repo directory).
|
|
||||||
|
|
||||||
To use Helix in desktop environments that supports [XDG desktop menu](https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html), including Gnome and KDE, copy the provided `.desktop` file to the correct folder:
|
Either set the `HELIX_RUNTIME` environment variable to point to the runtime files using the Windows setting (search for
|
||||||
|
`Edit environment variables for your account`) or use the `setx` command in
|
||||||
|
Cmd:
|
||||||
|
|
||||||
```bash
|
```sh
|
||||||
cp contrib/Helix.desktop ~/.local/share/applications
|
setx HELIX_RUNTIME "%userprofile%\source\repos\helix\runtime"
|
||||||
```
|
```
|
||||||
|
|
||||||
To use another terminal than the default, you will need to modify the `.desktop` file. For example, to use `kitty`:
|
> 💡 `%userprofile%` resolves to your user directory like
|
||||||
|
> `C:\Users\Your-Name\` for example.
|
||||||
|
|
||||||
```bash
|
Or, create a symlink in `%appdata%\helix\` that links to the source code directory:
|
||||||
sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
|
|
||||||
sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop
|
|
||||||
```
|
|
||||||
|
|
||||||
Please note: there is no icon for Helix yet, so the system default will be used.
|
| Method | Command |
|
||||||
|
| ---------- | -------------------------------------------------------------------------------------- |
|
||||||
|
| PowerShell | `New-Item -ItemType Junction -Target "runtime" -Path "$Env:AppData\helix\runtime"` |
|
||||||
|
| Cmd | `cd %appdata%\helix` <br/> `mklink /D runtime "%userprofile%\src\helix\runtime"` |
|
||||||
|
|
||||||
## Finishing up the installation
|
> 💡 On Windows, creating a symbolic link may require running PowerShell or
|
||||||
|
> Cmd as an administrator.
|
||||||
|
|
||||||
To make sure everything is set up as expected you should finally run the helix healthcheck via
|
### Validating the installation
|
||||||
|
|
||||||
```
|
To make sure everything is set up as expected you should run the Helix health
|
||||||
|
check:
|
||||||
|
|
||||||
|
```sh
|
||||||
hx --health
|
hx --health
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information on the information displayed in the health check results refer to [Healthcheck](https://github.com/helix-editor/helix/wiki/Healthcheck).
|
For more information on the health check results refer to
|
||||||
|
[Health check](https://github.com/helix-editor/helix/wiki/Healthcheck).
|
||||||
|
|
||||||
### Building tree-sitter grammars
|
### Configure the desktop shortcut
|
||||||
|
|
||||||
Tree-sitter grammars must be fetched and compiled if not pre-packaged.
|
If your desktop environment supports the
|
||||||
Fetch grammars with `hx --grammar fetch` (requires `git`) and compile them
|
[XDG desktop menu](https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html)
|
||||||
with `hx --grammar build` (requires a C++ compiler).
|
you can configure Helix to show up in the application menu by copying the
|
||||||
|
provided `.desktop` and icon files to their correct folders:
|
||||||
|
|
||||||
### Installing language servers
|
```sh
|
||||||
|
cp contrib/Helix.desktop ~/.local/share/applications
|
||||||
|
cp contrib/helix.png ~/.icons # or ~/.local/share/icons
|
||||||
|
```
|
||||||
|
|
||||||
|
To use another terminal than the system default, you can modify the `.desktop`
|
||||||
|
file. For example, to use `kitty`:
|
||||||
|
|
||||||
Language servers can optionally be installed if you want their features (auto-complete, diagnostics etc.).
|
```sh
|
||||||
Follow the [instructions on the wiki page](https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers) to add your language servers of choice.
|
sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
|
||||||
|
sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue