2

Helix Notes | Lobsters

 1 year ago
source link: https://lobste.rs/s/nvoikx/helix_notes
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Helix Notes

  1. dalanmiller

    edited 3 months ago

    | link

    There is no single killer feature that’s Better Than Vim,

    The lack of … any configuration required is what sold me on hx over Vim. The way it is out of the box is just the way I need it on any machine.

    1. Conversely, while I think Helix is very well executed (and if it existed ~10 years ago, I likely would have picked it up instead of Vim), the lack of configuration is one of the main reasons I’m sticking with Neovim. Configuration can be tedious and frustrating when you just want to Get Things Done, but once you get over the initial hill, the infinite extensibility of editors like Neovim or Emacs becomes addicting and hard to part with. After close to a decade of tinkering with Vim and experimenting with different things, my editor is a tool that fits like a perfect glove. It can morph into the exact form that I need and that works with whatever my current workflow is.

      One-size-fits-all editors like Helix or VS Code cannot achieve that. For many, that’s a worthwhile tradeoff to not have to deal with configuration at all (a position I sympathize with), but for me, I don’t think I can go back.

      1. icefox

        3 months ago

        | link

        …the infinite extensibility of editors like Neovim or Emacs becomes addicting and hard to part with.

        See, I haven’t actually ever felt this. XD Either I’ve never bothered getting over the initial hill, or my brain is just wired differently. I find it easier to mutate my workflow than to mutate the editor.

        1. calvin

          3 months ago

          | link

          Yeah, I never got anything out of extreme configuration either. Not to mention, I’m usually working on other peoples’ systems. Being able to use default editor configuration means I can be productive in an unfamiliar environment, instantly.

        2. Uhu. In particular, when I am using a code editor, I actually expect the editor maintainers to already think through which workflows work best. There are a lot of things I don’t actually know I want. Eg, it’s very important that the default keymap is reasonable, because it tells you what workflows to use.

      2. hwayne

        3 months ago

        | link

        One-size-fits-all editors like Helix or VS Code cannot achieve that. For many, that’s a worthwhile tradeoff to not have to deal with configuration at all (a position I sympathize with), but for me, I don’t think I can go back.

        That’s how I feel about it too. I wrote my own task runner for neovim! Took about an hour. I love how easy it is to write your own stuff.

    2. Exactly! And since it works well out of the box that means it also works pretty well on Windows with much less fussing around.

  2. There is no single killer feature that’s Better Than Vim,

    One candidate here is syntax aware “text objects”: https://docs.helix-editor.com/usage.html#syntax-tree-motions

    1. Do you use that a lot? For me it seems to have tho potential to be amazing, but I keep forgetting to use it.

      For me the killer feature is the multi cursor. I use that all the time.

      1. Alt-o (or its equivalents in other editors) I use all the time. Generally for me, multicursor + such “extend selection to the next syntax node” + moving arrows and other navigation keys to the home row give 80% of the modal editing, without needing modal editing.

        1. Wow, Alt-o is killer - I should use this a lot more!

        2. e12e

          3 months ago

          | link

          This sent me down a rabbit hole, finding out how to æ make option really work as alt on macos with Norwegian keyboard.

          Turns out there’s a ton of nonsense coded as alt(option)+letter - behaving more like compose - eg option-o inserts unicode glyph for œ (U+0153), and alt-a inserts the apple logo, for those with a burning desire to type that in directly.

          So far the best fix I’ve found (wip) is to define a copy of current input in ukulele - and manually remove/replace pretty much everything defined behind option-modifier.

          As a bonus there are some dead keys, like tilde - that only outputs tilde on tilde followed by space - otherwise a composition like ñ (U-00F1) - which is also possible to get rid of.

          Now I can have my alt-o!

          https://software.sil.org/ukelele/

          The general idea: https://medium.com/@scr34mz/make-your-mac-keyboard-work-on-medium-and-others-editors-without-dead-keys-issues-french-keyboard-4666b72fa2ae For dead keys

          1. For anyone who has similar problems with dead keys on macOS, but only in the terminal, note that you don’t need to create a new keyboard layout to solve that:

            • In macOS’s built-in Terminal, go to Preferences > Profiles > Keyboard and check “Use Option as Meta key”.
            • In iTerm, go to Preferences > Profiles > Keys > General and select “Esc+” for the Left Option key or the Right Option key (docs).
    2. icefox

      3 months ago

      | link

      Haven’t seen that yet! Looks pretty nice.

  3. asb

    3 months ago

    | link

    Helix with multi-megabyte files is unfortunately still very slow, seemingly due to treesitter. See this issue (with a test case from me).

    A multi-megabyte markdown file (I keep notes as I work through the day in a great big file) takes >5 seconds to load and lags upon insert so much it’s unusable. Opens instantly in vim, with no delays when editing.

  4. I want so badly to use Helix, but I have to disagree with the author on the level of LSP support. It integrates easily with the preconfigured LSP for each language, but it does not support multiple LSPs serving different functions running at the same time. There is a PR for it and I’m gon be super jazzed when (if?) it is merged, but until then.

    1. icefox

      3 months ago

      | link

      Out of curiosity, what is your use case for this? Multiple LSP’s sounds a little like an overhead nightmare (my experience with rust-analyzer is that its performance has only recently become reliably acceptable) and it seems Difficult to tell the editor which function should be done by which LSP’s. That said I don’t know much about it in practice.

      1. dhnaranjo

        edited 3 months ago

        | link

        Well, the state of LSPs in Ruby is kinda not ideal. I’m using this library that introduces types called Sorbet, it has an LSP that handles type checking. The team behind it decided not to take that complex project and tie formatting and code folding to the side of it, and separately released an LSP to handle all of that, recommending both are used.

        Edited to add: and the currently supported LSP is a third that I don’t want to use.

        It’s kind of a hassle, but once it works, it works.

  5. I do wish there were more convenient selection-mode shortcuts for “beginning of line” and “end of line” than home and end, something closer to the home row. Might have to conjure forth my own?

    Check out gs, gl, etc. Lots of useful stuff under g for this!

    1. e12e

      3 months ago

      | link

      Big challenge going from vim is that single-command jumps (eg |$) are missing - I do think the discoverability and consistency of “g” wins out (ge - gO eND BUFFER (last line), gd - gO TO dEFINISHION, gh - line head (start) etc). (Discoverable, as g pops up menu for g-what).

      1. yeah, I hit $ a lot when switching from Vim to Kakoune, although thankfully the transition to Helix was easier. I actually appreciate having to hit fewer modifier keys in these situations. The same amount of keys in a sequence instead of a chord is just nicer for my hands.

        1. I rebound the $ in both kakoune and helix :)

          1. e12e

            3 months ago

            | link

            I did try it first - but concluded it just got in my way of using Helix properly. On surface it might seem a bit like “different vi” - but in reality it’s quite different. And I think, probably, better (too soon to tell).

  6. In my experience Helix is much easier to hack on due to it being written entirely in Rust and not a mixture of C, Vimscript, and Lua (in Neovim’s case that is). Granted I don’t use any of those languages on a daily basis, but I found tinkering with the internals of Helix much more approachable than Neovim.

    Both are fantastic editors :)

  7. ptman

    3 months ago

    | link

    Not entirely on point, but “someday I would love to see a Matrix client that just actually works without any bullshit involved”. I agree that it’s a problem that there are so many alternatives. Have you tried web-clients other than element? hydrogen? cinny? What does “without bullshit” mean in concrete terms?

    1. icefox

      edited 3 months ago

      | link

      I did some more playing around after writing that and Cinny actually seems pretty good. It’s just still disappointing when a web client is just plain better than any desktop one. Element on web is slow af last I tried (works pretty ok on mobile tho), nheko complains about not being able to connect to a password key service that isn’t running, neochat sits there saying “loading” for an eon and when it eventually does something the UI is broken. After a while the urge to explore gets pretty effectively squished.

      1. ptman

        3 months ago

        | link

        element-web, element-android and element-ios are three completely separate codebases. They are going to be sharing more code in the future. All are going to get faster with sliding sync

  8. fs111

    3 months ago

    | link

    helix still can’t read from stdin on Mac, which is something I do all the time with vim :-(

  9. I like Helix a lot.

    My annoyances are:

    • I cannot switch color scheme depending on the environment variable DARKBG, as I do in neovim/init.lua.
    • why on earth would someone think that deleting text should be done with a key on the home row. It’s very easy to delete something accidentally, even easier than in vim, which bites me from time to time.
  10. colindean

    edited 3 months ago

    | link

    My knowledge of vim is based on untrained messing around and infrequent “how do I block comment in vim,” etc. searches. I’ve used Helix a little on Windows because I’ve found that vim on Windows has some latency that I dislike a lot. However, I could use Helix a lot more often.

    What I need is some kind of “Mavis Beacon teaches Typing Helix” tutorial that will run me through some exercises, like text editor katas. Does this exist?

    1. Have you already tried hx --tutor? That’s a good starting point.

  11. Jackevansevo

    edited 3 months ago

    | link

    The things that are missing for me (that would probably convince me to switch), are git signs / gitgutter integration, and buffer completion (right now completion only seems to come from LSP).

    I wonder if anyone has done any analysis (or has thoughts) on the performance. Once you load up neovim with plugins I’ve found it can occasionally slow down (depends entirely on how you use neovim). Maybe it’s just placebo but when I used Helix it felt a bit snappier.

    1. Git diff gutter has been in since 22.12 and you can jump around changes with ]g and [g. For the rest I personally use gitui.

      1. Thanks, that flew under my radar, I’ll have to check it out.

  12. This Helix editor keeps popping up under the vim tag, which is annoying to me because this is not about vim at all.

    1. Maybe there needs to be an “editors” tag, or a “cli” tool tag. I think helix is very on topic for lobsters, but there really should be a better way to categorize it.

      On the other hand, the “programming” tag seems to be a catch-all, meant to be used “no specific tag applies”

    2. Just suggest a different tag!

      1. I’ve already done this, and many times before.

  13. asymmetric

    edited 3 months ago

    | link

    The thing that really put me off Helix is that I can’t find an ergonomic way to go from initial to initial among different words.

    In vim I’d just do w, in Helix it’s something like wl? Or wb? I’m not sure. Either way it seems like a strange thing not to provide a 1-word command for.

    That and the lack of an ecosystem. At this point, Neovim with its lua plugins is starting to look more and more like an IDE, and Helix feels too barebones in comparison.

    1. You can customize the keymap, but I’m not sure what the use case for “initial to initial” would be here? With a selection-first system, you do just use w to jump around words, keeping the last word selected and the cursor on the space, and then you can e.g. cut that word with d or whatever.

      Not needing to have an ecosystem to manage has been a blessing. It’s just a simple tool with a simple short declarative config, without extensibility to manage, and yet it has all the features I ever needed and more. That said, some wasm based plugin support is being prototyped AFAIK.

      1. idk, say for example I want to make a function public in go, and want to capitalize it, so from foo to Foo. In vim I’d just go to the beginning of the word (maybe by pressing w a couple times) and change one letter , in Helix I’d have to press wb.

        Just seems counter-intuitive to me. I guess I could customize the keybinding, but then if I start doing so, what’s the selling point of Helix?

      2. e12e

        3 months ago

        | link

        Indeed “wc” to replace/change word via insert, or “wi” to insert before etc. (and “b” for previous word).

        I’d be curious to hear what vim usage of w-do_something is missing? We all use such different subsets of vim…

    2. I use kakoune, which is a closer cousin to helix than vim. w indeed takes you to the beginning of the next word with a-w (I don’t love the alt keybindings, but the consistency of extend on W is hard to pass up) taking to you the beginning of the next WORD. When I came from vim, I might have been confused by having my cursor be after the word instead of at the beginning, but since different actions act on the beginning of the selection and end, it’s like you always have two cursors. So, wi is insert at beginning of next word, same as vim, but you also get wbiFOO<esc>aBAR<esc to surround your word with FOO and BAR. Admittedly, it’s a little weird that I have to do wb, but vim would be about the same. wiFOO<esc>eiBAR<esc>. If you’re in the middle of a word, you can do <a-i>wc which changes the word from anywhere in the word, similar to ciw except that I can use that selection after doing my edit where in vim I would have to repeat the object. I’ll note that chorded commands in kakoune aren’t my favorite although I don’t have a solution. (Note that is a chord also.)

      Kakoune isn’t a better model and I’ve never used neovim, although I have a fair amount of vim7 and vim8 experience. I’m happier both when using kakoune without extensions and when adding new plugins. I spend less time configuring my text editor than I did with vim, and when I am configuring my editor, it fits my mental model much better. Once of the things that helped me switch is that I found kakoune much more responsive / faster than vim8 even without adding much plugins especially for mass edits. I did want to make the point that I don’t think either editor is substantively worse on their core navigation except for bufffer selects and changes. I much prefer doing buffer selects and changes to the macro composition / %s that I used to write. When that comes up, it is a big productivity / ease gap.

    3. icefox

      edited 3 months ago

      | link

      That and the lack of an ecosystem.

      Great example of the fact that different people want different things, for me not needing an ecosystem is one of Helix’s strengths. XD But I also am pretty happy dealing with plain text without IDE-ish features, most of the time. Different type of workflow!

  14. e12e

    3 months ago

    | link

    However, I can bind :reflow to C-r in selection mode, so I can just do x C-r to reflow text. Not quite Vg, but, oh well.

    Great idea (missing easy reflow annoyed me too) - but afaik it doesn’t quite work like that - with

    [keys.select]
    C-r = ":reflow"
    

    I need to do v - eg “xv” before ctrl-r - otherwise I’m in normal mode with line selected? Maybe op remapped C-r in normal mode (too)?

    This is unlike C-c to comment/uncomment current selection (which is mapped in normal mode and selection mode I guess)?

    wc and Wc are probably my most commonly used commands now, and I can’t even remember how to do the equivalent in vim.

    I’m not entirely clear on “word” vs “WORD” - but “wc” in Helix is “select word, change it”, so in vim that’s “cw” (change word) I guess?

    1. hwayne

      3 months ago

      | link

      word is a WORD and a word while “word” is a WORD and three words.

      1. icefox

        3 months ago

        | link

        bruh 🤣

    2. e12e

      3 months ago

      | link

      Replying to myself - I just found out that TOML sub-tables allow one to define commands that automatically comes with a little pop-up - so I now have this:

      [keys.normal]
      # previously bound to config-reload:
      C-r = ":reflow"
      
      # Quick iteration on config changes
      # Equivalent, but *must* be on one line:
      # C-o = { o = ":config-open", r = ":config-reload" }
      C-o.o = ":config-open"
      C-o.r = ":config-reload"
      

      Now “ctrl o” gives me a popup listing o and r as valid “sub”-commands with helptext (as defined by :config-open and :config-reload.

      IMNHO this is a lot better than vim, because I tend to forget such things before they enter muscle memory, and then I stop using them…

    3. icefox

      3 months ago

      | link

      I’m not entirely clear on “word” vs “WORD” …

      The difference is how they treat punctuation. “word” selects just alphanum text (and underscores, for some reason), “WORD” is text+punctuation.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK