helix
Docs
Usage
Keymap
Commands
Language Support , Languages
Migrating from Vim
Configuration
Themes
Key remapping
Установка
Sauce: Installing Helix
Для установки (моим методом) потребуется gh
(GitHub CLI):
sudo apt install gh
gh auth login
Перейди в папку какую-нибудь типа ~/src
или ~/gitcloned
:
cd ~/gitcloned
Скачивание последнего релиза:
gh release download \
-R https://github.com/helix-editor/helix \
--pattern 'helix-*-x86_64-linux.tar.xz'
Распаковка архива и тд:
tar -xJvf helix- * -x86_64-linux.tar.xz \
&& rm helix- * -x86_64-linux.tar.xz \
&& cd helix- * -x86_64-linux \
&& rm LICENSE README.md
Создание символьных ссылок:
sudo ln -s "$( realpath hx)" /usr/local/bin/ \
&& ln -Ts "$( realpath runtime/)" ~/.config/helix/runtime
Установка “одной” большой командой
HELIX_VERSION = "$( basename $( curl -Ls -o /dev/null -w %{url_effective} https://github.com/helix-editor/helix/releases/latest))"
wget -qO - https://github.com/helix-editor/helix/releases/download/" $HELIX_VERSION "/helix-" $HELIX_VERSION "-x86_64-linux.tar.xz \
| unxz \
| tar -xf - helix-" $HELIX_VERSION "-x86_64-linux/hx helix-" $HELIX_VERSION "-x86_64-linux/runtime \
&& sudo mv helix-" $HELIX_VERSION "-x86_64-linux/hx /usr/local/bin/ \
&& mv helix-" $HELIX_VERSION "-x86_64-linux/runtime ~/.config/helix/runtime
Удаление
sudo rm -rf ~/.config/helix/runtime /usr/local/bin/hx
LSPs
Sauce: How to install the default language servers
sudo npm i -g bash-language-server
~/.config/helix/languages.toml
:
[[language]]
name = "bash"
indent = { tab-width = 4, unit = "\t" }
file-types = [ "sh" , "bash", "zsh", ".bash_login", ".bash_logout", ".bash_profile", ".bashrc", ".profile", ".zshenv", ".zlogin", ".zlogout", ".zprofile", ".zshrc", ".bash_aliases", ".zsh_aliases_n_functions"]
language-servers = [ "bash-language-server" ]
[language-server.bash-language-server]
command = "bash-language-server"
args = [ "start" ]
[[grammar]]
name = "bash"
source = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "275effdfc0edce774acf7d481f9ea195c6c403cd" }
gh release download \
-R https://github.com/artempyanykh/marksman \
--pattern 'marksman-linux-x64'
chmod +x marksman-linux-x64
sudo mv marksman-linux-x64 /usr/local/bin/marksman
cargo install --locked --git https://github.com/Feel-ix-343/markdown-oxide.git markdown-oxide
sudo ln -s ~/.cargo/bin/markdown-oxide /usr/local/bin
sudo npm i -g yaml-language-server@next
~/.config/helix/languages.toml
:
[ language-server . yaml-language-server . config . yaml ]
format = { enable = true }
validation = true
[ language-server . yaml-language-server . config . yaml . schemas ]
"https://json.schemastore.org/github-workflow.json" = ".github/workflows/*.{yml,yaml}"
"https://raw.githubusercontent.com/ansible-community/schemas/main/f/ansible-tasks.json" = "roles/{tasks,handlers}/*.{yml,yaml}"
sudo npm i -g @ansible/ansible-language-server
sudo npm i -g vscode-langservers-extracted
sudo npm i -g sql-language-server
~/.config/helix/languages.toml
:
[ language-server . sql-language-server ]
command = "sql-language-server"
args = [ "up" , "--method" , "stdio" ]
[[ language ]]
name = "sql"
language-servers = [ "sql-language-server" ]
pipx install cmake-language-server
sudo ln -s ~/.local/bin/cmake-language-server /usr/local/bin/
sudo npm install -g dockerfile-language-server-nodejs
sudo npm install -g @microsoft/compose-language-service
sudo npm install -g dockerfile-language-server-nodejs
sudo npm i -g vscode-langservers-extracted
cargo install taplo-cli --locked --features lsp
sudo ln -s ~/.cargo/bin/taplo /usr/local/bin/
~/.config/helix/languages.toml
:
[[ language ]]
name = "toml"
formatter = { command = "taplo" , args = [ "fmt" , "-" ] }
pipx install python-lsp-server
pipx install pylsp-mypy --include-deps
pipx install python-lsp-ruff --include-deps
sudo ln -s /home/ ${USER} /.local/bin/{pylsp,ruff,dmypy,mypy,mypyc,stubgen,stubtest} /usr/local/bin/
~/.config/helix/languages.toml
:
[[ language ]]
name = "python"
indent = { tab-width = 4 , unit = " " }
language-servers = [ "pylsp" ]
[ language-server . pylsp . config . pylsp ]
plugins . pyls_mypy . enabled = true
plugins . pyls_mypy . live_mode = true
[[ grammar ]]
name = "python"
source = { git = "https://github.com/tree-sitter/tree-sitter-python" , rev = "4bfdd9033a2225cc95032ce77066b7aeca9e2efc" }
sudo npm i -g pyright
pipx install ruff-lsp
pipx install black
sudo ln -s ~/.local/bin/{ruff-lsp,black,blackd} /usr/local/bin
~/.config/helix/languages.toml
:
[[ language ]]
name = "python"
indent = { tab-width = 4 , unit = " " }
auto-format = true
language-servers = [ "pyright" , "ruff" ]
[ language . formatter ]
command = "/usr/local/bin/black"
args = [ "--line-length" , "80" , "--skip-string-normalization" , "--quiet" , "-" ]
[ language-server . pyright ]
command = "/usr/local/bin/pyright-langserver"
[ language-server . pyright . config . python . analysis ]
typeCheckingMode = "basic"
[ language-server . ruff ]
command = "/usr/local/bin/ruff-lsp"
[ language-server . ruff . config . settings ]
args = [ "--ignore" , "E501" ]
[[ grammar ]]
name = "python"
source = { git = "https://github.com/tree-sitter/tree-sitter-python" , rev = "4bfdd9033a2225cc95032ce77066b7aeca9e2efc" }
Snippets
Поддержка сниппетов ставится как language server:
estin/simple-completion-language-server
cargo install --git https://github.com/estin/simple-completion-language-server.git
sudo ln -s ~/.cargo/bin/simple-completion-language-server /usr/local/bin
~/.config/helix/languages.toml
:
[ language-server . scls ]
command = "simple-completion-language-server"
[ language-server . scls . config ]
max_completion_items = 20 # set max completion results len for each group: words, snippets, unicode-input
snippets_first = true # completions will return before snippets by default
feature_words = true # enable completion by word
feature_snippets = true # enable snippets
feature_unicode_input = true # enable "unicode input"
feature_paths = true # enable path completion
# write logs to /tmp/completion.log
[ language-server . scls . environment ]
LOG_FILE = "/tmp/completion.log"
И добавляешь к нужным языкам этот сервер. Например:
[[language]]
name = "bash"
language-servers = [ "scls", "bash-language-server" ]
# или
[[language]]
name = "python"
language-servers = [ "scls", "pyright", "ruff" ]
Добавление сниппетов
Либо сам пишешь свои сниппеты и добавляешь их по пути ~/.config/helix/snippets/python/python.json
(например), либо добавляешь внешние через репы в файле ~/.config/helix/external-snippets.toml
:
[[ sources ]] # list of sources to load
name = "friendly-snippets" # optional name shown on snippet description
git = "https://github.com/rafamadriz/friendly-snippets.git" # git repo with snippets collections
[[ sources . paths ]] # list of paths to load on current source
scope = [ "python" ] # optional scopes for current snippets
path = "snippets/python/" # where snippet file or dir located in repo
[[ sources . paths ]]
scope = [ "bash" ]
path = "snippets/shell/"
В [[sources.paths]] path
нужно указать файл или папку в git репе , где находятся сниппеты.
Загружай сниппеты и валидируй (🤷):
simple-completion-language-server fetch-external-snippets
simple-completion-language-server validate-snippets
Troubleshoot
Не работает auto-save
Параметр auto-save
в разделе editor в конфигурации config.toml
может не работать, если ты запускаешь helix
в tmux
, ибо по умолчанию (вроде), в tmux
не передаются events, происходящие с терминалом.
Решение
Нужно разрешить терминалу передавать events tmux
-у, то есть, включить focus-events в конфигурации tmux.conf
:
# for auto-save option in helix
set -g focus-events on
troubleshoot
Расширения VSCode
Helix For VS Code
Helix Keymap
Oomotion
Ballet
helix tool