u/umbalaxx

Share my keymaps and if you guys have any more tricks, please share with us

# theme = "cyan_light_mod"
# theme = "catppuccin_custom"
theme = "tokyonight_custom"

[editor]
scrolloff = 5
line-number = "relative"
bufferline = "always"
clipboard-provider = "pasteboard"
default-yank-register = "+"
jump-label-alphabet = "fjdkslarueiwoqpvncmxz"
trim-trailing-whitespace = true
color-modes = true

[editor.statusline]
left = ["mode"]
center = ["file-name", "file-modification-indicator"]
right = ["diagnostics", "selections", "position", "file-indent-style", "position-percentage", "total-line-numbers", "file-type"]
mode.normal = "NORMAL"
mode.select = "SELECT"
mode.insert = "INSERT"

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

[editor.soft-wrap]
enable = true

[editor.indent-guides]
render = true 

[editor.file-picker]
hidden = false
git-ignore = false

[keys.normal]
# "j" = ["move_visual_line_down", "align_view_center"]
# "k" = ["move_visual_line_up", "align_view_center"]
"e" = ["move_next_word_end", "trim_selections"]
"b" = ["move_prev_word_start", "trim_selections"]
"w" = "@lbe"
"A-j" = ["extend_to_line_bounds", "delete_selection", "paste_after"]
"A-k" = ["extend_to_line_bounds", "delete_selection", "move_line_up", "paste_before"]

"C-y" = [   ':sh rm -f /tmp/unique-file',   ':insert-output yazi --chooser-file=/tmp/unique-file',   ':sh printf "\x1b[?1049h\x1b[?2004h" > /dev/tty',   ':open %sh{cat /tmp/unique-file}',   ':redraw', ]

"{" = ["goto_prev_paragraph", "align_view_center", "trim_selections", "extend_visual_line_up"]
"}" = ["goto_next_paragraph", "align_view_center", "trim_selections", "extend_visual_line_down"]
"ret" = ["goto_word"]
"tab" = "flip_selections"
"C-u" = ["page_cursor_half_up", "align_view_center"]
"C-k" = ["page_cursor_half_up", "align_view_center"]
"C-d" = ["page_cursor_half_down", "align_view_center"]
"C-j" = ["page_cursor_half_down", "align_view_center"]

B = "move_prev_sub_word_start"
E = "move_next_sub_word_end"
W = "@lBE"
H = "@gh"
L = "goto_line_end"
G = "@ge"
V = ["extend_to_line_bounds", "select_mode"]

"C-e" = ["extend_to_line_bounds", ":pipe-to hx-repl"]

[keys.normal."]"]
"f" = ["goto_next_function", "flip_selections", "align_view_top"]
"]" = "goto_next_buffer"

[keys.normal."["]
"[" = "goto_previous_buffer" 

[keys.select]
"A-j" = ["extend_to_line_bounds", "delete_selection", "paste_after"]
"A-k" = ["extend_to_line_bounds", "delete_selection", "move_line_up", "paste_before"]
"ret" = "extend_to_word"
"tab" = "flip_selections"
"{" = ["goto_prev_paragraph", "extend_to_line_bounds"]
"}" = ["goto_next_paragraph", "extend_to_line_bounds"]
"w" = "@<A-:><A-;>lb<A-;>he"
B = "extend_prev_sub_word_start"
E = "extend_next_sub_word_end"
W = "@<A-:><A-;>lB<A-;>hE"
H = "@gh"
L = "goto_line_end"
G = "@ge"
V = ["extend_to_line_bounds", "select_mode"]
"C-e" = ["extend_to_line_bounds", ":pipe-to hx-repl"]

[keys.insert]
"C-t" = ["indent"]
"C-d" = ["unindent"]
"C-c" = ["toggle_comments"]
"C-o" = ["normal_mode", "open_below"]

I kind of change some behavior that I use often.

- I stop using w for navigating forward, I use it to select the current word under the cursor and only use b and e for navigating. And I always trim my selection

- tab I changed it so that I can flip my selection head with ease (I find that I use that more often than I thought)

- V I use mainly so that I can select kind of like line mode with ease

- G because I find it more efficient than ge

- H and L to go to the beginning and end of line

- I can select subword using B , E and W also kind of mimic the w behavior that I altered

- For the goto_next_function , I always flip selection and align view top for so that I can see the function in the viewport

- A bunch of \align_view_center` for moving around

- Add functionalities in the insert mode, so that I can indent, unindent and comment while in insert mode

If you guys have more tricks that might make editing in helix more efficient, please do share. I'm ready to copy lol.

PS. I tried moving back to neovim, and I setup from kickstart and make it mine. But I still miss a lot of functionalities and features from helix. It's just easier for me, so I moved back. Although, I kinda miss some things from neovim, and I always find ways to improve how I work in helix.

reddit.com
u/umbalaxx — 10 days ago
▲ 12 r/HelixEditor+1 crossposts

Send to iPython REPL using TMUX

I'm not sure if this is the most common/simple thing to do but I can't seem to find much info online. I write Python mainly and find using helix with iPython is cumbersome, so I came up with a solution that kinda works for me. Here goes.

Summary

I can press `C-e` to run the selected lines of code in the available TMUX pane/window that runs iPython session within "the same" current directory.

Method/Script

Put this in: ~/.local/bin

I saved mine as ~/.local/bin/hx-repl

#!/usr/bin/env bash
PANE=$(tmux list-panes -a -F '#{pane_id} #{pane_title} #{pane_current_path}' | awk -v p="$PWD" '$0 ~ /ipython/ && $0 ~ p {print $1; exit}')

if [ -z "$PANE" ]; then
  echo "No ipython pane found for $PWD" >&2 
  exit 1
fi

tmux load-buffer -b hx-repl -
tmux paste-buffer -b hx-repl -t "$PANE" -d -p
tmux send-keys -t "$PANE" Enter

What this does is use tmux commands to find the matching `ipython` session and send the selected buffer from helix

Make sure that the script is being chmod +x ~/.local/bin/hx-repl

And the usage I use :pipe-to command from helix, i.e., :pipe-to hx-repl or you can press Alt-Shift-| .

Currently I bind this in helix config like so:

[keys.normal]
... 
"C-e" = ["extend_to_line_bounds", ":pipe-to hx-repl"]


[keys.select]
...
"C-e" = ["extend_to_line_bounds", ":pipe-to hx-repl"]

Just want to share to you guys in case some of you might happen to use / find this useful like me.

https://reddit.com/link/1upxo3i/video/yvfjn4oumtbh1/player

Usage

For the demo, I edit a Python and create another tmux window using `<C-b> + c` then run uv run ipython. From then on I just switch between helix editor window, edit code, then press C-e then switch to see results in the iPython window. Notice that the code is pasted using bracketed paste mode (which essentially makes sure that the indentation is correct).

Also notice that you can grab/select bits inside the function that contains the indentation and run fine, given that you have those variables' names.

reddit.com
u/umbalaxx — 18 days ago