mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-05-19 14:17:26 +02:00
feat: update helix config & doc
This commit is contained in:
@@ -23,6 +23,9 @@ multi-cursor, surround), and a smaller moving part than a large Neovim plugin st
|
|||||||
1. Prefer **Zellij** for shells and panes; use **Helix** for buffers and text.
|
1. Prefer **Zellij** for shells and panes; use **Helix** for buffers and text.
|
||||||
1. On large codebases, navigation is often **by picker** (`Space f`, symbols, workspace search) or
|
1. On large codebases, navigation is often **by picker** (`Space f`, symbols, workspace search) or
|
||||||
**by LSP** (`g` goto mode), complementing motion-based editing.
|
**by LSP** (`g` goto mode), complementing motion-based editing.
|
||||||
|
1. After **git** operations (`checkout`, `merge`, `pull`, `rebase`) or whenever many files changed
|
||||||
|
on disk, run **`:reload-all`** (alias **`:rla`**) so every open buffer is refreshed from disk in
|
||||||
|
one step — much faster than revisiting each file or restarting Helix.
|
||||||
|
|
||||||
## Tutorial
|
## Tutorial
|
||||||
|
|
||||||
@@ -46,22 +49,27 @@ Zellij shortcuts used often (same idea as in the Neovim notes):
|
|||||||
|
|
||||||
In Helix, `|` / `!` and variants pipe or insert shell output on selections (see **Changes**).
|
In Helix, `|` / `!` and variants pipe or insert shell output on selections (see **Changes**).
|
||||||
|
|
||||||
|
This flake’s Helix Home Manager module keeps **almost all default keys**; the only remap is
|
||||||
|
**`Ctrl+Shift+o`** → jump backward, because Zellij uses **`Ctrl+o`** for Session (see
|
||||||
|
`home/base/core/editors/helix/default.nix`). For other Zellij clashes, use **locked mode**
|
||||||
|
(`Ctrl+g`), **`:`** commands, or the built-in **`Space`** menu.
|
||||||
|
|
||||||
### Command mode (`:`)
|
### Command mode (`:`)
|
||||||
|
|
||||||
> <https://docs.helix-editor.com/commands.html>
|
> <https://docs.helix-editor.com/commands.html>
|
||||||
|
|
||||||
| Action | Command examples |
|
| Action | Command examples |
|
||||||
| ---------------------- | ------------------------------------------ |
|
| ---------------------- | -------------------------------------------------------------------- |
|
||||||
| Write / write all | `:w` / `:wa` |
|
| Write / write all | `:w` / `:wa` |
|
||||||
| Quit view / quit all | `:q` / `:qa` — add `!` to discard changes |
|
| Quit view / quit all | `:q` / `:qa` — add `!` to discard changes |
|
||||||
| Write and quit | `:wq`, `:x` |
|
| Write and quit | `:wq`, `:x` |
|
||||||
| Write all and quit all | `:wqa`, `:xa` |
|
| Write all and quit all | `:wqa`, `:xa` |
|
||||||
| Open file | `:open path`, `:e path` |
|
| Open file | `:open path`, `:e path` |
|
||||||
| Next / previous buffer | `:bn` / `:bp` (also `gn` / `gp` in normal) |
|
| Next / previous buffer | `:bn` / `:bp` (also `gn` / `gp` in normal) |
|
||||||
| Close buffer | `:bc` (add `!` to force) |
|
| Close buffer | `:bc` (add `!` to force) |
|
||||||
| Reload from disk | `:reload` |
|
| Reload from disk | `:reload` (current buffer); `:reload-all` / **`:rla`** (all buffers) |
|
||||||
| Change directory / pwd | `:cd` / `:pwd` |
|
| Change directory / pwd | `:cd` / `:pwd` |
|
||||||
| Split open file | `:vs path`, `:hs path` |
|
| Split open file | `:vs path`, `:hs path` |
|
||||||
|
|
||||||
### Movement (normal mode)
|
### Movement (normal mode)
|
||||||
|
|
||||||
@@ -77,7 +85,7 @@ In Helix, `|` / `!` and variants pipe or insert shell output on selections (see
|
|||||||
### Selection & changes
|
### Selection & changes
|
||||||
|
|
||||||
| Action | Keys / notes |
|
| Action | Keys / notes |
|
||||||
| ---------------------- | ----------------------------------------------------------------- | ------------------- | -------------------------------------------- |
|
| ---------------------- | ----------------------------------------------------------------- |
|
||||||
| Extend selections | `v` select mode; motions extend instead of moving |
|
| Extend selections | `v` select mode; motions extend instead of moving |
|
||||||
| Line selection | `x` extend line; `X` line bounds |
|
| Line selection | `x` extend line; `X` line bounds |
|
||||||
| Select all / regex | `%`; `s` regex in selections; `S` split on regex |
|
| Select all / regex | `%`; `s` regex in selections; `S` split on regex |
|
||||||
@@ -88,7 +96,6 @@ In Helix, `|` / `!` and variants pipe or insert shell output on selections (see
|
|||||||
| Indent / format | `>` / `<`; `=` format (LSP) |
|
| Indent / format | `>` / `<`; `=` format (LSP) |
|
||||||
| Case | `~` toggle; lower/upper case via grave / `Alt-grave` (see keymap) |
|
| Case | `~` toggle; lower/upper case via grave / `Alt-grave` (see keymap) |
|
||||||
| Join lines | `J`; `Alt-J` join keeping space |
|
| Join lines | `J`; `Alt-J` join keeping space |
|
||||||
| Shell | ` | `pipe replace;`Alt- | `pipe to;`!` insert output before selections |
|
|
||||||
|
|
||||||
### Search
|
### Search
|
||||||
|
|
||||||
@@ -115,6 +122,7 @@ Helix has no vim-style `:%s` with preview. Typical patterns:
|
|||||||
| -------------------- | ---------------- |
|
| -------------------- | ---------------- |
|
||||||
| File start / end | `g` / `e` |
|
| File start / end | `g` / `e` |
|
||||||
| Line start / end | `h` / `l` |
|
| Line start / end | `h` / `l` |
|
||||||
|
| File / URL | `f` |
|
||||||
| First non-whitespace | `s` |
|
| First non-whitespace | `s` |
|
||||||
| Definition / refs | `d` / `r` (LSP) |
|
| Definition / refs | `d` / `r` (LSP) |
|
||||||
| Type / impl | `y` / `i` (LSP) |
|
| Type / impl | `y` / `i` (LSP) |
|
||||||
|
|||||||
@@ -5,10 +5,89 @@
|
|||||||
package = pkgs.helix;
|
package = pkgs.helix;
|
||||||
settings = {
|
settings = {
|
||||||
editor = {
|
editor = {
|
||||||
|
# Display & cursor
|
||||||
line-number = "relative";
|
line-number = "relative";
|
||||||
cursorline = true;
|
cursorline = true;
|
||||||
color-modes = true;
|
color-modes = true;
|
||||||
lsp.display-messages = true;
|
scrolloff = 8;
|
||||||
|
|
||||||
|
# Wrap long lines to the viewport (word-wrap style; does not insert hard line endings)
|
||||||
|
soft-wrap = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Completion / formatting
|
||||||
|
auto-format = true;
|
||||||
|
preview-completion-insert = true;
|
||||||
|
completion-timeout = 5;
|
||||||
|
idle-timeout = 200;
|
||||||
|
end-of-line-diagnostics = "hint";
|
||||||
|
|
||||||
|
# Save to disk on focus loss and after idle (helps LSP see disk changes)
|
||||||
|
auto-save = {
|
||||||
|
focus-lost = true;
|
||||||
|
after-delay = {
|
||||||
|
enable = true;
|
||||||
|
timeout = 2000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# LSP: inlay hints, signature help, progress / messages in status area
|
||||||
|
lsp = {
|
||||||
|
display-messages = true;
|
||||||
|
display-progress-messages = true;
|
||||||
|
display-inlay-hints = true;
|
||||||
|
auto-signature-help = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline-diagnostics = {
|
||||||
|
cursor-line = "hint";
|
||||||
|
other-lines = "disable";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Buffers tab strip, menu borders, status line layout
|
||||||
|
bufferline = "multiple";
|
||||||
|
popup-border = "menu";
|
||||||
|
statusline = {
|
||||||
|
left = [
|
||||||
|
"mode"
|
||||||
|
"spinner"
|
||||||
|
"version-control"
|
||||||
|
"file-name"
|
||||||
|
"read-only-indicator"
|
||||||
|
"file-modification-indicator"
|
||||||
|
];
|
||||||
|
center = [ ];
|
||||||
|
right = [
|
||||||
|
"workspace-diagnostics"
|
||||||
|
"diagnostics"
|
||||||
|
"selections"
|
||||||
|
"position"
|
||||||
|
"position-percentage"
|
||||||
|
"file-type"
|
||||||
|
"file-encoding"
|
||||||
|
"file-line-ending"
|
||||||
|
];
|
||||||
|
separator = "│";
|
||||||
|
diagnostics = [
|
||||||
|
"error"
|
||||||
|
"warning"
|
||||||
|
"info"
|
||||||
|
];
|
||||||
|
workspace-diagnostics = [
|
||||||
|
"error"
|
||||||
|
"warning"
|
||||||
|
];
|
||||||
|
mode = {
|
||||||
|
normal = "NORMAL";
|
||||||
|
insert = "INSERT";
|
||||||
|
select = "SELECT";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Show dotfiles in picker (project-wide ignores still apply)
|
||||||
|
file-picker.hidden = false;
|
||||||
|
|
||||||
cursor-shape = {
|
cursor-shape = {
|
||||||
insert = "bar";
|
insert = "bar";
|
||||||
normal = "block";
|
normal = "block";
|
||||||
@@ -16,17 +95,12 @@
|
|||||||
};
|
};
|
||||||
indent-guides.render = true;
|
indent-guides.render = true;
|
||||||
};
|
};
|
||||||
keys.normal = {
|
|
||||||
space = {
|
# home/base/tui/zellij/config.kdl: Ctrl+o opens Zellij Session, so Helix never receives the
|
||||||
space = "file_picker";
|
# default Ctrl+o (jump_backward). One remap restores backward jumplist; forward stays Ctrl+i.
|
||||||
w = ":w";
|
# Other Zellij binds (Ctrl+s scroll, Ctrl+p pane, …): use built-in Space menu, :w / :rla, or
|
||||||
q = ":q";
|
# Zellij locked mode — https://zellij.dev/tutorials/colliding-keybindings/
|
||||||
};
|
keys.normal."C-S-o" = "jump_backward";
|
||||||
esc = [
|
|
||||||
"collapse_selection"
|
|
||||||
"keep_primary_selection"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user