Stream: nix

Topic: helix


view this post on Zulip Shivaraj B H (Feb 20 2024 at 17:38):

I am planning to make a switch to helix as well, struggling a bit with key bindings, wish there were better defaults.

How does the code auto-complete work?

I am looking for something like this: https://x.com/victortaelin/status/1753593250340856179?s=46

view this post on Zulip David Arnold (Feb 20 2024 at 17:40):

struggling a bit with key bindings, wish there were better defaults.

You bet, I sunk yesterday roughly 6-10 hours into it. First output: https://github.com/helix-editor/helix/wiki/Keymap-brainstorm#nix--home-manager-snippet

Happy to help. Gotcha, so far:

Tim's also on helix and has good tips!

view this post on Zulip Tim DeHerrera (Feb 20 2024 at 17:45):

@Shivaraj B H I have been using Helix for almost two years. Have contributed a few PRs to improve the Nix support as well. Depends on what you are trying to accomplish, but my config is fairly basic and it's worked well for a long time now. Before Helix I was using kakoune for about 4 years and I really enjoyed it's paradigm, so my keybinds are designed to mimic it's behavior.

view this post on Zulip Shivaraj B H (Feb 20 2024 at 17:54):

Is your helix configuration public?

If I can mimic VIM key bindings in helix, I will be more than happy.

view this post on Zulip Tim DeHerrera (Feb 20 2024 at 17:58):

I just recently made my config private on github, as it is now exposing a lot of information about my private network topology, but I use home-manager for helix and the config I have used is really small:

  programs.helix.settings = {
    theme = "snazzy";
    editor.true-color = true;
    keys.normal = {
      # kakoune like
      w = "extend_next_word_start";
      b = "extend_prev_word_start";
      e = "extend_next_word_end";
      W = "extend_next_long_word_start";
      B = "extend_prev_long_word_start";
      E = "extend_next_long_word_end";

      n = "search_next";
      N = "search_prev";
      A-n = "extend_search_next";
      A-N = "extend_search_prev";
      # ----------------

      # syntax tree maniuplation
      A-j = "expand_selection";
      A-k = "shrink_selection";
      A-h = "select_prev_sibling";
      A-l = "select_next_sibling";
      # ----------------

      C-s = ":w";
      C-q = ":q";
      C-w = "rotate_view";
      C-p = "file_picker";
      C-b = "buffer_picker";
      C-A-n = ":bn";
      C-A-p = ":bp";
      y = ["yank" "yank_joined_to_clipboard"];
    };
    keys.insert.j.j = "normal_mode";
  };

A lot of the defaults are already very similar to Vim, there are only a few that deviate. Should be fairly easy to remap them. The doc should help as well:
https://docs.helix-editor.com/remapping.html

view this post on Zulip Shivaraj B H (Feb 20 2024 at 17:59):

Awesome! That’s helpful

view this post on Zulip David Arnold (Feb 20 2024 at 18:39):

Thus far I got.

# https://docs.helix-editor.com/remapping.html#key-remapping
# https://docs.helix-editor.com/keymap.html
v = "no_op"
a = "select_mode"
C-a = "select_mode"
# https://docs.helix-editor.com/keymap.html#movement
# [n,e,o,i]
h = "no_op"
j = "no_op"
# k       = "no_op"
# l       = "no_op"
n = "move_char_left"
e = "move_line_down"
o = "move_line_up"
i = "move_char_right"
# Ctrl: words instead
# w       = "no_op"
W = "no_op"
b = "no_op"
B = "no_op"
# e       = "no_op"
E = "no_op"
C-n = "move_prev_word_start"
C-A-n = "move_prev_long_word_start"
C-i = "move_next_word_end"
C-A-i = "move_next_long_word_end"
# modified arrow keys: page navigation
C-b = "no_op"
C-f = "no_op"
C-u = "no_op"
C-d = "no_op"
# C-i     = "no_op" # todo
# C-o     = "no_op" # todo
C-s = "no_op" # todo
C-S-up = "page_up"
C-S-down = "page_down"
C-up = "half_page_up"
C-down = "half_page_down"
C-left = "goto_line_start"
C-right = "goto_line_end"
# https://docs.helix-editor.com/keymap.html#changes
"A-`" = "no_op" # switch_case
"`" = "switch_to_lowercase"
"~" = "switch_to_uppercase"
# lines: k/l
# i       = "no_op"
# a       = "no_op"
I = "no_op"
A = "no_op"
# o       = "no_op"
O = "no_op"
k = "insert_mode"
C-k = "insert_at_line_start"
l = "append_mode"
C-l = "insert_at_line_end"
K = "open_above"
L = "open_below"
# copy / paste / replace / undo / redo / change: drw fup
# y       = "no_op"
f = "yank"
P = "no_op"
A-p = "paste_before"
r = "replace"
R = "no_op"
A-r = "replace_with_yanked"
c = "no_op"
A-c = "no_op"
w = "change_selection"
A-w = "change_selection_noyank"
# in/de - crement
# C-a = "no_op"
C-x = "no_op"
y = "decrement"
Y = "increment"
# https://docs.helix-editor.com/keymap.html#shell
# shell
"A-!" = "no_op"
"!" = "shell_keep_pipe"
"$" = "shell_insert_output"
"A-$" = "shell_append_output"
# https://docs.helix-editor.com/keymap.html#search
# searching
N = "no_op"
# n       = "no_op"
C-A-e = "search_next"
C-A-o = "search_prev"
# https://docs.helix-editor.com/keymap.html#selection-manipulation
# Shift: extend
C-e = "copy_selection_on_next_line"
C-o = "copy_selection_on_prev_line"
# line selection
C-E = "extend_line_below"
C-O = "extend_line_above"
# silences

Last updated: Nov 13 2024 at 13:02 UTC