Live data from Hacker News

Notes on switching to Helix from Vim

jvns.ca

161–170 of 242 posts

Re: Notes on switching to Helix from Vim

#161

Earlier quoted context omitted.

I think you completely missed the context for the configuration issues in vim: I’ve been trying to get a working language server setup (so I can do things like “go to definition”) and getting a setup that feels good in Vim or Neovim just felt like too much work.

Getting LSP to work on recent versions of Neovim is one plugin + one line of configuration. Here are the steps for enabling clangd: 1. Install nvim-lspconfig plugin 2. Add `vim.lsp.enable("clangd")` to init.lua You can even enable LSPs on a per-project basis by taking advantage of the revamped exrc feature: 1. Add `vim.opt.exrc = true` to init.lua 2. Add `vim.lsp.enable("clangd")` to $projectdir/.nvim.lua

You don't even need the plugin nowadays, you can just go to the lspconfig repo and copy paste the default config if you don't know where to start. lspconfig was an incredible effort, and I consider it a good thing that it is now fading into a simple repository of default configurations.

Re: Notes on switching to Helix from Vim

#162
> here’s what the vim ripgrep plugin I’ve been using looks like

Fun fact, Vim has built-in integration for grep-like tools via the `:grep` command.

For Neovim, it checks if ripgrep is available and uses it out of the box. For Vim, you can add this to your .vimrc:

    if executable('rg')
      set grepprg=rg\ --vimgrep\ --hidden
    endif
If you don't have ripgrep installed on your system, it'll use plain grep. In that case, the command `:grep -R foo` works just as nicely.

Re: Notes on switching to Helix from Vim

#163
post #160

I feel like I am not asking THAT MUCH from my neovim setup, but it is so complicated. My collection of vim config is about 1000 lines, that's insane, but when I try to trim it, everything seems required. My requirements: - language support (syntax, formatting) - lsp (I want the goto definition) - file browser - quick jump (fzf...) - a little bit of eye candy, nice fonts and a few icons to make things clear - auto rel…

My emacs configuration is around 500+ larger, but that's mostly because emacs is a whole ecosystem. My `.vimrc` is 244 lines and I think the lsp settings is around 100 of that. The rest is mostly mapping and a few plugins (vinegar, surround, fzf,...).

Re: Notes on switching to Helix from Vim

#164

Earlier quoted context omitted.

Getting LSP to work on recent versions of Neovim is one plugin + one line of configuration. Here are the steps for enabling clangd: 1. Install nvim-lspconfig plugin 2. Add `vim.lsp.enable("clangd")` to init.lua You can even enable LSPs on a per-project basis by taking advantage of the revamped exrc feature: 1. Add `vim.opt.exrc = true` to init.lua 2. Add `vim.lsp.enable("clangd")` to $projectdir/.nvim.lua

You don't even need the plugin nowadays, you can just go to the lspconfig repo and copy paste the default config if you don't know where to start. lspconfig was an incredible effort, and I consider it a good thing that it is now fading into a simple repository of default configurations.

I'd say that having a plugin with default configurations that is kept updated is a necessity. Because that's what enables me to use LSPs with a single line configuration.

Re: Notes on switching to Helix from Vim

#166
post #58

Earlier quoted context omitted.

Indeed, Vim has had ways to do this for years, before nvim. I suppose their point is that it comes out of the box? It is worded in a way that makes it seem like they think like there are no options. There are other things too, like pressing `*` then using `:%s` is no different than the behaviour they describe. I use a plugin that shows you all the updates live as you type making it essentially the same as multiple cu…

I think showing live preview for replacements is also a built-in Neovim feature now, but I can't remember if it's enabled by default or not.

I suppose it is, my Neovim has always done this.

Re: Notes on switching to Helix from Vim

#167

Earlier quoted context omitted.

That is not the same as helix multiple selections. I suggest trying our helix to really understand. I really liked helix, but the problem is that pretty much everything I use is setup using Vim bindings (shell, browser, ideavim,...) so switching to helix concept of editing was different enough to require effort, but close enough that it screwed up all my other muscle memory.

Fair enough, I definitely made some assumptions there, but it sure sounds the same based on the description. I guess `%` selects more than just the token? But ya, I'm way too invested in Vim to bother with Helix. I have years of scripts and plugins I've written. I can't even be bothered to switch to nvim (I tried once and was not fun).

“%” is a range operator standing for the entire buffer; so :%s just means to start a substitution on the whole buffer. Neovim will highlight what was previously searched for, in this case matched by the *, but that won’t actually affect the search command.

The way :s works in Neovim looks like multiple cursors to me, but I’m not familiar enough with Helix to know what the difference is.

Re: Notes on switching to Helix from Vim

#168
post #90
post #66

The one time I tried Helix, I could find no way to switch from noun-verb syntax to vim's noun-verb syntax, is it possible now?

No. Noun-verb is central to the design. Everything is built around it. The best writing about this is "Why Kakoune" (Kakoune inspired Helix): https://kakoune.org/why-kakoune/why-kakoune.html

[deleted]

Re: Notes on switching to Helix from Vim

#169

Earlier quoted context omitted.

I just heard of Helix and decided to take it for a spin. I'm not sure why I'd use it instead of Vim. For all the Vim similarity, inverting the do-this-to-that seems like an arbitrary annoyance that I don't understand. Why go from "change this word" (cw) to "I want to change this word, so I'm going to select it first, then change it" (wc). I mean, it's not a big deal, especially if you're not already using Vim, but wh…

the lack of a `gq` equivalent to reflow a paragraph, which julia mentioned, was the nail in the coffin for me when I tried it. It's a nice project though, I just use that feature constantly

in kakoune, this is `p|reflow`. which is obviously not as simple as `gq`, but you can rebind this, add things like auto-reflow as you type, etc., rather trivially, and rebind them (and a lot of these types of tools come preloaded as bindable commands). it's some work to set up this type of thing (and it makes perfect sense to use e.g. vim to not need to do that), but i like the composable design, where i can write some configuration to hook a shell command to a bind, rather than fork and PR changes (e.g. a c++ reflow function), and the config files can be written and PRd into the default distribution as well, so the user experience would be equivalent.

Re: Notes on switching to Helix from Vim

#170
I initially found the noun-verb model of Helix appealing, but I discovered that I prefer verb-noun much better after giving it a try.

One major drawback of the noun-verb approach is its inability to support repetition using the `.` command, which is one of my favorite features in Vim. I often find myself doing something along the lines of `dd..`, `dap..`, `..`, or `/foocgnbar...un...`.

More importantly, noun-verb editors have a shortage of usable keys. Too many common operations require the use of the alt key, and that bothers me a lot. This seems inherent to the noun-verb model.

To expand on this, Vim has normal, visual, and insert modes. Noun-verb editors only have visual and insert modes, resulting in fewer options for key assignments. To exacerbate the issue, noun-verb editors have no distinction between motions and text objects. This means they must map text objects in visual mode, whereas Vim only needs to map them after some verbs. So noun-verb editors uses up more keys in less modes.

Post reply on HN