diff --git a/home/base/core/editors/helix/README.md b/home/base/core/editors/helix/README.md index 3795ac0b..bc3cb840 100644 --- a/home/base/core/editors/helix/README.md +++ b/home/base/core/editors/helix/README.md @@ -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. On large codebases, navigation is often **by picker** (`Space f`, symbols, workspace search) or **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 @@ -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**). +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 (`:`) > -| Action | Command examples | -| ---------------------- | ------------------------------------------ | -| Write / write all | `:w` / `:wa` | -| Quit view / quit all | `:q` / `:qa` — add `!` to discard changes | -| Write and quit | `:wq`, `:x` | -| Write all and quit all | `:wqa`, `:xa` | -| Open file | `:open path`, `:e path` | -| Next / previous buffer | `:bn` / `:bp` (also `gn` / `gp` in normal) | -| Close buffer | `:bc` (add `!` to force) | -| Reload from disk | `:reload` | -| Change directory / pwd | `:cd` / `:pwd` | -| Split open file | `:vs path`, `:hs path` | +| Action | Command examples | +| ---------------------- | -------------------------------------------------------------------- | +| Write / write all | `:w` / `:wa` | +| Quit view / quit all | `:q` / `:qa` — add `!` to discard changes | +| Write and quit | `:wq`, `:x` | +| Write all and quit all | `:wqa`, `:xa` | +| Open file | `:open path`, `:e path` | +| Next / previous buffer | `:bn` / `:bp` (also `gn` / `gp` in normal) | +| Close buffer | `:bc` (add `!` to force) | +| Reload from disk | `:reload` (current buffer); `:reload-all` / **`:rla`** (all buffers) | +| Change directory / pwd | `:cd` / `:pwd` | +| Split open file | `:vs path`, `:hs path` | ### Movement (normal mode) @@ -77,7 +85,7 @@ In Helix, `|` / `!` and variants pipe or insert shell output on selections (see ### Selection & changes | Action | Keys / notes | -| ---------------------- | ----------------------------------------------------------------- | ------------------- | -------------------------------------------- | +| ---------------------- | ----------------------------------------------------------------- | | Extend selections | `v` select mode; motions extend instead of moving | | Line selection | `x` extend line; `X` line bounds | | 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) | | Case | `~` toggle; lower/upper case via grave / `Alt-grave` (see keymap) | | Join lines | `J`; `Alt-J` join keeping space | -| Shell | ` | `pipe replace;`Alt- | `pipe to;`!` insert output before selections | ### Search @@ -115,6 +122,7 @@ Helix has no vim-style `:%s` with preview. Typical patterns: | -------------------- | ---------------- | | File start / end | `g` / `e` | | Line start / end | `h` / `l` | +| File / URL | `f` | | First non-whitespace | `s` | | Definition / refs | `d` / `r` (LSP) | | Type / impl | `y` / `i` (LSP) | diff --git a/home/base/core/editors/helix/default.nix b/home/base/core/editors/helix/default.nix index 9b822747..6eb09308 100644 --- a/home/base/core/editors/helix/default.nix +++ b/home/base/core/editors/helix/default.nix @@ -5,10 +5,89 @@ package = pkgs.helix; settings = { editor = { + # Display & cursor line-number = "relative"; cursorline = 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 = { insert = "bar"; normal = "block"; @@ -16,17 +95,12 @@ }; indent-guides.render = true; }; - keys.normal = { - space = { - space = "file_picker"; - w = ":w"; - q = ":q"; - }; - esc = [ - "collapse_selection" - "keep_primary_selection" - ]; - }; + + # home/base/tui/zellij/config.kdl: Ctrl+o opens Zellij Session, so Helix never receives the + # default Ctrl+o (jump_backward). One remap restores backward jumplist; forward stays Ctrl+i. + # Other Zellij binds (Ctrl+s scroll, Ctrl+p pane, …): use built-in Space menu, :w / :rla, or + # Zellij locked mode — https://zellij.dev/tutorials/colliding-keybindings/ + keys.normal."C-S-o" = "jump_backward"; }; }; }