cbrake
February 29, 2024, 10:21pm
10
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:
khem
March 3, 2024, 7:56pm
11
Alright time to switch default to force muscle memory change
1 Like
khem
March 4, 2024, 3:36pm
12
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"]
khem
March 5, 2024, 1:14am
14
As a vim nerd I want this feature
helix-editor:master
← mitsuhiko:feature/vim-like-line-movement
opened 01:52PM - 11 Oct 22 UTC
This adds a few new movement commands to allow `hjkl` to be rebound so that they… follow more the movement of vim. left/right movement cannot move between lines and up/down either follows newline or does not accidentally move onto the newline character. See #4268 for motivation. This however does not emulate vim, it just has some vim inspired movements. In particular it retains the entire behavior of Helix with regards to how newlines are otherwise handled (they stay selectable, and these alternative movement commands to not interfere with other commands in use or change their assumptions).
![vim-movement mov](https://user-images.githubusercontent.com/7396/195949926-ad74756f-901b-4afa-b995-b907c0f469b6.gif)
The following commands are added:
* `move_line_up_anchored` (bind to `k`): implements anchored movement up
* `move_line_down_anchored` (bind to `j`): implements anchored movement down
* `move_char_left_same_line` (bind to `h`): implements same-line movement left
* `move_char_right_same_line` (bind to `l`): implements same-line movement right
* `extend_line_up_anchored` (bind to `k`): implements anchored selection extension up
* `extend_line_down_anchored` (bind to `j`): implements anchored selection extension down
* `extend_char_left_same_line` (bind to `h`): implements same-line selection extension left
* `extend_char_right_same_line` (bind to `l`): implements same-line selection extension right
## Bindings
```toml
[keys.normal]
j = ["move_line_down_anchored"]
k = ["move_line_up_anchored"]
h = ["move_char_left_same_line"]
l = ["move_char_right_same_line"]
[keys.select]
j = ["extend_line_down_anchored"]
k = ["extend_line_up_anchored"]
h = ["extend_char_left_same_line"]
l = ["extend_char_right_same_line"]
```
## Same Line Movement
The default movement behavior of helix will happily place you in the next line. Vim users are not used to that and are likely to prefer the cursor not to move into the next line (that is at least my expectation). This is what `move_char_left_same_line` and `move_char_right_same_line` do. They will however let you move to the rightmost character (the newline) which is not what vim does (except of `virtualedit=oneline` is used). However this pairs up nicely with the anchored movement (see next).
## Anchored Vertical Movements
The two commands `move_line_up_anchored` and `move_line_down_anchored` implement what I would call anchored movement. If you are on the newline character (eg: one to the right of where `goto_line_end` would place you) then as you move up and down you end up on the newline of the target line again. This emulates the behavior of vim of what happens if you move to the line end with `$`. If however you are placed to the left of the newline, as you move up and down you will not move onto the newline.
The main difference is that in vim if you use `$` and go up/down you stay anchored to the line end. In Helix with this change you need to do `gll` to stay anchored to the newline. I do however have to say that I prefer this actually because in Vim you do not actually know if you are newline anchored visually. That is as far as I can tell an internal state.
I played around with this a bit now and I really like the combination of the two. It stays true to the helix character model, but it also feels very natural for vim users.
**Limitation:** Movements across empty lines are ambiguous. To help with this I put the horizontal column to the largest possible integer on the range to tell these cases apart. From what I can tell this does not create negative impact and avoids extra complication on the range.
## Notes on Mixed Use
I think these move/extend commands are interesting to use independent of each other. For instance I find the anchored newline movement functionality useful even if one does not like restricting the movements within a line. For instance line based selection works really nice as once the visual selection is on the newline, any further moving down will continue to capture entire lines. That means for instance `vx` will continue to move downwards which I think also addresses some points of #1638 as it basically keeps you in line mode for as long as you don't move left.
1 Like
cbrake
March 5, 2024, 8:35pm
15
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.
khem
March 6, 2024, 3:55am
16
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.
khem
March 6, 2024, 3:57am
17
My helix has quite a bit bt now, wait for few months
kraj@apollo ~/.config/helix
❯ du -sh .
1.1G .
1.1G total
❯ ls
config.toml languages.toml runtime/
cbrake
March 6, 2024, 4:00pm
18
Do you have any idea where the “lua-match” is coming from? Is there Lua code running somewhere?
cbrake
March 7, 2024, 12:47pm
19
HTML auto-completion example:
(someone on YouTube was asking and I needed a place to upload an image).
cbrake
March 12, 2024, 3:01pm
20
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"
cbrake
March 13, 2024, 2:30pm
21
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.
cbrake
March 14, 2024, 3:31pm
22
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
khem
March 15, 2024, 3:41am
23
how do we make it permanent ?
nvim had this smart indention which deduced it smartly and did the needed.
cbrake
March 15, 2024, 12:32pm
24
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.
cbrake
March 18, 2024, 9:25pm
26
Here is another way to do this (from reddit ):
Alt-;;a0 to prepend the 0 instead of the second select operation
cbrake
March 19, 2024, 10:04pm
27
I kind of like that Helix does not leave lock files lying around if the editor is killed for some reason …
1 Like
khem
March 24, 2024, 1:06am
28