Enhancing Your Helix Editor: A Guide to Optimal Configuration

Posted June 7, 2023 by Ari Seyhun ‐ 3 min read

I've been daily driving Helix editor for a few months now, and love its simplicity and approach to modal editing.

I'm ashamed to say I was a VSCoder for many years before switching, and had given NeoVim a serious try, but the amount of configuration to manage is just too much in my opionion.

Despite Helix's awesome defaults, there were a few changes I've made to my configuration, and wanted to share them in case they may be useful to others.

All the configuration in this blog are not the defaults Helix has as of the time of writing this... but Helix might update in the future to include some of these configs as defaults. I'll try my best to update this if that happens.

Editor Configuration

Common Editor Configuration

Add a bufferline, cursorline, relative line numbers, ruler, and true color.

[editor]
# Show currently open buffers, only when more than one exists.
bufferline = "multiple"
# Highlight all lines with a cursor
cursorline = true
# Use relative line numbers
line-number = "relative"
# Show a ruler at column 120
rulers = [120]
# Force the theme to show colors
true-color = true

Cursor Shape

Show a bar cursor in insert mode, a block cursor in normal mode, and underline cursor in select mode.

[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"

Indentation Guides

Render indentation guides.

[editor.indent-guides]
character = ""
render = true

LSP

Disable annoying popups and display useful LSP messages in the status line.

[editor.lsp]
# Disable automatically popups of signature parameter help
auto-signature-help = false
# Show LSP messages in the status line
display-messages = true

Status Line

Add the git branch to the status line.

[editor.statusline]
left = ["mode", "spinner", "version-control", "file-name"]

Key Bindings

This adds support for navigate between open buffers using Alt , and Alt ., as well as closing the current buffer with Alt w.

[keys.normal]
"A-," = "goto_previous_buffer"
"A-." = "goto_next_buffer"
"A-w" = ":buffer-close"
"A-/" = "repeat_last_motion"

Helix doesn't have a default keybinding for navigating between buffers. The only way by default is either using Space b to open the buffer picker, or using the :bn and :bp commands.

This keybinding has been immensely useful for me to navigate between open buffers.

Unfortunately Alt . is already a keybinding which repeats the last motion, but since I have never found myself using it, I've rebound it to Alt / to avoid conflicting with our new keybind.

Shrink a Line Up with Shift x

This adds a function to "unselect" the previous line when you've accidentally selected too many lines.

The usual x extends the selection to the next line, but what if you've selected one line too many? Normally, you would have to navigate back up and start the selection all over again. But with this tweak, you can simply press Shift x to shrink your selection by one line, making the process much more efficient.

[keys.normal]
A-x = "extend_to_line_bounds"
X = ["extend_line_up", "extend_to_line_bounds"]

[keys.select]
A-x = "extend_to_line_bounds"
X = ["extend_line_up", "extend_to_line_bounds"]

Conclusion

In conclusion, Helix is awesome out of the box, but with a few small changes to its configuration it can be improved significantly with some small tweaks to its config.