Getting Started With helix-gpt
Helix-gpt is awesome, but its documentation wasn’t very helpful. I’ve managed to make it work, so here’s how.
You will need
- helix already installed
- gcc already installed
- patience
This guide assumes you write code in rust.
Configure helix
For nix home manager, just drop this into your home.nix
programs.helix.enable = true;
home.file.".config/helix/languages.toml".text = ''
[language-server.gpt]
command = "helix-gpt"
[language-server.rust-analyzer]
command = "rust-analyzer"
[[language]]
name = "rust"
language-servers = ["rust-analyzer", "gpt"]
'';
It’s important to use languages.toml
file, not config.toml
For non-nix, just drop
[language-server.gpt]
command = "helix-gpt"
[language-server.rust-analyzer]
command = "rust-analyzer"
[[language]]
name = "rust"
language-servers = ["rust-analyzer", "gpt"]
into ~/.config/helix/languages.toml
.
configure helix-gpt
Download helix-gpt binary. Either from github or from nix repository.
Codeium (windsurf)
Set the HANDLER variable to codeium. Copilot and openai options also available.
export HANDLER=codeium
Then you need an API key.
Use
helix-gpt --authCodeium
You will get the following
helix-gpt --authCodeium
Visit the following URL and enter the token below: https://<link>
Token:
Follow the link, register if necessary. Codeium and windsurf are the same thing by the way. Enter the token, and you will receive an API key.
Then set it up with
export CODEIUM_API_KEY=sk-ws-<keeeeey>
Copilot
export HANDLER=copilot
helix-gpt --authCopilot
$ helix-gpt --authCopilot
Visit: https://github.com/login/device in your browser and enter: <code>
Waiting for user authorization...
Waiting for user authorization...
Waiting for user authorization...
Got token: ghu_<token>
Store this in the COPILOT_API_KEY environment variable
export COPILOT_API_KEY=<token>
Try it
Launch helix on some file. Since the configuration was for rust, try files with the .rs
extension. Use visualization and then Space + a, there will be some new options, such as “Generate documentation” or “Improve code”. Also if you wait a bit while writing code you’ll get completions. Enjoy.