Helix (editor)

This is a cool hack:

diff --git a/.config/helix/config.toml b/.config/helix/config.toml
index 6ba117457..4924dcc67 100644
--- a/.config/helix/config.toml
+++ b/.config/helix/config.toml
@@ -6,3 +6,6 @@ theme = "dracula"
 [editor]
 line-number = "relative"
 true-color = true
+
+[keys.normal]
+C-g = ":sh tmux popup -d \"#{pane_current_path}\" -xC -yC -w80% -h80% -E lazygit"

This opens lazygit in a tmux popup:

Alright time to switch default to force muscle memory change :slight_smile:

1 Like

if you use ‘D’ in vim/nvim to delete till end of line then you can do so in helix by adding this to ~/.config/helix/config.toml

[keys.normal]
# Delete till end of line shortcut D to match vim
D = ["ensure_selections_forward", "extend_to_line_end", "delete_selection"]

Global search and replace

Summary:

  • % - select entire file
  • s - select
  • type text you want to find
  • enter
  • scroll through the file to make sure selections look good
  • c - change
  • type new text
  • , - remove select/multiple cursors
1 Like

As a vim nerd I want this feature

1 Like

Cleaning up disk space in my home dir (ncdu is an amazing tool!):

lazyvim is pretty heavy. It is neat that it downloads everything you might ever need into the .local/share/nvim, but it is also starting to resemble NPM or VSCode a bit …

One of the best things about Helix is it starts instantly and is not reminding me to update gobs of stuff every single day. I’m all for living on the edge, but there are practical limits. I don’t update my Arch system daily, rather weekly or bi-weekly.

There is a balance between getting new and good stuff, and the overhead of updating.

All is not rosy - Here is a simple crash seen editing a .bb file trying to change SRCREV hash thats all

❯ RUST_BACKTRACE=1 vi meta-networking/recipes-support/lksctp-tools/lksctp-tools_1.0.19.bb
thread 'main' panicked at helix-core/src/indent.rs:465:21:
Invalid indent query: Unknown predicate ("lua-match?")
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

My helix has quite a bit bt now, wait for few months :slight_smile:

kraj@apollo ~/.config/helix
❯ du -sh .
1.1G    .
1.1G    total
❯ ls
config.toml  languages.toml  runtime/

Do you have any idea where the “lua-match” is coming from? Is there Lua code running somewhere?

HTML auto-completion example:

(someone on YouTube was asking and I needed a place to upload an image).

Bufferline

I’ve always liked having a bufferline:

diff --git a/.config/helix/config.toml b/.config/helix/config.toml
index 58f818e..633a313 100644
--- a/.config/helix/config.toml
+++ b/.config/helix/config.toml
@@ -7,6 +7,7 @@ theme = "ayu_evolve"
 [editor]
 line-number = "relative"
 true-color = true
+bufferline = "multiple"
 
 [editor.cursor-shape]
 insert = "bar"

Advanced select and replace using multiple select

This shows how to use a select within a select which can do some of the things you would traditionally use a Regex group for.

When editing files in a project (typically OSS) where you are not the principal author, often you don’t want to auto-format on save. To disable this at run-time:

:set auto-format false

how do we make it permanent ?
nvim had this smart indention which deduced it smartly and did the needed.

I think you can add to your config.toml file:

[editor]
auto-format = false

It is neat how you can set these options easily in config or at runtime.

https://docs.helix-editor.com/configuration.html

One thing about Helix is the configuration and keymaps are still small enough that things are discoverable by reading the documentation which is all in one place. With nvim, it is endless Googling and plugins. It is similar to the difference between Yocto and Zephyr – with Zephyr, everything is in one place in one cohesive system. With Yocto, you need to figure out core, various layers, make them all work together, etc.

Here is another way to do this (from reddit):

Alt-;;a0 to prepend the 0 instead of the second select operation

I kind of like that Helix does not leave lock files lying around if the editor is killed for some reason …

1 Like

Handy Hotkey sheet - Helix Keyboard Shortcuts by HiddenMonkey - Download free from Cheatography - Cheatography.com: Cheat Sheets For Every Occasion

Helix 24.03 release:

1 Like